{"action":"created","comment":{"url":"https://api.github.com/repos/ooba-noriyuki/chat-space/pulls/comments/212793371","pull_request_review_id":149505049,"id":212793371,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMjc5MzM3MQ==","diff_hunk":"@@ -0,0 +1,73 @@\n+$(document).on('turbolinks:load', function(){\n+  $(function(){\n+    var searchResult = $('#user-search-result');\n+    var addedUsers = $('#chat-group-users');\n+\n+    function appendUser(user) {\n+      var html = `<div class=\"chat-group-user clearfix\">\n+                    <p class=\"chat-group-user__name\">\n+                      ${user.name}\n+                    </p>\n+                    <a class=\"user-search-add chat-group-user__btn chat-group-user__btn--add\" data-user-id=\"${user.id}\" data-user-name=\"${user.name}\">追加</a>\n+                  </div>`\n+    searchResult.append(html);\n+    }\n+\n+    function appendNoUser(message) {\n+      var html = `<div class=\"chat-group-user clearfix\">\n+                    <p class=\"chat-group-user__name\">\n+                      ${message}\n+                    </p>\n+                  </div>`\n+    searchResult.append(html);\n+    }\n+\n+    function appendAddUser(user_id, user_name) {\n+      var html = `<div class=\"chat-group-user clearfix js-chat-member\" id=\"chat-group-user-${user_id}\">\n+                    <input name=\"group[user_ids][]\", type='hidden', value='${user_id}'>\n+                      <p class=\"chat-group-user__name\">\n+                        ${user_name}\n+                      </p>\n+                      <a class='user-search-remove chat-group-user__btn chat-group-user__btn--remove js-remove-btn'>削除</a>\n+                  </div>`\n+    addedUsers.append(html);\n+    }\n+\n+    $('#user-search-field').on('keyup', function(){\n+      var input = $(this).val();\n+\n+      $.ajax({\n+        type: 'GET',\n+        url: '/users',\n+        data: { keyword: input },\n+        dataType: 'json'\n+      })\n+      .done(function(users){\n+        $('#user-search-result').empty();\n+        if((input != \"\") && (input != \" \")){\n+          if (users.length !== 0) {\n+            users.forEach(function(user){\n+              appendUser(user);\n+            });\n+          } else {\n+              appendNoUser(\"一致するユーザーはいません\");\n+          }\n+        }\n+      })\n+      .fail(function(){\n+        alert(\"検索に失敗しました\");\n+      })\n+    });\n+\n+    $('#user-search-result').on(\"click\", \".chat-group-user__btn--add\", function(){\n+      var add_user_id = $(this).attr(\"data-user-id\");\n+      var add_user_name = $(this).attr(\"data-user-name\");\n+      appendAddUser(add_user_id, add_user_name);\n+      $(this).parent().remove();\n+    });\n+\n+    $('#chat-group-users').on(\"click\", \".chat-group-user__btn--remove\", function(){","path":"app/assets/javascripts/users.js","position":69,"original_position":69,"commit_id":"565f498026046ae2d6e5ef30e95fbec6b27a97cf","original_commit_id":"565f498026046ae2d6e5ef30e95fbec6b27a97cf","user":{"login":"MrUrakou","id":18899359,"node_id":"MDQ6VXNlcjE4ODk5MzU5","avatar_url":"https://avatars1.githubusercontent.com/u/18899359?v=4","gravatar_id":"","url":"https://api.github.com/users/MrUrakou","html_url":"https://github.com/MrUrakou","followers_url":"https://api.github.com/users/MrUrakou/followers","following_url":"https://api.github.com/users/MrUrakou/following{/other_user}","gists_url":"https://api.github.com/users/MrUrakou/gists{/gist_id}","starred_url":"https://api.github.com/users/MrUrakou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrUrakou/subscriptions","organizations_url":"https://api.github.com/users/MrUrakou/orgs","repos_url":"https://api.github.com/users/MrUrakou/repos","events_url":"https://api.github.com/users/MrUrakou/events{/privacy}","received_events_url":"https://api.github.com/users/MrUrakou/received_events","type":"User","site_admin":false},"body":"ここは.chat-group-user__btn--removeではなく.js-remove-btnが正しいです。\r\n何故ならば見た目を調整するclassとjsで使用するclassは別々にしてた方が後々のメンテナンスがしやすいからです（なのでわざわざ複数のclassの記述があります。）","created_at":"2018-08-25T08:55:08Z","updated_at":"2018-08-25T08:55:34Z","html_url":"https://github.com/ooba-noriyuki/chat-space/pull/13#discussion_r212793371","pull_request_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/pulls/13","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/ooba-noriyuki/chat-space/pulls/comments/212793371"},"html":{"href":"https://github.com/ooba-noriyuki/chat-space/pull/13#discussion_r212793371"},"pull_request":{"href":"https://api.github.com/repos/ooba-noriyuki/chat-space/pulls/13"}}},"pull_request":{"url":"https://api.github.com/repos/ooba-noriyuki/chat-space/pulls/13","id":210890636,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEwODkwNjM2","html_url":"https://github.com/ooba-noriyuki/chat-space/pull/13","diff_url":"https://github.com/ooba-noriyuki/chat-space/pull/13.diff","patch_url":"https://github.com/ooba-noriyuki/chat-space/pull/13.patch","issue_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/issues/13","number":13,"state":"open","locked":false,"title":"インクリメンタルサーチの実装","user":{"login":"ooba-noriyuki","id":37300577,"node_id":"MDQ6VXNlcjM3MzAwNTc3","avatar_url":"https://avatars3.githubusercontent.com/u/37300577?v=4","gravatar_id":"","url":"https://api.github.com/users/ooba-noriyuki","html_url":"https://github.com/ooba-noriyuki","followers_url":"https://api.github.com/users/ooba-noriyuki/followers","following_url":"https://api.github.com/users/ooba-noriyuki/following{/other_user}","gists_url":"https://api.github.com/users/ooba-noriyuki/gists{/gist_id}","starred_url":"https://api.github.com/users/ooba-noriyuki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ooba-noriyuki/subscriptions","organizations_url":"https://api.github.com/users/ooba-noriyuki/orgs","repos_url":"https://api.github.com/users/ooba-noriyuki/repos","events_url":"https://api.github.com/users/ooba-noriyuki/events{/privacy}","received_events_url":"https://api.github.com/users/ooba-noriyuki/received_events","type":"User","site_admin":false},"body":"# what\r\nユーザー検索のインクリメンタルサーチの実装\r\n# why\r\nUX向上のため\r\n実装画面\r\nhttps://gyazo.com/1242252e866e9e3d841c724e9dd6de3b","created_at":"2018-08-25T07:35:20Z","updated_at":"2018-08-25T08:55:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bda34ef8a8c8e411e6cf921a726e390942bc5f8d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/pulls/13/commits","review_comments_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/pulls/13/comments","review_comment_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/issues/13/comments","statuses_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/statuses/565f498026046ae2d6e5ef30e95fbec6b27a97cf","head":{"label":"ooba-noriyuki:implementation-incremental-search","ref":"implementation-incremental-search","sha":"565f498026046ae2d6e5ef30e95fbec6b27a97cf","user":{"login":"ooba-noriyuki","id":37300577,"node_id":"MDQ6VXNlcjM3MzAwNTc3","avatar_url":"https://avatars3.githubusercontent.com/u/37300577?v=4","gravatar_id":"","url":"https://api.github.com/users/ooba-noriyuki","html_url":"https://github.com/ooba-noriyuki","followers_url":"https://api.github.com/users/ooba-noriyuki/followers","following_url":"https://api.github.com/users/ooba-noriyuki/following{/other_user}","gists_url":"https://api.github.com/users/ooba-noriyuki/gists{/gist_id}","starred_url":"https://api.github.com/users/ooba-noriyuki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ooba-noriyuki/subscriptions","organizations_url":"https://api.github.com/users/ooba-noriyuki/orgs","repos_url":"https://api.github.com/users/ooba-noriyuki/repos","events_url":"https://api.github.com/users/ooba-noriyuki/events{/privacy}","received_events_url":"https://api.github.com/users/ooba-noriyuki/received_events","type":"User","site_admin":false},"repo":{"id":134952542,"node_id":"MDEwOlJlcG9zaXRvcnkxMzQ5NTI1NDI=","name":"chat-space","full_name":"ooba-noriyuki/chat-space","owner":{"login":"ooba-noriyuki","id":37300577,"node_id":"MDQ6VXNlcjM3MzAwNTc3","avatar_url":"https://avatars3.githubusercontent.com/u/37300577?v=4","gravatar_id":"","url":"https://api.github.com/users/ooba-noriyuki","html_url":"https://github.com/ooba-noriyuki","followers_url":"https://api.github.com/users/ooba-noriyuki/followers","following_url":"https://api.github.com/users/ooba-noriyuki/following{/other_user}","gists_url":"https://api.github.com/users/ooba-noriyuki/gists{/gist_id}","starred_url":"https://api.github.com/users/ooba-noriyuki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ooba-noriyuki/subscriptions","organizations_url":"https://api.github.com/users/ooba-noriyuki/orgs","repos_url":"https://api.github.com/users/ooba-noriyuki/repos","events_url":"https://api.github.com/users/ooba-noriyuki/events{/privacy}","received_events_url":"https://api.github.com/users/ooba-noriyuki/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ooba-noriyuki/chat-space","description":null,"fork":false,"url":"https://api.github.com/repos/ooba-noriyuki/chat-space","forks_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/forks","keys_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/teams","hooks_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/hooks","issue_events_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/issues/events{/number}","events_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/events","assignees_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/assignees{/user}","branches_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/branches{/branch}","tags_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/tags","blobs_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/git/refs{/sha}","trees_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/statuses/{sha}","languages_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/languages","stargazers_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/stargazers","contributors_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/contributors","subscribers_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/subscribers","subscription_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/subscription","commits_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/commits{/sha}","git_commits_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/git/commits{/sha}","comments_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/comments{/number}","issue_comment_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/issues/comments{/number}","contents_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/contents/{+path}","compare_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/merges","archive_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/downloads","issues_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/issues{/number}","pulls_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/pulls{/number}","milestones_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/milestones{/number}","notifications_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/labels{/name}","releases_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/releases{/id}","deployments_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/deployments","created_at":"2018-05-26T10:40:15Z","updated_at":"2018-08-18T09:33:59Z","pushed_at":"2018-08-25T08:36:55Z","git_url":"git://github.com/ooba-noriyuki/chat-space.git","ssh_url":"git@github.com:ooba-noriyuki/chat-space.git","clone_url":"https://github.com/ooba-noriyuki/chat-space.git","svn_url":"https://github.com/ooba-noriyuki/chat-space","homepage":null,"size":207,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"ooba-noriyuki:master","ref":"master","sha":"14f9ac9f9abada53c88be82cb27c634e5c03067f","user":{"login":"ooba-noriyuki","id":37300577,"node_id":"MDQ6VXNlcjM3MzAwNTc3","avatar_url":"https://avatars3.githubusercontent.com/u/37300577?v=4","gravatar_id":"","url":"https://api.github.com/users/ooba-noriyuki","html_url":"https://github.com/ooba-noriyuki","followers_url":"https://api.github.com/users/ooba-noriyuki/followers","following_url":"https://api.github.com/users/ooba-noriyuki/following{/other_user}","gists_url":"https://api.github.com/users/ooba-noriyuki/gists{/gist_id}","starred_url":"https://api.github.com/users/ooba-noriyuki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ooba-noriyuki/subscriptions","organizations_url":"https://api.github.com/users/ooba-noriyuki/orgs","repos_url":"https://api.github.com/users/ooba-noriyuki/repos","events_url":"https://api.github.com/users/ooba-noriyuki/events{/privacy}","received_events_url":"https://api.github.com/users/ooba-noriyuki/received_events","type":"User","site_admin":false},"repo":{"id":134952542,"node_id":"MDEwOlJlcG9zaXRvcnkxMzQ5NTI1NDI=","name":"chat-space","full_name":"ooba-noriyuki/chat-space","owner":{"login":"ooba-noriyuki","id":37300577,"node_id":"MDQ6VXNlcjM3MzAwNTc3","avatar_url":"https://avatars3.githubusercontent.com/u/37300577?v=4","gravatar_id":"","url":"https://api.github.com/users/ooba-noriyuki","html_url":"https://github.com/ooba-noriyuki","followers_url":"https://api.github.com/users/ooba-noriyuki/followers","following_url":"https://api.github.com/users/ooba-noriyuki/following{/other_user}","gists_url":"https://api.github.com/users/ooba-noriyuki/gists{/gist_id}","starred_url":"https://api.github.com/users/ooba-noriyuki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ooba-noriyuki/subscriptions","organizations_url":"https://api.github.com/users/ooba-noriyuki/orgs","repos_url":"https://api.github.com/users/ooba-noriyuki/repos","events_url":"https://api.github.com/users/ooba-noriyuki/events{/privacy}","received_events_url":"https://api.github.com/users/ooba-noriyuki/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ooba-noriyuki/chat-space","description":null,"fork":false,"url":"https://api.github.com/repos/ooba-noriyuki/chat-space","forks_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/forks","keys_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/teams","hooks_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/hooks","issue_events_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/issues/events{/number}","events_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/events","assignees_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/assignees{/user}","branches_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/branches{/branch}","tags_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/tags","blobs_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/git/refs{/sha}","trees_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/statuses/{sha}","languages_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/languages","stargazers_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/stargazers","contributors_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/contributors","subscribers_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/subscribers","subscription_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/subscription","commits_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/commits{/sha}","git_commits_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/git/commits{/sha}","comments_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/comments{/number}","issue_comment_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/issues/comments{/number}","contents_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/contents/{+path}","compare_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/merges","archive_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/downloads","issues_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/issues{/number}","pulls_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/pulls{/number}","milestones_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/milestones{/number}","notifications_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/labels{/name}","releases_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/releases{/id}","deployments_url":"https://api.github.com/repos/ooba-noriyuki/chat-space/deployments","created_at":"2018-05-26T10:40:15Z","updated_at":"2018-08-18T09:33:59Z","pushed_at":"2018-08-25T08:36:55Z","git_url":"git://github.com/ooba-noriyuki/chat-space.git","ssh_url":"git@github.com:ooba-noriyuki/chat-space.git","clone_url":"https://github.com/ooba-noriyuki/chat-space.git","svn_url":"https://github.com/ooba-noriyuki/chat-space","homepage":null,"size":207,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ooba-noriyuki/chat-space/pulls/13"},"html":{"href":"https://github.com/ooba-noriyuki/chat-space/pull/13"},"issue":{"href":"https://api.github.com/repos/ooba-noriyuki/chat-space/issues/13"},"comments":{"href":"https://api.github.com/repos/ooba-noriyuki/chat-space/issues/13/comments"},"review_comments":{"href":"https://api.github.com/repos/ooba-noriyuki/chat-space/pulls/13/comments"},"review_comment":{"href":"https://api.github.com/repos/ooba-noriyuki/chat-space/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ooba-noriyuki/chat-space/pulls/13/commits"},"statuses":{"href":"https://api.github.com/repos/ooba-noriyuki/chat-space/statuses/565f498026046ae2d6e5ef30e95fbec6b27a97cf"}},"author_association":"OWNER"}}
{"actor":{"display_login":"MrUrakou"}}