Exclude special comments in comment field settings; fixing the inline editiing

This commit is contained in:
FinnStutzenstein 2017-08-11 12:37:19 +02:00
parent 2aeaf251a2
commit a12440ed2c
5 changed files with 18 additions and 6 deletions

View File

@ -741,6 +741,15 @@ angular.module('OpenSlidesApp.core.site', [
}
])
.filter('excludeSpecialComments', function () {
return function (comments) {
return _.filter(comments, function (comment) {
var specialComment = comment.forState || comment.forRecommendation;
return !specialComment;
});
};
})
// angular formly config options
.run([
'formlyConfig',

View File

@ -20,7 +20,7 @@
<!-- comments -->
<div class="input-comments" ng-if="type === 'comments'">
<div ng-repeat="entry in $parent.value" class="input-group">
<div ng-repeat="entry in $parent.value | excludeSpecialComments" class="input-group">
<input ng-model="entry.name"
ng-model-options="{debounce: 1000}"
ng-change="save(configOption, $parent.value)"

View File

@ -134,7 +134,7 @@ angular.module('OpenSlidesApp.motions.motionservices', ['OpenSlidesApp.motions',
var commentsInlineEditing = {
editors: []
};
_.forEach($scope.commentsFields, function (field) {
_.forEach($scope.commentsFieldsNoSpecialComments, function (field) {
var inlineEditing = MotionInlineEditing.createInstance($scope, motion,
'view-original-comment-inline-editor-' + field.name, false,
function (obj) {

View File

@ -1268,6 +1268,10 @@ angular.module('OpenSlidesApp.motions.site', [
}
};
$scope.commentsFields = Config.get('motions_comments').value;
$scope.commentsFieldsNoSpecialComments = _.filter($scope.commentsFields, function (field) {
var specialComment = field.forState || field.forRecommendation;
return !specialComment;
});
$scope.commentFieldForState = MotionComment.getFieldNameForFlag('forState');
$scope.commentFieldForRecommendation = MotionComment.getFieldNameForFlag('forRecommendation');
$scope.version = motion.active_version;

View File

@ -1,4 +1,4 @@
<div class="details" ng-if="isAllowedToSeeCommentField()">
<div class="details" ng-if="isAllowedToSeeCommentField() && commentsFieldsNoSpecialComments.length">
<div class="row">
<!-- inline editing toolbar -->
<div class="motion-toolbar">
@ -25,9 +25,8 @@
</div>
<!-- comment fields -->
<div class="col-sm-12">
<div ng-repeat="field in commentsFields">
<div ng-if="(field.public && !field.forState && !field.forRecommendation) ||
(operator.hasPerms('motions.can_see_and_manage_comments') && !field.forState && !field.forRecommendation)">
<div ng-repeat="field in commentsFieldsNoSpecialComments">
<div ng-if="operator.hasPerms('motions.can_see_and_manage_comments') && !field.forState && !field.forRecommendation">
<h4>
{{ field.name }}
<span ng-if="!field.public" class="label label-warning" translate>internal</span>