diff --git a/bower.json b/bower.json index dd08732fd..6130c9e24 100644 --- a/bower.json +++ b/bower.json @@ -23,6 +23,7 @@ "angular-xeditable": "~0.1.9", "angular-scroll-glue": "~2.0.6", "ngBootbox": "~0.1.2", + "ng-dialog": "~0.5.6", "sockjs": "~0.3.4", "font-awesome-bower": "~4.4.0", "js-data": "~2.8.1", diff --git a/openslides/agenda/static/js/agenda/site.js b/openslides/agenda/static/js/agenda/site.js index 533bf6f12..86919c2fe 100644 --- a/openslides/agenda/static/js/agenda/site.js +++ b/openslides/agenda/static/js/agenda/site.js @@ -92,26 +92,82 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda']) '$scope', '$http', '$state', + 'ngDialog', 'Agenda', 'AgendaTree', + 'Customslide', 'Projector', - function($scope, $http, $state, Agenda, AgendaTree, Projector) { + function($scope, $http, $state, ngDialog, Agenda, AgendaTree, Customslide, Projector) { // Bind agenda tree to the scope $scope.$watch(function () { return Agenda.lastModified(); - }, function () { $scope.items = AgendaTree.getFlatTree(Agenda.getAll()); }); + $scope.alert = {}; - // open detail view link - $scope.openDetail = function (id) { - $state.go('agenda.item.detail', {id: id}); + // project related item (content object) + $scope.project = function (item) { + item.getContentResource().find(item.content_object.id).then( + function(object) { + object.project(); + } + ); }; - // save changed item - $scope.save = function (item) { - Agenda.save(item); + // open new customslide dialog + $scope.newDialog = function () { + ngDialog.open({ + template: 'static/templates/core/customslide-form.html', + controller: 'CustomslideCreateCtrl', + className: 'ngdialog-theme-default wide-form' + }); + }; + // detail view of related item (content object) + $scope.open = function (item) { + $state.go(item.content_object.collection.replace('/','.')+'.detail', + {id: item.content_object.id}); + }; + // edit view of related item (content object) + $scope.edit = function (item) { + if (item.content_object.collection == "core/customslide") { + ngDialog.open({ + template: 'static/templates/core/customslide-form.html', + controller: 'CustomslideUpdateCtrl', + className: 'ngdialog-theme-default wide-form', + resolve: { + customslide: function(Customslide) { + return Customslide.find(item.content_object.id); + } + } + }); + } + else { + $state.go(item.content_object.collection.replace('/','.')+'.detail.update', + {id: item.content_object.id}); + } + }; + // update changed item + $scope.update = function (item) { + Agenda.save(item).then( + function(success) { + item.quickEdit = false; + $scope.alert.show = false; + }, + function(error){ + var message = ''; + for (var e in error.data) { + message += e + ': ' + error.data[e] + ' '; + } + $scope.alert = { type: 'danger', msg: message, show: true }; + }); +; + }; + // delete related item + $scope.deleteRelatedItem = function (item) { + if (item.content_object.collection == 'core/customslide') { + Customslide.destroy(item.content_object.id); + } }; // *** delete mode functions *** @@ -131,11 +187,14 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda']) }); } }; - // delete selected item + // delete selected items only if items are customslides $scope.delete = function () { angular.forEach($scope.items, function (item) { - if (item.selected) - Agenda.destroy(item.id); + if (item.selected) { + if (item.content_object.collection == 'core/customslide') { + Customslide.destroy(item.content_object.id); + } + } }); $scope.isDeleteMode = false; $scope.uncheckAll(); @@ -292,7 +351,8 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda']) '$scope', '$state', 'Agenda', - function($scope, $state, Agenda) { + 'Customslide', + function($scope, $state, Agenda, Customslide) { // import from textarea $scope.importByLine = function () { $scope.items = $scope.itemlist[0].split("\n"); @@ -300,7 +360,7 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda']) $scope.items.forEach(function(title) { var item = {title: title}; // TODO: create all items in bulk mode - Agenda.create(item).then( + Customslide.create(item).then( function(success) { $scope.importcounter++; } @@ -324,8 +384,8 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda']) var item = {}; item.title = obj[i].title; item.text = obj[i].text; - item.duration = obj[i].duration; - Agenda.create(item).then( + // TODO: save also 'duration' in related agenda item + Customslide.create(item).then( function(success) { $scope.csvimportcounter++; } diff --git a/openslides/agenda/static/templates/agenda/item-detail.html b/openslides/agenda/static/templates/agenda/item-detail.html index e9d79a87d..673abf51b 100644 --- a/openslides/agenda/static/templates/agenda/item-detail.html +++ b/openslides/agenda/static/templates/agenda/item-detail.html @@ -1,9 +1,9 @@ -

{{ item.get_title }}

+

{{ item.title }}

- -
{{ item.text }}
- -
-

Duration

- {{ item.duration }} -
- -
-

Comment

-
{{ item.comment }}
-

List of speakers

+

+ List of speakers - + - Project list + + List of speakers

-
- diff --git a/openslides/agenda/static/templates/agenda/item-import.html b/openslides/agenda/static/templates/agenda/item-import.html index b6588f80f..d52033e35 100644 --- a/openslides/agenda/static/templates/agenda/item-import.html +++ b/openslides/agenda/static/templates/agenda/item-import.html @@ -34,7 +34,7 @@ Keep each item in a single line.

Please note:

- - -
- - @@ -173,13 +136,18 @@
-
+
+
+
+
+
+

diff --git a/openslides/motions/static/js/motions/site.js b/openslides/motions/static/js/motions/site.js index 6d417d882..98a7ed730 100644 --- a/openslides/motions/static/js/motions/site.js +++ b/openslides/motions/static/js/motions/site.js @@ -180,14 +180,6 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions']) }); }); - // hover edit actions - $scope.hoverIn = function () { - $scope.showEditActions = true; - }; - $scope.hoverOut = function () { - $scope.showEditActions = false; - }; - // save changed motion $scope.update = function (motion) { // get (unchanged) values from latest version for update method diff --git a/openslides/motions/static/templates/motions/motion-detail.html b/openslides/motions/static/templates/motions/motion-detail.html index 214ecc1d5..f62a6ee1e 100644 --- a/openslides/motions/static/templates/motions/motion-detail.html +++ b/openslides/motions/static/templates/motions/motion-detail.html @@ -17,6 +17,11 @@ PDF + + + + List of speakers + -
+
diff --git a/openslides/users/static/js/users/site.js b/openslides/users/static/js/users/site.js index 54feba1c6..4c6906db2 100644 --- a/openslides/users/static/js/users/site.js +++ b/openslides/users/static/js/users/site.js @@ -563,7 +563,8 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users']) 'DS', 'User', 'operator', - function($scope, $http, DS, User, operator) { + 'ngDialog', + function($scope, $http, DS, User, operator, ngDialog) { $scope.logout = function() { $http.post('/users/logout/').success(function(data) { operator.setUser(null); @@ -571,6 +572,59 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users']) // DS.flush(); }); }; + $scope.openLoginForm = function () { + ngDialog.open({ + template: 'static/templates/core/login-form.html', + controller: 'LoginFormCtrl', + }); + }; + } +]) + +.controller('LoginFormCtrl', [ + '$scope', + '$http', + 'operator', + 'gettext', + 'Config', + function ($scope, $http, operator, gettext, Config) { + $scope.alerts = []; + + // TODO: add welcome message only on first time (or if admin password not changed) + $scope.alerts.push({ + type: 'success', + msg: gettext("Installation was successfully.") + "
" + + gettext("Use admin and admin for first login.") + "

" + + gettext("Important: Please change your password!") + }); + // close alert function + $scope.closeAlert = function(index) { + $scope.alerts.splice(index, 1); + }; + // check if guest login is allowed + $scope.guestAllowed = true; //TODO Config.get('general_system_enable_anonymous').value; + // login + $scope.login = function () { + $http.post( + '/users/login/', + {'username': $scope.username, 'password': $scope.password} + ).success(function(data) { + if (data.success) { + operator.setUser(data.user_id); + $scope.closeThisDialog(); + } else { + $scope.alerts.push({ + type: 'danger', + msg: gettext('Username or password was not correct.') + }); + //Username or password is not correct. + } + }); + }; + // guest login + $scope.guestLogin = function () { + $scope.closeThisDialog(); + }; } ]);