From d3d73a019d234806e1fc5eab23e38f16cb8e058e Mon Sep 17 00:00:00 2001 From: Emanuel Schuetze Date: Wed, 24 Feb 2016 20:50:32 +0100 Subject: [PATCH 1/2] Fix translations in group detail template. --- openslides/users/static/js/users/site.js | 16 +++++++++++++++- .../static/templates/users/group-detail.html | 6 +++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/openslides/users/static/js/users/site.js b/openslides/users/static/js/users/site.js index 1108e7604..f9e87c139 100644 --- a/openslides/users/static/js/users/site.js +++ b/openslides/users/static/js/users/site.js @@ -105,6 +105,9 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users']) resolve: { group: function(Group, $stateParams) { return Group.find($stateParams.id); + }, + permissions: function(Group) { + return Group.getPermissions(); } } }) @@ -854,8 +857,19 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users']) '$scope', 'Group', 'group', - function($scope, Group, group) { + 'permissions', + function($scope, Group, group, permissions) { Group.bindOne(group.id, $scope, 'group'); + $scope.groupPermissionNames = []; + // get display names of group permissions + // from an object array with all available permissions [{display_name, value}] + angular.forEach(group.permissions, function(permValue) { + angular.forEach(permissions, function(p) { + if (p.value == permValue) { + $scope.groupPermissionNames.push(p.display_name); + } + }); + }); } ]) diff --git a/openslides/users/static/templates/users/group-detail.html b/openslides/users/static/templates/users/group-detail.html index 864673c25..578170220 100644 --- a/openslides/users/static/templates/users/group-detail.html +++ b/openslides/users/static/templates/users/group-detail.html @@ -6,14 +6,14 @@ Back to overview -

{{ group.name }}

+

{{ group.name | translate }}

Group

Permissions:

-
From a6be43809fe262a8097c023d99bfb4de80aed790 Mon Sep 17 00:00:00 2001 From: Emanuel Schuetze Date: Wed, 24 Feb 2016 21:01:52 +0100 Subject: [PATCH 2/2] Agenda list slide improvements - project summary of selected item - show full tree OR main agenda items only - show done items grey (without icon) --- openslides/agenda/static/js/agenda/base.js | 28 ++++++---- .../agenda/static/js/agenda/projector.js | 28 +++++++++- openslides/agenda/static/js/agenda/site.js | 20 +++++-- .../static/templates/agenda/item-list.html | 53 ++++++++++++++----- .../templates/agenda/slide-item-list.html | 6 +-- openslides/core/static/css/app.css | 5 ++ openslides/core/static/css/projector.css | 3 ++ 7 files changed, 111 insertions(+), 32 deletions(-) diff --git a/openslides/agenda/static/js/agenda/base.js b/openslides/agenda/static/js/agenda/base.js index ff58ee2f3..eee5c681d 100644 --- a/openslides/agenda/static/js/agenda/base.js +++ b/openslides/agenda/static/js/agenda/base.js @@ -80,7 +80,7 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users']) ); }, // override isProjected function of jsDataModel factory - isProjected: function () { + isProjected: function (list) { // Returns true if there is a projector element with the same // name and the same id. var projector = Projector.get(1); @@ -88,9 +88,19 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users']) if (typeof projector !== 'undefined') { var self = this; var predicate = function (element) { - return element.name == self.content_object.collection && - typeof element.id !== 'undefined' && - element.id == self.content_object.id; + var value; + if (typeof list === 'undefined') { + // Releated item detail slide + value = element.name == self.content_object.collection && + typeof element.id !== 'undefined' && + element.id == self.content_object.id; + } else { + // Item list slide for sub tree + value = element.name == 'agenda/item-list' && + typeof element.id !== 'undefined' && + element.id == self.id; + } + return value; }; isProjected = typeof _.findKey(projector.elements, predicate) === 'string'; } else { @@ -186,21 +196,21 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users']) return getChildren(parentItems); }, - // Returns a list of all items as a flat tree the attribute parentCount + // Returns a list of all items as a flat tree getFlatTree: function(items) { var tree = this.getTree(items); var flatItems = []; - function generateFatTree(tree, parentCount) { + function generateFlatTree(tree, parentCount) { _.each(tree, function (item) { item.item.parentCount = parentCount; flatItems.push(item.item); - generateFatTree(item.children, parentCount + 1); + generateFlatTree(item.children, parentCount + 1); }); } - generateFatTree(tree, 0); + generateFlatTree(tree, 0); return flatItems; - }, + } }; } ]) diff --git a/openslides/agenda/static/js/agenda/projector.js b/openslides/agenda/static/js/agenda/projector.js index 87a662589..80577f81b 100644 --- a/openslides/agenda/static/js/agenda/projector.js +++ b/openslides/agenda/static/js/agenda/projector.js @@ -34,9 +34,10 @@ angular.module('OpenSlidesApp.agenda.projector', ['OpenSlidesApp.agenda']) .controller('SlideItemListCtrl', [ '$scope', '$http', + '$filter', 'Agenda', 'AgendaTree', - function($scope, $http, Agenda, AgendaTree) { + function($scope, $http, $filter, Agenda, AgendaTree) { // Attention! Each object that is used here has to be dealt on server side. // Add it to the coresponding get_requirements method of the ProjectorElement // class. @@ -45,7 +46,30 @@ angular.module('OpenSlidesApp.agenda.projector', ['OpenSlidesApp.agenda']) $scope.$watch(function () { return Agenda.lastModified(); }, function () { - $scope.items = AgendaTree.getFlatTree(Agenda.getAll()); + if ($scope.element.id) { + $scope.rootItem = Agenda.get($scope.element.id); + var tree = AgendaTree.getFlatTree(Agenda.getAll()); + var startIndex = tree.indexOf($scope.rootItem); + tree = tree.slice(startIndex); + // define delta to move the whole subtree to level 0 + if (tree[0]) { + var parentCountDelta = tree[0].parentCount; + } + $scope.items = []; + for (var i = 1; i < tree.length; i++) { + if (tree[i].parentCount - parentCountDelta <= 0) { + break; + } + var item = tree[i]; + // move rootItem (and all childs) to level 0 + item.parentCount = item.parentCount - parentCountDelta; + $scope.items.push(item); + } + } else if ($scope.element.tree) { + $scope.items = AgendaTree.getFlatTree(Agenda.getAll()); + } else { + $scope.items = $filter('filter')(Agenda.getAll(), {'parent_id': null}); + } }); } ]); diff --git a/openslides/agenda/static/js/agenda/site.js b/openslides/agenda/static/js/agenda/site.js index 490677f9a..c27984a31 100644 --- a/openslides/agenda/static/js/agenda/site.js +++ b/openslides/agenda/static/js/agenda/site.js @@ -178,19 +178,31 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda']) }; // project agenda - $scope.projectAgenda = function () { + $scope.projectAgenda = function (tree, id) { $http.post('/rest/core/projector/1/prune_elements/', - [{name: 'agenda/item-list'}]); + [{name: 'agenda/item-list', tree: tree, id: id}]); }; // check if agenda is projected - $scope.isAgendaProjected = function () { + $scope.isAgendaProjected = function (tree) { // Returns true if there is a projector element with the name // 'agenda/item-list'. var projector = Projector.get(1); if (typeof projector === 'undefined') return false; var self = this; var predicate = function (element) { - return element.name == 'agenda/item-list'; + var value; + if (typeof tree === 'undefined') { + // only main agenda items + value = element.name == 'agenda/item-list' && + typeof element.id === 'undefined' && + !element.tree; + } else { + // tree with all agenda items + value = element.name == 'agenda/item-list' && + typeof element.id === 'undefined' && + element.tree; + } + return value; }; return typeof _.findKey(projector.elements, predicate) === 'string'; }; diff --git a/openslides/agenda/static/templates/agenda/item-list.html b/openslides/agenda/static/templates/agenda/item-list.html index b2b856df8..09d4d8948 100644 --- a/openslides/agenda/static/templates/agenda/item-list.html +++ b/openslides/agenda/static/templates/agenda/item-list.html @@ -38,14 +38,26 @@ Select ... - - - Agenda - +
+ + + +
- - - + diff --git a/openslides/agenda/static/templates/agenda/slide-item-list.html b/openslides/agenda/static/templates/agenda/slide-item-list.html index ed0d1c635..b1c7571fd 100644 --- a/openslides/agenda/static/templates/agenda/slide-item-list.html +++ b/openslides/agenda/static/templates/agenda/slide-item-list.html @@ -1,13 +1,13 @@
-

Agenda

+

Agenda

+

{{ rootItem.getTitle() }}

+ ng-class="{mainitem: item.parentCount == 0, subitem: item.parentCount != 0, done: item.closed}">       {{ item.getListViewTitle() }} -

diff --git a/openslides/core/static/css/app.css b/openslides/core/static/css/app.css index 4bd284e9e..ba033752f 100644 --- a/openslides/core/static/css/app.css +++ b/openslides/core/static/css/app.css @@ -532,6 +532,11 @@ img { background-color: #317796; } +.slimDropDown { + padding-left: 4px !important; + padding-right: 4px !important; +} + .spacer, .spacer-top { margin-top: 7px; } diff --git a/openslides/core/static/css/projector.css b/openslides/core/static/css/projector.css index 5b5abbc11..4899a3d39 100644 --- a/openslides/core/static/css/projector.css +++ b/openslides/core/static/css/projector.css @@ -301,6 +301,9 @@ tr.elected td { .agendalist p { font-size: 140%; } +.agendalist p.done { + color: #9a9898; +} .agendalist .mainitem { margin-top: 25px; }