{"action":"created","comment":{"url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/pulls/comments/76950177","id":76950177,"diff_hunk":"@@ -376,6 +381,7 @@ function DragAndDropTemplates(configuration) {\n             h(\"section.action-toolbar-item.sidebar-buttons\", {}, [\n                 sidebarButtonTemplate(\"keyboard-help-button\", \"fa-question\", gettext('Keyboard Help')),\n                 sidebarButtonTemplate(\"reset-button\", \"fa-refresh\", gettext('Reset'), ctx.disable_reset_button),\n+                (ctx.show_show_answer ? sidebarButtonTemplate(\"show-answer-button\", \"fa-warning\", gettext('Show Answer'), ctx.disable_show_answer_button, ctx.show_answer_spinner) : null),","path":"drag_and_drop_v2/public/js/drag_and_drop.js","position":56,"original_position":56,"commit_id":"12375cf8c4b35a020a537412c20c167e39b578f7","original_commit_id":"12375cf8c4b35a020a537412c20c167e39b578f7","user":{"login":"itsjeyd","id":961441,"avatar_url":"https://avatars.githubusercontent.com/u/961441?v=3","gravatar_id":"","url":"https://api.github.com/users/itsjeyd","html_url":"https://github.com/itsjeyd","followers_url":"https://api.github.com/users/itsjeyd/followers","following_url":"https://api.github.com/users/itsjeyd/following{/other_user}","gists_url":"https://api.github.com/users/itsjeyd/gists{/gist_id}","starred_url":"https://api.github.com/users/itsjeyd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itsjeyd/subscriptions","organizations_url":"https://api.github.com/users/itsjeyd/orgs","repos_url":"https://api.github.com/users/itsjeyd/repos","events_url":"https://api.github.com/users/itsjeyd/events{/privacy}","received_events_url":"https://api.github.com/users/itsjeyd/received_events","type":"User","site_admin":false},"body":"@arbrandes This line is quite long and a little hard to read. I'd probably spell the logic out before the call to `h`:\r\n\r\n```js\r\nvar showAnswerButton = null;\r\nif (ctx.show_show_answer) {\r\n    showAnswerButton = sidebarButtonTemplate(\r\n        \"show-answer-button\",\r\n        \"fa-warning\",\r\n        gettext('Show Answer'),\r\n        ctx.disable_show_answer_button,\r\n        ctx.show_answer_spinner\r\n    );\r\n}\r\n```\r\n\r\n... and then just reference the `showAnswerButton` variable here.","created_at":"2016-08-31T09:05:24Z","updated_at":"2016-08-31T09:05:24Z","html_url":"https://github.com/open-craft/xblock-drag-and-drop-v2/pull/10#discussion_r76950177","pull_request_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/pulls/10","_links":{"self":{"href":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/pulls/comments/76950177"},"html":{"href":"https://github.com/open-craft/xblock-drag-and-drop-v2/pull/10#discussion_r76950177"},"pull_request":{"href":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/pulls/10","id":83129059,"html_url":"https://github.com/open-craft/xblock-drag-and-drop-v2/pull/10","diff_url":"https://github.com/open-craft/xblock-drag-and-drop-v2/pull/10.diff","patch_url":"https://github.com/open-craft/xblock-drag-and-drop-v2/pull/10.patch","issue_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/issues/10","number":10,"state":"open","locked":false,"title":"[SOL-1998] Implement Show Answer button","user":{"login":"arbrandes","id":759355,"avatar_url":"https://avatars.githubusercontent.com/u/759355?v=3","gravatar_id":"","url":"https://api.github.com/users/arbrandes","html_url":"https://github.com/arbrandes","followers_url":"https://api.github.com/users/arbrandes/followers","following_url":"https://api.github.com/users/arbrandes/following{/other_user}","gists_url":"https://api.github.com/users/arbrandes/gists{/gist_id}","starred_url":"https://api.github.com/users/arbrandes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arbrandes/subscriptions","organizations_url":"https://api.github.com/users/arbrandes/orgs","repos_url":"https://api.github.com/users/arbrandes/repos","events_url":"https://api.github.com/users/arbrandes/events{/privacy}","received_events_url":"https://api.github.com/users/arbrandes/received_events","type":"User","site_admin":false},"body":"## Description\r\n\r\nIn assessment mode, when the learner has run out of attempts, enable a \"Show Answer\" button. Clicking it causes all items to move to a correct placement.\r\n\r\n## Dependencies\r\n\r\n*None*\r\n\r\n## JIRA\r\n\r\n- [SOL-1998](https://openedx.atlassian.net/browse/SOL-1998)\r\n\r\n## Sandbox URLs\r\n\r\n- [Assessment mode](http://dndv2-sol-1998.opencraft.hosting/courses/course-v1:test+tt101+run/courseware/chapter/drag_and_drop_v2/): a DnDv2 instance in assessment mode, with one maximum attempt.\r\n- [Standard mode](http://dndv2-sol-1998.opencraft.hosting/courses/course-v1:test+tt101+run/courseware/chapter/drag_and_drop_v2_standard/): a DnDv2 instance in standard mode.\r\n\r\n## Latest commit\r\n\r\n- 12375cf *(updated 2016-08-30)*\r\n\r\n## Testing instructions\r\n\r\n### Assessment mode\r\n\r\n1. Go to the [assessment mode DnDv2 instance](http://dndv2-sol-1998.opencraft.hosting/courses/course-v1:test+tt101+run/courseware/chapter/drag_and_drop_v2/) on the LMS, and log in as `staff@example.com`.\r\n2. Click on `Staff Debug Info`, `Delete Student State`, and refresh the page.\r\n3. Notice that there is a \"Show Answer\" button, because this is in assessment mode.\r\n4. Notice that the \"Show Answer\" button is disabled, because this is your first attempt.  \r\n5. Pick any item and drop it onto any zone.\r\n6. Click submit, which will make you run out of attempts (there's only one).\r\n7. Notice that the \"Show Answer\" button is now enabled.\r\n8. Click the \"Show Answer\" button, see that all items are placed correctly (and decoy items are still in the bank), and check that you can't drag any of them.\r\n9. Refresh the page, and see that your final attempt is displayed.\r\n10. Click \"Show Answer\" again.  The same thing should happen again.\r\n\r\n### Standard mode\r\n\r\n1. Go to the [standard mode DnDv2 instance](http://dndv2-sol-1998.opencraft.hosting/courses/course-v1:test+tt101+run/courseware/chapter/drag_and_drop_v2_standard/) on the LMS, and log in as `staff@example.com`.\r\n2. Notice that there is no \"Show Answer\" button, because this is in standard mode.","created_at":"2016-08-29T16:42:43Z","updated_at":"2016-08-31T09:05:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"88dbfbc65a964a9e4ce638be1ccc39b11d9afd37","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/pulls/10/commits","review_comments_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/pulls/10/comments","review_comment_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/issues/10/comments","statuses_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/statuses/12375cf8c4b35a020a537412c20c167e39b578f7","head":{"label":"arbrandes:SOL-1998","ref":"SOL-1998","sha":"12375cf8c4b35a020a537412c20c167e39b578f7","user":{"login":"arbrandes","id":759355,"avatar_url":"https://avatars.githubusercontent.com/u/759355?v=3","gravatar_id":"","url":"https://api.github.com/users/arbrandes","html_url":"https://github.com/arbrandes","followers_url":"https://api.github.com/users/arbrandes/followers","following_url":"https://api.github.com/users/arbrandes/following{/other_user}","gists_url":"https://api.github.com/users/arbrandes/gists{/gist_id}","starred_url":"https://api.github.com/users/arbrandes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arbrandes/subscriptions","organizations_url":"https://api.github.com/users/arbrandes/orgs","repos_url":"https://api.github.com/users/arbrandes/repos","events_url":"https://api.github.com/users/arbrandes/events{/privacy}","received_events_url":"https://api.github.com/users/arbrandes/received_events","type":"User","site_admin":false},"repo":{"id":65496055,"name":"xblock-drag-and-drop-v2","full_name":"arbrandes/xblock-drag-and-drop-v2","owner":{"login":"arbrandes","id":759355,"avatar_url":"https://avatars.githubusercontent.com/u/759355?v=3","gravatar_id":"","url":"https://api.github.com/users/arbrandes","html_url":"https://github.com/arbrandes","followers_url":"https://api.github.com/users/arbrandes/followers","following_url":"https://api.github.com/users/arbrandes/following{/other_user}","gists_url":"https://api.github.com/users/arbrandes/gists{/gist_id}","starred_url":"https://api.github.com/users/arbrandes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arbrandes/subscriptions","organizations_url":"https://api.github.com/users/arbrandes/orgs","repos_url":"https://api.github.com/users/arbrandes/repos","events_url":"https://api.github.com/users/arbrandes/events{/privacy}","received_events_url":"https://api.github.com/users/arbrandes/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/arbrandes/xblock-drag-and-drop-v2","description":"Drag and Drop v2 XBlock","fork":true,"url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2","forks_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/forks","keys_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/teams","hooks_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/hooks","issue_events_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/issues/events{/number}","events_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/events","assignees_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/assignees{/user}","branches_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/branches{/branch}","tags_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/tags","blobs_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/git/refs{/sha}","trees_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/statuses/{sha}","languages_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/languages","stargazers_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/stargazers","contributors_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/contributors","subscribers_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/subscribers","subscription_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/subscription","commits_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/commits{/sha}","git_commits_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/git/commits{/sha}","comments_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/comments{/number}","issue_comment_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/issues/comments{/number}","contents_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/contents/{+path}","compare_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/merges","archive_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/downloads","issues_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/issues{/number}","pulls_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/pulls{/number}","milestones_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/milestones{/number}","notifications_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/labels{/name}","releases_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/releases{/id}","deployments_url":"https://api.github.com/repos/arbrandes/xblock-drag-and-drop-v2/deployments","created_at":"2016-08-11T19:31:01Z","updated_at":"2016-08-11T19:31:03Z","pushed_at":"2016-08-30T18:52:10Z","git_url":"git://github.com/arbrandes/xblock-drag-and-drop-v2.git","ssh_url":"git@github.com:arbrandes/xblock-drag-and-drop-v2.git","clone_url":"https://github.com/arbrandes/xblock-drag-and-drop-v2.git","svn_url":"https://github.com/arbrandes/xblock-drag-and-drop-v2","homepage":"","size":1614,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"open-craft:master","ref":"master","sha":"e2600bc5a81cfb2f36fc2aa3456dda385030c85b","user":{"login":"open-craft","id":7414786,"avatar_url":"https://avatars.githubusercontent.com/u/7414786?v=3","gravatar_id":"","url":"https://api.github.com/users/open-craft","html_url":"https://github.com/open-craft","followers_url":"https://api.github.com/users/open-craft/followers","following_url":"https://api.github.com/users/open-craft/following{/other_user}","gists_url":"https://api.github.com/users/open-craft/gists{/gist_id}","starred_url":"https://api.github.com/users/open-craft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/open-craft/subscriptions","organizations_url":"https://api.github.com/users/open-craft/orgs","repos_url":"https://api.github.com/users/open-craft/repos","events_url":"https://api.github.com/users/open-craft/events{/privacy}","received_events_url":"https://api.github.com/users/open-craft/received_events","type":"Organization","site_admin":false},"repo":{"id":24362875,"name":"xblock-drag-and-drop-v2","full_name":"open-craft/xblock-drag-and-drop-v2","owner":{"login":"open-craft","id":7414786,"avatar_url":"https://avatars.githubusercontent.com/u/7414786?v=3","gravatar_id":"","url":"https://api.github.com/users/open-craft","html_url":"https://github.com/open-craft","followers_url":"https://api.github.com/users/open-craft/followers","following_url":"https://api.github.com/users/open-craft/following{/other_user}","gists_url":"https://api.github.com/users/open-craft/gists{/gist_id}","starred_url":"https://api.github.com/users/open-craft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/open-craft/subscriptions","organizations_url":"https://api.github.com/users/open-craft/orgs","repos_url":"https://api.github.com/users/open-craft/repos","events_url":"https://api.github.com/users/open-craft/events{/privacy}","received_events_url":"https://api.github.com/users/open-craft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/open-craft/xblock-drag-and-drop-v2","description":"Drag and Drop v2 XBlock","fork":true,"url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2","forks_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/forks","keys_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/teams","hooks_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/hooks","issue_events_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/issues/events{/number}","events_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/events","assignees_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/assignees{/user}","branches_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/branches{/branch}","tags_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/tags","blobs_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/git/refs{/sha}","trees_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/statuses/{sha}","languages_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/languages","stargazers_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/stargazers","contributors_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/contributors","subscribers_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/subscribers","subscription_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/subscription","commits_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/commits{/sha}","git_commits_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/git/commits{/sha}","comments_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/comments{/number}","issue_comment_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/issues/comments{/number}","contents_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/contents/{+path}","compare_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/merges","archive_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/downloads","issues_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/issues{/number}","pulls_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/pulls{/number}","milestones_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/milestones{/number}","notifications_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/labels{/name}","releases_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/releases{/id}","deployments_url":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/deployments","created_at":"2014-09-23T08:23:37Z","updated_at":"2016-08-11T19:47:53Z","pushed_at":"2016-08-30T18:52:11Z","git_url":"git://github.com/open-craft/xblock-drag-and-drop-v2.git","ssh_url":"git@github.com:open-craft/xblock-drag-and-drop-v2.git","clone_url":"https://github.com/open-craft/xblock-drag-and-drop-v2.git","svn_url":"https://github.com/open-craft/xblock-drag-and-drop-v2","homepage":"","size":1639,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/pulls/10"},"html":{"href":"https://github.com/open-craft/xblock-drag-and-drop-v2/pull/10"},"issue":{"href":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/issues/10"},"comments":{"href":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/open-craft/xblock-drag-and-drop-v2/statuses/12375cf8c4b35a020a537412c20c167e39b578f7"}}}}
{"actor":{"display_login":"itsjeyd"}}