Motion comments fix and close open dialogs if a relogin is necessary

This commit is contained in:
FinnStutzenstein 2017-09-19 13:56:12 +02:00
parent 1fafd74dfa
commit 31708df436
4 changed files with 19 additions and 9 deletions

View File

@ -14,7 +14,9 @@ angular.module('OpenSlidesApp.core.start', [])
'operator', 'operator',
'Group', 'Group',
'mainMenu', 'mainMenu',
function($http, $rootScope, $state, $q, DS, autoupdate, operator, Group, mainMenu) { 'ngDialog',
'LoginDialog',
function($http, $rootScope, $state, $q, DS, autoupdate, operator, Group, mainMenu, ngDialog, LoginDialog) {
var OpenSlides = { var OpenSlides = {
bootup: function () { bootup: function () {
$rootScope.openslidesBootstrapDone = false; $rootScope.openslidesBootstrapDone = false;
@ -41,6 +43,12 @@ angular.module('OpenSlidesApp.core.start', [])
operator.setUser(null); operator.setUser(null);
$rootScope.openslidesBootstrapDone = false; $rootScope.openslidesBootstrapDone = false;
$rootScope.operator = operator; $rootScope.operator = operator;
// close all open dialogs (except the login dialog)
_.forEach(ngDialog.getOpenDialogs(), function (id) {
if (id !== LoginDialog.id) {
ngDialog.close(id);
}
});
}, },
reboot: function () { reboot: function () {
this.shutdown(); this.shutdown();

View File

@ -987,7 +987,7 @@ angular.module('OpenSlidesApp.motions.site', [
function (motion) {return motion.category ? motion.category.name : '';}, function (motion) {return motion.category ? motion.category.name : '';},
function (motion) {return motion.motionBlock ? motion.motionBlock.name : '';}, function (motion) {return motion.motionBlock ? motion.motionBlock.name : '';},
function (motion) {return motion.recommendation ? motion.getRecommendationName() : '';}, function (motion) {return motion.recommendation ? motion.getRecommendationName() : '';},
function (motion) {return motion.comments.join(' ');}, function (motion) {return _.filter(motion.comments, function (comment) {return !!comment;}).join(' ');},
]; ];
$scope.filter.propertyDict = { $scope.filter.propertyDict = {
'submitters': function (submitter) { 'submitters': function (submitter) {

View File

@ -161,10 +161,10 @@
</div> </div>
<div os-perms="motions.can_manage" class="input-group spacer" <div os-perms="motions.can_manage" class="input-group spacer"
ng-show="motion.state.show_state_extension_field"> ng-show="motion.state.show_state_extension_field">
<label class="sr-only" for="stateExtensionField">{{ commentsFields[commentFieldForStateId] }}</label> <label class="sr-only" for="stateExtensionField">{{ motion.comments[commentFieldForStateId] }}</label>
<input type="text" ng-model="stateExtension" <input type="text" ng-model="stateExtension"
id="stateNameExtensionField" class="form-control input-sm" id="stateNameExtensionField" class="form-control input-sm"
placeholder="{{ commentsFields[commentFieldForStateId] }}"> placeholder="{{ motion.comments[commentFieldForStateId] }}">
<span class="input-group-btn"> <span class="input-group-btn">
<button ng-click="saveAdditionalStateField(stateExtension)" class="btn btn-default btn-sm"> <button ng-click="saveAdditionalStateField(stateExtension)" class="btn btn-default btn-sm">
<i class="fa fa-check"></i> <i class="fa fa-check"></i>
@ -204,11 +204,11 @@
<div class="input-group spacer" <div class="input-group spacer"
ng-if="motion.recommendation.show_recommendation_extension_field"> ng-if="motion.recommendation.show_recommendation_extension_field">
<label class="sr-only" for="recommendationExtensionField"> <label class="sr-only" for="recommendationExtensionField">
{{ commentsFields[commentFieldForRecommendationId] }} {{ motion.comments[commentFieldForRecommendationId] }}
</label> </label>
<input type="text" ng-model="recommendationExtension" <input type="text" ng-model="recommendationExtension"
id="recommendationExtensionField" class="form-control input-sm" id="recommendationExtensionField" class="form-control input-sm"
placeholder="{{ commentsFields[commentFieldForRecommendationId] }}"> placeholder="{{ motion.comments[commentFieldForRecommendationId] }}">
<span class="input-group-btn"> <span class="input-group-btn">
<button ng-click="saveAdditionalRecommendationField(recommendationExtension)" class="btn btn-default btn-sm"> <button ng-click="saveAdditionalRecommendationField(recommendationExtension)" class="btn btn-default btn-sm">
<i class="fa fa-check"></i> <i class="fa fa-check"></i>

View File

@ -93,14 +93,14 @@ angular.module('OpenSlidesApp.users.site', [
guest_enabled: false, guest_enabled: false,
msg: null, msg: null,
}, },
onEnter: ['$state', '$stateParams', 'ngDialog', function($state, $stateParams, ngDialog) { onEnter: ['$state', '$stateParams', 'ngDialog', 'LoginDialog', function($state, $stateParams, ngDialog, LoginDialog) {
ngDialog.open({ LoginDialog.id = ngDialog.open({
template: 'static/templates/core/login-form.html', template: 'static/templates/core/login-form.html',
controller: 'LoginFormCtrl', controller: 'LoginFormCtrl',
showClose: $stateParams.guest_enabled, showClose: $stateParams.guest_enabled,
closeByEscape: $stateParams.guest_enabled, closeByEscape: $stateParams.guest_enabled,
closeByDocument: $stateParams.guest_enabled, closeByDocument: $stateParams.guest_enabled,
}); }).id;
}], }],
data: { data: {
title: 'Login', title: 'Login',
@ -109,6 +109,8 @@ angular.module('OpenSlidesApp.users.site', [
} }
]) ])
.value('LoginDialog', {id: undefined})
/* /*
* Directive to check for permissions * Directive to check for permissions
* *