{"action":"created","comment":{"url":"https://api.github.com/repos/miyagit/chat-space/pulls/comments/105547278","pull_request_review_id":26435750,"id":105547278,"diff_hunk":"@@ -0,0 +1,68 @@\n+$(document).on('turbolinks:load', function() {\n+  $('#chatments').on('keyup', function() {\n+    ajaxsearch();\n+  });\n+\n+  $('.chat-group-form__field--right').on('click','.chat-group-user__add', function() {\n+    var user = $(this).parent();\n+    var user_id = user.data('id');\n+    var user_name = user.data('name');\n+    addition(user, user_id, user_name);\n+  });\n+\n+  $('.chat-group-form__field--right').on('click','.chat-group-user__remove', function() {\n+    var user = $(this).parent();\n+    removement(user);\n+  });\n+});\n+\n+\n+function buildHTML(user) {\n+  var html = `<li class=\"addinglist\" data-id=\"${ user.id }\" data-name=\"${ user.name }\">${ user.name }<button\n+              type=\"button\" class=\"chat-group-user__add\">追加</button></li>`;\n+  return html;\n+}\n+\n+function BuildUserList(user_id, user_name) {\n+  var html = `<li class=\"list\">${ user_name }<button type=\"button\" class=\"chat-group-user__remove\">削除</button><input type=\"hidden\" name='group[user_ids][]' value=\"${ user_id }\" class=\"user_id\"></li>`;\n+  return html;\n+}\n+\n+\n+function ajaxsearch() {\n+  var word = $(\"#chatments\").val();\n+  $.ajax({\n+    type: 'GET',\n+    url: '/users/search',\n+    data: {\n+      user: {\n+        search: word\n+      }\n+    },\n+    dataType: 'json'\n+  })\n+  .done(function(data) {\n+    $(\".addinglist\").remove();\n+    if (word.length !== 0) {\n+      $.each(data.users, function(i, user) {\n+        var list = buildHTML(user);\n+        $(\"#searchresult\").append(list);\n+      });\n+    }\n+  })\n+  .fail(function() {\n+    alert('error');\n+  });\n+  return false;\n+}\n+\n+function addition(user, user_id, user_name) {","path":"app/assets/javascripts/group.js","position":59,"original_position":59,"commit_id":"94bdb20dfd9771e307ddacdfd22d35073721efed","original_commit_id":"94bdb20dfd9771e307ddacdfd22d35073721efed","user":{"login":"miyagit","id":17040491,"avatar_url":"https://avatars0.githubusercontent.com/u/17040491?v=3","gravatar_id":"","url":"https://api.github.com/users/miyagit","html_url":"https://github.com/miyagit","followers_url":"https://api.github.com/users/miyagit/followers","following_url":"https://api.github.com/users/miyagit/following{/other_user}","gists_url":"https://api.github.com/users/miyagit/gists{/gist_id}","starred_url":"https://api.github.com/users/miyagit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miyagit/subscriptions","organizations_url":"https://api.github.com/users/miyagit/orgs","repos_url":"https://api.github.com/users/miyagit/repos","events_url":"https://api.github.com/users/miyagit/events{/privacy}","received_events_url":"https://api.github.com/users/miyagit/received_events","type":"User","site_admin":false},"body":"done","created_at":"2017-03-12T02:34:39Z","updated_at":"2017-03-12T02:34:39Z","html_url":"https://github.com/miyagit/chat-space/pull/18#discussion_r105547278","pull_request_url":"https://api.github.com/repos/miyagit/chat-space/pulls/18","_links":{"self":{"href":"https://api.github.com/repos/miyagit/chat-space/pulls/comments/105547278"},"html":{"href":"https://github.com/miyagit/chat-space/pull/18#discussion_r105547278"},"pull_request":{"href":"https://api.github.com/repos/miyagit/chat-space/pulls/18"}}},"pull_request":{"url":"https://api.github.com/repos/miyagit/chat-space/pulls/18","id":108952263,"html_url":"https://github.com/miyagit/chat-space/pull/18","diff_url":"https://github.com/miyagit/chat-space/pull/18.diff","patch_url":"https://github.com/miyagit/chat-space/pull/18.patch","issue_url":"https://api.github.com/repos/miyagit/chat-space/issues/18","number":18,"state":"open","locked":false,"title":"user追加の非同期通信","user":{"login":"miyagit","id":17040491,"avatar_url":"https://avatars0.githubusercontent.com/u/17040491?v=3","gravatar_id":"","url":"https://api.github.com/users/miyagit","html_url":"https://github.com/miyagit","followers_url":"https://api.github.com/users/miyagit/followers","following_url":"https://api.github.com/users/miyagit/following{/other_user}","gists_url":"https://api.github.com/users/miyagit/gists{/gist_id}","starred_url":"https://api.github.com/users/miyagit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miyagit/subscriptions","organizations_url":"https://api.github.com/users/miyagit/orgs","repos_url":"https://api.github.com/users/miyagit/repos","events_url":"https://api.github.com/users/miyagit/events{/privacy}","received_events_url":"https://api.github.com/users/miyagit/received_events","type":"User","site_admin":false},"body":"# WHAT\r\nuser追加を非同期通信で実装\r\n\r\n# WHY\r\nuser追加を非同期通信で実装したいため。","created_at":"2017-03-03T11:08:07Z","updated_at":"2017-03-12T02:34:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9bcdd9f17984f8700ea8125c39065408f75c04af","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/miyagit/chat-space/pulls/18/commits","review_comments_url":"https://api.github.com/repos/miyagit/chat-space/pulls/18/comments","review_comment_url":"https://api.github.com/repos/miyagit/chat-space/pulls/comments{/number}","comments_url":"https://api.github.com/repos/miyagit/chat-space/issues/18/comments","statuses_url":"https://api.github.com/repos/miyagit/chat-space/statuses/94bdb20dfd9771e307ddacdfd22d35073721efed","head":{"label":"miyagit:user_add","ref":"user_add","sha":"94bdb20dfd9771e307ddacdfd22d35073721efed","user":{"login":"miyagit","id":17040491,"avatar_url":"https://avatars0.githubusercontent.com/u/17040491?v=3","gravatar_id":"","url":"https://api.github.com/users/miyagit","html_url":"https://github.com/miyagit","followers_url":"https://api.github.com/users/miyagit/followers","following_url":"https://api.github.com/users/miyagit/following{/other_user}","gists_url":"https://api.github.com/users/miyagit/gists{/gist_id}","starred_url":"https://api.github.com/users/miyagit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miyagit/subscriptions","organizations_url":"https://api.github.com/users/miyagit/orgs","repos_url":"https://api.github.com/users/miyagit/repos","events_url":"https://api.github.com/users/miyagit/events{/privacy}","received_events_url":"https://api.github.com/users/miyagit/received_events","type":"User","site_admin":false},"repo":{"id":80834077,"name":"chat-space","full_name":"miyagit/chat-space","owner":{"login":"miyagit","id":17040491,"avatar_url":"https://avatars0.githubusercontent.com/u/17040491?v=3","gravatar_id":"","url":"https://api.github.com/users/miyagit","html_url":"https://github.com/miyagit","followers_url":"https://api.github.com/users/miyagit/followers","following_url":"https://api.github.com/users/miyagit/following{/other_user}","gists_url":"https://api.github.com/users/miyagit/gists{/gist_id}","starred_url":"https://api.github.com/users/miyagit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miyagit/subscriptions","organizations_url":"https://api.github.com/users/miyagit/orgs","repos_url":"https://api.github.com/users/miyagit/repos","events_url":"https://api.github.com/users/miyagit/events{/privacy}","received_events_url":"https://api.github.com/users/miyagit/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/miyagit/chat-space","description":null,"fork":false,"url":"https://api.github.com/repos/miyagit/chat-space","forks_url":"https://api.github.com/repos/miyagit/chat-space/forks","keys_url":"https://api.github.com/repos/miyagit/chat-space/keys{/key_id}","collaborators_url":"https://api.github.com/repos/miyagit/chat-space/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/miyagit/chat-space/teams","hooks_url":"https://api.github.com/repos/miyagit/chat-space/hooks","issue_events_url":"https://api.github.com/repos/miyagit/chat-space/issues/events{/number}","events_url":"https://api.github.com/repos/miyagit/chat-space/events","assignees_url":"https://api.github.com/repos/miyagit/chat-space/assignees{/user}","branches_url":"https://api.github.com/repos/miyagit/chat-space/branches{/branch}","tags_url":"https://api.github.com/repos/miyagit/chat-space/tags","blobs_url":"https://api.github.com/repos/miyagit/chat-space/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/miyagit/chat-space/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/miyagit/chat-space/git/refs{/sha}","trees_url":"https://api.github.com/repos/miyagit/chat-space/git/trees{/sha}","statuses_url":"https://api.github.com/repos/miyagit/chat-space/statuses/{sha}","languages_url":"https://api.github.com/repos/miyagit/chat-space/languages","stargazers_url":"https://api.github.com/repos/miyagit/chat-space/stargazers","contributors_url":"https://api.github.com/repos/miyagit/chat-space/contributors","subscribers_url":"https://api.github.com/repos/miyagit/chat-space/subscribers","subscription_url":"https://api.github.com/repos/miyagit/chat-space/subscription","commits_url":"https://api.github.com/repos/miyagit/chat-space/commits{/sha}","git_commits_url":"https://api.github.com/repos/miyagit/chat-space/git/commits{/sha}","comments_url":"https://api.github.com/repos/miyagit/chat-space/comments{/number}","issue_comment_url":"https://api.github.com/repos/miyagit/chat-space/issues/comments{/number}","contents_url":"https://api.github.com/repos/miyagit/chat-space/contents/{+path}","compare_url":"https://api.github.com/repos/miyagit/chat-space/compare/{base}...{head}","merges_url":"https://api.github.com/repos/miyagit/chat-space/merges","archive_url":"https://api.github.com/repos/miyagit/chat-space/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/miyagit/chat-space/downloads","issues_url":"https://api.github.com/repos/miyagit/chat-space/issues{/number}","pulls_url":"https://api.github.com/repos/miyagit/chat-space/pulls{/number}","milestones_url":"https://api.github.com/repos/miyagit/chat-space/milestones{/number}","notifications_url":"https://api.github.com/repos/miyagit/chat-space/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/miyagit/chat-space/labels{/name}","releases_url":"https://api.github.com/repos/miyagit/chat-space/releases{/id}","deployments_url":"https://api.github.com/repos/miyagit/chat-space/deployments","created_at":"2017-02-03T14:02:02Z","updated_at":"2017-02-03T14:02:10Z","pushed_at":"2017-03-12T02:09:44Z","git_url":"git://github.com/miyagit/chat-space.git","ssh_url":"git@github.com:miyagit/chat-space.git","clone_url":"https://github.com/miyagit/chat-space.git","svn_url":"https://github.com/miyagit/chat-space","homepage":null,"size":126,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":0,"default_branch":"master"}},"base":{"label":"miyagit:master","ref":"master","sha":"8c2422b6ac2f7788362ec466d934b83460a08a90","user":{"login":"miyagit","id":17040491,"avatar_url":"https://avatars0.githubusercontent.com/u/17040491?v=3","gravatar_id":"","url":"https://api.github.com/users/miyagit","html_url":"https://github.com/miyagit","followers_url":"https://api.github.com/users/miyagit/followers","following_url":"https://api.github.com/users/miyagit/following{/other_user}","gists_url":"https://api.github.com/users/miyagit/gists{/gist_id}","starred_url":"https://api.github.com/users/miyagit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miyagit/subscriptions","organizations_url":"https://api.github.com/users/miyagit/orgs","repos_url":"https://api.github.com/users/miyagit/repos","events_url":"https://api.github.com/users/miyagit/events{/privacy}","received_events_url":"https://api.github.com/users/miyagit/received_events","type":"User","site_admin":false},"repo":{"id":80834077,"name":"chat-space","full_name":"miyagit/chat-space","owner":{"login":"miyagit","id":17040491,"avatar_url":"https://avatars0.githubusercontent.com/u/17040491?v=3","gravatar_id":"","url":"https://api.github.com/users/miyagit","html_url":"https://github.com/miyagit","followers_url":"https://api.github.com/users/miyagit/followers","following_url":"https://api.github.com/users/miyagit/following{/other_user}","gists_url":"https://api.github.com/users/miyagit/gists{/gist_id}","starred_url":"https://api.github.com/users/miyagit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miyagit/subscriptions","organizations_url":"https://api.github.com/users/miyagit/orgs","repos_url":"https://api.github.com/users/miyagit/repos","events_url":"https://api.github.com/users/miyagit/events{/privacy}","received_events_url":"https://api.github.com/users/miyagit/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/miyagit/chat-space","description":null,"fork":false,"url":"https://api.github.com/repos/miyagit/chat-space","forks_url":"https://api.github.com/repos/miyagit/chat-space/forks","keys_url":"https://api.github.com/repos/miyagit/chat-space/keys{/key_id}","collaborators_url":"https://api.github.com/repos/miyagit/chat-space/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/miyagit/chat-space/teams","hooks_url":"https://api.github.com/repos/miyagit/chat-space/hooks","issue_events_url":"https://api.github.com/repos/miyagit/chat-space/issues/events{/number}","events_url":"https://api.github.com/repos/miyagit/chat-space/events","assignees_url":"https://api.github.com/repos/miyagit/chat-space/assignees{/user}","branches_url":"https://api.github.com/repos/miyagit/chat-space/branches{/branch}","tags_url":"https://api.github.com/repos/miyagit/chat-space/tags","blobs_url":"https://api.github.com/repos/miyagit/chat-space/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/miyagit/chat-space/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/miyagit/chat-space/git/refs{/sha}","trees_url":"https://api.github.com/repos/miyagit/chat-space/git/trees{/sha}","statuses_url":"https://api.github.com/repos/miyagit/chat-space/statuses/{sha}","languages_url":"https://api.github.com/repos/miyagit/chat-space/languages","stargazers_url":"https://api.github.com/repos/miyagit/chat-space/stargazers","contributors_url":"https://api.github.com/repos/miyagit/chat-space/contributors","subscribers_url":"https://api.github.com/repos/miyagit/chat-space/subscribers","subscription_url":"https://api.github.com/repos/miyagit/chat-space/subscription","commits_url":"https://api.github.com/repos/miyagit/chat-space/commits{/sha}","git_commits_url":"https://api.github.com/repos/miyagit/chat-space/git/commits{/sha}","comments_url":"https://api.github.com/repos/miyagit/chat-space/comments{/number}","issue_comment_url":"https://api.github.com/repos/miyagit/chat-space/issues/comments{/number}","contents_url":"https://api.github.com/repos/miyagit/chat-space/contents/{+path}","compare_url":"https://api.github.com/repos/miyagit/chat-space/compare/{base}...{head}","merges_url":"https://api.github.com/repos/miyagit/chat-space/merges","archive_url":"https://api.github.com/repos/miyagit/chat-space/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/miyagit/chat-space/downloads","issues_url":"https://api.github.com/repos/miyagit/chat-space/issues{/number}","pulls_url":"https://api.github.com/repos/miyagit/chat-space/pulls{/number}","milestones_url":"https://api.github.com/repos/miyagit/chat-space/milestones{/number}","notifications_url":"https://api.github.com/repos/miyagit/chat-space/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/miyagit/chat-space/labels{/name}","releases_url":"https://api.github.com/repos/miyagit/chat-space/releases{/id}","deployments_url":"https://api.github.com/repos/miyagit/chat-space/deployments","created_at":"2017-02-03T14:02:02Z","updated_at":"2017-02-03T14:02:10Z","pushed_at":"2017-03-12T02:09:44Z","git_url":"git://github.com/miyagit/chat-space.git","ssh_url":"git@github.com:miyagit/chat-space.git","clone_url":"https://github.com/miyagit/chat-space.git","svn_url":"https://github.com/miyagit/chat-space","homepage":null,"size":126,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/miyagit/chat-space/pulls/18"},"html":{"href":"https://github.com/miyagit/chat-space/pull/18"},"issue":{"href":"https://api.github.com/repos/miyagit/chat-space/issues/18"},"comments":{"href":"https://api.github.com/repos/miyagit/chat-space/issues/18/comments"},"review_comments":{"href":"https://api.github.com/repos/miyagit/chat-space/pulls/18/comments"},"review_comment":{"href":"https://api.github.com/repos/miyagit/chat-space/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/miyagit/chat-space/pulls/18/commits"},"statuses":{"href":"https://api.github.com/repos/miyagit/chat-space/statuses/94bdb20dfd9771e307ddacdfd22d35073721efed"}}}}
{"actor":{"display_login":"miyagit"}}