{"action":"created","comment":{"url":"https://api.github.com/repos/rohandaxini/knowbuddy/pulls/comments/32318658","id":32318658,"diff_hunk":"@@ -64,54 +94,51 @@ $(document).ready(function(){\n   //Ajaxify posting comment\n   //start\n   $(\"#new_comment\").validationEngine({\n-    'customFunctions': {\n-      'checkContent': function (field, rules, i, options){\n-        if ($('#comment_comment').val() == '') {\n+    \"customFunctions\": {\n+      \"checkContent\": function (field, rules, i, options){\n+        if ($(\"#wmd-input-comment\").val() === \"\") {\n           return options.allrules.required.alertText;\n         }\n       }\n     }\n   });\n \n-  $('body').on('ajax:success', '#new_comment', function(xhr, data, status) {\n-    $(\"#latest_comment\").prepend(data.new_comment).fadeOut(200).fadeIn(2000)\n-    $('#comment_comment').val('')\n-    $('.time_ago').timeago()\n+  $(\"body\").on(\"ajax:success\", \"#new_comment\", function(xhr, data, status) {\n+    $(\"#latest_comment\").prepend(data.new_comment).fadeOut(200).fadeIn(2000);\n+    $(\"#wmd-input-comment\").val(\"\");\n+    $(\".time_ago\").timeago();\n   });\n   //end\n \n+  //hide and display the pagedown preview\n+  $(\"#wmd-input-comment\").focus(function(){\n+    var preview = $(\"#wmd-preview-comment\");\n+    preview.show().html(replaceTag(preview.html()));\n+  });\n+\n+  $(\"body\").on(\"click\", \".submit-comment\", function(){\n+    $(\"#wmd-preview-comment\").empty().hide();\n+  });\n+\n   //File Preview icon display\n   //start\n-  function makeflieupload() {\n-    $('#fileupload').fileupload({\n-      dataType: 'json',\n-      add: function (e, data) {\n-        $('#load').attr(\"src\",'/assets/loading.gif')\n-        $('#load').show()\n-        var fileType =data.files[0].type\n-        var extensionflag = $.inArray(fileType,['image/jpeg',\n-          'image/png', 'image/gif', 'image/jpg', 'application/pdf',\n-          'application/msword', 'text/plain', 'text/html',\n-          'application/vnd.openxmlformats-officedocument.wordprocessingml.document'])\n-        if (extensionflag >= 0) {\n-          data.submit();\n-        }\n-        else {\n-          alert('Invalid File Extension for: '+data.files[0].name);\n-          $('#load').hide()\n-          return false;\n-        }\n+  function makefileupload() {\n+    $(\"#upload-photo\").fileupload({\n+      dataType: \"JSON\",\n+      add: function(e, data){\n+        createAttachment(e, data);\n       },\n       done: function (e, data) {\n-        $('#load').hide()\n-        var id = $('#attachments_field').val();\n-        $('#post_attachment').append(data.result.attachment)\n-        $('#attachments_field').val(data.result.id + ',' + id);\n+        $(\"#preview_attachments_field\").val(data.result.id);\n+        $(\"#load-preview\").hide();\n+        if(data.result.is_image)","path":"app/assets/javascripts/custom.js","position":149,"original_position":149,"commit_id":"84e948e3003513b855f791a4cac0d8a6a6cb463e","original_commit_id":"84e948e3003513b855f791a4cac0d8a6a6cb463e","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Identifier 'is_image' is not in camel case.","created_at":"2015-06-12T14:09:09Z","updated_at":"2015-06-12T14:09:09Z","html_url":"https://github.com/rohandaxini/knowbuddy/pull/43#discussion_r32318658","pull_request_url":"https://api.github.com/repos/rohandaxini/knowbuddy/pulls/43","_links":{"self":{"href":"https://api.github.com/repos/rohandaxini/knowbuddy/pulls/comments/32318658"},"html":{"href":"https://github.com/rohandaxini/knowbuddy/pull/43#discussion_r32318658"},"pull_request":{"href":"https://api.github.com/repos/rohandaxini/knowbuddy/pulls/43"}}},"pull_request":{"url":"https://api.github.com/repos/rohandaxini/knowbuddy/pulls/43","id":37333000,"html_url":"https://github.com/rohandaxini/knowbuddy/pull/43","diff_url":"https://github.com/rohandaxini/knowbuddy/pull/43.diff","patch_url":"https://github.com/rohandaxini/knowbuddy/pull/43.patch","issue_url":"https://api.github.com/repos/rohandaxini/knowbuddy/issues/43","number":43,"state":"open","locked":false,"title":"Integrate pagedown editor","user":{"login":"ruchikamayekar","id":10151376,"avatar_url":"https://avatars.githubusercontent.com/u/10151376?v=3","gravatar_id":"","url":"https://api.github.com/users/ruchikamayekar","html_url":"https://github.com/ruchikamayekar","followers_url":"https://api.github.com/users/ruchikamayekar/followers","following_url":"https://api.github.com/users/ruchikamayekar/following{/other_user}","gists_url":"https://api.github.com/users/ruchikamayekar/gists{/gist_id}","starred_url":"https://api.github.com/users/ruchikamayekar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruchikamayekar/subscriptions","organizations_url":"https://api.github.com/users/ruchikamayekar/orgs","repos_url":"https://api.github.com/users/ruchikamayekar/repos","events_url":"https://api.github.com/users/ruchikamayekar/events{/privacy}","received_events_url":"https://api.github.com/users/ruchikamayekar/received_events","type":"User","site_admin":false},"body":"Hi @rohandaxini \r\n\r\n  This PR contains changes for integration of PageDown editor, syntaxhighlighter and implementing custom image upload for posts and comments.\r\n\r\nThanks","created_at":"2015-06-10T08:01:04Z","updated_at":"2015-06-12T14:09:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d5df96d187a62ea14c72bd51439872267e140909","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rohandaxini/knowbuddy/pulls/43/commits","review_comments_url":"https://api.github.com/repos/rohandaxini/knowbuddy/pulls/43/comments","review_comment_url":"https://api.github.com/repos/rohandaxini/knowbuddy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rohandaxini/knowbuddy/issues/43/comments","statuses_url":"https://api.github.com/repos/rohandaxini/knowbuddy/statuses/84e948e3003513b855f791a4cac0d8a6a6cb463e","head":{"label":"rohandaxini:integrate-pagedown-editor","ref":"integrate-pagedown-editor","sha":"84e948e3003513b855f791a4cac0d8a6a6cb463e","user":{"login":"rohandaxini","id":970712,"avatar_url":"https://avatars.githubusercontent.com/u/970712?v=3","gravatar_id":"","url":"https://api.github.com/users/rohandaxini","html_url":"https://github.com/rohandaxini","followers_url":"https://api.github.com/users/rohandaxini/followers","following_url":"https://api.github.com/users/rohandaxini/following{/other_user}","gists_url":"https://api.github.com/users/rohandaxini/gists{/gist_id}","starred_url":"https://api.github.com/users/rohandaxini/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rohandaxini/subscriptions","organizations_url":"https://api.github.com/users/rohandaxini/orgs","repos_url":"https://api.github.com/users/rohandaxini/repos","events_url":"https://api.github.com/users/rohandaxini/events{/privacy}","received_events_url":"https://api.github.com/users/rohandaxini/received_events","type":"User","site_admin":false},"repo":{"id":3616675,"name":"knowbuddy","full_name":"rohandaxini/knowbuddy","owner":{"login":"rohandaxini","id":970712,"avatar_url":"https://avatars.githubusercontent.com/u/970712?v=3","gravatar_id":"","url":"https://api.github.com/users/rohandaxini","html_url":"https://github.com/rohandaxini","followers_url":"https://api.github.com/users/rohandaxini/followers","following_url":"https://api.github.com/users/rohandaxini/following{/other_user}","gists_url":"https://api.github.com/users/rohandaxini/gists{/gist_id}","starred_url":"https://api.github.com/users/rohandaxini/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rohandaxini/subscriptions","organizations_url":"https://api.github.com/users/rohandaxini/orgs","repos_url":"https://api.github.com/users/rohandaxini/repos","events_url":"https://api.github.com/users/rohandaxini/events{/privacy}","received_events_url":"https://api.github.com/users/rohandaxini/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rohandaxini/knowbuddy","description":"Knowledge Buddy","fork":false,"url":"https://api.github.com/repos/rohandaxini/knowbuddy","forks_url":"https://api.github.com/repos/rohandaxini/knowbuddy/forks","keys_url":"https://api.github.com/repos/rohandaxini/knowbuddy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rohandaxini/knowbuddy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rohandaxini/knowbuddy/teams","hooks_url":"https://api.github.com/repos/rohandaxini/knowbuddy/hooks","issue_events_url":"https://api.github.com/repos/rohandaxini/knowbuddy/issues/events{/number}","events_url":"https://api.github.com/repos/rohandaxini/knowbuddy/events","assignees_url":"https://api.github.com/repos/rohandaxini/knowbuddy/assignees{/user}","branches_url":"https://api.github.com/repos/rohandaxini/knowbuddy/branches{/branch}","tags_url":"https://api.github.com/repos/rohandaxini/knowbuddy/tags","blobs_url":"https://api.github.com/repos/rohandaxini/knowbuddy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rohandaxini/knowbuddy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rohandaxini/knowbuddy/git/refs{/sha}","trees_url":"https://api.github.com/repos/rohandaxini/knowbuddy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rohandaxini/knowbuddy/statuses/{sha}","languages_url":"https://api.github.com/repos/rohandaxini/knowbuddy/languages","stargazers_url":"https://api.github.com/repos/rohandaxini/knowbuddy/stargazers","contributors_url":"https://api.github.com/repos/rohandaxini/knowbuddy/contributors","subscribers_url":"https://api.github.com/repos/rohandaxini/knowbuddy/subscribers","subscription_url":"https://api.github.com/repos/rohandaxini/knowbuddy/subscription","commits_url":"https://api.github.com/repos/rohandaxini/knowbuddy/commits{/sha}","git_commits_url":"https://api.github.com/repos/rohandaxini/knowbuddy/git/commits{/sha}","comments_url":"https://api.github.com/repos/rohandaxini/knowbuddy/comments{/number}","issue_comment_url":"https://api.github.com/repos/rohandaxini/knowbuddy/issues/comments{/number}","contents_url":"https://api.github.com/repos/rohandaxini/knowbuddy/contents/{+path}","compare_url":"https://api.github.com/repos/rohandaxini/knowbuddy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rohandaxini/knowbuddy/merges","archive_url":"https://api.github.com/repos/rohandaxini/knowbuddy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rohandaxini/knowbuddy/downloads","issues_url":"https://api.github.com/repos/rohandaxini/knowbuddy/issues{/number}","pulls_url":"https://api.github.com/repos/rohandaxini/knowbuddy/pulls{/number}","milestones_url":"https://api.github.com/repos/rohandaxini/knowbuddy/milestones{/number}","notifications_url":"https://api.github.com/repos/rohandaxini/knowbuddy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rohandaxini/knowbuddy/labels{/name}","releases_url":"https://api.github.com/repos/rohandaxini/knowbuddy/releases{/id}","created_at":"2012-03-04T07:19:54Z","updated_at":"2015-06-02T16:00:41Z","pushed_at":"2015-06-12T14:08:49Z","git_url":"git://github.com/rohandaxini/knowbuddy.git","ssh_url":"git@github.com:rohandaxini/knowbuddy.git","clone_url":"https://github.com/rohandaxini/knowbuddy.git","svn_url":"https://github.com/rohandaxini/knowbuddy","homepage":"","size":3208,"stargazers_count":7,"watchers_count":7,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":2,"forks":4,"open_issues":2,"watchers":7,"default_branch":"master"}},"base":{"label":"rohandaxini:master","ref":"master","sha":"f1af8604fc22840e4a74436d6904321b155ae1ec","user":{"login":"rohandaxini","id":970712,"avatar_url":"https://avatars.githubusercontent.com/u/970712?v=3","gravatar_id":"","url":"https://api.github.com/users/rohandaxini","html_url":"https://github.com/rohandaxini","followers_url":"https://api.github.com/users/rohandaxini/followers","following_url":"https://api.github.com/users/rohandaxini/following{/other_user}","gists_url":"https://api.github.com/users/rohandaxini/gists{/gist_id}","starred_url":"https://api.github.com/users/rohandaxini/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rohandaxini/subscriptions","organizations_url":"https://api.github.com/users/rohandaxini/orgs","repos_url":"https://api.github.com/users/rohandaxini/repos","events_url":"https://api.github.com/users/rohandaxini/events{/privacy}","received_events_url":"https://api.github.com/users/rohandaxini/received_events","type":"User","site_admin":false},"repo":{"id":3616675,"name":"knowbuddy","full_name":"rohandaxini/knowbuddy","owner":{"login":"rohandaxini","id":970712,"avatar_url":"https://avatars.githubusercontent.com/u/970712?v=3","gravatar_id":"","url":"https://api.github.com/users/rohandaxini","html_url":"https://github.com/rohandaxini","followers_url":"https://api.github.com/users/rohandaxini/followers","following_url":"https://api.github.com/users/rohandaxini/following{/other_user}","gists_url":"https://api.github.com/users/rohandaxini/gists{/gist_id}","starred_url":"https://api.github.com/users/rohandaxini/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rohandaxini/subscriptions","organizations_url":"https://api.github.com/users/rohandaxini/orgs","repos_url":"https://api.github.com/users/rohandaxini/repos","events_url":"https://api.github.com/users/rohandaxini/events{/privacy}","received_events_url":"https://api.github.com/users/rohandaxini/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rohandaxini/knowbuddy","description":"Knowledge Buddy","fork":false,"url":"https://api.github.com/repos/rohandaxini/knowbuddy","forks_url":"https://api.github.com/repos/rohandaxini/knowbuddy/forks","keys_url":"https://api.github.com/repos/rohandaxini/knowbuddy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rohandaxini/knowbuddy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rohandaxini/knowbuddy/teams","hooks_url":"https://api.github.com/repos/rohandaxini/knowbuddy/hooks","issue_events_url":"https://api.github.com/repos/rohandaxini/knowbuddy/issues/events{/number}","events_url":"https://api.github.com/repos/rohandaxini/knowbuddy/events","assignees_url":"https://api.github.com/repos/rohandaxini/knowbuddy/assignees{/user}","branches_url":"https://api.github.com/repos/rohandaxini/knowbuddy/branches{/branch}","tags_url":"https://api.github.com/repos/rohandaxini/knowbuddy/tags","blobs_url":"https://api.github.com/repos/rohandaxini/knowbuddy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rohandaxini/knowbuddy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rohandaxini/knowbuddy/git/refs{/sha}","trees_url":"https://api.github.com/repos/rohandaxini/knowbuddy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rohandaxini/knowbuddy/statuses/{sha}","languages_url":"https://api.github.com/repos/rohandaxini/knowbuddy/languages","stargazers_url":"https://api.github.com/repos/rohandaxini/knowbuddy/stargazers","contributors_url":"https://api.github.com/repos/rohandaxini/knowbuddy/contributors","subscribers_url":"https://api.github.com/repos/rohandaxini/knowbuddy/subscribers","subscription_url":"https://api.github.com/repos/rohandaxini/knowbuddy/subscription","commits_url":"https://api.github.com/repos/rohandaxini/knowbuddy/commits{/sha}","git_commits_url":"https://api.github.com/repos/rohandaxini/knowbuddy/git/commits{/sha}","comments_url":"https://api.github.com/repos/rohandaxini/knowbuddy/comments{/number}","issue_comment_url":"https://api.github.com/repos/rohandaxini/knowbuddy/issues/comments{/number}","contents_url":"https://api.github.com/repos/rohandaxini/knowbuddy/contents/{+path}","compare_url":"https://api.github.com/repos/rohandaxini/knowbuddy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rohandaxini/knowbuddy/merges","archive_url":"https://api.github.com/repos/rohandaxini/knowbuddy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rohandaxini/knowbuddy/downloads","issues_url":"https://api.github.com/repos/rohandaxini/knowbuddy/issues{/number}","pulls_url":"https://api.github.com/repos/rohandaxini/knowbuddy/pulls{/number}","milestones_url":"https://api.github.com/repos/rohandaxini/knowbuddy/milestones{/number}","notifications_url":"https://api.github.com/repos/rohandaxini/knowbuddy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rohandaxini/knowbuddy/labels{/name}","releases_url":"https://api.github.com/repos/rohandaxini/knowbuddy/releases{/id}","created_at":"2012-03-04T07:19:54Z","updated_at":"2015-06-02T16:00:41Z","pushed_at":"2015-06-12T14:08:49Z","git_url":"git://github.com/rohandaxini/knowbuddy.git","ssh_url":"git@github.com:rohandaxini/knowbuddy.git","clone_url":"https://github.com/rohandaxini/knowbuddy.git","svn_url":"https://github.com/rohandaxini/knowbuddy","homepage":"","size":3208,"stargazers_count":7,"watchers_count":7,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":2,"forks":4,"open_issues":2,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rohandaxini/knowbuddy/pulls/43"},"html":{"href":"https://github.com/rohandaxini/knowbuddy/pull/43"},"issue":{"href":"https://api.github.com/repos/rohandaxini/knowbuddy/issues/43"},"comments":{"href":"https://api.github.com/repos/rohandaxini/knowbuddy/issues/43/comments"},"review_comments":{"href":"https://api.github.com/repos/rohandaxini/knowbuddy/pulls/43/comments"},"review_comment":{"href":"https://api.github.com/repos/rohandaxini/knowbuddy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rohandaxini/knowbuddy/pulls/43/commits"},"statuses":{"href":"https://api.github.com/repos/rohandaxini/knowbuddy/statuses/84e948e3003513b855f791a4cac0d8a6a6cb463e"}}}}