{"action":"created","comment":{"url":"https://api.github.com/repos/vanliem/laravel_social/pulls/comments/68530874","id":68530874,"diff_hunk":"@@ -0,0 +1,70 @@\n+// var body = 1;\n+var App = {}\n+App.init = function(){\n+    var scope = this;\n+    scope.handleUpdatePost();\n+    scope.popUpModal();\n+    scope.handleLike();\n+}\n+\n+App.popUpModal = function(){\n+    $('.post .interaction').on('click', '.edit-post', function(e) {\n+        e.preventDefault();\n+        var postID = $(e.target).attr('data-id');\n+        $('#edit-post-modal').modal('show');\n+        $('.hidden-post-id').val(postID);\n+        $('#post-body-modal').val('').val($('.post-' + postID).text()).focus();\n+    });\n+}\n+\n+App.handleUpdatePost = function(){\n+    $('#save-post-modal').on('click', function() {\n+        var postID = $('.hidden-post-id').val();\n+        var data = {body: $('#post-body-modal').val(), postID: postID, _token: token };\n+\n+        $.ajax({\n+            url: '/post/' + postID + '/edit',\n+            method: 'POST',\n+            data: data,\n+            dataType: 'JSON',\n+            statusCode:{\n+                401: function(){\n+                    $('#edit-post-modal').modal('show');\n+                    alert('Please login!');\n+                    window.location.href = \"/\";\n+                }\n+            }\n+\n+        })\n+        . done(function(resp){\n+            $('.post-' + postID).text('').text(resp.body);\n+            $('#edit-post-modal').modal('hide');\n+        });\n+    })\n+}\n+\n+App.handleLike = function(){\n+    $('.post').on('click', '.like',function(e) {\n+        var className = $(e.target).parent('.interaction').parent().find('p').attr('class').split(\"-\");\n+        var postID = className[1];","path":"public/src/js/app.js","position":49,"original_position":49,"commit_id":"6eac1a00f1453e1e116aed96ab2da9bb1a7b9a96","original_commit_id":"6eac1a00f1453e1e116aed96ab2da9bb1a7b9a96","user":{"login":"DungNQ-Framgia","id":5467203,"avatar_url":"https://avatars.githubusercontent.com/u/5467203?v=3","gravatar_id":"","url":"https://api.github.com/users/DungNQ-Framgia","html_url":"https://github.com/DungNQ-Framgia","followers_url":"https://api.github.com/users/DungNQ-Framgia/followers","following_url":"https://api.github.com/users/DungNQ-Framgia/following{/other_user}","gists_url":"https://api.github.com/users/DungNQ-Framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/DungNQ-Framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DungNQ-Framgia/subscriptions","organizations_url":"https://api.github.com/users/DungNQ-Framgia/orgs","repos_url":"https://api.github.com/users/DungNQ-Framgia/repos","events_url":"https://api.github.com/users/DungNQ-Framgia/events{/privacy}","received_events_url":"https://api.github.com/users/DungNQ-Framgia/received_events","type":"User","site_admin":false},"body":"Để lấy ra id của 1 post, ko cần phải quá vất vả thế này . Tại sao em ko gán cho giá trị post ID trực tiếp vào trong nút like, đặt cho  id=$postId chẳng hạn, sau đó đọc ra ?","created_at":"2016-06-27T07:12:38Z","updated_at":"2016-06-27T07:12:38Z","html_url":"https://github.com/vanliem/laravel_social/pull/1#discussion_r68530874","pull_request_url":"https://api.github.com/repos/vanliem/laravel_social/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/vanliem/laravel_social/pulls/comments/68530874"},"html":{"href":"https://github.com/vanliem/laravel_social/pull/1#discussion_r68530874"},"pull_request":{"href":"https://api.github.com/repos/vanliem/laravel_social/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/vanliem/laravel_social/pulls/1","id":75072145,"html_url":"https://github.com/vanliem/laravel_social/pull/1","diff_url":"https://github.com/vanliem/laravel_social/pull/1.diff","patch_url":"https://github.com/vanliem/laravel_social/pull/1.patch","issue_url":"https://api.github.com/repos/vanliem/laravel_social/issues/1","number":1,"state":"open","locked":false,"title":"My code","user":{"login":"vanliem","id":11506612,"avatar_url":"https://avatars.githubusercontent.com/u/11506612?v=3","gravatar_id":"","url":"https://api.github.com/users/vanliem","html_url":"https://github.com/vanliem","followers_url":"https://api.github.com/users/vanliem/followers","following_url":"https://api.github.com/users/vanliem/following{/other_user}","gists_url":"https://api.github.com/users/vanliem/gists{/gist_id}","starred_url":"https://api.github.com/users/vanliem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vanliem/subscriptions","organizations_url":"https://api.github.com/users/vanliem/orgs","repos_url":"https://api.github.com/users/vanliem/repos","events_url":"https://api.github.com/users/vanliem/events{/privacy}","received_events_url":"https://api.github.com/users/vanliem/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-06-24T06:58:34Z","updated_at":"2016-06-27T07:12:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2fb91c7d70ce54f9f3c9a700f5af5b0676277193","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/vanliem/laravel_social/pulls/1/commits","review_comments_url":"https://api.github.com/repos/vanliem/laravel_social/pulls/1/comments","review_comment_url":"https://api.github.com/repos/vanliem/laravel_social/pulls/comments{/number}","comments_url":"https://api.github.com/repos/vanliem/laravel_social/issues/1/comments","statuses_url":"https://api.github.com/repos/vanliem/laravel_social/statuses/6eac1a00f1453e1e116aed96ab2da9bb1a7b9a96","head":{"label":"vanliem:merge-code","ref":"merge-code","sha":"6eac1a00f1453e1e116aed96ab2da9bb1a7b9a96","user":{"login":"vanliem","id":11506612,"avatar_url":"https://avatars.githubusercontent.com/u/11506612?v=3","gravatar_id":"","url":"https://api.github.com/users/vanliem","html_url":"https://github.com/vanliem","followers_url":"https://api.github.com/users/vanliem/followers","following_url":"https://api.github.com/users/vanliem/following{/other_user}","gists_url":"https://api.github.com/users/vanliem/gists{/gist_id}","starred_url":"https://api.github.com/users/vanliem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vanliem/subscriptions","organizations_url":"https://api.github.com/users/vanliem/orgs","repos_url":"https://api.github.com/users/vanliem/repos","events_url":"https://api.github.com/users/vanliem/events{/privacy}","received_events_url":"https://api.github.com/users/vanliem/received_events","type":"User","site_admin":false},"repo":{"id":61861475,"name":"laravel_social","full_name":"vanliem/laravel_social","owner":{"login":"vanliem","id":11506612,"avatar_url":"https://avatars.githubusercontent.com/u/11506612?v=3","gravatar_id":"","url":"https://api.github.com/users/vanliem","html_url":"https://github.com/vanliem","followers_url":"https://api.github.com/users/vanliem/followers","following_url":"https://api.github.com/users/vanliem/following{/other_user}","gists_url":"https://api.github.com/users/vanliem/gists{/gist_id}","starred_url":"https://api.github.com/users/vanliem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vanliem/subscriptions","organizations_url":"https://api.github.com/users/vanliem/orgs","repos_url":"https://api.github.com/users/vanliem/repos","events_url":"https://api.github.com/users/vanliem/events{/privacy}","received_events_url":"https://api.github.com/users/vanliem/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vanliem/laravel_social","description":"","fork":false,"url":"https://api.github.com/repos/vanliem/laravel_social","forks_url":"https://api.github.com/repos/vanliem/laravel_social/forks","keys_url":"https://api.github.com/repos/vanliem/laravel_social/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vanliem/laravel_social/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vanliem/laravel_social/teams","hooks_url":"https://api.github.com/repos/vanliem/laravel_social/hooks","issue_events_url":"https://api.github.com/repos/vanliem/laravel_social/issues/events{/number}","events_url":"https://api.github.com/repos/vanliem/laravel_social/events","assignees_url":"https://api.github.com/repos/vanliem/laravel_social/assignees{/user}","branches_url":"https://api.github.com/repos/vanliem/laravel_social/branches{/branch}","tags_url":"https://api.github.com/repos/vanliem/laravel_social/tags","blobs_url":"https://api.github.com/repos/vanliem/laravel_social/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vanliem/laravel_social/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vanliem/laravel_social/git/refs{/sha}","trees_url":"https://api.github.com/repos/vanliem/laravel_social/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vanliem/laravel_social/statuses/{sha}","languages_url":"https://api.github.com/repos/vanliem/laravel_social/languages","stargazers_url":"https://api.github.com/repos/vanliem/laravel_social/stargazers","contributors_url":"https://api.github.com/repos/vanliem/laravel_social/contributors","subscribers_url":"https://api.github.com/repos/vanliem/laravel_social/subscribers","subscription_url":"https://api.github.com/repos/vanliem/laravel_social/subscription","commits_url":"https://api.github.com/repos/vanliem/laravel_social/commits{/sha}","git_commits_url":"https://api.github.com/repos/vanliem/laravel_social/git/commits{/sha}","comments_url":"https://api.github.com/repos/vanliem/laravel_social/comments{/number}","issue_comment_url":"https://api.github.com/repos/vanliem/laravel_social/issues/comments{/number}","contents_url":"https://api.github.com/repos/vanliem/laravel_social/contents/{+path}","compare_url":"https://api.github.com/repos/vanliem/laravel_social/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vanliem/laravel_social/merges","archive_url":"https://api.github.com/repos/vanliem/laravel_social/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vanliem/laravel_social/downloads","issues_url":"https://api.github.com/repos/vanliem/laravel_social/issues{/number}","pulls_url":"https://api.github.com/repos/vanliem/laravel_social/pulls{/number}","milestones_url":"https://api.github.com/repos/vanliem/laravel_social/milestones{/number}","notifications_url":"https://api.github.com/repos/vanliem/laravel_social/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vanliem/laravel_social/labels{/name}","releases_url":"https://api.github.com/repos/vanliem/laravel_social/releases{/id}","deployments_url":"https://api.github.com/repos/vanliem/laravel_social/deployments","created_at":"2016-06-24T06:20:41Z","updated_at":"2016-06-24T06:23:10Z","pushed_at":"2016-06-27T06:06:11Z","git_url":"git://github.com/vanliem/laravel_social.git","ssh_url":"git@github.com:vanliem/laravel_social.git","clone_url":"https://github.com/vanliem/laravel_social.git","svn_url":"https://github.com/vanliem/laravel_social","homepage":null,"size":52,"stargazers_count":0,"watchers_count":0,"language":"PHP","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":"vanliem:master","ref":"master","sha":"c8f8fb4ffd29a97db32f7d75721328a624a31033","user":{"login":"vanliem","id":11506612,"avatar_url":"https://avatars.githubusercontent.com/u/11506612?v=3","gravatar_id":"","url":"https://api.github.com/users/vanliem","html_url":"https://github.com/vanliem","followers_url":"https://api.github.com/users/vanliem/followers","following_url":"https://api.github.com/users/vanliem/following{/other_user}","gists_url":"https://api.github.com/users/vanliem/gists{/gist_id}","starred_url":"https://api.github.com/users/vanliem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vanliem/subscriptions","organizations_url":"https://api.github.com/users/vanliem/orgs","repos_url":"https://api.github.com/users/vanliem/repos","events_url":"https://api.github.com/users/vanliem/events{/privacy}","received_events_url":"https://api.github.com/users/vanliem/received_events","type":"User","site_admin":false},"repo":{"id":61861475,"name":"laravel_social","full_name":"vanliem/laravel_social","owner":{"login":"vanliem","id":11506612,"avatar_url":"https://avatars.githubusercontent.com/u/11506612?v=3","gravatar_id":"","url":"https://api.github.com/users/vanliem","html_url":"https://github.com/vanliem","followers_url":"https://api.github.com/users/vanliem/followers","following_url":"https://api.github.com/users/vanliem/following{/other_user}","gists_url":"https://api.github.com/users/vanliem/gists{/gist_id}","starred_url":"https://api.github.com/users/vanliem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vanliem/subscriptions","organizations_url":"https://api.github.com/users/vanliem/orgs","repos_url":"https://api.github.com/users/vanliem/repos","events_url":"https://api.github.com/users/vanliem/events{/privacy}","received_events_url":"https://api.github.com/users/vanliem/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vanliem/laravel_social","description":"","fork":false,"url":"https://api.github.com/repos/vanliem/laravel_social","forks_url":"https://api.github.com/repos/vanliem/laravel_social/forks","keys_url":"https://api.github.com/repos/vanliem/laravel_social/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vanliem/laravel_social/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vanliem/laravel_social/teams","hooks_url":"https://api.github.com/repos/vanliem/laravel_social/hooks","issue_events_url":"https://api.github.com/repos/vanliem/laravel_social/issues/events{/number}","events_url":"https://api.github.com/repos/vanliem/laravel_social/events","assignees_url":"https://api.github.com/repos/vanliem/laravel_social/assignees{/user}","branches_url":"https://api.github.com/repos/vanliem/laravel_social/branches{/branch}","tags_url":"https://api.github.com/repos/vanliem/laravel_social/tags","blobs_url":"https://api.github.com/repos/vanliem/laravel_social/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vanliem/laravel_social/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vanliem/laravel_social/git/refs{/sha}","trees_url":"https://api.github.com/repos/vanliem/laravel_social/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vanliem/laravel_social/statuses/{sha}","languages_url":"https://api.github.com/repos/vanliem/laravel_social/languages","stargazers_url":"https://api.github.com/repos/vanliem/laravel_social/stargazers","contributors_url":"https://api.github.com/repos/vanliem/laravel_social/contributors","subscribers_url":"https://api.github.com/repos/vanliem/laravel_social/subscribers","subscription_url":"https://api.github.com/repos/vanliem/laravel_social/subscription","commits_url":"https://api.github.com/repos/vanliem/laravel_social/commits{/sha}","git_commits_url":"https://api.github.com/repos/vanliem/laravel_social/git/commits{/sha}","comments_url":"https://api.github.com/repos/vanliem/laravel_social/comments{/number}","issue_comment_url":"https://api.github.com/repos/vanliem/laravel_social/issues/comments{/number}","contents_url":"https://api.github.com/repos/vanliem/laravel_social/contents/{+path}","compare_url":"https://api.github.com/repos/vanliem/laravel_social/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vanliem/laravel_social/merges","archive_url":"https://api.github.com/repos/vanliem/laravel_social/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vanliem/laravel_social/downloads","issues_url":"https://api.github.com/repos/vanliem/laravel_social/issues{/number}","pulls_url":"https://api.github.com/repos/vanliem/laravel_social/pulls{/number}","milestones_url":"https://api.github.com/repos/vanliem/laravel_social/milestones{/number}","notifications_url":"https://api.github.com/repos/vanliem/laravel_social/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vanliem/laravel_social/labels{/name}","releases_url":"https://api.github.com/repos/vanliem/laravel_social/releases{/id}","deployments_url":"https://api.github.com/repos/vanliem/laravel_social/deployments","created_at":"2016-06-24T06:20:41Z","updated_at":"2016-06-24T06:23:10Z","pushed_at":"2016-06-27T06:06:11Z","git_url":"git://github.com/vanliem/laravel_social.git","ssh_url":"git@github.com:vanliem/laravel_social.git","clone_url":"https://github.com/vanliem/laravel_social.git","svn_url":"https://github.com/vanliem/laravel_social","homepage":null,"size":52,"stargazers_count":0,"watchers_count":0,"language":"PHP","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/vanliem/laravel_social/pulls/1"},"html":{"href":"https://github.com/vanliem/laravel_social/pull/1"},"issue":{"href":"https://api.github.com/repos/vanliem/laravel_social/issues/1"},"comments":{"href":"https://api.github.com/repos/vanliem/laravel_social/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/vanliem/laravel_social/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/vanliem/laravel_social/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/vanliem/laravel_social/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/vanliem/laravel_social/statuses/6eac1a00f1453e1e116aed96ab2da9bb1a7b9a96"}}}}
{"actor":{"display_login":"DungNQ-Framgia"}}