{"action":"created","comment":{"url":"https://api.github.com/repos/SUSE/TeamDashboard/pulls/comments/41614142","id":41614142,"diff_hunk":"@@ -0,0 +1,77 @@\n+$(function() {\n+  $('.gh-repo').each(function () {\n+    var target = $(this);\n+    var repo   = $(target).data('repo');\n+\n+    /* fetch pull requests */\n+    $.get('/github/' + repo + '/pulls', function(html) {\n+        var prs = $(html);\n+        $(target).find('.spinner').remove();\n+        $(target).children('.panel-body').append(prs);\n+ \n+        /* show description */\n+        $(prs).find('.description').hide();\n+        $(prs).find('.show-desc').click(function() {\n+          $(this).hide();\n+          $(this).next('.description').slideToggle(); \n+        });\n+\n+\n+        /* pull request functions */\n+        $(prs).find('.gh-pr').each(function () {\n+          var pr     = $(this);\n+          var num    = $(this).data('number');\n+\n+          /* trello select card feature */\n+          $(pr).find('.select-card').click(function() {\n+            var button  = $(this);\n+            var spinner = '<div class=\"text-center\"><i class=\"fa fa-cog fa-spin fa-5x\"></i></div>';\n+\n+\n+            /* handle select cards modal */\n+            $('#cards').html(spinner);\n+            $.get('/github/' + repo + '/pull/' + num +'/cards', function(html) { \n+              var cards = $(html);\n+              $('#cards').html(cards); \n+\n+              /* handle on card click (in modal) */\n+              $(cards).find('.card').click(function() {\n+                var card = $(this).data('card');\n+\n+                /* Add spinner to card */\n+                $(this).html('<i class=\"fa fa-cog fa-spin\"></div>');\n+                /* save card to github pull request */\n+                $.getJSON('/github/' + repo + '/pull/' + num + '/cards/' + card, function(status) {\n+                  if (status.ok) {\n+                    var icon = '<i class=\"fa fa-trello fa-fw\">';\n+                    var link = '<a href=\"'+ status.shorturl + '\">#' + status.cardid + '</a>';\n+\n+                    $(button).replaceWith(icon + link);\n+                    $('#select-cards').modal('hide');\n+                  } else\n+                    $(\"#cards\").html('<div class=\"alert alert-danger\">Could not set card</div>'); \n+                }); \n+\n+              });\n+\n+            });\n+          });\n+\n+          /* pull request status feature */\n+          $.getJSON('/github/' + repo + '/pull/' + num, function(status) {\n+            var check  = $('<i class=\"fa fa-check-square fa-3x\"></i>');\n+\n+            if (status.mergeable)\n+              $(pr).find('.mergeable').append(check.clone());\n+\n+            if (status.ci_green)\n+              $(pr).find('.ci-green').append(check.clone());\n+\n+            if (! (status.ci_green && status.mergeable))\n+              $(pr).addClass('danger');","path":"app/assets/javascripts/github.js","position":71,"original_position":71,"commit_id":"c101a4911f093b911f7d73dcacae81b94c00ce05","original_commit_id":"c101a4911f093b911f7d73dcacae81b94c00ce05","user":{"login":"felixsch","id":4460715,"avatar_url":"https://avatars.githubusercontent.com/u/4460715?v=3","gravatar_id":"","url":"https://api.github.com/users/felixsch","html_url":"https://github.com/felixsch","followers_url":"https://api.github.com/users/felixsch/followers","following_url":"https://api.github.com/users/felixsch/following{/other_user}","gists_url":"https://api.github.com/users/felixsch/gists{/gist_id}","starred_url":"https://api.github.com/users/felixsch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/felixsch/subscriptions","organizations_url":"https://api.github.com/users/felixsch/orgs","repos_url":"https://api.github.com/users/felixsch/repos","events_url":"https://api.github.com/users/felixsch/events{/privacy}","received_events_url":"https://api.github.com/users/felixsch/received_events","type":"User","site_admin":false},"body":"I tested it. Yes it looks more nice.","created_at":"2015-10-09T09:49:38Z","updated_at":"2015-10-09T09:49:38Z","html_url":"https://github.com/SUSE/TeamDashboard/pull/21#discussion_r41614142","pull_request_url":"https://api.github.com/repos/SUSE/TeamDashboard/pulls/21","_links":{"self":{"href":"https://api.github.com/repos/SUSE/TeamDashboard/pulls/comments/41614142"},"html":{"href":"https://github.com/SUSE/TeamDashboard/pull/21#discussion_r41614142"},"pull_request":{"href":"https://api.github.com/repos/SUSE/TeamDashboard/pulls/21"}}},"pull_request":{"url":"https://api.github.com/repos/SUSE/TeamDashboard/pulls/21","id":47136243,"html_url":"https://github.com/SUSE/TeamDashboard/pull/21","diff_url":"https://github.com/SUSE/TeamDashboard/pull/21.diff","patch_url":"https://github.com/SUSE/TeamDashboard/pull/21.patch","issue_url":"https://api.github.com/repos/SUSE/TeamDashboard/issues/21","number":21,"state":"open","locked":false,"title":"Add a github pull requests overview 2811","user":{"login":"felixsch","id":4460715,"avatar_url":"https://avatars.githubusercontent.com/u/4460715?v=3","gravatar_id":"","url":"https://api.github.com/users/felixsch","html_url":"https://github.com/felixsch","followers_url":"https://api.github.com/users/felixsch/followers","following_url":"https://api.github.com/users/felixsch/following{/other_user}","gists_url":"https://api.github.com/users/felixsch/gists{/gist_id}","starred_url":"https://api.github.com/users/felixsch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/felixsch/subscriptions","organizations_url":"https://api.github.com/users/felixsch/orgs","repos_url":"https://api.github.com/users/felixsch/repos","events_url":"https://api.github.com/users/felixsch/events{/privacy}","received_events_url":"https://api.github.com/users/felixsch/received_events","type":"User","site_admin":false},"body":"  - List all open pull requests on github\r\n  - Shows the current state of the pull request (mergeable & ci green)\r\n  - Shows if a trello card was assigned to the pull request\r\n  - A trello card can be assigned to a pull requests\r\n\r\n  Changes despite the pull requests overview:\r\n\r\n  - Moved trello_wrapper to lib/\r\n  - Added check if commanding officer where found","created_at":"2015-10-08T10:33:51Z","updated_at":"2015-10-09T09:49:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a6371d432c9d7d6854311f026fb9767782f4924d","assignee":{"login":"lagartoflojo","id":2944,"avatar_url":"https://avatars.githubusercontent.com/u/2944?v=3","gravatar_id":"","url":"https://api.github.com/users/lagartoflojo","html_url":"https://github.com/lagartoflojo","followers_url":"https://api.github.com/users/lagartoflojo/followers","following_url":"https://api.github.com/users/lagartoflojo/following{/other_user}","gists_url":"https://api.github.com/users/lagartoflojo/gists{/gist_id}","starred_url":"https://api.github.com/users/lagartoflojo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lagartoflojo/subscriptions","organizations_url":"https://api.github.com/users/lagartoflojo/orgs","repos_url":"https://api.github.com/users/lagartoflojo/repos","events_url":"https://api.github.com/users/lagartoflojo/events{/privacy}","received_events_url":"https://api.github.com/users/lagartoflojo/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/SUSE/TeamDashboard/pulls/21/commits","review_comments_url":"https://api.github.com/repos/SUSE/TeamDashboard/pulls/21/comments","review_comment_url":"https://api.github.com/repos/SUSE/TeamDashboard/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SUSE/TeamDashboard/issues/21/comments","statuses_url":"https://api.github.com/repos/SUSE/TeamDashboard/statuses/c101a4911f093b911f7d73dcacae81b94c00ce05","head":{"label":"SUSE:github-overview","ref":"github-overview","sha":"c101a4911f093b911f7d73dcacae81b94c00ce05","user":{"login":"SUSE","id":1067733,"avatar_url":"https://avatars.githubusercontent.com/u/1067733?v=3","gravatar_id":"","url":"https://api.github.com/users/SUSE","html_url":"https://github.com/SUSE","followers_url":"https://api.github.com/users/SUSE/followers","following_url":"https://api.github.com/users/SUSE/following{/other_user}","gists_url":"https://api.github.com/users/SUSE/gists{/gist_id}","starred_url":"https://api.github.com/users/SUSE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SUSE/subscriptions","organizations_url":"https://api.github.com/users/SUSE/orgs","repos_url":"https://api.github.com/users/SUSE/repos","events_url":"https://api.github.com/users/SUSE/events{/privacy}","received_events_url":"https://api.github.com/users/SUSE/received_events","type":"Organization","site_admin":false},"repo":{"id":27915376,"name":"TeamDashboard","full_name":"SUSE/TeamDashboard","owner":{"login":"SUSE","id":1067733,"avatar_url":"https://avatars.githubusercontent.com/u/1067733?v=3","gravatar_id":"","url":"https://api.github.com/users/SUSE","html_url":"https://github.com/SUSE","followers_url":"https://api.github.com/users/SUSE/followers","following_url":"https://api.github.com/users/SUSE/following{/other_user}","gists_url":"https://api.github.com/users/SUSE/gists{/gist_id}","starred_url":"https://api.github.com/users/SUSE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SUSE/subscriptions","organizations_url":"https://api.github.com/users/SUSE/orgs","repos_url":"https://api.github.com/users/SUSE/repos","events_url":"https://api.github.com/users/SUSE/events{/privacy}","received_events_url":"https://api.github.com/users/SUSE/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SUSE/TeamDashboard","description":"","fork":false,"url":"https://api.github.com/repos/SUSE/TeamDashboard","forks_url":"https://api.github.com/repos/SUSE/TeamDashboard/forks","keys_url":"https://api.github.com/repos/SUSE/TeamDashboard/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SUSE/TeamDashboard/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SUSE/TeamDashboard/teams","hooks_url":"https://api.github.com/repos/SUSE/TeamDashboard/hooks","issue_events_url":"https://api.github.com/repos/SUSE/TeamDashboard/issues/events{/number}","events_url":"https://api.github.com/repos/SUSE/TeamDashboard/events","assignees_url":"https://api.github.com/repos/SUSE/TeamDashboard/assignees{/user}","branches_url":"https://api.github.com/repos/SUSE/TeamDashboard/branches{/branch}","tags_url":"https://api.github.com/repos/SUSE/TeamDashboard/tags","blobs_url":"https://api.github.com/repos/SUSE/TeamDashboard/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SUSE/TeamDashboard/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SUSE/TeamDashboard/git/refs{/sha}","trees_url":"https://api.github.com/repos/SUSE/TeamDashboard/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SUSE/TeamDashboard/statuses/{sha}","languages_url":"https://api.github.com/repos/SUSE/TeamDashboard/languages","stargazers_url":"https://api.github.com/repos/SUSE/TeamDashboard/stargazers","contributors_url":"https://api.github.com/repos/SUSE/TeamDashboard/contributors","subscribers_url":"https://api.github.com/repos/SUSE/TeamDashboard/subscribers","subscription_url":"https://api.github.com/repos/SUSE/TeamDashboard/subscription","commits_url":"https://api.github.com/repos/SUSE/TeamDashboard/commits{/sha}","git_commits_url":"https://api.github.com/repos/SUSE/TeamDashboard/git/commits{/sha}","comments_url":"https://api.github.com/repos/SUSE/TeamDashboard/comments{/number}","issue_comment_url":"https://api.github.com/repos/SUSE/TeamDashboard/issues/comments{/number}","contents_url":"https://api.github.com/repos/SUSE/TeamDashboard/contents/{+path}","compare_url":"https://api.github.com/repos/SUSE/TeamDashboard/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SUSE/TeamDashboard/merges","archive_url":"https://api.github.com/repos/SUSE/TeamDashboard/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SUSE/TeamDashboard/downloads","issues_url":"https://api.github.com/repos/SUSE/TeamDashboard/issues{/number}","pulls_url":"https://api.github.com/repos/SUSE/TeamDashboard/pulls{/number}","milestones_url":"https://api.github.com/repos/SUSE/TeamDashboard/milestones{/number}","notifications_url":"https://api.github.com/repos/SUSE/TeamDashboard/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SUSE/TeamDashboard/labels{/name}","releases_url":"https://api.github.com/repos/SUSE/TeamDashboard/releases{/id}","created_at":"2014-12-12T10:10:59Z","updated_at":"2015-08-28T13:22:27Z","pushed_at":"2015-10-08T15:50:36Z","git_url":"git://github.com/SUSE/TeamDashboard.git","ssh_url":"git@github.com:SUSE/TeamDashboard.git","clone_url":"https://github.com/SUSE/TeamDashboard.git","svn_url":"https://github.com/SUSE/TeamDashboard","homepage":null,"size":4214,"stargazers_count":1,"watchers_count":1,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"SUSE:master","ref":"master","sha":"1668e73b6160b24070995818f90a5d577a184a63","user":{"login":"SUSE","id":1067733,"avatar_url":"https://avatars.githubusercontent.com/u/1067733?v=3","gravatar_id":"","url":"https://api.github.com/users/SUSE","html_url":"https://github.com/SUSE","followers_url":"https://api.github.com/users/SUSE/followers","following_url":"https://api.github.com/users/SUSE/following{/other_user}","gists_url":"https://api.github.com/users/SUSE/gists{/gist_id}","starred_url":"https://api.github.com/users/SUSE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SUSE/subscriptions","organizations_url":"https://api.github.com/users/SUSE/orgs","repos_url":"https://api.github.com/users/SUSE/repos","events_url":"https://api.github.com/users/SUSE/events{/privacy}","received_events_url":"https://api.github.com/users/SUSE/received_events","type":"Organization","site_admin":false},"repo":{"id":27915376,"name":"TeamDashboard","full_name":"SUSE/TeamDashboard","owner":{"login":"SUSE","id":1067733,"avatar_url":"https://avatars.githubusercontent.com/u/1067733?v=3","gravatar_id":"","url":"https://api.github.com/users/SUSE","html_url":"https://github.com/SUSE","followers_url":"https://api.github.com/users/SUSE/followers","following_url":"https://api.github.com/users/SUSE/following{/other_user}","gists_url":"https://api.github.com/users/SUSE/gists{/gist_id}","starred_url":"https://api.github.com/users/SUSE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SUSE/subscriptions","organizations_url":"https://api.github.com/users/SUSE/orgs","repos_url":"https://api.github.com/users/SUSE/repos","events_url":"https://api.github.com/users/SUSE/events{/privacy}","received_events_url":"https://api.github.com/users/SUSE/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SUSE/TeamDashboard","description":"","fork":false,"url":"https://api.github.com/repos/SUSE/TeamDashboard","forks_url":"https://api.github.com/repos/SUSE/TeamDashboard/forks","keys_url":"https://api.github.com/repos/SUSE/TeamDashboard/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SUSE/TeamDashboard/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SUSE/TeamDashboard/teams","hooks_url":"https://api.github.com/repos/SUSE/TeamDashboard/hooks","issue_events_url":"https://api.github.com/repos/SUSE/TeamDashboard/issues/events{/number}","events_url":"https://api.github.com/repos/SUSE/TeamDashboard/events","assignees_url":"https://api.github.com/repos/SUSE/TeamDashboard/assignees{/user}","branches_url":"https://api.github.com/repos/SUSE/TeamDashboard/branches{/branch}","tags_url":"https://api.github.com/repos/SUSE/TeamDashboard/tags","blobs_url":"https://api.github.com/repos/SUSE/TeamDashboard/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SUSE/TeamDashboard/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SUSE/TeamDashboard/git/refs{/sha}","trees_url":"https://api.github.com/repos/SUSE/TeamDashboard/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SUSE/TeamDashboard/statuses/{sha}","languages_url":"https://api.github.com/repos/SUSE/TeamDashboard/languages","stargazers_url":"https://api.github.com/repos/SUSE/TeamDashboard/stargazers","contributors_url":"https://api.github.com/repos/SUSE/TeamDashboard/contributors","subscribers_url":"https://api.github.com/repos/SUSE/TeamDashboard/subscribers","subscription_url":"https://api.github.com/repos/SUSE/TeamDashboard/subscription","commits_url":"https://api.github.com/repos/SUSE/TeamDashboard/commits{/sha}","git_commits_url":"https://api.github.com/repos/SUSE/TeamDashboard/git/commits{/sha}","comments_url":"https://api.github.com/repos/SUSE/TeamDashboard/comments{/number}","issue_comment_url":"https://api.github.com/repos/SUSE/TeamDashboard/issues/comments{/number}","contents_url":"https://api.github.com/repos/SUSE/TeamDashboard/contents/{+path}","compare_url":"https://api.github.com/repos/SUSE/TeamDashboard/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SUSE/TeamDashboard/merges","archive_url":"https://api.github.com/repos/SUSE/TeamDashboard/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SUSE/TeamDashboard/downloads","issues_url":"https://api.github.com/repos/SUSE/TeamDashboard/issues{/number}","pulls_url":"https://api.github.com/repos/SUSE/TeamDashboard/pulls{/number}","milestones_url":"https://api.github.com/repos/SUSE/TeamDashboard/milestones{/number}","notifications_url":"https://api.github.com/repos/SUSE/TeamDashboard/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SUSE/TeamDashboard/labels{/name}","releases_url":"https://api.github.com/repos/SUSE/TeamDashboard/releases{/id}","created_at":"2014-12-12T10:10:59Z","updated_at":"2015-08-28T13:22:27Z","pushed_at":"2015-10-08T15:50:36Z","git_url":"git://github.com/SUSE/TeamDashboard.git","ssh_url":"git@github.com:SUSE/TeamDashboard.git","clone_url":"https://github.com/SUSE/TeamDashboard.git","svn_url":"https://github.com/SUSE/TeamDashboard","homepage":null,"size":4214,"stargazers_count":1,"watchers_count":1,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SUSE/TeamDashboard/pulls/21"},"html":{"href":"https://github.com/SUSE/TeamDashboard/pull/21"},"issue":{"href":"https://api.github.com/repos/SUSE/TeamDashboard/issues/21"},"comments":{"href":"https://api.github.com/repos/SUSE/TeamDashboard/issues/21/comments"},"review_comments":{"href":"https://api.github.com/repos/SUSE/TeamDashboard/pulls/21/comments"},"review_comment":{"href":"https://api.github.com/repos/SUSE/TeamDashboard/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SUSE/TeamDashboard/pulls/21/commits"},"statuses":{"href":"https://api.github.com/repos/SUSE/TeamDashboard/statuses/c101a4911f093b911f7d73dcacae81b94c00ce05"}}}}