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)
This commit is contained in:
parent
f09a39a3c3
commit
4c8da7b04d
@ -286,18 +286,10 @@ export abstract class BaseImportService<V extends BaseViewModel> {
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ export abstract class BaseSortListService<V extends BaseViewModel> {
|
||||
/**
|
||||
* 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.
|
||||
|
@ -78,7 +78,12 @@
|
||||
<!-- Filename -->
|
||||
<ng-container matColumnDef="title">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header>Name</mat-header-cell>
|
||||
<mat-cell *matCellDef="let file" (click)="selectItem(file, $event)">{{ file.title }}</mat-cell>
|
||||
<mat-cell *matCellDef="let file" (click)="selectItem(file, $event)">
|
||||
<span *ngIf="file.is_hidden">
|
||||
<mat-icon matTooltip="{{'is hidden' | translate }}">lock</mat-icon>
|
||||
|
||||
</span>
|
||||
{{ file.title }}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Info -->
|
||||
|
@ -37,10 +37,10 @@ export class MediafileFilterListService extends BaseFilterListService<Mediafile,
|
||||
*/
|
||||
public hiddenOptions: OsFilter = {
|
||||
property: 'is_hidden',
|
||||
label: this.translate.instant('Hidden'),
|
||||
label: this.translate.instant('Hidden status'),
|
||||
options: [
|
||||
{ condition: true, label: this.translate.instant('is hidden') },
|
||||
{ condition: false, label: this.translate.instant('is not hidden'), isActive: true }
|
||||
{ condition: false, label: this.translate.instant('is not hidden') }
|
||||
]
|
||||
};
|
||||
|
||||
|
@ -12,6 +12,7 @@ import { MotionCommentSectionRepositoryService } from 'app/core/repositories/mot
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { ConfigService } from 'app/core/ui-services/config.service';
|
||||
import { ViewWorkflow } from '../models/view-workflow';
|
||||
import { OperatorService } from 'app/core/core-services/operator.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@ -134,7 +135,8 @@ export class MotionFilterListService extends BaseFilterListService<Motion, ViewM
|
||||
private commentRepo: MotionCommentSectionRepositoryService,
|
||||
private translate: TranslateService,
|
||||
private config: ConfigService,
|
||||
motionRepo: MotionRepositoryService
|
||||
motionRepo: MotionRepositoryService,
|
||||
private operator: OperatorService
|
||||
) {
|
||||
super(store, motionRepo);
|
||||
this.subscribeWorkflows();
|
||||
@ -248,6 +250,11 @@ export class MotionFilterListService extends BaseFilterListService<Motion, ViewM
|
||||
workflowOptions.push(workflow.name);
|
||||
recommendationOptions.push(workflow.name);
|
||||
workflow.states.forEach(state => {
|
||||
// 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 {
|
||||
@ -258,6 +265,7 @@ export class MotionFilterListService extends BaseFilterListService<Motion, ViewM
|
||||
label: state.name,
|
||||
isActive: false
|
||||
});
|
||||
}
|
||||
if (state.recommendation_label) {
|
||||
recommendationOptions.push({
|
||||
condition: state.id,
|
||||
|
@ -15,15 +15,14 @@ export class MotionSortListService extends BaseSortListService<ViewMotion> {
|
||||
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';
|
||||
|
@ -163,6 +163,7 @@ class MotionViewSet(ModelViewSet):
|
||||
"reason",
|
||||
"category_id",
|
||||
"statute_paragraph_id",
|
||||
"workflow_id",
|
||||
]
|
||||
if parent_motion is not None:
|
||||
# For creating amendments.
|
||||
|
Loading…
Reference in New Issue
Block a user