Merge pull request #3351 from FinnStutzenstein/NoSpecialCommentsInConfig

Exclude special comments in comment field settings; fixing the inline…
This commit is contained in:
Norman Jäckel 2017-08-16 11:45:28 +02:00 committed by GitHub
commit 40e3958a7d
5 changed files with 18 additions and 6 deletions

View File

@ -743,6 +743,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 // angular formly config options
.run([ .run([
'formlyConfig', 'formlyConfig',

View File

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

View File

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

View File

@ -1267,6 +1267,10 @@ angular.module('OpenSlidesApp.motions.site', [
} }
}; };
$scope.commentsFields = Config.get('motions_comments').value; $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.commentFieldForState = MotionComment.getFieldNameForFlag('forState');
$scope.commentFieldForRecommendation = MotionComment.getFieldNameForFlag('forRecommendation'); $scope.commentFieldForRecommendation = MotionComment.getFieldNameForFlag('forRecommendation');
$scope.version = motion.active_version; $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"> <div class="row">
<!-- inline editing toolbar --> <!-- inline editing toolbar -->
<div class="motion-toolbar"> <div class="motion-toolbar">
@ -25,9 +25,8 @@
</div> </div>
<!-- comment fields --> <!-- comment fields -->
<div class="col-sm-12"> <div class="col-sm-12">
<div ng-repeat="field in commentsFields"> <div ng-repeat="field in commentsFieldsNoSpecialComments">
<div ng-if="(field.public && !field.forState && !field.forRecommendation) || <div ng-if="operator.hasPerms('motions.can_see_and_manage_comments') && !field.forState && !field.forRecommendation">
(operator.hasPerms('motions.can_see_and_manage_comments') && !field.forState && !field.forRecommendation)">
<h4> <h4>
{{ field.name }} {{ field.name }}
<span ng-if="!field.public" class="label label-warning" translate>internal</span> <span ng-if="!field.public" class="label label-warning" translate>internal</span>