Merge pull request #3501 from FinnStutzenstein/motionFilter

Added is amendment filter, fixed ckeditor image browser logo, changed…
This commit is contained in:
Emanuel Schütze 2017-12-01 09:26:46 +01:00 committed by GitHub
commit 5caeb11a1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 54 additions and 24 deletions

View File

@ -51,6 +51,8 @@ Motions:
- Show the number of next speakers in motion list view [#3470].
- Reference to motions by id in state and recommendation special field [#3498].
- Added new change recommendation type "other" [#3495].
- Combined all boolean filters into one dropdown menu and added a filter
for amendments [#3501].
Elections:
- Added pagination for list view [#3393].

View File

@ -1118,6 +1118,7 @@ img {
.os-table .main-header .form-inline {
margin-left: 15px;
width: 100%;
}
.os-table .content > div { /* horizontal blocks */

View File

@ -81,7 +81,7 @@ angular.module('OpenSlidesApp.mediafiles.image-plugin', [
});
// Set the toolbar icon to the default image icon.
CKEDITOR.on('instanceReady', function () {
var toolbarIcon = $('span.cke_button_icon.cke_button__image.browser_icon');
var toolbarIcon = $('span.cke_button_icon.cke_button__bildbrowser_icon');
toolbarIcon.removeClass('cke_button__image browser_icon');
toolbarIcon.addClass('cke_button__image_icon');
});

View File

@ -240,6 +240,11 @@ angular.module('OpenSlidesApp.motions', [
MotionComment.populateFieldsReverse(data);
callback(null, data);
},
computed: {
isAmendment: function () {
return this.parent_id !== null;
},
},
methods: {
getResourceName: function () {
return name;
@ -505,9 +510,6 @@ angular.module('OpenSlidesApp.motions', [
]
});
},
isAmendment: function () {
return this.parent_id !== null;
},
hasAmendments: function () {
return DS.filter('motions/motion', {parent_id: this.id}).length > 0;
},
@ -591,8 +593,8 @@ angular.module('OpenSlidesApp.motions', [
return (
operator.hasPerms('motions.can_create') &&
Config.get('motions_amendments_enabled').value &&
( !this.isAmendment() ||
(this.isAmendment() && OpenSlidesSettings.MOTIONS_ALLOW_AMENDMENTS_OF_AMENDMENTS))
( !this.isAmendment ||
(this.isAmendment && OpenSlidesSettings.MOTIONS_ALLOW_AMENDMENTS_OF_AMENDMENTS))
);
default:
return false;

View File

@ -1024,6 +1024,9 @@ angular.module('OpenSlidesApp.motions.site', [
// collect all states and all recommendations of all workflows
$scope.collectStatesAndRecommendations = function () {
// Special case: If it is the first time updated, update the state filter.
// This causes to set the done/undone states correct on page load.
var doStateFilterUpdate = !$scope.states;
$scope.states = [];
$scope.recommendations = [];
var workflows = $scope.collectAllUsedWorkflows();
@ -1049,6 +1052,9 @@ angular.module('OpenSlidesApp.motions.site', [
}
});
});
if (doStateFilterUpdate) {
updateStateFilter();
}
};
$scope.collectAllUsedWorkflows = function () {
return _.filter(Workflow.getAll(), function (workflow) {
@ -1101,6 +1107,11 @@ angular.module('OpenSlidesApp.motions.site', [
comment: [],
};
$scope.filter.booleanFilters = {
isAmendment: {
value: undefined,
choiceYes: gettext('Is an amendment'),
choiceNo: gettext('Is not an amendment'),
},
isFavorite: {
value: undefined,
choiceYes: gettext('Marked as favorite'),
@ -1113,7 +1124,6 @@ angular.module('OpenSlidesApp.motions.site', [
},
};
}
updateStateFilter();
$scope.filter.propertyList = ['identifier', 'origin'];
$scope.filter.propertyFunctionList = [
function (motion) {return motion.getTitle();},

View File

@ -135,19 +135,12 @@
<div class="os-table container-fluid">
<div class="row header-row">
<div class="col-xs-1 centered" ng-show="isSelectMode">
<div class="col-xs-1 centered" ng-if="isSelectMode">
<i class="fa text-danger pointer" ng-class=" selectedAll ? 'fa-check-square-o' : 'fa-square-o'"
ng-click="checkAll()"></i>
</div>
<div class="col-xs-11 main-header">
<span class="form-inline text-right pull-right">
<!-- clear all filters -->
<span class="sort-spacer pointer" ng-click="resetFilters()"
ng-if="filter.areFiltersSet()" ng-disabled="isSelectMode"
ng-class="{'disabled': isSelectMode}">
<i class="fa fa-times-circle"></i>
<translate>Filter</translate>
</span>
<div class="col-xs-11 main-header" ng-style="{'width': isSelectMode ? '' : '100%'}">
<div class="form-inline text-right pull-right">
<!-- State filter -->
<span uib-dropdown>
<span class="pointer" id="dropdownState" uib-dropdown-toggle
@ -308,14 +301,28 @@
</span>
<!-- boolean Filters (customized!) -->
<span ng-if="operator.user.id" uib-dropdown>
<span class="pointer" id="dropdownPrivate" uib-dropdown-toggle
<span class="pointer" id="dropdownMisc" uib-dropdown-toggle
ng-class="{'bold': (filter.booleanFilters.isFavorite.value !== undefined) ||
(filter.booleanFilters.hasPersonalNote.value !== undefined), 'disabled': isSelectMode}"
(filter.booleanFilters.hasPersonalNote.value !== undefined) ||
(filter.booleanFilters.isAmendment.value !== undefined), 'disabled': isSelectMode}"
ng-disabled="isSelectMode">
<translate>Private</translate>
<translate>Misc</translate>
<span class="caret"></span>
</span>
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownPrivate">
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMisc">
<li>
<a href ng-click="filter.booleanFilters.isAmendment.value = (filter.booleanFilters.isAmendment.value ? undefined : true); filter.save();">
<i class="fa" ng-class="{'fa-check': filter.booleanFilters.isAmendment.value === true}"></i>
{{ filter.booleanFilters.isAmendment.choiceYes | translate }}
</a>
</li>
<li>
<a href ng-click="filter.booleanFilters.isAmendment.value = (filter.booleanFilters.isAmendment.value === false) ? undefined : false; filter.save();">
<i class="fa" ng-class="{'fa-check': filter.booleanFilters.isAmendment.value === false}"></i>
{{ filter.booleanFilters.isAmendment.choiceNo | translate }}
</a>
</li>
<li class="divider"></li>
<li>
<a href ng-click="filter.booleanFilters.isFavorite.value = (filter.booleanFilters.isFavorite.value ? undefined : true); filter.save();">
<i class="fa" ng-class="{'fa-check': filter.booleanFilters.isFavorite.value === true}"></i>
@ -385,9 +392,16 @@
ng-change="filter.save()">
</span>
</span>
</span>
</div>
<!-- show all selected multiselectoptions -->
<span>
<div>
<!-- clear all filters -->
<span class="spacer-left-lg pointer" ng-click="resetFilters()"
ng-if="filter.areFiltersSet()" ng-disabled="isSelectMode"
ng-class="{'disabled': isSelectMode}">
<i class="fa fa-times-circle"></i>
<strong translate>All Filters</strong>
</span>
<!-- state -->
<span ng-repeat="state in states" class="pointer spacer-left-lg"
ng-if="!state.workflowHeader && filter.multiselectFilters.state.indexOf(state.id) > -1"
@ -496,7 +510,7 @@
{{ booleanFilter.value ? booleanFilter.choiceYes : booleanFilter.choiceNo | translate }}
</span>
</span>
</span>
</div>
</div>
</div>
@ -515,6 +529,7 @@
| MultiselectFilter: filter.multiselectFilters.tag : getItemId.tag
| filter: {star: filter.booleanFilters.isFavorite.value}
| filter: {hasPersonalNote: filter.booleanFilters.hasPersonalNote.value}
| filter: {isAmendment: filter.booleanFilters.isAmendment.value}
| toArray
| orderByEmptyLast: sort.column : sort.reverse)
| limitTo : itemsPerPage : limitBegin">