{"action":"created","comment":{"url":"https://api.github.com/repos/DaikiInaba/protospace/pulls/comments/69869110","id":69869110,"diff_hunk":"@@ -0,0 +1,30 @@\n+// $(window).on('page:change', function(){\r\n+//   var file_field = $('input[type=file]');\r\n+//   file_field.on('change', function(){\r\n+//     var file = $(this).prop('files')[0],\r\n+//         fileRdr = new FileReader(),\r\n+//         preview = $(this).parent('.js-file-preview');\r\n+//     fileRdr.readAsDataURL(file);\r\n+//     if(file.type.match('image.*')){\r\n+//       fileRdr.onload = function(){\r\n+//         preview.css({backgroundImage: 'url('+ fileRdr.result +')', backgroundSize: 'cover'});\r\n+//       }\r\n+//     }\r\n+//   });\r\n+// });\r\n+\r\n+\r\n+$(window).on('page:change', function(){\r\n+  var file_field = $('input[type=file]');\r\n+  file_field.on('change', function(){\r\n+    var file = $(this).prop('files')[0],\r\n+        fileRdr = new FileReader(),\r\n+        preview = $(this).data('preview');\r\n+    fileRdr.readAsDataURL(file);\r\n+    if(file.type.match('image.*')){\r\n+      fileRdr.onload = function(){\r\n+        $(preview).css({backgroundImage: 'url('+ fileRdr.result +')', backgroundSize: 'cover'});\r\n+      }\r\n+    }\r\n+  });\r\n+});\r","path":"app/assets/javascripts/image_preview.js","position":30,"original_position":30,"commit_id":"8407462f0dfd1e260e9f4201b7c9c1b9821aaf99","original_commit_id":"8407462f0dfd1e260e9f4201b7c9c1b9821aaf99","user":{"login":"DaikiInaba","id":19761679,"avatar_url":"https://avatars.githubusercontent.com/u/19761679?v=3","gravatar_id":"","url":"https://api.github.com/users/DaikiInaba","html_url":"https://github.com/DaikiInaba","followers_url":"https://api.github.com/users/DaikiInaba/followers","following_url":"https://api.github.com/users/DaikiInaba/following{/other_user}","gists_url":"https://api.github.com/users/DaikiInaba/gists{/gist_id}","starred_url":"https://api.github.com/users/DaikiInaba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DaikiInaba/subscriptions","organizations_url":"https://api.github.com/users/DaikiInaba/orgs","repos_url":"https://api.github.com/users/DaikiInaba/repos","events_url":"https://api.github.com/users/DaikiInaba/events{/privacy}","received_events_url":"https://api.github.com/users/DaikiInaba/received_events","type":"User","site_admin":false},"body":"コメントアウトしている書き方だと一括して親にjs-file-previewクラスを付与するだけでいいんですが、代わりにjsの指定にもクラスを使用しる必要がでてきます。その代わりviewファイルが簡潔になります。\r\nどっちの書き方がいいですかね？？？？","created_at":"2016-07-07T08:29:36Z","updated_at":"2016-07-07T08:29:36Z","html_url":"https://github.com/DaikiInaba/protospace/pull/15#discussion_r69869110","pull_request_url":"https://api.github.com/repos/DaikiInaba/protospace/pulls/15","_links":{"self":{"href":"https://api.github.com/repos/DaikiInaba/protospace/pulls/comments/69869110"},"html":{"href":"https://github.com/DaikiInaba/protospace/pull/15#discussion_r69869110"},"pull_request":{"href":"https://api.github.com/repos/DaikiInaba/protospace/pulls/15"}}},"pull_request":{"url":"https://api.github.com/repos/DaikiInaba/protospace/pulls/15","id":76553685,"html_url":"https://github.com/DaikiInaba/protospace/pull/15","diff_url":"https://github.com/DaikiInaba/protospace/pull/15.diff","patch_url":"https://github.com/DaikiInaba/protospace/pull/15.patch","issue_url":"https://api.github.com/repos/DaikiInaba/protospace/issues/15","number":15,"state":"open","locked":false,"title":"Introduce JS","user":{"login":"DaikiInaba","id":19761679,"avatar_url":"https://avatars.githubusercontent.com/u/19761679?v=3","gravatar_id":"","url":"https://api.github.com/users/DaikiInaba","html_url":"https://github.com/DaikiInaba","followers_url":"https://api.github.com/users/DaikiInaba/followers","following_url":"https://api.github.com/users/DaikiInaba/following{/other_user}","gists_url":"https://api.github.com/users/DaikiInaba/gists{/gist_id}","starred_url":"https://api.github.com/users/DaikiInaba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DaikiInaba/subscriptions","organizations_url":"https://api.github.com/users/DaikiInaba/orgs","repos_url":"https://api.github.com/users/DaikiInaba/repos","events_url":"https://api.github.com/users/DaikiInaba/events{/privacy}","received_events_url":"https://api.github.com/users/DaikiInaba/received_events","type":"User","site_admin":false},"body":"# WHAT\r\nJSによるファイルプレビューの導入　\r\n\r\n# WHY\r\nアップロードしたファイルをリアルタイムで確認できるようにするため","created_at":"2016-07-07T08:01:52Z","updated_at":"2016-07-07T08:29:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a63a363ec0dddd78c30f4b99438a5f0be31cc4bc","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/DaikiInaba/protospace/pulls/15/commits","review_comments_url":"https://api.github.com/repos/DaikiInaba/protospace/pulls/15/comments","review_comment_url":"https://api.github.com/repos/DaikiInaba/protospace/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DaikiInaba/protospace/issues/15/comments","statuses_url":"https://api.github.com/repos/DaikiInaba/protospace/statuses/8407462f0dfd1e260e9f4201b7c9c1b9821aaf99","head":{"label":"DaikiInaba:intro_js","ref":"intro_js","sha":"8407462f0dfd1e260e9f4201b7c9c1b9821aaf99","user":{"login":"DaikiInaba","id":19761679,"avatar_url":"https://avatars.githubusercontent.com/u/19761679?v=3","gravatar_id":"","url":"https://api.github.com/users/DaikiInaba","html_url":"https://github.com/DaikiInaba","followers_url":"https://api.github.com/users/DaikiInaba/followers","following_url":"https://api.github.com/users/DaikiInaba/following{/other_user}","gists_url":"https://api.github.com/users/DaikiInaba/gists{/gist_id}","starred_url":"https://api.github.com/users/DaikiInaba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DaikiInaba/subscriptions","organizations_url":"https://api.github.com/users/DaikiInaba/orgs","repos_url":"https://api.github.com/users/DaikiInaba/repos","events_url":"https://api.github.com/users/DaikiInaba/events{/privacy}","received_events_url":"https://api.github.com/users/DaikiInaba/received_events","type":"User","site_admin":false},"repo":{"id":60463927,"name":"protospace","full_name":"DaikiInaba/protospace","owner":{"login":"DaikiInaba","id":19761679,"avatar_url":"https://avatars.githubusercontent.com/u/19761679?v=3","gravatar_id":"","url":"https://api.github.com/users/DaikiInaba","html_url":"https://github.com/DaikiInaba","followers_url":"https://api.github.com/users/DaikiInaba/followers","following_url":"https://api.github.com/users/DaikiInaba/following{/other_user}","gists_url":"https://api.github.com/users/DaikiInaba/gists{/gist_id}","starred_url":"https://api.github.com/users/DaikiInaba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DaikiInaba/subscriptions","organizations_url":"https://api.github.com/users/DaikiInaba/orgs","repos_url":"https://api.github.com/users/DaikiInaba/repos","events_url":"https://api.github.com/users/DaikiInaba/events{/privacy}","received_events_url":"https://api.github.com/users/DaikiInaba/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/DaikiInaba/protospace","description":"","fork":false,"url":"https://api.github.com/repos/DaikiInaba/protospace","forks_url":"https://api.github.com/repos/DaikiInaba/protospace/forks","keys_url":"https://api.github.com/repos/DaikiInaba/protospace/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DaikiInaba/protospace/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DaikiInaba/protospace/teams","hooks_url":"https://api.github.com/repos/DaikiInaba/protospace/hooks","issue_events_url":"https://api.github.com/repos/DaikiInaba/protospace/issues/events{/number}","events_url":"https://api.github.com/repos/DaikiInaba/protospace/events","assignees_url":"https://api.github.com/repos/DaikiInaba/protospace/assignees{/user}","branches_url":"https://api.github.com/repos/DaikiInaba/protospace/branches{/branch}","tags_url":"https://api.github.com/repos/DaikiInaba/protospace/tags","blobs_url":"https://api.github.com/repos/DaikiInaba/protospace/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DaikiInaba/protospace/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DaikiInaba/protospace/git/refs{/sha}","trees_url":"https://api.github.com/repos/DaikiInaba/protospace/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DaikiInaba/protospace/statuses/{sha}","languages_url":"https://api.github.com/repos/DaikiInaba/protospace/languages","stargazers_url":"https://api.github.com/repos/DaikiInaba/protospace/stargazers","contributors_url":"https://api.github.com/repos/DaikiInaba/protospace/contributors","subscribers_url":"https://api.github.com/repos/DaikiInaba/protospace/subscribers","subscription_url":"https://api.github.com/repos/DaikiInaba/protospace/subscription","commits_url":"https://api.github.com/repos/DaikiInaba/protospace/commits{/sha}","git_commits_url":"https://api.github.com/repos/DaikiInaba/protospace/git/commits{/sha}","comments_url":"https://api.github.com/repos/DaikiInaba/protospace/comments{/number}","issue_comment_url":"https://api.github.com/repos/DaikiInaba/protospace/issues/comments{/number}","contents_url":"https://api.github.com/repos/DaikiInaba/protospace/contents/{+path}","compare_url":"https://api.github.com/repos/DaikiInaba/protospace/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DaikiInaba/protospace/merges","archive_url":"https://api.github.com/repos/DaikiInaba/protospace/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DaikiInaba/protospace/downloads","issues_url":"https://api.github.com/repos/DaikiInaba/protospace/issues{/number}","pulls_url":"https://api.github.com/repos/DaikiInaba/protospace/pulls{/number}","milestones_url":"https://api.github.com/repos/DaikiInaba/protospace/milestones{/number}","notifications_url":"https://api.github.com/repos/DaikiInaba/protospace/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DaikiInaba/protospace/labels{/name}","releases_url":"https://api.github.com/repos/DaikiInaba/protospace/releases{/id}","deployments_url":"https://api.github.com/repos/DaikiInaba/protospace/deployments","created_at":"2016-06-05T14:24:52Z","updated_at":"2016-06-14T15:23:25Z","pushed_at":"2016-07-07T08:27:04Z","git_url":"git://github.com/DaikiInaba/protospace.git","ssh_url":"git@github.com:DaikiInaba/protospace.git","clone_url":"https://github.com/DaikiInaba/protospace.git","svn_url":"https://github.com/DaikiInaba/protospace","homepage":null,"size":624,"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":"DaikiInaba:master","ref":"master","sha":"deca85eb9fcf69590b1a084395f67f18ceef7640","user":{"login":"DaikiInaba","id":19761679,"avatar_url":"https://avatars.githubusercontent.com/u/19761679?v=3","gravatar_id":"","url":"https://api.github.com/users/DaikiInaba","html_url":"https://github.com/DaikiInaba","followers_url":"https://api.github.com/users/DaikiInaba/followers","following_url":"https://api.github.com/users/DaikiInaba/following{/other_user}","gists_url":"https://api.github.com/users/DaikiInaba/gists{/gist_id}","starred_url":"https://api.github.com/users/DaikiInaba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DaikiInaba/subscriptions","organizations_url":"https://api.github.com/users/DaikiInaba/orgs","repos_url":"https://api.github.com/users/DaikiInaba/repos","events_url":"https://api.github.com/users/DaikiInaba/events{/privacy}","received_events_url":"https://api.github.com/users/DaikiInaba/received_events","type":"User","site_admin":false},"repo":{"id":60463927,"name":"protospace","full_name":"DaikiInaba/protospace","owner":{"login":"DaikiInaba","id":19761679,"avatar_url":"https://avatars.githubusercontent.com/u/19761679?v=3","gravatar_id":"","url":"https://api.github.com/users/DaikiInaba","html_url":"https://github.com/DaikiInaba","followers_url":"https://api.github.com/users/DaikiInaba/followers","following_url":"https://api.github.com/users/DaikiInaba/following{/other_user}","gists_url":"https://api.github.com/users/DaikiInaba/gists{/gist_id}","starred_url":"https://api.github.com/users/DaikiInaba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DaikiInaba/subscriptions","organizations_url":"https://api.github.com/users/DaikiInaba/orgs","repos_url":"https://api.github.com/users/DaikiInaba/repos","events_url":"https://api.github.com/users/DaikiInaba/events{/privacy}","received_events_url":"https://api.github.com/users/DaikiInaba/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/DaikiInaba/protospace","description":"","fork":false,"url":"https://api.github.com/repos/DaikiInaba/protospace","forks_url":"https://api.github.com/repos/DaikiInaba/protospace/forks","keys_url":"https://api.github.com/repos/DaikiInaba/protospace/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DaikiInaba/protospace/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DaikiInaba/protospace/teams","hooks_url":"https://api.github.com/repos/DaikiInaba/protospace/hooks","issue_events_url":"https://api.github.com/repos/DaikiInaba/protospace/issues/events{/number}","events_url":"https://api.github.com/repos/DaikiInaba/protospace/events","assignees_url":"https://api.github.com/repos/DaikiInaba/protospace/assignees{/user}","branches_url":"https://api.github.com/repos/DaikiInaba/protospace/branches{/branch}","tags_url":"https://api.github.com/repos/DaikiInaba/protospace/tags","blobs_url":"https://api.github.com/repos/DaikiInaba/protospace/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DaikiInaba/protospace/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DaikiInaba/protospace/git/refs{/sha}","trees_url":"https://api.github.com/repos/DaikiInaba/protospace/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DaikiInaba/protospace/statuses/{sha}","languages_url":"https://api.github.com/repos/DaikiInaba/protospace/languages","stargazers_url":"https://api.github.com/repos/DaikiInaba/protospace/stargazers","contributors_url":"https://api.github.com/repos/DaikiInaba/protospace/contributors","subscribers_url":"https://api.github.com/repos/DaikiInaba/protospace/subscribers","subscription_url":"https://api.github.com/repos/DaikiInaba/protospace/subscription","commits_url":"https://api.github.com/repos/DaikiInaba/protospace/commits{/sha}","git_commits_url":"https://api.github.com/repos/DaikiInaba/protospace/git/commits{/sha}","comments_url":"https://api.github.com/repos/DaikiInaba/protospace/comments{/number}","issue_comment_url":"https://api.github.com/repos/DaikiInaba/protospace/issues/comments{/number}","contents_url":"https://api.github.com/repos/DaikiInaba/protospace/contents/{+path}","compare_url":"https://api.github.com/repos/DaikiInaba/protospace/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DaikiInaba/protospace/merges","archive_url":"https://api.github.com/repos/DaikiInaba/protospace/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DaikiInaba/protospace/downloads","issues_url":"https://api.github.com/repos/DaikiInaba/protospace/issues{/number}","pulls_url":"https://api.github.com/repos/DaikiInaba/protospace/pulls{/number}","milestones_url":"https://api.github.com/repos/DaikiInaba/protospace/milestones{/number}","notifications_url":"https://api.github.com/repos/DaikiInaba/protospace/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DaikiInaba/protospace/labels{/name}","releases_url":"https://api.github.com/repos/DaikiInaba/protospace/releases{/id}","deployments_url":"https://api.github.com/repos/DaikiInaba/protospace/deployments","created_at":"2016-06-05T14:24:52Z","updated_at":"2016-06-14T15:23:25Z","pushed_at":"2016-07-07T08:27:04Z","git_url":"git://github.com/DaikiInaba/protospace.git","ssh_url":"git@github.com:DaikiInaba/protospace.git","clone_url":"https://github.com/DaikiInaba/protospace.git","svn_url":"https://github.com/DaikiInaba/protospace","homepage":null,"size":624,"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/DaikiInaba/protospace/pulls/15"},"html":{"href":"https://github.com/DaikiInaba/protospace/pull/15"},"issue":{"href":"https://api.github.com/repos/DaikiInaba/protospace/issues/15"},"comments":{"href":"https://api.github.com/repos/DaikiInaba/protospace/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/DaikiInaba/protospace/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/DaikiInaba/protospace/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DaikiInaba/protospace/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/DaikiInaba/protospace/statuses/8407462f0dfd1e260e9f4201b7c9c1b9821aaf99"}}}}
{"actor":{"display_login":"DaikiInaba"}}