From 4c8da7b04d3095c2c802893dafbd4cda66256f65 Mon Sep 17 00:00:00 2001 From: Maximilian Krambach Date: Tue, 19 Feb 2019 12:13:45 +0100 Subject: [PATCH] minor improvements - add a 'lock' symbol to hidden files - default disable (and rename) hidden filter status - limit display of workflow states for restricted users - remove supporter sorting - mark other strings for translation - fix new workflow id for statute amendments - remove csv file type check (on Windows file type is always empty) --- .../core/ui-services/base-import.service.ts | 14 ++-------- .../ui-services/base-sort-list.service.ts | 2 +- .../mediafile-list.component.html | 7 ++++- .../services/mediafile-filter.service.ts | 4 +-- .../services/motion-filter-list.service.ts | 28 ++++++++++++------- .../services/motion-sort-list.service.ts | 5 ++-- openslides/motions/views.py | 1 + 7 files changed, 33 insertions(+), 28 deletions(-) diff --git a/client/src/app/core/ui-services/base-import.service.ts b/client/src/app/core/ui-services/base-import.service.ts index f03d0b571..c8e41c695 100644 --- a/client/src/app/core/ui-services/base-import.service.ts +++ b/client/src/app/core/ui-services/base-import.service.ts @@ -286,18 +286,10 @@ export abstract class BaseImportService { * @param event type is Event, but has target.files, which typescript doesn't seem to recognize */ public onSelectFile(event: any): void { - // TODO type + // TODO: error message for wrong file type (test Firefox on Windows!) if (event.target.files && event.target.files.length === 1) { - if (event.target.files[0].type.startsWith('text/csv')) { - this._rawFile = event.target.files[0]; - this.readFile(event.target.files[0]); - } else { - this.matSnackbar.open(this.translate.instant('Wrong file type detected. Import failed.'), '', { - duration: 3000 - }); - this.clearPreview(); - this._rawFile = null; - } + this._rawFile = event.target.files[0]; + this.readFile(event.target.files[0]); } } diff --git a/client/src/app/core/ui-services/base-sort-list.service.ts b/client/src/app/core/ui-services/base-sort-list.service.ts index 1f3b63861..6cfe689f9 100644 --- a/client/src/app/core/ui-services/base-sort-list.service.ts +++ b/client/src/app/core/ui-services/base-sort-list.service.ts @@ -53,7 +53,7 @@ export abstract class BaseSortListService { /** * Constructor. Does nothing. TranslateService is used for localeCompeare. */ - public constructor(private translate: TranslateService, private store: StorageService) {} + public constructor(public translate: TranslateService, private store: StorageService) {} /** * Put an array of data that you want sorted. diff --git a/client/src/app/site/mediafiles/components/mediafile-list/mediafile-list.component.html b/client/src/app/site/mediafiles/components/mediafile-list/mediafile-list.component.html index 04006bf3c..af253523b 100644 --- a/client/src/app/site/mediafiles/components/mediafile-list/mediafile-list.component.html +++ b/client/src/app/site/mediafiles/components/mediafile-list/mediafile-list.component.html @@ -78,7 +78,12 @@ Name - {{ file.title }} + + + lock +   + + {{ file.title }} diff --git a/client/src/app/site/mediafiles/services/mediafile-filter.service.ts b/client/src/app/site/mediafiles/services/mediafile-filter.service.ts index 14d686383..25b376632 100644 --- a/client/src/app/site/mediafiles/services/mediafile-filter.service.ts +++ b/client/src/app/site/mediafiles/services/mediafile-filter.service.ts @@ -37,10 +37,10 @@ export class MediafileFilterListService extends BaseFilterListService { - if (state.isFinalState) { - finalStates.push(state.id); - } else { - nonFinalStates.push(state.id); + // filter out restricted states for unpriviledged users + if ( + this.operator.hasPerms('motions.can_manage', 'motions.can_manage_metadata') || + state.access_level === 0 + ) { + if (state.isFinalState) { + finalStates.push(state.id); + } else { + nonFinalStates.push(state.id); + } + workflowOptions.push({ + condition: state.id, + label: state.name, + isActive: false + }); } - workflowOptions.push({ - condition: state.id, - label: state.name, - isActive: false - }); if (state.recommendation_label) { recommendationOptions.push({ condition: state.id, diff --git a/client/src/app/site/motions/services/motion-sort-list.service.ts b/client/src/app/site/motions/services/motion-sort-list.service.ts index 7a87a3afe..a8fa5f975 100644 --- a/client/src/app/site/motions/services/motion-sort-list.service.ts +++ b/client/src/app/site/motions/services/motion-sort-list.service.ts @@ -15,15 +15,14 @@ export class MotionSortListService extends BaseSortListService { sortAscending: true, options: [ { property: 'callListWeight', label: 'Call list' }, - { property: 'supporters' }, { property: 'identifier' }, { property: 'title' }, { property: 'submitters' }, { property: 'category' }, { property: 'motion_block_id', label: 'Motion block' }, { property: 'state' }, - { property: 'creationDate', label: 'Creation date' }, - { property: 'lastChangeDate', label: 'Last modified' } + { property: 'creationDate', label: this.translate.instant('Creation date') }, + { property: 'lastChangeDate', label: this.translate.instant('Last modified') } ] }; protected name = 'Motion'; diff --git a/openslides/motions/views.py b/openslides/motions/views.py index eaaf2b06b..67ee5af21 100644 --- a/openslides/motions/views.py +++ b/openslides/motions/views.py @@ -163,6 +163,7 @@ class MotionViewSet(ModelViewSet): "reason", "category_id", "statute_paragraph_id", + "workflow_id", ] if parent_motion is not None: # For creating amendments.