{"action":"created","comment":{"url":"https://api.github.com/repos/magfest/magstock/pulls/comments/32700913","id":32700913,"diff_hunk":"@@ -0,0 +1,154 @@\n+<script type=\"text/javascript\">\n+    $(function() {\n+        $('.dialog-form').dialog({ autoOpen: false });\n+\n+        $('.attendee-checkin').button().on('click', function () {\n+            var attendee_id = $(this).attr('data-attendeeid');\n+            var dialog = $('#' + attendee_id).dialog({\n+                autoOpen: false,\n+                height: 450,\n+                width: 500,\n+                modal: true,\n+                buttons: [{\n+                    text: 'Save & Check In',\n+                    click: function() {\n+                        check_in(attendee_id);\n+                        dialog.dialog('close');\n+                    }\n+                }, {\n+                    text: 'Cancel',\n+                    click: function () {\n+                        dialog.dialog('close');\n+                    }\n+                }],\n+                // FIXME: OMG TERRIBLE POSITION HAX\n+                open: function () {\n+                  $('.ui-dialog').css('position', 'fixed')\n+                    .css('top', '5%')\n+                    .css('left', '33%');\n+                }\n+            });\n+            dialog.find('input.num').keypress(function (event) {\n+                if (event.keyCode === 13) {  // Enter key\n+                    event.preventDefault();\n+                    dialog.dialog('close');\n+                }\n+            });\n+            dialog.dialog('open');\n+            dialog.dialog('option', 'position', {at: 'center', of: window});\n+        });\n+    });\n+\n+    var check_in = function (id) {\n+        if ($('#age_' + id).val() == {{ c.AGE_UNKNOWN }}) {\n+            alert('You may not check someone in without confirming their age.');\n+            return;\n+        }\n+        $.post('../magstock/set_extra_checkin_fields', {\n+            id: id,\n+            csrf_token: csrf_token,\n+            site_number: $('#site_' + id).val(),\n+            license_plate: $('#license_' + id).val()\n+        }, function (json) {\n+            $.post('check_in', {\n+                id: id,\n+                csrf_token: csrf_token,\n+                age_group:  $('#age_' + id).val(),\n+                badge_num:  $('#num_' + id).val(),\n+                group: $('#group_' + id).val() || ''\n+            }, function (json) {\n+                var message = json.message;\n+                if (json.success) {\n+                    message += ' &nbsp; <a href=\"#\" onClick=\"undoCheckin(\\'' + id + '\\', ' + json.pre_badge + ') ; return false\">Undo</a>';\n+                    $('#paid_' + id).html(json.paid);\n+                    $('#cin_' + id).html(json.checked_in);\n+                    $('#age_' + id).parent().html(json.age_group);\n+                    $('#num_' + id).parent().html(json.badge);\n+                }\n+                toastr.info(message);\n+                if (json.increment) {\n+                    $('#checkin_count').html(1 + parseInt($(\"#checkin_count\").html()));\n+                }\n+            }, 'json');\n+        }, 'json');\n+    };\n+\n+    var undoCheckin = function (id, pre_badge) {\n+        $.post('undo_checkin', {id: id, csrf_token: csrf_token, pre_badge: pre_badge}, function(s) {\n+            var sep = location.href.indexOf('?') === -1 ? '?' : '&';\n+            location.href += sep + 'message=' + encodeURIComponent(s);\n+        });\n+    };\n+</script>\n+{% for attendee in attendees %}\n+    {% if c.AT_THE_CON and attendee.paid != c.NOT_PAID and not attendee.is_unassigned and not attendee.checked_in %}\n+        <div class=\"dialog-form\" id=\"{{ attendee.id }}\" title=\"Quick Check-In\">\n+            <table>\n+                <tr>\n+                    <td><strong>Name:</strong></td>\n+                    <td>{{ attendee.full_name }}</td>\n+                </tr>\n+                <tr>\n+                    <td><strong>Badge Type:</strong></td>\n+                    <td>{{ attendee.badge_type_label }}\n+                        {% if attendee.ribbon != c.NO_RIBBON %}\n+                            ({{ attendee.ribbon_label }})\n+                        {% endif %}\n+                    </td>\n+                </tr>\n+                {% if c.NUMBERED_BADGES %}\n+                    <tr>\n+                        <td><strong>Badge Number:</strong></td>\n+                        <td>\n+                            {% if attendee.badge_num %}\n+                                {{ attendee.badge_num }}\n+                                <input type=\"hidden\" id=\"num_{{ attendee.id }}\" value=\"{{ attendee.badge_num }}\" />\n+                            {% else %}\n+                                # <input class=\"num\" id=\"num_{{ attendee.id }}\" type=\"text\" size=\"5\" />\n+                            {% endif %}\n+                        </td>\n+                    </tr>\n+                {% endif %}\n+                <tr>\n+                    <td><strong>Age Group:</strong></td>\n+                    <td>\n+                        <select id=\"age_{{ attendee.id }}\">\n+                            {% options c.AGE_GROUP_OPTS attendee.age_group %}\n+                        </select>\n+                    </td>\n+                </tr>","path":"magstock/templates/registration/checkin.html","position":119,"original_position":119,"commit_id":"67030a374ef0fbd30f230bab0dd02ccb38abcb3a","original_commit_id":"67030a374ef0fbd30f230bab0dd02ccb38abcb3a","user":{"login":"EliAndrewC","id":651592,"avatar_url":"https://avatars.githubusercontent.com/u/651592?v=3","gravatar_id":"","url":"https://api.github.com/users/EliAndrewC","html_url":"https://github.com/EliAndrewC","followers_url":"https://api.github.com/users/EliAndrewC/followers","following_url":"https://api.github.com/users/EliAndrewC/following{/other_user}","gists_url":"https://api.github.com/users/EliAndrewC/gists{/gist_id}","starred_url":"https://api.github.com/users/EliAndrewC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EliAndrewC/subscriptions","organizations_url":"https://api.github.com/users/EliAndrewC/orgs","repos_url":"https://api.github.com/users/EliAndrewC/repos","events_url":"https://api.github.com/users/EliAndrewC/events{/privacy}","received_events_url":"https://api.github.com/users/EliAndrewC/received_events","type":"User","site_admin":false},"body":"This is where I added the new fields.","created_at":"2015-06-18T05:56:38Z","updated_at":"2015-06-18T05:56:38Z","html_url":"https://github.com/magfest/magstock/pull/10#discussion_r32700913","pull_request_url":"https://api.github.com/repos/magfest/magstock/pulls/10","_links":{"self":{"href":"https://api.github.com/repos/magfest/magstock/pulls/comments/32700913"},"html":{"href":"https://github.com/magfest/magstock/pull/10#discussion_r32700913"},"pull_request":{"href":"https://api.github.com/repos/magfest/magstock/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/magfest/magstock/pulls/10","id":37973524,"html_url":"https://github.com/magfest/magstock/pull/10","diff_url":"https://github.com/magfest/magstock/pull/10.diff","patch_url":"https://github.com/magfest/magstock/pull/10.patch","issue_url":"https://api.github.com/repos/magfest/magstock/issues/10","number":10,"state":"open","locked":false,"title":"Added extra fields to checkin","user":{"login":"EliAndrewC","id":651592,"avatar_url":"https://avatars.githubusercontent.com/u/651592?v=3","gravatar_id":"","url":"https://api.github.com/users/EliAndrewC","html_url":"https://github.com/EliAndrewC","followers_url":"https://api.github.com/users/EliAndrewC/followers","following_url":"https://api.github.com/users/EliAndrewC/following{/other_user}","gists_url":"https://api.github.com/users/EliAndrewC/gists{/gist_id}","starred_url":"https://api.github.com/users/EliAndrewC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EliAndrewC/subscriptions","organizations_url":"https://api.github.com/users/EliAndrewC/orgs","repos_url":"https://api.github.com/users/EliAndrewC/repos","events_url":"https://api.github.com/users/EliAndrewC/events{/privacy}","received_events_url":"https://api.github.com/users/EliAndrewC/received_events","type":"User","site_admin":false},"body":"In the long run we'll need a better way than this - what I did here was kludgy because doing it right was more effort than I have time for at the moment,\r\n\r\nThe way I did this was as follows:\r\n* I added two new database columns (which I manually added to the dbs on the staging and production server, since we don't have automatic migrations yet).\r\n* I added an ajax action to the ``magstock`` site section which sets the extra fields.\r\n* I overrode the two templates where people get checked in; because there's not an elegant way in place to do this, I just overrode the templates in their entirety by copying the contents of the files and adding some Javascript which submits the extra fields to the new ajax action.\r\n\r\nSo yeah, this is kind of dumb, but I tested it out and it works great, and we didn't need to modify core Uber.  Obviously this isn't how we'll want to do this stuff in the future, but we'll make it more flexible next time :)\r\n\r\nWhile I was at it, I also made it so that the main prereg form just says that prereg is closed and links you to the at-the-door reg page.","created_at":"2015-06-18T05:53:11Z","updated_at":"2015-06-18T05:56:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"060ac69faaf1982fab03f55e8681b5b7254b2cd4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/magfest/magstock/pulls/10/commits","review_comments_url":"https://api.github.com/repos/magfest/magstock/pulls/10/comments","review_comment_url":"https://api.github.com/repos/magfest/magstock/pulls/comments{/number}","comments_url":"https://api.github.com/repos/magfest/magstock/issues/10/comments","statuses_url":"https://api.github.com/repos/magfest/magstock/statuses/67030a374ef0fbd30f230bab0dd02ccb38abcb3a","head":{"label":"magfest:extra_checkin_fields","ref":"extra_checkin_fields","sha":"67030a374ef0fbd30f230bab0dd02ccb38abcb3a","user":{"login":"magfest","id":7840140,"avatar_url":"https://avatars.githubusercontent.com/u/7840140?v=3","gravatar_id":"","url":"https://api.github.com/users/magfest","html_url":"https://github.com/magfest","followers_url":"https://api.github.com/users/magfest/followers","following_url":"https://api.github.com/users/magfest/following{/other_user}","gists_url":"https://api.github.com/users/magfest/gists{/gist_id}","starred_url":"https://api.github.com/users/magfest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magfest/subscriptions","organizations_url":"https://api.github.com/users/magfest/orgs","repos_url":"https://api.github.com/users/magfest/repos","events_url":"https://api.github.com/users/magfest/events{/privacy}","received_events_url":"https://api.github.com/users/magfest/received_events","type":"Organization","site_admin":false},"repo":{"id":34233723,"name":"magstock","full_name":"magfest/magstock","owner":{"login":"magfest","id":7840140,"avatar_url":"https://avatars.githubusercontent.com/u/7840140?v=3","gravatar_id":"","url":"https://api.github.com/users/magfest","html_url":"https://github.com/magfest","followers_url":"https://api.github.com/users/magfest/followers","following_url":"https://api.github.com/users/magfest/following{/other_user}","gists_url":"https://api.github.com/users/magfest/gists{/gist_id}","starred_url":"https://api.github.com/users/magfest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magfest/subscriptions","organizations_url":"https://api.github.com/users/magfest/orgs","repos_url":"https://api.github.com/users/magfest/repos","events_url":"https://api.github.com/users/magfest/events{/privacy}","received_events_url":"https://api.github.com/users/magfest/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/magfest/magstock","description":"Plugin to implement magstock-specific logic","fork":false,"url":"https://api.github.com/repos/magfest/magstock","forks_url":"https://api.github.com/repos/magfest/magstock/forks","keys_url":"https://api.github.com/repos/magfest/magstock/keys{/key_id}","collaborators_url":"https://api.github.com/repos/magfest/magstock/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/magfest/magstock/teams","hooks_url":"https://api.github.com/repos/magfest/magstock/hooks","issue_events_url":"https://api.github.com/repos/magfest/magstock/issues/events{/number}","events_url":"https://api.github.com/repos/magfest/magstock/events","assignees_url":"https://api.github.com/repos/magfest/magstock/assignees{/user}","branches_url":"https://api.github.com/repos/magfest/magstock/branches{/branch}","tags_url":"https://api.github.com/repos/magfest/magstock/tags","blobs_url":"https://api.github.com/repos/magfest/magstock/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/magfest/magstock/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/magfest/magstock/git/refs{/sha}","trees_url":"https://api.github.com/repos/magfest/magstock/git/trees{/sha}","statuses_url":"https://api.github.com/repos/magfest/magstock/statuses/{sha}","languages_url":"https://api.github.com/repos/magfest/magstock/languages","stargazers_url":"https://api.github.com/repos/magfest/magstock/stargazers","contributors_url":"https://api.github.com/repos/magfest/magstock/contributors","subscribers_url":"https://api.github.com/repos/magfest/magstock/subscribers","subscription_url":"https://api.github.com/repos/magfest/magstock/subscription","commits_url":"https://api.github.com/repos/magfest/magstock/commits{/sha}","git_commits_url":"https://api.github.com/repos/magfest/magstock/git/commits{/sha}","comments_url":"https://api.github.com/repos/magfest/magstock/comments{/number}","issue_comment_url":"https://api.github.com/repos/magfest/magstock/issues/comments{/number}","contents_url":"https://api.github.com/repos/magfest/magstock/contents/{+path}","compare_url":"https://api.github.com/repos/magfest/magstock/compare/{base}...{head}","merges_url":"https://api.github.com/repos/magfest/magstock/merges","archive_url":"https://api.github.com/repos/magfest/magstock/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/magfest/magstock/downloads","issues_url":"https://api.github.com/repos/magfest/magstock/issues{/number}","pulls_url":"https://api.github.com/repos/magfest/magstock/pulls{/number}","milestones_url":"https://api.github.com/repos/magfest/magstock/milestones{/number}","notifications_url":"https://api.github.com/repos/magfest/magstock/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/magfest/magstock/labels{/name}","releases_url":"https://api.github.com/repos/magfest/magstock/releases{/id}","created_at":"2015-04-20T02:32:36Z","updated_at":"2015-05-04T00:15:18Z","pushed_at":"2015-06-18T05:53:11Z","git_url":"git://github.com/magfest/magstock.git","ssh_url":"git@github.com:magfest/magstock.git","clone_url":"https://github.com/magfest/magstock.git","svn_url":"https://github.com/magfest/magstock","homepage":null,"size":536,"stargazers_count":1,"watchers_count":1,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"magfest:master","ref":"master","sha":"99e276f2b8a153de57d306a0e4bcae23d2f42ce5","user":{"login":"magfest","id":7840140,"avatar_url":"https://avatars.githubusercontent.com/u/7840140?v=3","gravatar_id":"","url":"https://api.github.com/users/magfest","html_url":"https://github.com/magfest","followers_url":"https://api.github.com/users/magfest/followers","following_url":"https://api.github.com/users/magfest/following{/other_user}","gists_url":"https://api.github.com/users/magfest/gists{/gist_id}","starred_url":"https://api.github.com/users/magfest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magfest/subscriptions","organizations_url":"https://api.github.com/users/magfest/orgs","repos_url":"https://api.github.com/users/magfest/repos","events_url":"https://api.github.com/users/magfest/events{/privacy}","received_events_url":"https://api.github.com/users/magfest/received_events","type":"Organization","site_admin":false},"repo":{"id":34233723,"name":"magstock","full_name":"magfest/magstock","owner":{"login":"magfest","id":7840140,"avatar_url":"https://avatars.githubusercontent.com/u/7840140?v=3","gravatar_id":"","url":"https://api.github.com/users/magfest","html_url":"https://github.com/magfest","followers_url":"https://api.github.com/users/magfest/followers","following_url":"https://api.github.com/users/magfest/following{/other_user}","gists_url":"https://api.github.com/users/magfest/gists{/gist_id}","starred_url":"https://api.github.com/users/magfest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magfest/subscriptions","organizations_url":"https://api.github.com/users/magfest/orgs","repos_url":"https://api.github.com/users/magfest/repos","events_url":"https://api.github.com/users/magfest/events{/privacy}","received_events_url":"https://api.github.com/users/magfest/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/magfest/magstock","description":"Plugin to implement magstock-specific logic","fork":false,"url":"https://api.github.com/repos/magfest/magstock","forks_url":"https://api.github.com/repos/magfest/magstock/forks","keys_url":"https://api.github.com/repos/magfest/magstock/keys{/key_id}","collaborators_url":"https://api.github.com/repos/magfest/magstock/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/magfest/magstock/teams","hooks_url":"https://api.github.com/repos/magfest/magstock/hooks","issue_events_url":"https://api.github.com/repos/magfest/magstock/issues/events{/number}","events_url":"https://api.github.com/repos/magfest/magstock/events","assignees_url":"https://api.github.com/repos/magfest/magstock/assignees{/user}","branches_url":"https://api.github.com/repos/magfest/magstock/branches{/branch}","tags_url":"https://api.github.com/repos/magfest/magstock/tags","blobs_url":"https://api.github.com/repos/magfest/magstock/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/magfest/magstock/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/magfest/magstock/git/refs{/sha}","trees_url":"https://api.github.com/repos/magfest/magstock/git/trees{/sha}","statuses_url":"https://api.github.com/repos/magfest/magstock/statuses/{sha}","languages_url":"https://api.github.com/repos/magfest/magstock/languages","stargazers_url":"https://api.github.com/repos/magfest/magstock/stargazers","contributors_url":"https://api.github.com/repos/magfest/magstock/contributors","subscribers_url":"https://api.github.com/repos/magfest/magstock/subscribers","subscription_url":"https://api.github.com/repos/magfest/magstock/subscription","commits_url":"https://api.github.com/repos/magfest/magstock/commits{/sha}","git_commits_url":"https://api.github.com/repos/magfest/magstock/git/commits{/sha}","comments_url":"https://api.github.com/repos/magfest/magstock/comments{/number}","issue_comment_url":"https://api.github.com/repos/magfest/magstock/issues/comments{/number}","contents_url":"https://api.github.com/repos/magfest/magstock/contents/{+path}","compare_url":"https://api.github.com/repos/magfest/magstock/compare/{base}...{head}","merges_url":"https://api.github.com/repos/magfest/magstock/merges","archive_url":"https://api.github.com/repos/magfest/magstock/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/magfest/magstock/downloads","issues_url":"https://api.github.com/repos/magfest/magstock/issues{/number}","pulls_url":"https://api.github.com/repos/magfest/magstock/pulls{/number}","milestones_url":"https://api.github.com/repos/magfest/magstock/milestones{/number}","notifications_url":"https://api.github.com/repos/magfest/magstock/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/magfest/magstock/labels{/name}","releases_url":"https://api.github.com/repos/magfest/magstock/releases{/id}","created_at":"2015-04-20T02:32:36Z","updated_at":"2015-05-04T00:15:18Z","pushed_at":"2015-06-18T05:53:11Z","git_url":"git://github.com/magfest/magstock.git","ssh_url":"git@github.com:magfest/magstock.git","clone_url":"https://github.com/magfest/magstock.git","svn_url":"https://github.com/magfest/magstock","homepage":null,"size":536,"stargazers_count":1,"watchers_count":1,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/magfest/magstock/pulls/10"},"html":{"href":"https://github.com/magfest/magstock/pull/10"},"issue":{"href":"https://api.github.com/repos/magfest/magstock/issues/10"},"comments":{"href":"https://api.github.com/repos/magfest/magstock/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/magfest/magstock/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/magfest/magstock/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/magfest/magstock/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/magfest/magstock/statuses/67030a374ef0fbd30f230bab0dd02ccb38abcb3a"}}}}