diff --git a/openslides/agenda/static/templates/agenda/item-list.html b/openslides/agenda/static/templates/agenda/item-list.html index 0ca7023d3..7a0e0fe49 100644 --- a/openslides/agenda/static/templates/agenda/item-list.html +++ b/openslides/agenda/static/templates/agenda/item-list.html @@ -78,7 +78,7 @@ Sort ... - diff --git a/openslides/core/static/css/app.css b/openslides/core/static/css/app.css index 302a8b70b..827827b59 100644 --- a/openslides/core/static/css/app.css +++ b/openslides/core/static/css/app.css @@ -384,9 +384,6 @@ img { opacity: 1; background-color: #eee; } -.col1 .details .motion-toolbar .toolbar-left .goto-line-number { - max-width: 220px; -} .col1 .details .inline-editing-activator { margin-right: 13px; @@ -1642,6 +1639,10 @@ tr.selected td { background-color: #ff9999; } +/** Angular formly **/ +.checkbox label { + padding-left: 0; +} /** Colors **/ diff --git a/openslides/core/static/js/core/site.js b/openslides/core/static/js/core/site.js index cae342285..f268ce039 100644 --- a/openslides/core/static/js/core/site.js +++ b/openslides/core/static/js/core/site.js @@ -634,6 +634,11 @@ angular.module('OpenSlidesApp.core.site', [ extends: 'input', templateUrl: 'static/templates/core/password.html', }); + formlyConfig.setType({ + name: 'checkbox', + templateUrl: 'static/templates/core/checkbox.html', + overwriteOk: true, + }); formlyConfig.setType({ name: 'select-single', extends: 'select', diff --git a/openslides/core/static/templates/core/checkbox.html b/openslides/core/static/templates/core/checkbox.html new file mode 100644 index 000000000..da3bf5403 --- /dev/null +++ b/openslides/core/static/templates/core/checkbox.html @@ -0,0 +1,7 @@ +
+ +
diff --git a/openslides/motions/static/js/motions/site.js b/openslides/motions/static/js/motions/site.js index 248bbd778..e40e8e174 100644 --- a/openslides/motions/static/js/motions/site.js +++ b/openslides/motions/static/js/motions/site.js @@ -995,6 +995,7 @@ angular.module('OpenSlidesApp.motions.site', [ .controller('MotionDetailCtrl', [ '$scope', '$http', + '$timeout', 'operator', 'ngDialog', 'MotionForm', @@ -1015,16 +1016,18 @@ angular.module('OpenSlidesApp.motions.site', [ 'MotionCommentsInlineEditing', 'Projector', 'ProjectionDefault', - function($scope, $http, operator, ngDialog, MotionForm, + 'MotionBlock', + function($scope, $http, $timeout, operator, ngDialog, MotionForm, ChangeRecommmendationCreate, ChangeRecommmendationView, MotionChangeRecommendation, MotionPDFExport, Motion, MotionComment, Category, Mediafile, Tag, User, Workflow, Config, motionId, MotionInlineEditing, - MotionCommentsInlineEditing, Projector, ProjectionDefault) { + MotionCommentsInlineEditing, Projector, ProjectionDefault, MotionBlock) { var motion = Motion.get(motionId); Category.bindAll({}, $scope, 'categories'); Mediafile.bindAll({}, $scope, 'mediafiles'); Tag.bindAll({}, $scope, 'tags'); User.bindAll({}, $scope, 'users'); Workflow.bindAll({}, $scope, 'workflows'); + MotionBlock.bindAll({}, $scope, 'motionBlocks'); $scope.$watch(function () { return MotionChangeRecommendation.lastModified(); }, function () { @@ -1132,6 +1135,10 @@ angular.module('OpenSlidesApp.motions.site', [ $('html, body').animate({ 'scrollTop': scrollTop - 50 }, 1000); + // remove the line highlight after 2 seconds. + $timeout(function () { + $scope.highlight = 0; + }, 2000); } // set highlight and scroll on Projector setHighlightOnProjector($scope.linesForProjector ? line : 0); @@ -1148,6 +1155,12 @@ angular.module('OpenSlidesApp.motions.site', [ } ngDialog.open(MotionForm.getDialog(motion)); }; + $scope.save = function (motion) { + motion.title = motion.getTitle(-1); + motion.text = motion.getText(-1); + motion.reason = motion.getReason(-1); + Motion.save(motion); + }; // support $scope.support = function () { $http.post('/rest/motions/motion/' + motion.id + '/support/'); @@ -1173,24 +1186,49 @@ angular.module('OpenSlidesApp.motions.site', [ $scope.reset_state = function () { $http.put('/rest/motions/motion/' + motion.id + '/set_state/', {}); }; + // toggle functions for meta information + $scope.toggleCategory = function (category) { + if ($scope.motion.category_id == category.id) { + $scope.motion.category_id = null; + } else { + $scope.motion.category_id = category.id; + } + $scope.save($scope.motion); + }; + $scope.toggleMotionBlock = function (block) { + if ($scope.motion.motion_block_id == block.id) { + $scope.motion.motion_block_id = null; + } else { + $scope.motion.motion_block_id = block.id; + } + $scope.save($scope.motion); + + }; + $scope.toggleTag = function (tag) { + if (_.indexOf($scope.motion.tags_id, tag.id) > -1) { + // remove + $scope.motion.tags_id = _.filter($scope.motion.tags_id, + function (tag_id){ + return tag_id != tag.id; + } + ); + } else { + $scope.motion.tags_id.push(tag.id); + } + $scope.save($scope.motion); + }; // save additional state field $scope.saveAdditionalStateField = function (stateExtension) { if (stateExtension) { motion["comment " + $scope.commentFieldForState] = stateExtension; - motion.title = motion.getTitle(-1); - motion.text = motion.getText(-1); - motion.reason = motion.getReason(-1); - Motion.save(motion); + $scope.save(motion); } }; // save additional recommendation field $scope.saveAdditionalRecommendationField = function (recommendationExtension) { if (recommendationExtension) { motion["comment " + $scope.commentFieldForRecommendation] = recommendationExtension; - motion.title = motion.getTitle(-1); - motion.text = motion.getText(-1); - motion.reason = motion.getReason(-1); - Motion.save(motion); + $scope.save(motion); } }; // update recommendation @@ -1414,7 +1452,7 @@ angular.module('OpenSlidesApp.motions.site', [ $scope.formFields = MotionForm.getFormFields(true); // save motion - $scope.save = function (motion) { + $scope.save = function (motion, gotoDetailView) { Motion.create(motion).then( function(success) { // type: Value 1 means a non hidden agenda item, value 2 means a hidden agenda item, @@ -1422,7 +1460,7 @@ angular.module('OpenSlidesApp.motions.site', [ var changes = [{key: 'type', value: (motion.showAsAgendaItem ? 1 : 2)}, {key: 'parent_id', value: motion.agenda_parent_item_id}]; AgendaUpdate.saveChanges(success.agenda_item_id, changes); - if (isAmendment) { + if (isAmendment || gotoDetailView) { $state.go('motions.motion.detail', {id: success.id}); } $scope.closeThisDialog(); @@ -1434,6 +1472,7 @@ angular.module('OpenSlidesApp.motions.site', [ .controller('MotionUpdateCtrl', [ '$scope', + '$state', 'Motion', 'Category', 'Config', @@ -1445,7 +1484,8 @@ angular.module('OpenSlidesApp.motions.site', [ 'Agenda', 'AgendaUpdate', 'motionId', - function($scope, Motion, Category, Config, Mediafile, MotionForm, Tag, User, Workflow, Agenda, AgendaUpdate, motionId) { + function($scope, $state, Motion, Category, Config, Mediafile, MotionForm, Tag, + User, Workflow, Agenda, AgendaUpdate, motionId) { Category.bindAll({}, $scope, 'categories'); Mediafile.bindAll({}, $scope, 'mediafiles'); Tag.bindAll({}, $scope, 'tags'); @@ -1501,7 +1541,7 @@ angular.module('OpenSlidesApp.motions.site', [ } // save motion - $scope.save = function (motion) { + $scope.save = function (motion, gotoDetailView) { // inject the changed motion (copy) object back into DS store Motion.inject(motion); // save change motion object on server @@ -1512,6 +1552,9 @@ angular.module('OpenSlidesApp.motions.site', [ var changes = [{key: 'type', value: (motion.showAsAgendaItem ? 1 : 2)}, {key: 'parent_id', value: motion.agenda_parent_item_id}]; AgendaUpdate.saveChanges(success.agenda_item_id,changes); + if (gotoDetailView) { + $state.go('motions.motion.detail', {id: success.id}); + } $scope.closeThisDialog(); }, function (error) { diff --git a/openslides/motions/static/templates/motions/motion-detail.html b/openslides/motions/static/templates/motions/motion-detail.html index ef553b160..094e2d7b1 100644 --- a/openslides/motions/static/templates/motions/motion-detail.html +++ b/openslides/motions/static/templates/motions/motion-detail.html @@ -132,10 +132,10 @@

State

- + State - +
-
+ +
+
+ + Open motion detail view after save. +