From ee159f5b3615907c88dd2b2795da15f16029f25a Mon Sep 17 00:00:00 2001 From: jendib Date: Sun, 20 Mar 2016 19:12:38 +0100 Subject: [PATCH] #18: Groups profile (web) --- docs-web/src/main/webapp/src/app/docs/app.js | 24 ++++++++++++-- .../src/app/docs/controller/GroupProfile.js | 11 +++++++ .../app/docs/controller/SettingsGroupEdit.js | 4 ++- .../webapp/src/app/docs/controller/User.js | 19 ----------- .../src/app/docs/controller/UserGroup.js | 32 +++++++++++++++++++ docs-web/src/main/webapp/src/index.html | 3 +- .../src/partial/docs/group.profile.html | 22 +++++++++++++ .../src/partial/docs/settings.group.edit.html | 2 +- .../webapp/src/partial/docs/user.profile.html | 2 +- .../docs/{user.html => usergroup.html} | 24 ++++++++++++-- docs-web/src/main/webapp/src/style/main.less | 21 ++++++------ 11 files changed, 123 insertions(+), 41 deletions(-) create mode 100644 docs-web/src/main/webapp/src/app/docs/controller/GroupProfile.js delete mode 100644 docs-web/src/main/webapp/src/app/docs/controller/User.js create mode 100644 docs-web/src/main/webapp/src/app/docs/controller/UserGroup.js create mode 100644 docs-web/src/main/webapp/src/partial/docs/group.profile.html rename docs-web/src/main/webapp/src/partial/docs/{user.html => usergroup.html} (53%) diff --git a/docs-web/src/main/webapp/src/app/docs/app.js b/docs-web/src/main/webapp/src/app/docs/app.js index 839420e3..cdcfb0d1 100644 --- a/docs-web/src/main/webapp/src/app/docs/app.js +++ b/docs-web/src/main/webapp/src/app/docs/app.js @@ -248,19 +248,37 @@ angular.module('docs', url: '/user', views: { 'page': { - templateUrl: 'partial/docs/user.html', - controller: 'User' + templateUrl: 'partial/docs/usergroup.html', + controller: 'UserGroup' } } }) .state('user.profile', { url: '/:username', views: { - 'user': { + 'sub': { templateUrl: 'partial/docs/user.profile.html', controller: 'UserProfile' } } + }) + .state('group', { + url: '/group', + views: { + 'page': { + templateUrl: 'partial/docs/usergroup.html', + controller: 'UserGroup' + } + } + }) + .state('group.profile', { + url: '/:name', + views: { + 'sub': { + templateUrl: 'partial/docs/group.profile.html', + controller: 'GroupProfile' + } + } }); // Configuring Restangular diff --git a/docs-web/src/main/webapp/src/app/docs/controller/GroupProfile.js b/docs-web/src/main/webapp/src/app/docs/controller/GroupProfile.js new file mode 100644 index 00000000..3d47fda2 --- /dev/null +++ b/docs-web/src/main/webapp/src/app/docs/controller/GroupProfile.js @@ -0,0 +1,11 @@ +'use strict'; + +/** + * Group profile controller. + */ +angular.module('docs').controller('GroupProfile', function($stateParams, Restangular, $scope) { + // Load user + Restangular.one('group', $stateParams.name).get().then(function(data) { + $scope.group = data; + }); +}); \ No newline at end of file diff --git a/docs-web/src/main/webapp/src/app/docs/controller/SettingsGroupEdit.js b/docs-web/src/main/webapp/src/app/docs/controller/SettingsGroupEdit.js index d63bba42..0275288a 100644 --- a/docs-web/src/main/webapp/src/app/docs/controller/SettingsGroupEdit.js +++ b/docs-web/src/main/webapp/src/app/docs/controller/SettingsGroupEdit.js @@ -96,7 +96,9 @@ angular.module('docs').controller('SettingsGroupEdit', function($scope, $dialog, sort_column: 1, asc: true }).then(function(data) { - deferred.resolve(_.pluck(data.users, 'username')); + deferred.resolve(_.pluck(_.filter(data.users, function(user) { + return user.username.indexOf($viewValue) !== -1; + }), 'username')); }); return deferred.promise; }; diff --git a/docs-web/src/main/webapp/src/app/docs/controller/User.js b/docs-web/src/main/webapp/src/app/docs/controller/User.js deleted file mode 100644 index bf5420a9..00000000 --- a/docs-web/src/main/webapp/src/app/docs/controller/User.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict'; - -/** - * User controller. - */ -angular.module('docs').controller('User', function(Restangular, $scope, $state) { - // Load users - Restangular.one('user/list').get({ - sort_column: 1, - asc: true - }).then(function(data) { - $scope.users = data.users; - }); - - // Open a user - $scope.openUser = function(user) { - $state.go('user.profile', { username: user.username }); - }; -}); \ No newline at end of file diff --git a/docs-web/src/main/webapp/src/app/docs/controller/UserGroup.js b/docs-web/src/main/webapp/src/app/docs/controller/UserGroup.js new file mode 100644 index 00000000..fb3c27b8 --- /dev/null +++ b/docs-web/src/main/webapp/src/app/docs/controller/UserGroup.js @@ -0,0 +1,32 @@ +'use strict'; + +/** + * User/group controller. + */ +angular.module('docs').controller('UserGroup', function(Restangular, $scope, $state) { + // Load users + Restangular.one('user/list').get({ + sort_column: 1, + asc: true + }).then(function(data) { + $scope.users = data.users; + }); + + // Load groups + Restangular.one('group').get({ + sort_column: 1, + asc: true + }).then(function(data) { + $scope.groups = data.groups; + }); + + // Open a user + $scope.openUser = function(user) { + $state.go('user.profile', { username: user.username }); + }; + + // Open a group + $scope.openGroup = function(group) { + $state.go('group.profile', { name: group.name }); + }; +}); \ No newline at end of file diff --git a/docs-web/src/main/webapp/src/index.html b/docs-web/src/main/webapp/src/index.html index 3793ffa0..384c59b1 100644 --- a/docs-web/src/main/webapp/src/index.html +++ b/docs-web/src/main/webapp/src/index.html @@ -63,8 +63,9 @@ - + + diff --git a/docs-web/src/main/webapp/src/partial/docs/group.profile.html b/docs-web/src/main/webapp/src/partial/docs/group.profile.html new file mode 100644 index 00000000..8aa8c586 --- /dev/null +++ b/docs-web/src/main/webapp/src/partial/docs/group.profile.html @@ -0,0 +1,22 @@ + + +

Members

+ + +
+

Related links

+ +
\ No newline at end of file diff --git a/docs-web/src/main/webapp/src/partial/docs/settings.group.edit.html b/docs-web/src/main/webapp/src/partial/docs/settings.group.edit.html index 38066ea6..1a49d88c 100644 --- a/docs-web/src/main/webapp/src/partial/docs/settings.group.edit.html +++ b/docs-web/src/main/webapp/src/partial/docs/settings.group.edit.html @@ -52,7 +52,7 @@
+ typeahead-wait-ms="200" typeahead-editable="false" autocomplete="off" />
diff --git a/docs-web/src/main/webapp/src/partial/docs/user.profile.html b/docs-web/src/main/webapp/src/partial/docs/user.profile.html index faae31de..b67c0f6c 100644 --- a/docs-web/src/main/webapp/src/partial/docs/user.profile.html +++ b/docs-web/src/main/webapp/src/partial/docs/user.profile.html @@ -29,7 +29,7 @@
  • - Edit {{ user.username}} user + Edit {{ user.username }} user
  • \ No newline at end of file diff --git a/docs-web/src/main/webapp/src/partial/docs/user.html b/docs-web/src/main/webapp/src/partial/docs/usergroup.html similarity index 53% rename from docs-web/src/main/webapp/src/partial/docs/user.html rename to docs-web/src/main/webapp/src/partial/docs/usergroup.html index 07a5261d..6e0000b1 100644 --- a/docs-web/src/main/webapp/src/partial/docs/user.html +++ b/docs-web/src/main/webapp/src/partial/docs/usergroup.html @@ -3,12 +3,30 @@

    - +

    - + + + +
    + {{ group.name }} +
    +
    + +
    +

    + + +

    + + + +
    @@ -22,6 +40,6 @@
    -
    +
    \ No newline at end of file diff --git a/docs-web/src/main/webapp/src/style/main.less b/docs-web/src/main/webapp/src/style/main.less index 27a29a4c..588f939b 100644 --- a/docs-web/src/main/webapp/src/style/main.less +++ b/docs-web/src/main/webapp/src/style/main.less @@ -12,6 +12,15 @@ background-color: #263238; } +// Selected table line +.table tr { + &.active { + td { + background-color: #e8e8e8 !important; + } + } +} + // Documents list .table-documents { thead th { @@ -20,12 +29,6 @@ tbody tr { cursor: pointer; - - &.active { - td { - background-color: #e8e8e8; - } - } } .cell-tags { @@ -71,12 +74,6 @@ .table-users { tbody tr { cursor: pointer; - - &.active { - td { - background-color: #e8e8e8; - } - } } }