{"action":"created","comment":{"url":"https://api.github.com/repos/hypothesis/h/pulls/comments/40067084","id":40067084,"diff_hunk":"@@ -1,20 +1,66 @@\n 'use strict';\n \n+// @ngInject\n+function GroupsListController($scope) {\n+  $scope.expandedGroupId = undefined;\n+\n+  // used to keep the dropdown from closing when the user\n+  // interacts with the inline link share pane within the groups list\n+  $scope.stopClickPropagation = function($event) {\n+    $event.stopPropagation();\n+  }\n+\n+  // show the share link for the specified group or clear it if\n+  // null\n+  $scope.toggleShareLink = function (groupId) {\n+    if (!groupId || $scope.expandedGroupId === groupId) {\n+      $scope.expandedGroupId = undefined;\n+    } else {\n+      $scope.expandedGroupId = groupId;\n+    }\n+  };\n+\n+  $scope.shouldShowShareLink = function (groupId) {\n+    return $scope.expandedGroupId === groupId;\n+  }\n+}\n+\n /**\n  * @ngdoc directive\n  * @name groupList\n  * @restrict AE\n  * @description Displays a list of groups of which the user is a member.\n  */\n-\n // @ngInject\n-module.exports = function (groups) {\n+function GroupsListDirective(groups, $window) {\n   return {\n-    link: function (scope, elem, attrs) {\n-      scope.groups = groups;\n+    controller: GroupsListController,\n+    link: function ($scope, elem, attrs) {\n+      $scope.groups = groups;\n+\n+      $scope.createNewGroup = function() {\n+        $window.open('/groups/new', '_blank');\n+      }\n+\n+      $scope.$watch('expandedGroupId', function (activeGroupId) {\n+        if (activeGroupId) {\n+          // wait for the share link field to be revealed and then select\n+          // the link's text\n+          setTimeout(function() {\n+            var activeShareLinkField = elem[0].querySelector('.share-link-field[data-group-id=' + activeGroupId + ']');\n+            activeShareLinkField.focus();\n+            activeShareLinkField.select();\n+          }, 0);\n+        }\n+      });\n     },\n     restrict: 'AE',\n     scope: {},\n     templateUrl: 'group_list.html'\n   };\n };\n+\n+module.exports = {\n+  directive: GroupsListDirective,\n+  _Controller: GroupsListController","path":"h/static/scripts/directive/group-list.js","position":69,"original_position":69,"commit_id":"341c239e85fa905131d8e296181eb0155a6496ff","original_commit_id":"341c239e85fa905131d8e296181eb0155a6496ff","user":{"login":"nickstenning","id":3602,"avatar_url":"https://avatars.githubusercontent.com/u/3602?v=3","gravatar_id":"","url":"https://api.github.com/users/nickstenning","html_url":"https://github.com/nickstenning","followers_url":"https://api.github.com/users/nickstenning/followers","following_url":"https://api.github.com/users/nickstenning/following{/other_user}","gists_url":"https://api.github.com/users/nickstenning/gists{/gist_id}","starred_url":"https://api.github.com/users/nickstenning/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickstenning/subscriptions","organizations_url":"https://api.github.com/users/nickstenning/orgs","repos_url":"https://api.github.com/users/nickstenning/repos","events_url":"https://api.github.com/users/nickstenning/events{/privacy}","received_events_url":"https://api.github.com/users/nickstenning/received_events","type":"User","site_admin":false},"body":"Not sure about the leading underscore here. If we're exporting we're exporting it, so it should just be `Controller`.","created_at":"2015-09-22T09:28:45Z","updated_at":"2015-09-22T09:28:45Z","html_url":"https://github.com/hypothesis/h/pull/2514#discussion_r40067084","pull_request_url":"https://api.github.com/repos/hypothesis/h/pulls/2514","_links":{"self":{"href":"https://api.github.com/repos/hypothesis/h/pulls/comments/40067084"},"html":{"href":"https://github.com/hypothesis/h/pull/2514#discussion_r40067084"},"pull_request":{"href":"https://api.github.com/repos/hypothesis/h/pulls/2514"}}},"pull_request":{"url":"https://api.github.com/repos/hypothesis/h/pulls/2514","id":45454996,"html_url":"https://github.com/hypothesis/h/pull/2514","diff_url":"https://github.com/hypothesis/h/pull/2514.diff","patch_url":"https://github.com/hypothesis/h/pull/2514.patch","issue_url":"https://api.github.com/repos/hypothesis/h/issues/2514","number":2514,"state":"open","locked":false,"title":"T87 - Improve group scope dropdown ui","user":{"login":"robertknight","id":2458,"avatar_url":"https://avatars.githubusercontent.com/u/2458?v=3","gravatar_id":"","url":"https://api.github.com/users/robertknight","html_url":"https://github.com/robertknight","followers_url":"https://api.github.com/users/robertknight/followers","following_url":"https://api.github.com/users/robertknight/following{/other_user}","gists_url":"https://api.github.com/users/robertknight/gists{/gist_id}","starred_url":"https://api.github.com/users/robertknight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertknight/subscriptions","organizations_url":"https://api.github.com/users/robertknight/orgs","repos_url":"https://api.github.com/users/robertknight/repos","events_url":"https://api.github.com/users/robertknight/events{/privacy}","received_events_url":"https://api.github.com/users/robertknight/received_events","type":"User","site_admin":false},"body":"This is the initial cut of the improved group link sharing UI.\r\n\r\nRemaining tasks:\r\n * Implement suitable tests\r\n * Clarify design when there are many groups in the list. Currently it will grow ad-infinitum\r\n\r\n![group-share-ui-update](https://cloud.githubusercontent.com/assets/2458/9971551/9bbfc694-5e54-11e5-8051-7b9886480888.png)\r\n","created_at":"2015-09-18T21:30:57Z","updated_at":"2015-09-22T09:28:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e18a52e9baf5fab3304a543023cdf2b9f90aef88","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hypothesis/h/pulls/2514/commits","review_comments_url":"https://api.github.com/repos/hypothesis/h/pulls/2514/comments","review_comment_url":"https://api.github.com/repos/hypothesis/h/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hypothesis/h/issues/2514/comments","statuses_url":"https://api.github.com/repos/hypothesis/h/statuses/341c239e85fa905131d8e296181eb0155a6496ff","head":{"label":"robertknight:t87-group_scope_dropdown_ui","ref":"t87-group_scope_dropdown_ui","sha":"341c239e85fa905131d8e296181eb0155a6496ff","user":{"login":"robertknight","id":2458,"avatar_url":"https://avatars.githubusercontent.com/u/2458?v=3","gravatar_id":"","url":"https://api.github.com/users/robertknight","html_url":"https://github.com/robertknight","followers_url":"https://api.github.com/users/robertknight/followers","following_url":"https://api.github.com/users/robertknight/following{/other_user}","gists_url":"https://api.github.com/users/robertknight/gists{/gist_id}","starred_url":"https://api.github.com/users/robertknight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertknight/subscriptions","organizations_url":"https://api.github.com/users/robertknight/orgs","repos_url":"https://api.github.com/users/robertknight/repos","events_url":"https://api.github.com/users/robertknight/events{/privacy}","received_events_url":"https://api.github.com/users/robertknight/received_events","type":"User","site_admin":false},"repo":{"id":38578279,"name":"h","full_name":"robertknight/h","owner":{"login":"robertknight","id":2458,"avatar_url":"https://avatars.githubusercontent.com/u/2458?v=3","gravatar_id":"","url":"https://api.github.com/users/robertknight","html_url":"https://github.com/robertknight","followers_url":"https://api.github.com/users/robertknight/followers","following_url":"https://api.github.com/users/robertknight/following{/other_user}","gists_url":"https://api.github.com/users/robertknight/gists{/gist_id}","starred_url":"https://api.github.com/users/robertknight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertknight/subscriptions","organizations_url":"https://api.github.com/users/robertknight/orgs","repos_url":"https://api.github.com/users/robertknight/repos","events_url":"https://api.github.com/users/robertknight/events{/privacy}","received_events_url":"https://api.github.com/users/robertknight/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/robertknight/h","description":"The Internet, peer reviewed.","fork":true,"url":"https://api.github.com/repos/robertknight/h","forks_url":"https://api.github.com/repos/robertknight/h/forks","keys_url":"https://api.github.com/repos/robertknight/h/keys{/key_id}","collaborators_url":"https://api.github.com/repos/robertknight/h/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/robertknight/h/teams","hooks_url":"https://api.github.com/repos/robertknight/h/hooks","issue_events_url":"https://api.github.com/repos/robertknight/h/issues/events{/number}","events_url":"https://api.github.com/repos/robertknight/h/events","assignees_url":"https://api.github.com/repos/robertknight/h/assignees{/user}","branches_url":"https://api.github.com/repos/robertknight/h/branches{/branch}","tags_url":"https://api.github.com/repos/robertknight/h/tags","blobs_url":"https://api.github.com/repos/robertknight/h/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/robertknight/h/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/robertknight/h/git/refs{/sha}","trees_url":"https://api.github.com/repos/robertknight/h/git/trees{/sha}","statuses_url":"https://api.github.com/repos/robertknight/h/statuses/{sha}","languages_url":"https://api.github.com/repos/robertknight/h/languages","stargazers_url":"https://api.github.com/repos/robertknight/h/stargazers","contributors_url":"https://api.github.com/repos/robertknight/h/contributors","subscribers_url":"https://api.github.com/repos/robertknight/h/subscribers","subscription_url":"https://api.github.com/repos/robertknight/h/subscription","commits_url":"https://api.github.com/repos/robertknight/h/commits{/sha}","git_commits_url":"https://api.github.com/repos/robertknight/h/git/commits{/sha}","comments_url":"https://api.github.com/repos/robertknight/h/comments{/number}","issue_comment_url":"https://api.github.com/repos/robertknight/h/issues/comments{/number}","contents_url":"https://api.github.com/repos/robertknight/h/contents/{+path}","compare_url":"https://api.github.com/repos/robertknight/h/compare/{base}...{head}","merges_url":"https://api.github.com/repos/robertknight/h/merges","archive_url":"https://api.github.com/repos/robertknight/h/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/robertknight/h/downloads","issues_url":"https://api.github.com/repos/robertknight/h/issues{/number}","pulls_url":"https://api.github.com/repos/robertknight/h/pulls{/number}","milestones_url":"https://api.github.com/repos/robertknight/h/milestones{/number}","notifications_url":"https://api.github.com/repos/robertknight/h/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/robertknight/h/labels{/name}","releases_url":"https://api.github.com/repos/robertknight/h/releases{/id}","created_at":"2015-07-05T17:52:44Z","updated_at":"2015-07-05T17:52:46Z","pushed_at":"2015-09-22T09:25:50Z","git_url":"git://github.com/robertknight/h.git","ssh_url":"git@github.com:robertknight/h.git","clone_url":"https://github.com/robertknight/h.git","svn_url":"https://github.com/robertknight/h","homepage":"https://hypothes.is/","size":18623,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"hypothesis:master","ref":"master","sha":"8c2ed7d27576ec92482385e40d3d6dce6867b93e","user":{"login":"hypothesis","id":1243215,"avatar_url":"https://avatars.githubusercontent.com/u/1243215?v=3","gravatar_id":"","url":"https://api.github.com/users/hypothesis","html_url":"https://github.com/hypothesis","followers_url":"https://api.github.com/users/hypothesis/followers","following_url":"https://api.github.com/users/hypothesis/following{/other_user}","gists_url":"https://api.github.com/users/hypothesis/gists{/gist_id}","starred_url":"https://api.github.com/users/hypothesis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hypothesis/subscriptions","organizations_url":"https://api.github.com/users/hypothesis/orgs","repos_url":"https://api.github.com/users/hypothesis/repos","events_url":"https://api.github.com/users/hypothesis/events{/privacy}","received_events_url":"https://api.github.com/users/hypothesis/received_events","type":"Organization","site_admin":false},"repo":{"id":3910945,"name":"h","full_name":"hypothesis/h","owner":{"login":"hypothesis","id":1243215,"avatar_url":"https://avatars.githubusercontent.com/u/1243215?v=3","gravatar_id":"","url":"https://api.github.com/users/hypothesis","html_url":"https://github.com/hypothesis","followers_url":"https://api.github.com/users/hypothesis/followers","following_url":"https://api.github.com/users/hypothesis/following{/other_user}","gists_url":"https://api.github.com/users/hypothesis/gists{/gist_id}","starred_url":"https://api.github.com/users/hypothesis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hypothesis/subscriptions","organizations_url":"https://api.github.com/users/hypothesis/orgs","repos_url":"https://api.github.com/users/hypothesis/repos","events_url":"https://api.github.com/users/hypothesis/events{/privacy}","received_events_url":"https://api.github.com/users/hypothesis/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hypothesis/h","description":"The Internet, peer reviewed.","fork":false,"url":"https://api.github.com/repos/hypothesis/h","forks_url":"https://api.github.com/repos/hypothesis/h/forks","keys_url":"https://api.github.com/repos/hypothesis/h/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hypothesis/h/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hypothesis/h/teams","hooks_url":"https://api.github.com/repos/hypothesis/h/hooks","issue_events_url":"https://api.github.com/repos/hypothesis/h/issues/events{/number}","events_url":"https://api.github.com/repos/hypothesis/h/events","assignees_url":"https://api.github.com/repos/hypothesis/h/assignees{/user}","branches_url":"https://api.github.com/repos/hypothesis/h/branches{/branch}","tags_url":"https://api.github.com/repos/hypothesis/h/tags","blobs_url":"https://api.github.com/repos/hypothesis/h/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hypothesis/h/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hypothesis/h/git/refs{/sha}","trees_url":"https://api.github.com/repos/hypothesis/h/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hypothesis/h/statuses/{sha}","languages_url":"https://api.github.com/repos/hypothesis/h/languages","stargazers_url":"https://api.github.com/repos/hypothesis/h/stargazers","contributors_url":"https://api.github.com/repos/hypothesis/h/contributors","subscribers_url":"https://api.github.com/repos/hypothesis/h/subscribers","subscription_url":"https://api.github.com/repos/hypothesis/h/subscription","commits_url":"https://api.github.com/repos/hypothesis/h/commits{/sha}","git_commits_url":"https://api.github.com/repos/hypothesis/h/git/commits{/sha}","comments_url":"https://api.github.com/repos/hypothesis/h/comments{/number}","issue_comment_url":"https://api.github.com/repos/hypothesis/h/issues/comments{/number}","contents_url":"https://api.github.com/repos/hypothesis/h/contents/{+path}","compare_url":"https://api.github.com/repos/hypothesis/h/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hypothesis/h/merges","archive_url":"https://api.github.com/repos/hypothesis/h/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hypothesis/h/downloads","issues_url":"https://api.github.com/repos/hypothesis/h/issues{/number}","pulls_url":"https://api.github.com/repos/hypothesis/h/pulls{/number}","milestones_url":"https://api.github.com/repos/hypothesis/h/milestones{/number}","notifications_url":"https://api.github.com/repos/hypothesis/h/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hypothesis/h/labels{/name}","releases_url":"https://api.github.com/repos/hypothesis/h/releases{/id}","created_at":"2012-04-02T19:56:59Z","updated_at":"2015-09-16T00:04:25Z","pushed_at":"2015-09-22T09:25:51Z","git_url":"git://github.com/hypothesis/h.git","ssh_url":"git@github.com:hypothesis/h.git","clone_url":"https://github.com/hypothesis/h.git","svn_url":"https://github.com/hypothesis/h","homepage":"https://hypothes.is/","size":46701,"stargazers_count":484,"watchers_count":484,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":122,"mirror_url":null,"open_issues_count":126,"forks":122,"open_issues":126,"watchers":484,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hypothesis/h/pulls/2514"},"html":{"href":"https://github.com/hypothesis/h/pull/2514"},"issue":{"href":"https://api.github.com/repos/hypothesis/h/issues/2514"},"comments":{"href":"https://api.github.com/repos/hypothesis/h/issues/2514/comments"},"review_comments":{"href":"https://api.github.com/repos/hypothesis/h/pulls/2514/comments"},"review_comment":{"href":"https://api.github.com/repos/hypothesis/h/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hypothesis/h/pulls/2514/commits"},"statuses":{"href":"https://api.github.com/repos/hypothesis/h/statuses/341c239e85fa905131d8e296181eb0155a6496ff"}}}}