{"action":"created","comment":{"url":"https://api.github.com/repos/sul-dlss/argo/pulls/comments/45141441","id":45141441,"diff_hunk":"@@ -1,71 +1,93 @@\n // This file contains JavaScript specific functionality for the bulk loading of spreadsheets.\n \n-function enable_submit()\n-{\n-    $(\"#spreadsheet_submit\").prop(\"disabled\", false);\n-}\n+console.log('loading ssheet file');\n \n-function disable_control(ctrl)\n-{\n-    ctrl.prop(\"disabled\", true)\n-}\n+(function($) {\n+    /*\n+      jQuery plugin with utility functions for spreadsheet bulk upload submission\n+    */\n \n-function enable_control(ctrl)\n-{\n-    ctrl.prop(\"disabled\", false)\n-}\n-\n-\n-// The Blacklight onLoad event works better than the regular onLoad event if turbolinks is enabled.\n-Blacklight.onLoad(function(){\n-\n-    // When the user clicks the \"MODS bulk loads\" button, a lightbox is opened. The event\n-    // \"loaded.blacklight.ajax-modal\" is fired just before this Blacklight lightbox is shown.\n-    $(\"#ajax-modal\").on(\"loaded.blacklight.ajax-modal\", function(e){\n-\tvar input_controls = [$(\"#filetypes_1\"), $(\"#filetypes_2\"), $(\"#convert_only\"), $(\"#note_text\")]\n-\tvar radio_buttons = input_controls.slice(0, 3)\n+    $.fn.argoSpreadsheet = function() {\n+\t// var enableSubmit = function() {\n+\t//     $('#spreadsheet_submit').prop('disabled', false);\n+\t// };\n \t\n-\t// Adjust the width of the lightbox when it hosts a metadata spreadsheet upload form.\n-\t$(\"#spreadsheet-upload-container\").parent().parent().css(\"width\", \"650px\");\n-\n-\t// Width of the lightbox when hosting a metadata bulk upload log\n-\t$(\"#spreadsheet-log-container\").parent().parent().css(\"width\", \"700\")\n+\t// var disableControl = function(ctrl) {\n+\t//     ctrl.prop('disabled', true);\n+\t// };\n \t\n-\t// None of the form controls should be functional until a file has been selected\n-\t$(\"#spreadsheet_submit\").prop(\"disabled\", true);\n-\tinput_controls.map(disable_control)\n+\t// var enableControl = function(ctrl) {\n+\t//     ctrl.prop('disabled', false);\n+\t// };\n \n-\t// Enable everything except for the submit button upon file upload\n-\t$(\"#spreadsheet_file\").change(function (){\n-\t    input_controls.map(enable_control)\n-\t});\n-\n-\t// Only when the user has uploaded a file AND selected one of the radio buttons should it be possible to submit\n-\tradio_buttons.forEach(function(button) {\n-\t    button.click(function() {\n-\t\tenable_submit()\n+\treturn this.each(function() {\n+\t    console.log('start of call');\n+\t    \n+\t    // When the user clicks the 'MODS bulk loads' button, a lightbox is opened. The event\n+\t    // 'loaded.blacklight.ajax-modal' is fired just before this Blacklight lightbox is shown.\n+\t    var inputControls = [$('#filetypes_1'), $('#filetypes_2'), $('#convert_only'), $('#note_text')];\n+\t    var radioButtons = inputControls.slice(0, 3);\n+\t    \n+\t    // Adjust the width of the lightbox when it hosts a metadata spreadsheet upload form.\n+\t    $('#spreadsheet-upload-container').parent().parent().css('width', '650px');\n+\t    \n+\t    // Width of the lightbox when hosting a metadata bulk upload log\n+\t    $('#spreadsheet-log-container').parent().parent().css('width', '700');\n+\t    \n+\t    // None of the form controls should be functional until a file has been selected\n+\t    $('#spreadsheet_submit').prop('disabled', true);\n+\t    inputControls.map(argoSpreadsheet.disableControl);","path":"app/assets/javascripts/spreadsheet.js","position":78,"original_position":78,"commit_id":"c04994a3e9775dbe9dbbc938a45b874dab4b03eb","original_commit_id":"c04994a3e9775dbe9dbbc938a45b874dab4b03eb","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"'argoSpreadsheet' is not defined.","created_at":"2015-11-17T23:59:10Z","updated_at":"2015-11-17T23:59:10Z","html_url":"https://github.com/sul-dlss/argo/pull/174#discussion_r45141441","pull_request_url":"https://api.github.com/repos/sul-dlss/argo/pulls/174","_links":{"self":{"href":"https://api.github.com/repos/sul-dlss/argo/pulls/comments/45141441"},"html":{"href":"https://github.com/sul-dlss/argo/pull/174#discussion_r45141441"},"pull_request":{"href":"https://api.github.com/repos/sul-dlss/argo/pulls/174"}}},"pull_request":{"url":"https://api.github.com/repos/sul-dlss/argo/pulls/174","id":50665428,"html_url":"https://github.com/sul-dlss/argo/pull/174","diff_url":"https://github.com/sul-dlss/argo/pull/174.diff","patch_url":"https://github.com/sul-dlss/argo/pull/174.patch","issue_url":"https://api.github.com/repos/sul-dlss/argo/issues/174","number":174,"state":"open","locked":false,"title":"Testing spreadsheet bulk upload UI, minor JS refactoring.","user":{"login":"tingulfsen","id":3740294,"avatar_url":"https://avatars.githubusercontent.com/u/3740294?v=3","gravatar_id":"","url":"https://api.github.com/users/tingulfsen","html_url":"https://github.com/tingulfsen","followers_url":"https://api.github.com/users/tingulfsen/followers","following_url":"https://api.github.com/users/tingulfsen/following{/other_user}","gists_url":"https://api.github.com/users/tingulfsen/gists{/gist_id}","starred_url":"https://api.github.com/users/tingulfsen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tingulfsen/subscriptions","organizations_url":"https://api.github.com/users/tingulfsen/orgs","repos_url":"https://api.github.com/users/tingulfsen/repos","events_url":"https://api.github.com/users/tingulfsen/events{/privacy}","received_events_url":"https://api.github.com/users/tingulfsen/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-11-13T17:05:52Z","updated_at":"2015-11-17T23:59:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9ef2d845989a2365c95fe30a09ae3eb0ce363c56","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sul-dlss/argo/pulls/174/commits","review_comments_url":"https://api.github.com/repos/sul-dlss/argo/pulls/174/comments","review_comment_url":"https://api.github.com/repos/sul-dlss/argo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sul-dlss/argo/issues/174/comments","statuses_url":"https://api.github.com/repos/sul-dlss/argo/statuses/c04994a3e9775dbe9dbbc938a45b874dab4b03eb","head":{"label":"sul-dlss:bulk_upload_jstest","ref":"bulk_upload_jstest","sha":"c04994a3e9775dbe9dbbc938a45b874dab4b03eb","user":{"login":"sul-dlss","id":230583,"avatar_url":"https://avatars.githubusercontent.com/u/230583?v=3","gravatar_id":"","url":"https://api.github.com/users/sul-dlss","html_url":"https://github.com/sul-dlss","followers_url":"https://api.github.com/users/sul-dlss/followers","following_url":"https://api.github.com/users/sul-dlss/following{/other_user}","gists_url":"https://api.github.com/users/sul-dlss/gists{/gist_id}","starred_url":"https://api.github.com/users/sul-dlss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sul-dlss/subscriptions","organizations_url":"https://api.github.com/users/sul-dlss/orgs","repos_url":"https://api.github.com/users/sul-dlss/repos","events_url":"https://api.github.com/users/sul-dlss/events{/privacy}","received_events_url":"https://api.github.com/users/sul-dlss/received_events","type":"Organization","site_admin":false},"repo":{"id":4989164,"name":"argo","full_name":"sul-dlss/argo","owner":{"login":"sul-dlss","id":230583,"avatar_url":"https://avatars.githubusercontent.com/u/230583?v=3","gravatar_id":"","url":"https://api.github.com/users/sul-dlss","html_url":"https://github.com/sul-dlss","followers_url":"https://api.github.com/users/sul-dlss/followers","following_url":"https://api.github.com/users/sul-dlss/following{/other_user}","gists_url":"https://api.github.com/users/sul-dlss/gists{/gist_id}","starred_url":"https://api.github.com/users/sul-dlss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sul-dlss/subscriptions","organizations_url":"https://api.github.com/users/sul-dlss/orgs","repos_url":"https://api.github.com/users/sul-dlss/repos","events_url":"https://api.github.com/users/sul-dlss/events{/privacy}","received_events_url":"https://api.github.com/users/sul-dlss/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sul-dlss/argo","description":"The administrative discovery interface for Stanford's Digital Object Registry","fork":false,"url":"https://api.github.com/repos/sul-dlss/argo","forks_url":"https://api.github.com/repos/sul-dlss/argo/forks","keys_url":"https://api.github.com/repos/sul-dlss/argo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sul-dlss/argo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sul-dlss/argo/teams","hooks_url":"https://api.github.com/repos/sul-dlss/argo/hooks","issue_events_url":"https://api.github.com/repos/sul-dlss/argo/issues/events{/number}","events_url":"https://api.github.com/repos/sul-dlss/argo/events","assignees_url":"https://api.github.com/repos/sul-dlss/argo/assignees{/user}","branches_url":"https://api.github.com/repos/sul-dlss/argo/branches{/branch}","tags_url":"https://api.github.com/repos/sul-dlss/argo/tags","blobs_url":"https://api.github.com/repos/sul-dlss/argo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sul-dlss/argo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sul-dlss/argo/git/refs{/sha}","trees_url":"https://api.github.com/repos/sul-dlss/argo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sul-dlss/argo/statuses/{sha}","languages_url":"https://api.github.com/repos/sul-dlss/argo/languages","stargazers_url":"https://api.github.com/repos/sul-dlss/argo/stargazers","contributors_url":"https://api.github.com/repos/sul-dlss/argo/contributors","subscribers_url":"https://api.github.com/repos/sul-dlss/argo/subscribers","subscription_url":"https://api.github.com/repos/sul-dlss/argo/subscription","commits_url":"https://api.github.com/repos/sul-dlss/argo/commits{/sha}","git_commits_url":"https://api.github.com/repos/sul-dlss/argo/git/commits{/sha}","comments_url":"https://api.github.com/repos/sul-dlss/argo/comments{/number}","issue_comment_url":"https://api.github.com/repos/sul-dlss/argo/issues/comments{/number}","contents_url":"https://api.github.com/repos/sul-dlss/argo/contents/{+path}","compare_url":"https://api.github.com/repos/sul-dlss/argo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sul-dlss/argo/merges","archive_url":"https://api.github.com/repos/sul-dlss/argo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sul-dlss/argo/downloads","issues_url":"https://api.github.com/repos/sul-dlss/argo/issues{/number}","pulls_url":"https://api.github.com/repos/sul-dlss/argo/pulls{/number}","milestones_url":"https://api.github.com/repos/sul-dlss/argo/milestones{/number}","notifications_url":"https://api.github.com/repos/sul-dlss/argo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sul-dlss/argo/labels{/name}","releases_url":"https://api.github.com/repos/sul-dlss/argo/releases{/id}","created_at":"2012-07-11T13:15:05Z","updated_at":"2015-11-09T08:17:26Z","pushed_at":"2015-11-17T23:59:01Z","git_url":"git://github.com/sul-dlss/argo.git","ssh_url":"git@github.com:sul-dlss/argo.git","clone_url":"https://github.com/sul-dlss/argo.git","svn_url":"https://github.com/sul-dlss/argo","homepage":null,"size":29152,"stargazers_count":12,"watchers_count":12,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":74,"forks":1,"open_issues":74,"watchers":12,"default_branch":"develop"}},"base":{"label":"sul-dlss:develop","ref":"develop","sha":"9ddccb8e07c79f3d447ee90e066ed50f27d292b8","user":{"login":"sul-dlss","id":230583,"avatar_url":"https://avatars.githubusercontent.com/u/230583?v=3","gravatar_id":"","url":"https://api.github.com/users/sul-dlss","html_url":"https://github.com/sul-dlss","followers_url":"https://api.github.com/users/sul-dlss/followers","following_url":"https://api.github.com/users/sul-dlss/following{/other_user}","gists_url":"https://api.github.com/users/sul-dlss/gists{/gist_id}","starred_url":"https://api.github.com/users/sul-dlss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sul-dlss/subscriptions","organizations_url":"https://api.github.com/users/sul-dlss/orgs","repos_url":"https://api.github.com/users/sul-dlss/repos","events_url":"https://api.github.com/users/sul-dlss/events{/privacy}","received_events_url":"https://api.github.com/users/sul-dlss/received_events","type":"Organization","site_admin":false},"repo":{"id":4989164,"name":"argo","full_name":"sul-dlss/argo","owner":{"login":"sul-dlss","id":230583,"avatar_url":"https://avatars.githubusercontent.com/u/230583?v=3","gravatar_id":"","url":"https://api.github.com/users/sul-dlss","html_url":"https://github.com/sul-dlss","followers_url":"https://api.github.com/users/sul-dlss/followers","following_url":"https://api.github.com/users/sul-dlss/following{/other_user}","gists_url":"https://api.github.com/users/sul-dlss/gists{/gist_id}","starred_url":"https://api.github.com/users/sul-dlss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sul-dlss/subscriptions","organizations_url":"https://api.github.com/users/sul-dlss/orgs","repos_url":"https://api.github.com/users/sul-dlss/repos","events_url":"https://api.github.com/users/sul-dlss/events{/privacy}","received_events_url":"https://api.github.com/users/sul-dlss/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sul-dlss/argo","description":"The administrative discovery interface for Stanford's Digital Object Registry","fork":false,"url":"https://api.github.com/repos/sul-dlss/argo","forks_url":"https://api.github.com/repos/sul-dlss/argo/forks","keys_url":"https://api.github.com/repos/sul-dlss/argo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sul-dlss/argo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sul-dlss/argo/teams","hooks_url":"https://api.github.com/repos/sul-dlss/argo/hooks","issue_events_url":"https://api.github.com/repos/sul-dlss/argo/issues/events{/number}","events_url":"https://api.github.com/repos/sul-dlss/argo/events","assignees_url":"https://api.github.com/repos/sul-dlss/argo/assignees{/user}","branches_url":"https://api.github.com/repos/sul-dlss/argo/branches{/branch}","tags_url":"https://api.github.com/repos/sul-dlss/argo/tags","blobs_url":"https://api.github.com/repos/sul-dlss/argo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sul-dlss/argo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sul-dlss/argo/git/refs{/sha}","trees_url":"https://api.github.com/repos/sul-dlss/argo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sul-dlss/argo/statuses/{sha}","languages_url":"https://api.github.com/repos/sul-dlss/argo/languages","stargazers_url":"https://api.github.com/repos/sul-dlss/argo/stargazers","contributors_url":"https://api.github.com/repos/sul-dlss/argo/contributors","subscribers_url":"https://api.github.com/repos/sul-dlss/argo/subscribers","subscription_url":"https://api.github.com/repos/sul-dlss/argo/subscription","commits_url":"https://api.github.com/repos/sul-dlss/argo/commits{/sha}","git_commits_url":"https://api.github.com/repos/sul-dlss/argo/git/commits{/sha}","comments_url":"https://api.github.com/repos/sul-dlss/argo/comments{/number}","issue_comment_url":"https://api.github.com/repos/sul-dlss/argo/issues/comments{/number}","contents_url":"https://api.github.com/repos/sul-dlss/argo/contents/{+path}","compare_url":"https://api.github.com/repos/sul-dlss/argo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sul-dlss/argo/merges","archive_url":"https://api.github.com/repos/sul-dlss/argo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sul-dlss/argo/downloads","issues_url":"https://api.github.com/repos/sul-dlss/argo/issues{/number}","pulls_url":"https://api.github.com/repos/sul-dlss/argo/pulls{/number}","milestones_url":"https://api.github.com/repos/sul-dlss/argo/milestones{/number}","notifications_url":"https://api.github.com/repos/sul-dlss/argo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sul-dlss/argo/labels{/name}","releases_url":"https://api.github.com/repos/sul-dlss/argo/releases{/id}","created_at":"2012-07-11T13:15:05Z","updated_at":"2015-11-09T08:17:26Z","pushed_at":"2015-11-17T23:59:01Z","git_url":"git://github.com/sul-dlss/argo.git","ssh_url":"git@github.com:sul-dlss/argo.git","clone_url":"https://github.com/sul-dlss/argo.git","svn_url":"https://github.com/sul-dlss/argo","homepage":null,"size":29152,"stargazers_count":12,"watchers_count":12,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":74,"forks":1,"open_issues":74,"watchers":12,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/sul-dlss/argo/pulls/174"},"html":{"href":"https://github.com/sul-dlss/argo/pull/174"},"issue":{"href":"https://api.github.com/repos/sul-dlss/argo/issues/174"},"comments":{"href":"https://api.github.com/repos/sul-dlss/argo/issues/174/comments"},"review_comments":{"href":"https://api.github.com/repos/sul-dlss/argo/pulls/174/comments"},"review_comment":{"href":"https://api.github.com/repos/sul-dlss/argo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sul-dlss/argo/pulls/174/commits"},"statuses":{"href":"https://api.github.com/repos/sul-dlss/argo/statuses/c04994a3e9775dbe9dbbc938a45b874dab4b03eb"}}}}