{"action":"created","comment":{"url":"https://api.github.com/repos/framgia/fts_13/pulls/comments/23582988","id":23582988,"diff_hunk":"@@ -0,0 +1,77 @@\n+$(document).ready(function() {\n+\tvar maxFields = 10;\n+\tvar wrapper = $(\".input-fields-wrap-add-question\");\n+\tvar addButton = $(\".add-field-button-add-question\");\n+\tvar answers = 1;\n+\t$(addButton).click(function(e) {\n+\t\te.preventDefault();\n+\t\tif (answers < maxFields) {\n+\t\t\tanswers++;\n+\t\t\t$(wrapper).append('<div class=\"form-group\"><label class=\"col-sm-2 control-label\">' + $(\"#answer\").text() + '</label><div class=\"col-sm-5\"><input name=\"data[Answer][content_' + answers + ']\" placeholder=\"' + $(\"#answer\").text() + ' ' + answers + '\" class=\"form-control\" type=\"text\" id=\"AnswerContent' + answers + '\"><input type=\"radio\" name=\"data[Answer][correct]\" id=\"AnswerCorrectContent' + answers + '\" value=\"content_' + answers + '\"><label for=\"AnswerCorrectContent' + answers + '\">' + $('#correct').text() + '</label><a href=\"#\" class=\"remove-field\"><span class=\"glyphicon glyphicon-minus\"></span></a></div></div>');\n+\t\t}\n+\t});\n+\n+\t$(wrapper).on(\"click\",\".remove-field\", function(e) {\n+\t\te.preventDefault(); $(this).parent('div').parent('div').remove();\n+\t\tanswers--;\n+\t})\n+});\n+\n+$(document).ready(function() {\n+\tvar maxFields = 10;\n+\tvar wrapper = $(\".input-fields-wrap-edit-question\");\n+\tvar addButton = $(\".add-field-button-edit-question\");\n+\tvar answers = $('#number-answers').text();\n+\t$(addButton).click(function(e) {\n+\t\te.preventDefault();\n+\t\tif (answers < maxFields) {\n+\t\t\tanswers++;\n+\t\t\t$(wrapper).append('<div class=\"form-group\"><label class=\"col-sm-2 control-label\">' + $(\"#answer\").text() + '</label><div class=\"col-sm-5\"><input name=\"data[Answer][content_' + answers + ']\" placeholder=\"' + $(\"#answer\").text() + ' ' + answers + '\" class=\"form-control\" type=\"text\" id=\"AnswerContent' + answers + '\"><input type=\"radio\" name=\"data[Answer][correct]\" id=\"AnswerCorrectContent' + answers + '\" value=\"content_' + answers + '\"><label for=\"AnswerCorrectContent' + answers + '\">' + $('#correct').text() + '</label><a href=\"#\" class=\"remove-field\"><span class=\"glyphicon glyphicon-minus\"></span></a></div></div>');\n+\t\t}\n+\t});\n+\n+\t$(wrapper).on(\"click\",\".remove-field\", function(e) {\n+\t\te.preventDefault(); $(this).parent('div').parent('div').remove();\n+\t\tanswers--;\n+\t})\n+});\n+\n+$('#AnswersSheetSaveForm').submit(function( event ) {\n+\t$('#ExaminationTimeLeft').val($('#timer').text());\n+});\n+\n+$(document).ready(function() {\n+\tif (Number($('#time-to-do').val()) > 0) {\n+\t\tvar intervalId = setInterval(function() {\n+\t\t\tvar examTime = Number($('#time-to-do').val());\n+\t\t\tif (examTime < 0) {\n+\t\t\t\tclearInterval(intervalId);\n+\t\t\t\talert('Exam time has expired, your examination will be submitted automatically');\n+\t\t\t\t$('#finish-exam').click();\n+\t\t\t\treturn;\n+\t\t\t}\n+\t\t\t$('#timer').html(examTimeFormat(examTime));\n+\t\t\t$('#time-to-do').val(examTime - 1);\n+\t\t},1000);\n+\t}\n+});\n+\n+function examTimeFormat(examTime) {\n+\tif (examTime <= 0) {\n+\t\treturn \"00:00:00\";\n+\t}\n+\tvar day = parseInt(examTime / (24 * 60 * 60));\n+\tvar hour = parseInt(examTime / (60 * 60) % 24);\n+\tvar minute = parseInt((examTime / 60) % 60);\n+\tvar second = parseInt(examTime % 60);\n+\tvar time = '';\n+\tif (day > 0) time = time + day + ' day ';\n+\t(hour > 9) ? (time = time + hour) : (time = time + '0' + hour);","path":"app/webroot/js/custom.js","position":69,"original_position":69,"commit_id":"287033725e47537f3926ca3ec0cefee9f18cb032","original_commit_id":"287033725e47537f3926ca3ec0cefee9f18cb032","user":{"login":"dinhhoanglong91","id":1893820,"avatar_url":"https://avatars.githubusercontent.com/u/1893820?v=3","gravatar_id":"","url":"https://api.github.com/users/dinhhoanglong91","html_url":"https://github.com/dinhhoanglong91","followers_url":"https://api.github.com/users/dinhhoanglong91/followers","following_url":"https://api.github.com/users/dinhhoanglong91/following{/other_user}","gists_url":"https://api.github.com/users/dinhhoanglong91/gists{/gist_id}","starred_url":"https://api.github.com/users/dinhhoanglong91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dinhhoanglong91/subscriptions","organizations_url":"https://api.github.com/users/dinhhoanglong91/orgs","repos_url":"https://api.github.com/users/dinhhoanglong91/repos","events_url":"https://api.github.com/users/dinhhoanglong91/events{/privacy}","received_events_url":"https://api.github.com/users/dinhhoanglong91/received_events","type":"User","site_admin":false},"body":"Tôi thấy đoạn set hour, minute, second hơi rối, vì phải cộng thêm cái dấu ':' xen vào giữa lần if. Ông thử đoạn sau xem ổn ko.\r\n```javascript\r\nhour     = (hour > 9) ? hour : '0' + hour;\r\nminute  = (minute >  9) ? minute : '0' + minute;\r\nsecond = (second > 9) ? second : '0' + second;\r\nreturn time + [hour, minute, second].join(':');\r\n```","created_at":"2015-01-27T02:17:22Z","updated_at":"2015-01-27T02:17:22Z","html_url":"https://github.com/framgia/fts_13/pull/4#discussion_r23582988","pull_request_url":"https://api.github.com/repos/framgia/fts_13/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/framgia/fts_13/pulls/comments/23582988"},"html":{"href":"https://github.com/framgia/fts_13/pull/4#discussion_r23582988"},"pull_request":{"href":"https://api.github.com/repos/framgia/fts_13/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/framgia/fts_13/pulls/4","id":28012594,"html_url":"https://github.com/framgia/fts_13/pull/4","diff_url":"https://github.com/framgia/fts_13/pull/4.diff","patch_url":"https://github.com/framgia/fts_13/pull/4.patch","issue_url":"https://api.github.com/repos/framgia/fts_13/issues/4","number":4,"state":"open","locked":false,"title":"add Question, Subject: model, controller, view. add custom js, css","user":{"login":"thaont540","id":1962584,"avatar_url":"https://avatars.githubusercontent.com/u/1962584?v=3","gravatar_id":"","url":"https://api.github.com/users/thaont540","html_url":"https://github.com/thaont540","followers_url":"https://api.github.com/users/thaont540/followers","following_url":"https://api.github.com/users/thaont540/following{/other_user}","gists_url":"https://api.github.com/users/thaont540/gists{/gist_id}","starred_url":"https://api.github.com/users/thaont540/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thaont540/subscriptions","organizations_url":"https://api.github.com/users/thaont540/orgs","repos_url":"https://api.github.com/users/thaont540/repos","events_url":"https://api.github.com/users/thaont540/events{/privacy}","received_events_url":"https://api.github.com/users/thaont540/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-01-26T08:55:43Z","updated_at":"2015-01-27T02:17:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"aa664b651e27b2d47128fc0aa29f47c60a97086a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/framgia/fts_13/pulls/4/commits","review_comments_url":"https://api.github.com/repos/framgia/fts_13/pulls/4/comments","review_comment_url":"https://api.github.com/repos/framgia/fts_13/pulls/comments/{number}","comments_url":"https://api.github.com/repos/framgia/fts_13/issues/4/comments","statuses_url":"https://api.github.com/repos/framgia/fts_13/statuses/287033725e47537f3926ca3ec0cefee9f18cb032","head":{"label":"thaont540:subjects_questions_admin","ref":"subjects_questions_admin","sha":"287033725e47537f3926ca3ec0cefee9f18cb032","user":{"login":"thaont540","id":1962584,"avatar_url":"https://avatars.githubusercontent.com/u/1962584?v=3","gravatar_id":"","url":"https://api.github.com/users/thaont540","html_url":"https://github.com/thaont540","followers_url":"https://api.github.com/users/thaont540/followers","following_url":"https://api.github.com/users/thaont540/following{/other_user}","gists_url":"https://api.github.com/users/thaont540/gists{/gist_id}","starred_url":"https://api.github.com/users/thaont540/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thaont540/subscriptions","organizations_url":"https://api.github.com/users/thaont540/orgs","repos_url":"https://api.github.com/users/thaont540/repos","events_url":"https://api.github.com/users/thaont540/events{/privacy}","received_events_url":"https://api.github.com/users/thaont540/received_events","type":"User","site_admin":false},"repo":{"id":29338548,"name":"fts_13","full_name":"thaont540/fts_13","owner":{"login":"thaont540","id":1962584,"avatar_url":"https://avatars.githubusercontent.com/u/1962584?v=3","gravatar_id":"","url":"https://api.github.com/users/thaont540","html_url":"https://github.com/thaont540","followers_url":"https://api.github.com/users/thaont540/followers","following_url":"https://api.github.com/users/thaont540/following{/other_user}","gists_url":"https://api.github.com/users/thaont540/gists{/gist_id}","starred_url":"https://api.github.com/users/thaont540/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thaont540/subscriptions","organizations_url":"https://api.github.com/users/thaont540/orgs","repos_url":"https://api.github.com/users/thaont540/repos","events_url":"https://api.github.com/users/thaont540/events{/privacy}","received_events_url":"https://api.github.com/users/thaont540/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/thaont540/fts_13","description":"Framgia Test System (training)","fork":true,"url":"https://api.github.com/repos/thaont540/fts_13","forks_url":"https://api.github.com/repos/thaont540/fts_13/forks","keys_url":"https://api.github.com/repos/thaont540/fts_13/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thaont540/fts_13/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thaont540/fts_13/teams","hooks_url":"https://api.github.com/repos/thaont540/fts_13/hooks","issue_events_url":"https://api.github.com/repos/thaont540/fts_13/issues/events{/number}","events_url":"https://api.github.com/repos/thaont540/fts_13/events","assignees_url":"https://api.github.com/repos/thaont540/fts_13/assignees{/user}","branches_url":"https://api.github.com/repos/thaont540/fts_13/branches{/branch}","tags_url":"https://api.github.com/repos/thaont540/fts_13/tags","blobs_url":"https://api.github.com/repos/thaont540/fts_13/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thaont540/fts_13/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thaont540/fts_13/git/refs{/sha}","trees_url":"https://api.github.com/repos/thaont540/fts_13/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thaont540/fts_13/statuses/{sha}","languages_url":"https://api.github.com/repos/thaont540/fts_13/languages","stargazers_url":"https://api.github.com/repos/thaont540/fts_13/stargazers","contributors_url":"https://api.github.com/repos/thaont540/fts_13/contributors","subscribers_url":"https://api.github.com/repos/thaont540/fts_13/subscribers","subscription_url":"https://api.github.com/repos/thaont540/fts_13/subscription","commits_url":"https://api.github.com/repos/thaont540/fts_13/commits{/sha}","git_commits_url":"https://api.github.com/repos/thaont540/fts_13/git/commits{/sha}","comments_url":"https://api.github.com/repos/thaont540/fts_13/comments{/number}","issue_comment_url":"https://api.github.com/repos/thaont540/fts_13/issues/comments/{number}","contents_url":"https://api.github.com/repos/thaont540/fts_13/contents/{+path}","compare_url":"https://api.github.com/repos/thaont540/fts_13/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thaont540/fts_13/merges","archive_url":"https://api.github.com/repos/thaont540/fts_13/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thaont540/fts_13/downloads","issues_url":"https://api.github.com/repos/thaont540/fts_13/issues{/number}","pulls_url":"https://api.github.com/repos/thaont540/fts_13/pulls{/number}","milestones_url":"https://api.github.com/repos/thaont540/fts_13/milestones{/number}","notifications_url":"https://api.github.com/repos/thaont540/fts_13/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thaont540/fts_13/labels{/name}","releases_url":"https://api.github.com/repos/thaont540/fts_13/releases{/id}","created_at":"2015-01-16T07:58:52Z","updated_at":"2015-01-16T07:55:32Z","pushed_at":"2015-01-26T09:11:50Z","git_url":"git://github.com/thaont540/fts_13.git","ssh_url":"git@github.com:thaont540/fts_13.git","clone_url":"https://github.com/thaont540/fts_13.git","svn_url":"https://github.com/thaont540/fts_13","homepage":null,"size":1782,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"framgia:develop","ref":"develop","sha":"5c57b1daa4b65f3764257f7c30a5a4fee4ba389c","user":{"login":"framgia","id":2322183,"avatar_url":"https://avatars.githubusercontent.com/u/2322183?v=3","gravatar_id":"","url":"https://api.github.com/users/framgia","html_url":"https://github.com/framgia","followers_url":"https://api.github.com/users/framgia/followers","following_url":"https://api.github.com/users/framgia/following{/other_user}","gists_url":"https://api.github.com/users/framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia/subscriptions","organizations_url":"https://api.github.com/users/framgia/orgs","repos_url":"https://api.github.com/users/framgia/repos","events_url":"https://api.github.com/users/framgia/events{/privacy}","received_events_url":"https://api.github.com/users/framgia/received_events","type":"Organization","site_admin":false},"repo":{"id":29338457,"name":"fts_13","full_name":"framgia/fts_13","owner":{"login":"framgia","id":2322183,"avatar_url":"https://avatars.githubusercontent.com/u/2322183?v=3","gravatar_id":"","url":"https://api.github.com/users/framgia","html_url":"https://github.com/framgia","followers_url":"https://api.github.com/users/framgia/followers","following_url":"https://api.github.com/users/framgia/following{/other_user}","gists_url":"https://api.github.com/users/framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia/subscriptions","organizations_url":"https://api.github.com/users/framgia/orgs","repos_url":"https://api.github.com/users/framgia/repos","events_url":"https://api.github.com/users/framgia/events{/privacy}","received_events_url":"https://api.github.com/users/framgia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/framgia/fts_13","description":"Framgia Test System (training)","fork":false,"url":"https://api.github.com/repos/framgia/fts_13","forks_url":"https://api.github.com/repos/framgia/fts_13/forks","keys_url":"https://api.github.com/repos/framgia/fts_13/keys{/key_id}","collaborators_url":"https://api.github.com/repos/framgia/fts_13/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/framgia/fts_13/teams","hooks_url":"https://api.github.com/repos/framgia/fts_13/hooks","issue_events_url":"https://api.github.com/repos/framgia/fts_13/issues/events{/number}","events_url":"https://api.github.com/repos/framgia/fts_13/events","assignees_url":"https://api.github.com/repos/framgia/fts_13/assignees{/user}","branches_url":"https://api.github.com/repos/framgia/fts_13/branches{/branch}","tags_url":"https://api.github.com/repos/framgia/fts_13/tags","blobs_url":"https://api.github.com/repos/framgia/fts_13/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/framgia/fts_13/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/framgia/fts_13/git/refs{/sha}","trees_url":"https://api.github.com/repos/framgia/fts_13/git/trees{/sha}","statuses_url":"https://api.github.com/repos/framgia/fts_13/statuses/{sha}","languages_url":"https://api.github.com/repos/framgia/fts_13/languages","stargazers_url":"https://api.github.com/repos/framgia/fts_13/stargazers","contributors_url":"https://api.github.com/repos/framgia/fts_13/contributors","subscribers_url":"https://api.github.com/repos/framgia/fts_13/subscribers","subscription_url":"https://api.github.com/repos/framgia/fts_13/subscription","commits_url":"https://api.github.com/repos/framgia/fts_13/commits{/sha}","git_commits_url":"https://api.github.com/repos/framgia/fts_13/git/commits{/sha}","comments_url":"https://api.github.com/repos/framgia/fts_13/comments{/number}","issue_comment_url":"https://api.github.com/repos/framgia/fts_13/issues/comments/{number}","contents_url":"https://api.github.com/repos/framgia/fts_13/contents/{+path}","compare_url":"https://api.github.com/repos/framgia/fts_13/compare/{base}...{head}","merges_url":"https://api.github.com/repos/framgia/fts_13/merges","archive_url":"https://api.github.com/repos/framgia/fts_13/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/framgia/fts_13/downloads","issues_url":"https://api.github.com/repos/framgia/fts_13/issues{/number}","pulls_url":"https://api.github.com/repos/framgia/fts_13/pulls{/number}","milestones_url":"https://api.github.com/repos/framgia/fts_13/milestones{/number}","notifications_url":"https://api.github.com/repos/framgia/fts_13/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/framgia/fts_13/labels{/name}","releases_url":"https://api.github.com/repos/framgia/fts_13/releases{/id}","created_at":"2015-01-16T07:55:32Z","updated_at":"2015-01-16T07:55:32Z","pushed_at":"2015-01-26T07:34:20Z","git_url":"git://github.com/framgia/fts_13.git","ssh_url":"git@github.com:framgia/fts_13.git","clone_url":"https://github.com/framgia/fts_13.git","svn_url":"https://github.com/framgia/fts_13","homepage":null,"size":1940,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/framgia/fts_13/pulls/4"},"html":{"href":"https://github.com/framgia/fts_13/pull/4"},"issue":{"href":"https://api.github.com/repos/framgia/fts_13/issues/4"},"comments":{"href":"https://api.github.com/repos/framgia/fts_13/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/framgia/fts_13/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/framgia/fts_13/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/framgia/fts_13/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/framgia/fts_13/statuses/287033725e47537f3926ca3ec0cefee9f18cb032"}}}}