{"action":"created","comment":{"url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/comments/39544362","id":39544362,"diff_hunk":"@@ -205,6 +207,141 @@ ko.bindingHandlers.fadeVisible = {\n     }\n };\n \n+// Run Bootstrap tooltip JS automagically\n+// http://getbootstrap.com/javascript/#tooltips\n+ko.bindingHandlers.tooltip = {\n+    init: function(el, valueAccessor) {\n+        var params = valueAccessor();\n+        $(el).tooltip(params);\n+    }\n+};\n+// Attach view model logic to global keypress events\n+ko.bindingHandlers.onKeyPress = {\n+    init: function(el, valueAccessor) {\n+        $(window).keydown(function(e) {\n+            var params = valueAccessor();\n+            if (e.keyCode === params.keyCode) {\n+                params.listener(e);\n+            }\n+        });\n+    }\n+};\n+\n+/* A binding handler to convert lists into formatted lists, e.g.:\n+ * [dog] -> dog\n+ * [dog, cat] -> dog and cat\n+ * [dog, cat, fish] -> dog, cat, and fish\n+ *\n+ * This handler should not be used for user inputs.\n+ *\n+ * Example use:\n+ * <span data-bind=\"listing: {data: ['Alpha', 'Beta', 'Gamma'],\n+ *                            map: function(item) {return item.charAt(0) + '.';}}\"></span>\n+ * yields\n+ * <span ...>A., B., and G.</span>\n+ */\n+ko.bindingHandlers.listing = {\n+    update: function(element, valueAccessor, allBindings, viewModel, bindingContext) {\n+        var value = valueAccessor();\n+        var valueUnwrapped = ko.unwrap(value);\n+        var map = valueUnwrapped.map || function(item) {return item;};\n+        var data = valueUnwrapped.data || [];\n+        var keys = [];\n+        if (!Array.isArray(data)) {\n+            keys = Object.keys(data);\n+        }\n+        else {\n+            keys = data;\n+        }\n+        var index = 1;\n+        var list = ko.utils.arrayMap(keys, function(key) {\n+            var ret;\n+            if (index === 1){\n+                ret = '';\n+            }\n+            else if (index === 2){\n+                if (valueUnwrapped.length === 2) {\n+                    ret = ' and ';\n+                }\n+                else {\n+                    ret = ', ';\n+                }\n+            }\n+            else {\n+                ret = ', and ';\n+            }\n+            ret += map(key, data[key]);\n+            index++;\n+            return ret;\n+        }).join('');\n+        $(element).html(list);","path":"website/static/js/koHelpers.js","position":80,"original_position":80,"commit_id":"ae819818cf5e9e9ef5e8d4f6d6a94cf8f1215ffd","original_commit_id":"ae819818cf5e9e9ef5e8d4f6d6a94cf8f1215ffd","user":{"login":"abought","id":2957073,"avatar_url":"https://avatars.githubusercontent.com/u/2957073?v=3","gravatar_id":"","url":"https://api.github.com/users/abought","html_url":"https://github.com/abought","followers_url":"https://api.github.com/users/abought/followers","following_url":"https://api.github.com/users/abought/following{/other_user}","gists_url":"https://api.github.com/users/abought/gists{/gist_id}","starred_url":"https://api.github.com/users/abought/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abought/subscriptions","organizations_url":"https://api.github.com/users/abought/orgs","repos_url":"https://api.github.com/users/abought/repos","events_url":"https://api.github.com/users/abought/events{/privacy}","received_events_url":"https://api.github.com/users/abought/received_events","type":"User","site_admin":false},"body":"Why does this set `.html()` instead of `.text()`?\r\n\r\nIf the strings in `data` contain malicious user entered HTML, it seems that this binding would allow insertion of that text onto the page directly as code. We try to avoid this if at all possible; some HTML escaping functions are available if needed.","created_at":"2015-09-15T18:04:42Z","updated_at":"2015-09-15T18:04:42Z","html_url":"https://github.com/CenterForOpenScience/osf.io/pull/3476#discussion_r39544362","pull_request_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/3476","_links":{"self":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/comments/39544362"},"html":{"href":"https://github.com/CenterForOpenScience/osf.io/pull/3476#discussion_r39544362"},"pull_request":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/3476"}}},"pull_request":{"url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/3476","id":39476889,"html_url":"https://github.com/CenterForOpenScience/osf.io/pull/3476","diff_url":"https://github.com/CenterForOpenScience/osf.io/pull/3476.diff","patch_url":"https://github.com/CenterForOpenScience/osf.io/pull/3476.patch","issue_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/3476","number":3476,"state":"open","locked":false,"title":"[Ready for Review] Prereg + Draft Registrations ","user":{"login":"samchrisinger","id":2207561,"avatar_url":"https://avatars.githubusercontent.com/u/2207561?v=3","gravatar_id":"","url":"https://api.github.com/users/samchrisinger","html_url":"https://github.com/samchrisinger","followers_url":"https://api.github.com/users/samchrisinger/followers","following_url":"https://api.github.com/users/samchrisinger/following{/other_user}","gists_url":"https://api.github.com/users/samchrisinger/gists{/gist_id}","starred_url":"https://api.github.com/users/samchrisinger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samchrisinger/subscriptions","organizations_url":"https://api.github.com/users/samchrisinger/orgs","repos_url":"https://api.github.com/users/samchrisinger/repos","events_url":"https://api.github.com/users/samchrisinger/events{/privacy}","received_events_url":"https://api.github.com/users/samchrisinger/received_events","type":"User","site_admin":false},"body":"#### Replacing https://github.com/CenterForOpenScience/osf.io/pull/3284\r\n#### Associated proposal: https://docs.google.com/document/d/1-CdCKQCQFZ_ju5TEWqIKEII7WiellBurb53sGWJduJ0/edit\r\n\r\n# Purpose\r\n\r\nThe Prereg prize will require several new infrastructure components. In particular this project requires partial/draft registrations. This PR replaces the old registration creation workflow to support partial registration states and updates the UI to a more modern JS implementation.\r\n\r\n# Changes\r\n\r\n- Remove old style registration editor and replace with new editor\r\n- Add UI and backend support for DraftRegistration CRUD\r\n\r\n# Side Effects\r\n\r\n## Registrations page: \r\nA new tab has been added to show and create Draft Registrations. This UI lets users create, edit, and delete Draft Registrations. The blue bar shows the progress of completed items in the registration form.\r\n\r\n### Old: \r\n![screen shot 2015-07-29 at 1 52 46 pm](https://cloud.githubusercontent.com/assets/2207561/8965380/20687104-35f9-11e5-8a72-f23f43a7f2ab.png)\r\n\r\n### New: \r\n![screen shot 2015-07-29 at 1 52 04 pm](https://cloud.githubusercontent.com/assets/2207561/8965369/08212a50-35f9-11e5-8553-ead7b82f0a9f.png)\r\n![screen shot 2015-07-29 at 1 53 11 pm](https://cloud.githubusercontent.com/assets/2207561/8965394/31b9601c-35f9-11e5-963a-81acf07edaeb.png)\r\n![screen shot 2015-07-29 at 2 07 13 pm](https://cloud.githubusercontent.com/assets/2207561/8965710/261dacb6-35fb-11e5-9a2d-6674b16482dc.png)\r\n\r\n![screen shot 2015-07-29 at 2 06 41 pm](https://cloud.githubusercontent.com/assets/2207561/8965698/13676b3e-35fb-11e5-8f1a-0fe415998cd1.png)\r\n\r\n## Picking a template:\r\nUsers can now preview the registration schema before starting the registration process. \r\n### Old: \r\n![screen shot 2015-07-29 at 2 10 27 pm](https://cloud.githubusercontent.com/assets/2207561/8965777/96646596-35fb-11e5-9776-6bf3fb532be1.png)\r\n\r\n### New: \r\n![screen shot 2015-07-29 at 2 10 56 pm](https://cloud.githubusercontent.com/assets/2207561/8965789/aa759672-35fb-11e5-95e0-92e1053d5835.png)\r\n\r\n## Filling in form data:\r\n\r\n### Old: \r\n![screen shot 2015-07-29 at 2 12 05 pm](https://cloud.githubusercontent.com/assets/2207561/8965816/dc25564e-35fb-11e5-837e-07e94717100b.png)\r\n\r\n### New: \r\n![screen shot 2015-07-29 at 2 13 04 pm](https://cloud.githubusercontent.com/assets/2207561/8965832/f6fa8656-35fb-11e5-909c-9b67edcfb5cf.png)\r\n![screen shot 2015-07-29 at 2 13 58 pm](https://cloud.githubusercontent.com/assets/2207561/8965856/17d5c7fa-35fc-11e5-98e1-9311e351e6d7.png)\r\n","created_at":"2015-07-08T13:31:25Z","updated_at":"2015-09-15T18:04:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d010c4e0676ad6e7ba792ee9c7852f473d3f5909","assignee":{"login":"lyndsysimon","id":131414,"avatar_url":"https://avatars.githubusercontent.com/u/131414?v=3","gravatar_id":"","url":"https://api.github.com/users/lyndsysimon","html_url":"https://github.com/lyndsysimon","followers_url":"https://api.github.com/users/lyndsysimon/followers","following_url":"https://api.github.com/users/lyndsysimon/following{/other_user}","gists_url":"https://api.github.com/users/lyndsysimon/gists{/gist_id}","starred_url":"https://api.github.com/users/lyndsysimon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lyndsysimon/subscriptions","organizations_url":"https://api.github.com/users/lyndsysimon/orgs","repos_url":"https://api.github.com/users/lyndsysimon/repos","events_url":"https://api.github.com/users/lyndsysimon/events{/privacy}","received_events_url":"https://api.github.com/users/lyndsysimon/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/3476/commits","review_comments_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/3476/comments","review_comment_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/3476/comments","statuses_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/statuses/ae819818cf5e9e9ef5e8d4f6d6a94cf8f1215ffd","head":{"label":"samchrisinger:feature/prereg-prize","ref":"feature/prereg-prize","sha":"ae819818cf5e9e9ef5e8d4f6d6a94cf8f1215ffd","user":{"login":"samchrisinger","id":2207561,"avatar_url":"https://avatars.githubusercontent.com/u/2207561?v=3","gravatar_id":"","url":"https://api.github.com/users/samchrisinger","html_url":"https://github.com/samchrisinger","followers_url":"https://api.github.com/users/samchrisinger/followers","following_url":"https://api.github.com/users/samchrisinger/following{/other_user}","gists_url":"https://api.github.com/users/samchrisinger/gists{/gist_id}","starred_url":"https://api.github.com/users/samchrisinger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samchrisinger/subscriptions","organizations_url":"https://api.github.com/users/samchrisinger/orgs","repos_url":"https://api.github.com/users/samchrisinger/repos","events_url":"https://api.github.com/users/samchrisinger/events{/privacy}","received_events_url":"https://api.github.com/users/samchrisinger/received_events","type":"User","site_admin":false},"repo":{"id":30772672,"name":"osf.io","full_name":"samchrisinger/osf.io","owner":{"login":"samchrisinger","id":2207561,"avatar_url":"https://avatars.githubusercontent.com/u/2207561?v=3","gravatar_id":"","url":"https://api.github.com/users/samchrisinger","html_url":"https://github.com/samchrisinger","followers_url":"https://api.github.com/users/samchrisinger/followers","following_url":"https://api.github.com/users/samchrisinger/following{/other_user}","gists_url":"https://api.github.com/users/samchrisinger/gists{/gist_id}","starred_url":"https://api.github.com/users/samchrisinger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samchrisinger/subscriptions","organizations_url":"https://api.github.com/users/samchrisinger/orgs","repos_url":"https://api.github.com/users/samchrisinger/repos","events_url":"https://api.github.com/users/samchrisinger/events{/privacy}","received_events_url":"https://api.github.com/users/samchrisinger/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/samchrisinger/osf.io","description":"Facilitating Open Science","fork":true,"url":"https://api.github.com/repos/samchrisinger/osf.io","forks_url":"https://api.github.com/repos/samchrisinger/osf.io/forks","keys_url":"https://api.github.com/repos/samchrisinger/osf.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/samchrisinger/osf.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/samchrisinger/osf.io/teams","hooks_url":"https://api.github.com/repos/samchrisinger/osf.io/hooks","issue_events_url":"https://api.github.com/repos/samchrisinger/osf.io/issues/events{/number}","events_url":"https://api.github.com/repos/samchrisinger/osf.io/events","assignees_url":"https://api.github.com/repos/samchrisinger/osf.io/assignees{/user}","branches_url":"https://api.github.com/repos/samchrisinger/osf.io/branches{/branch}","tags_url":"https://api.github.com/repos/samchrisinger/osf.io/tags","blobs_url":"https://api.github.com/repos/samchrisinger/osf.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/samchrisinger/osf.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/samchrisinger/osf.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/samchrisinger/osf.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/samchrisinger/osf.io/statuses/{sha}","languages_url":"https://api.github.com/repos/samchrisinger/osf.io/languages","stargazers_url":"https://api.github.com/repos/samchrisinger/osf.io/stargazers","contributors_url":"https://api.github.com/repos/samchrisinger/osf.io/contributors","subscribers_url":"https://api.github.com/repos/samchrisinger/osf.io/subscribers","subscription_url":"https://api.github.com/repos/samchrisinger/osf.io/subscription","commits_url":"https://api.github.com/repos/samchrisinger/osf.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/samchrisinger/osf.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/samchrisinger/osf.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/samchrisinger/osf.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/samchrisinger/osf.io/contents/{+path}","compare_url":"https://api.github.com/repos/samchrisinger/osf.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/samchrisinger/osf.io/merges","archive_url":"https://api.github.com/repos/samchrisinger/osf.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/samchrisinger/osf.io/downloads","issues_url":"https://api.github.com/repos/samchrisinger/osf.io/issues{/number}","pulls_url":"https://api.github.com/repos/samchrisinger/osf.io/pulls{/number}","milestones_url":"https://api.github.com/repos/samchrisinger/osf.io/milestones{/number}","notifications_url":"https://api.github.com/repos/samchrisinger/osf.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/samchrisinger/osf.io/labels{/name}","releases_url":"https://api.github.com/repos/samchrisinger/osf.io/releases{/id}","created_at":"2015-02-13T19:40:14Z","updated_at":"2015-02-27T18:03:37Z","pushed_at":"2015-09-15T17:57:55Z","git_url":"git://github.com/samchrisinger/osf.io.git","ssh_url":"git@github.com:samchrisinger/osf.io.git","clone_url":"https://github.com/samchrisinger/osf.io.git","svn_url":"https://github.com/samchrisinger/osf.io","homepage":"http://osf.io","size":107527,"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":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"develop"}},"base":{"label":"CenterForOpenScience:develop","ref":"develop","sha":"c55d7c6402de872888c44d1ecb50c19697230c4c","user":{"login":"CenterForOpenScience","id":3344584,"avatar_url":"https://avatars.githubusercontent.com/u/3344584?v=3","gravatar_id":"","url":"https://api.github.com/users/CenterForOpenScience","html_url":"https://github.com/CenterForOpenScience","followers_url":"https://api.github.com/users/CenterForOpenScience/followers","following_url":"https://api.github.com/users/CenterForOpenScience/following{/other_user}","gists_url":"https://api.github.com/users/CenterForOpenScience/gists{/gist_id}","starred_url":"https://api.github.com/users/CenterForOpenScience/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CenterForOpenScience/subscriptions","organizations_url":"https://api.github.com/users/CenterForOpenScience/orgs","repos_url":"https://api.github.com/users/CenterForOpenScience/repos","events_url":"https://api.github.com/users/CenterForOpenScience/events{/privacy}","received_events_url":"https://api.github.com/users/CenterForOpenScience/received_events","type":"Organization","site_admin":false},"repo":{"id":10199599,"name":"osf.io","full_name":"CenterForOpenScience/osf.io","owner":{"login":"CenterForOpenScience","id":3344584,"avatar_url":"https://avatars.githubusercontent.com/u/3344584?v=3","gravatar_id":"","url":"https://api.github.com/users/CenterForOpenScience","html_url":"https://github.com/CenterForOpenScience","followers_url":"https://api.github.com/users/CenterForOpenScience/followers","following_url":"https://api.github.com/users/CenterForOpenScience/following{/other_user}","gists_url":"https://api.github.com/users/CenterForOpenScience/gists{/gist_id}","starred_url":"https://api.github.com/users/CenterForOpenScience/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CenterForOpenScience/subscriptions","organizations_url":"https://api.github.com/users/CenterForOpenScience/orgs","repos_url":"https://api.github.com/users/CenterForOpenScience/repos","events_url":"https://api.github.com/users/CenterForOpenScience/events{/privacy}","received_events_url":"https://api.github.com/users/CenterForOpenScience/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CenterForOpenScience/osf.io","description":"Facilitating Open Science","fork":false,"url":"https://api.github.com/repos/CenterForOpenScience/osf.io","forks_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/forks","keys_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/teams","hooks_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/hooks","issue_events_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/events{/number}","events_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/events","assignees_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/assignees{/user}","branches_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/branches{/branch}","tags_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/tags","blobs_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/statuses/{sha}","languages_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/languages","stargazers_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/stargazers","contributors_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/contributors","subscribers_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/subscribers","subscription_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/subscription","commits_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/contents/{+path}","compare_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/merges","archive_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/downloads","issues_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues{/number}","pulls_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls{/number}","milestones_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/milestones{/number}","notifications_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/labels{/name}","releases_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/releases{/id}","created_at":"2013-05-21T15:53:37Z","updated_at":"2015-09-10T13:17:29Z","pushed_at":"2015-09-15T17:59:08Z","git_url":"git://github.com/CenterForOpenScience/osf.io.git","ssh_url":"git@github.com:CenterForOpenScience/osf.io.git","clone_url":"https://github.com/CenterForOpenScience/osf.io.git","svn_url":"https://github.com/CenterForOpenScience/osf.io","homepage":"http://osf.io","size":229519,"stargazers_count":137,"watchers_count":137,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":116,"mirror_url":null,"open_issues_count":420,"forks":116,"open_issues":420,"watchers":137,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/3476"},"html":{"href":"https://github.com/CenterForOpenScience/osf.io/pull/3476"},"issue":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/3476"},"comments":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/3476/comments"},"review_comments":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/3476/comments"},"review_comment":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/3476/commits"},"statuses":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/statuses/ae819818cf5e9e9ef5e8d4f6d6a94cf8f1215ffd"}}}}