Commit 86c58c80 authored by Nick Stenning's avatar Nick Stenning Committed by Randall Leeds

Add groupList directive to display user's groups

This commit adds a list of groups to the "topbar" when the groups
feature flag is enabled.
parent 0dede511
...@@ -5,13 +5,13 @@ module.exports = class AppController ...@@ -5,13 +5,13 @@ module.exports = class AppController
this.$inject = [ this.$inject = [
'$controller', '$document', '$location', '$route', '$scope', '$window', '$controller', '$document', '$location', '$route', '$scope', '$window',
'auth', 'drafts', 'features', 'identity', 'auth', 'drafts', 'features', 'identity',
'streamer', 'annotationUI', 'session', 'streamer', 'annotationUI',
'annotationMapper', 'threading' 'annotationMapper', 'threading'
] ]
constructor: ( constructor: (
$controller, $document, $location, $route, $scope, $window, $controller, $document, $location, $route, $scope, $window,
auth, drafts, features, identity, auth, drafts, features, identity,
streamer, annotationUI, session, streamer, annotationUI,
annotationMapper, threading annotationMapper, threading
) -> ) ->
$controller('AnnotationUIController', {$scope}) $controller('AnnotationUIController', {$scope})
...@@ -21,6 +21,9 @@ module.exports = class AppController ...@@ -21,6 +21,9 @@ module.exports = class AppController
# if ($scope.feature('foo')) { ... } # if ($scope.feature('foo')) { ... }
$scope.feature = features.flagEnabled $scope.feature = features.flagEnabled
# Allow all child scopes access to the session
$scope.session = session
$scope.auth = auth $scope.auth = auth
isFirstRun = $location.search().hasOwnProperty('firstrun') isFirstRun = $location.search().hasOwnProperty('firstrun')
......
...@@ -102,6 +102,7 @@ module.exports = angular.module('h', [ ...@@ -102,6 +102,7 @@ module.exports = angular.module('h', [
.directive('deepCount', require('./directive/deep-count')) .directive('deepCount', require('./directive/deep-count'))
.directive('formInput', require('./directive/form-input')) .directive('formInput', require('./directive/form-input'))
.directive('formValidate', require('./directive/form-validate')) .directive('formValidate', require('./directive/form-validate'))
.directive('groupList', require('./directive/group-list'))
.directive('markdown', require('./directive/markdown')) .directive('markdown', require('./directive/markdown'))
.directive('privacy', require('./directive/privacy')) .directive('privacy', require('./directive/privacy'))
.directive('simpleSearch', require('./directive/simple-search')) .directive('simpleSearch', require('./directive/simple-search'))
......
'use strict';
/**
* @ngdoc directive
* @name groupList
* @restrict AE
* @description Displays a list of groups of which the user is a member.
*/
module.exports = function () {
return {
restrict: 'AE',
scope: {
groups: '='
},
templateUrl: 'group_list.html'
};
};
...@@ -11,6 +11,7 @@ describe 'AppController', -> ...@@ -11,6 +11,7 @@ describe 'AppController', ->
fakeIdentity = null fakeIdentity = null
fakeLocation = null fakeLocation = null
fakeParams = null fakeParams = null
fakeSession = null
fakeStore = null fakeStore = null
fakeStreamer = null fakeStreamer = null
fakeStreamFilter = null fakeStreamFilter = null
...@@ -67,6 +68,8 @@ describe 'AppController', -> ...@@ -67,6 +68,8 @@ describe 'AppController', ->
fakeParams = {id: 'test'} fakeParams = {id: 'test'}
fakeSession = {}
fakeStore = { fakeStore = {
SearchResource: { SearchResource: {
get: sinon.spy() get: sinon.spy()
...@@ -99,6 +102,7 @@ describe 'AppController', -> ...@@ -99,6 +102,7 @@ describe 'AppController', ->
$provide.value 'identity', fakeIdentity $provide.value 'identity', fakeIdentity
$provide.value '$location', fakeLocation $provide.value '$location', fakeLocation
$provide.value '$routeParams', fakeParams $provide.value '$routeParams', fakeParams
$provide.value 'session', fakeSession
$provide.value 'store', fakeStore $provide.value 'store', fakeStore
$provide.value 'streamer', fakeStreamer $provide.value 'streamer', fakeStreamer
$provide.value 'streamfilter', fakeStreamFilter $provide.value 'streamfilter', fakeStreamFilter
......
...@@ -129,6 +129,9 @@ ol { ...@@ -129,6 +129,9 @@ ol {
} }
} }
.group-list {
margin-right: 0.5em;
}
.user-picker { .user-picker {
.avatar { .avatar {
......
<span role="button" class="dropdown-toggle" data-toggle="dropdown">
Groups
<i class="h-icon-arrow-drop-down"></i>
</span>
<ul class="dropdown-menu pull-right" role="menu">
<li ng-repeat="group in groups">
<a ng-href="{{group.url}}" ng-bind="group.name" target="_blank"></a>
</li>
<li>
<a href="/groups/new" target="_blank"><i class="h-icon-add"></i> Create a group</a>
</li>
</ul>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment