{"action":"created","comment":{"url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/pulls/comments/229673867","pull_request_review_id":170226235,"id":229673867,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyOTY3Mzg2Nw==","diff_hunk":"@@ -11,18 +11,103 @@ function fillUserTable(HBTemplate) {\n             return result.json()\n         })\n         .then(function(result) {\n-            let user_list = document.querySelector(\".user_list\")\n-            user_list.innerHTML = \"\"\n-\n-            if (result.success) {\n-                result.data.forEach(function(userData) {\n-                    let html = template(userData)\n-                    user_list.innerHTML += html\n-                })\n-            } else {\n-                user_list.innerHTML = \"Please contact Admin, user list unavailable\"\n+            updateDisplayedUsers(result, template)\n+        })\n+}\n+\n+/**\n+ *this fills the handlebars template with users that have not been soft deleted\n+ *\n+ * @param apiResponse\n+ * @param template\n+ */\n+function updateDisplayedUsers(apiResponse, template) {\n+    let user_list = document.querySelector(\".user_list\")\n+    user_list.innerHTML = \"\"\n+    if (apiResponse.success) {\n+        apiResponse.data.forEach(function(userData) {\n+            if (userData.deleted === \"0\") {\n+                let html = template(userData)\n+                user_list.innerHTML += html\n             }\n         })\n+        addEditEventListeners()\n+        addDeleteEventListeners()\n+    } else {\n+        user_list.innerHTML = \"Please contact Admin, user list unavailable\"\n+    }\n+}\n+\n+/**\n+ * fills handlebars template by passing in object and inserts into the score_list div\n+ *\n+ * @param HBTemplate the handlebars template\n+ * @param ObjFunction the function that creates an object of all fields required in scores page\n+ */\n+function fillEditModal(HBTemplate, userInfo) {\n+    let template = Handlebars.compile(HBTemplate)\n+    let modal_content = document.querySelector(\"#modal-content\")\n+\n+    modal_content.innerHTML = \"\"\n+\n+    if (userInfo.name && userInfo.email && userInfo.id) {\n+        let html = template(userInfo)\n+        modal_content.innerHTML += html\n+    } else {\n+        modal_content.innerHTML = \"Please contact Admin, user list unavailable\"\n+    }\n+}\n+\n+/**\n+ * this adds the event listener to the edit button on creation of it the button\n+ *\n+ */\n+function addEditEventListeners() {\n+    let editButtons = document.querySelectorAll(\".modalBtn\")\n+    editButtons.forEach(function (editButton) {\n+        editButton.addEventListener('click', function (e) {\n+            openDialog()\n+            let userInfo = createObjectFromParentElement(e)\n+            populateEditModal(userInfo)\n+        })\n+    })\n+}\n+\n+/**\n+ * Turns data from parent element (userTable handlebars template) into an object\n+ *\n+ */\n+function createObjectFromParentElement(event){","path":"app/js/handlebarsUserTable.js","position":null,"original_position":80,"commit_id":"6c94576bb19d56e8126c286d104a628cb7c72b94","original_commit_id":"3e2ec5cf15782f1cb22ce2723dd98d8e97387461","user":{"login":"Skylucas","id":42674256,"node_id":"MDQ6VXNlcjQyNjc0MjU2","avatar_url":"https://avatars0.githubusercontent.com/u/42674256?v=4","gravatar_id":"","url":"https://api.github.com/users/Skylucas","html_url":"https://github.com/Skylucas","followers_url":"https://api.github.com/users/Skylucas/followers","following_url":"https://api.github.com/users/Skylucas/following{/other_user}","gists_url":"https://api.github.com/users/Skylucas/gists{/gist_id}","starred_url":"https://api.github.com/users/Skylucas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Skylucas/subscriptions","organizations_url":"https://api.github.com/users/Skylucas/orgs","repos_url":"https://api.github.com/users/Skylucas/repos","events_url":"https://api.github.com/users/Skylucas/events{/privacy}","received_events_url":"https://api.github.com/users/Skylucas/received_events","type":"User","site_admin":false},"body":"resolved ","created_at":"2018-10-31T12:33:20Z","updated_at":"2018-10-31T12:33:21Z","html_url":"https://github.com/Mayden-Academy/aptitude-test/pull/34#discussion_r229673867","pull_request_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/pulls/34","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/Mayden-Academy/aptitude-test/pulls/comments/229673867"},"html":{"href":"https://github.com/Mayden-Academy/aptitude-test/pull/34#discussion_r229673867"},"pull_request":{"href":"https://api.github.com/repos/Mayden-Academy/aptitude-test/pulls/34"}},"in_reply_to_id":229651775},"pull_request":{"url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/pulls/34","id":227240025,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI3MjQwMDI1","html_url":"https://github.com/Mayden-Academy/aptitude-test/pull/34","diff_url":"https://github.com/Mayden-Academy/aptitude-test/pull/34.diff","patch_url":"https://github.com/Mayden-Academy/aptitude-test/pull/34.patch","issue_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/issues/34","number":34,"state":"open","locked":false,"title":"Story bees edit delete users","user":{"login":"arielwc","id":33848430,"node_id":"MDQ6VXNlcjMzODQ4NDMw","avatar_url":"https://avatars1.githubusercontent.com/u/33848430?v=4","gravatar_id":"","url":"https://api.github.com/users/arielwc","html_url":"https://github.com/arielwc","followers_url":"https://api.github.com/users/arielwc/followers","following_url":"https://api.github.com/users/arielwc/following{/other_user}","gists_url":"https://api.github.com/users/arielwc/gists{/gist_id}","starred_url":"https://api.github.com/users/arielwc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arielwc/subscriptions","organizations_url":"https://api.github.com/users/arielwc/orgs","repos_url":"https://api.github.com/users/arielwc/repos","events_url":"https://api.github.com/users/arielwc/events{/privacy}","received_events_url":"https://api.github.com/users/arielwc/received_events","type":"User","site_admin":false},"body":"code review for story 1","created_at":"2018-10-31T10:55:06Z","updated_at":"2018-10-31T12:33:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b1f4618781b1dc49c4f52829390d567705a7c680","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/pulls/34/commits","review_comments_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/pulls/34/comments","review_comment_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/issues/34/comments","statuses_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/statuses/6c94576bb19d56e8126c286d104a628cb7c72b94","head":{"label":"Mayden-Academy:story-bees-editDeleteUsers","ref":"story-bees-editDeleteUsers","sha":"6c94576bb19d56e8126c286d104a628cb7c72b94","user":{"login":"Mayden-Academy","id":23072457,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIzMDcyNDU3","avatar_url":"https://avatars2.githubusercontent.com/u/23072457?v=4","gravatar_id":"","url":"https://api.github.com/users/Mayden-Academy","html_url":"https://github.com/Mayden-Academy","followers_url":"https://api.github.com/users/Mayden-Academy/followers","following_url":"https://api.github.com/users/Mayden-Academy/following{/other_user}","gists_url":"https://api.github.com/users/Mayden-Academy/gists{/gist_id}","starred_url":"https://api.github.com/users/Mayden-Academy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mayden-Academy/subscriptions","organizations_url":"https://api.github.com/users/Mayden-Academy/orgs","repos_url":"https://api.github.com/users/Mayden-Academy/repos","events_url":"https://api.github.com/users/Mayden-Academy/events{/privacy}","received_events_url":"https://api.github.com/users/Mayden-Academy/received_events","type":"Organization","site_admin":false},"repo":{"id":152083748,"node_id":"MDEwOlJlcG9zaXRvcnkxNTIwODM3NDg=","name":"aptitude-test","full_name":"Mayden-Academy/aptitude-test","private":false,"owner":{"login":"Mayden-Academy","id":23072457,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIzMDcyNDU3","avatar_url":"https://avatars2.githubusercontent.com/u/23072457?v=4","gravatar_id":"","url":"https://api.github.com/users/Mayden-Academy","html_url":"https://github.com/Mayden-Academy","followers_url":"https://api.github.com/users/Mayden-Academy/followers","following_url":"https://api.github.com/users/Mayden-Academy/following{/other_user}","gists_url":"https://api.github.com/users/Mayden-Academy/gists{/gist_id}","starred_url":"https://api.github.com/users/Mayden-Academy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mayden-Academy/subscriptions","organizations_url":"https://api.github.com/users/Mayden-Academy/orgs","repos_url":"https://api.github.com/users/Mayden-Academy/repos","events_url":"https://api.github.com/users/Mayden-Academy/events{/privacy}","received_events_url":"https://api.github.com/users/Mayden-Academy/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/Mayden-Academy/aptitude-test","description":null,"fork":false,"url":"https://api.github.com/repos/Mayden-Academy/aptitude-test","forks_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/forks","keys_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/teams","hooks_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/hooks","issue_events_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/issues/events{/number}","events_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/events","assignees_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/assignees{/user}","branches_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/branches{/branch}","tags_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/tags","blobs_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/git/refs{/sha}","trees_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/statuses/{sha}","languages_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/languages","stargazers_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/stargazers","contributors_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/contributors","subscribers_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/subscribers","subscription_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/subscription","commits_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/commits{/sha}","git_commits_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/git/commits{/sha}","comments_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/comments{/number}","issue_comment_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/issues/comments{/number}","contents_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/contents/{+path}","compare_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/merges","archive_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/downloads","issues_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/issues{/number}","pulls_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/pulls{/number}","milestones_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/milestones{/number}","notifications_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/labels{/name}","releases_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/releases{/id}","deployments_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/deployments","created_at":"2018-10-08T13:21:45Z","updated_at":"2018-10-31T11:21:40Z","pushed_at":"2018-10-31T12:32:51Z","git_url":"git://github.com/Mayden-Academy/aptitude-test.git","ssh_url":"git@github.com:Mayden-Academy/aptitude-test.git","clone_url":"https://github.com/Mayden-Academy/aptitude-test.git","svn_url":"https://github.com/Mayden-Academy/aptitude-test","homepage":null,"size":1414,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":6,"license":null,"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"base":{"label":"Mayden-Academy:master","ref":"master","sha":"f4c765e9c30bd287df4b3cd86a62de45dc54a233","user":{"login":"Mayden-Academy","id":23072457,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIzMDcyNDU3","avatar_url":"https://avatars2.githubusercontent.com/u/23072457?v=4","gravatar_id":"","url":"https://api.github.com/users/Mayden-Academy","html_url":"https://github.com/Mayden-Academy","followers_url":"https://api.github.com/users/Mayden-Academy/followers","following_url":"https://api.github.com/users/Mayden-Academy/following{/other_user}","gists_url":"https://api.github.com/users/Mayden-Academy/gists{/gist_id}","starred_url":"https://api.github.com/users/Mayden-Academy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mayden-Academy/subscriptions","organizations_url":"https://api.github.com/users/Mayden-Academy/orgs","repos_url":"https://api.github.com/users/Mayden-Academy/repos","events_url":"https://api.github.com/users/Mayden-Academy/events{/privacy}","received_events_url":"https://api.github.com/users/Mayden-Academy/received_events","type":"Organization","site_admin":false},"repo":{"id":152083748,"node_id":"MDEwOlJlcG9zaXRvcnkxNTIwODM3NDg=","name":"aptitude-test","full_name":"Mayden-Academy/aptitude-test","private":false,"owner":{"login":"Mayden-Academy","id":23072457,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIzMDcyNDU3","avatar_url":"https://avatars2.githubusercontent.com/u/23072457?v=4","gravatar_id":"","url":"https://api.github.com/users/Mayden-Academy","html_url":"https://github.com/Mayden-Academy","followers_url":"https://api.github.com/users/Mayden-Academy/followers","following_url":"https://api.github.com/users/Mayden-Academy/following{/other_user}","gists_url":"https://api.github.com/users/Mayden-Academy/gists{/gist_id}","starred_url":"https://api.github.com/users/Mayden-Academy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mayden-Academy/subscriptions","organizations_url":"https://api.github.com/users/Mayden-Academy/orgs","repos_url":"https://api.github.com/users/Mayden-Academy/repos","events_url":"https://api.github.com/users/Mayden-Academy/events{/privacy}","received_events_url":"https://api.github.com/users/Mayden-Academy/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/Mayden-Academy/aptitude-test","description":null,"fork":false,"url":"https://api.github.com/repos/Mayden-Academy/aptitude-test","forks_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/forks","keys_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/teams","hooks_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/hooks","issue_events_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/issues/events{/number}","events_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/events","assignees_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/assignees{/user}","branches_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/branches{/branch}","tags_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/tags","blobs_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/git/refs{/sha}","trees_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/statuses/{sha}","languages_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/languages","stargazers_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/stargazers","contributors_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/contributors","subscribers_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/subscribers","subscription_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/subscription","commits_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/commits{/sha}","git_commits_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/git/commits{/sha}","comments_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/comments{/number}","issue_comment_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/issues/comments{/number}","contents_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/contents/{+path}","compare_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/merges","archive_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/downloads","issues_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/issues{/number}","pulls_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/pulls{/number}","milestones_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/milestones{/number}","notifications_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/labels{/name}","releases_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/releases{/id}","deployments_url":"https://api.github.com/repos/Mayden-Academy/aptitude-test/deployments","created_at":"2018-10-08T13:21:45Z","updated_at":"2018-10-31T11:21:40Z","pushed_at":"2018-10-31T12:32:51Z","git_url":"git://github.com/Mayden-Academy/aptitude-test.git","ssh_url":"git@github.com:Mayden-Academy/aptitude-test.git","clone_url":"https://github.com/Mayden-Academy/aptitude-test.git","svn_url":"https://github.com/Mayden-Academy/aptitude-test","homepage":null,"size":1414,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":6,"license":null,"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Mayden-Academy/aptitude-test/pulls/34"},"html":{"href":"https://github.com/Mayden-Academy/aptitude-test/pull/34"},"issue":{"href":"https://api.github.com/repos/Mayden-Academy/aptitude-test/issues/34"},"comments":{"href":"https://api.github.com/repos/Mayden-Academy/aptitude-test/issues/34/comments"},"review_comments":{"href":"https://api.github.com/repos/Mayden-Academy/aptitude-test/pulls/34/comments"},"review_comment":{"href":"https://api.github.com/repos/Mayden-Academy/aptitude-test/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Mayden-Academy/aptitude-test/pulls/34/commits"},"statuses":{"href":"https://api.github.com/repos/Mayden-Academy/aptitude-test/statuses/6c94576bb19d56e8126c286d104a628cb7c72b94"}},"author_association":"NONE"}}
{"actor":{"display_login":"Skylucas"}}