Merge pull request #4368 from MaximilianKrambach/minorStuff
minor improvements
This commit is contained in:
commit
667fe61e94
@ -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
|
* @param event type is Event, but has target.files, which typescript doesn't seem to recognize
|
||||||
*/
|
*/
|
||||||
public onSelectFile(event: any): void {
|
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 && event.target.files.length === 1) {
|
||||||
if (event.target.files[0].type.startsWith('text/csv')) {
|
this._rawFile = event.target.files[0];
|
||||||
this._rawFile = event.target.files[0];
|
this.readFile(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.
|
* 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.
|
* Put an array of data that you want sorted.
|
||||||
|
@ -78,7 +78,12 @@
|
|||||||
<!-- Filename -->
|
<!-- Filename -->
|
||||||
<ng-container matColumnDef="title">
|
<ng-container matColumnDef="title">
|
||||||
<mat-header-cell *matHeaderCellDef mat-sort-header>Name</mat-header-cell>
|
<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>
|
</ng-container>
|
||||||
|
|
||||||
<!-- Info -->
|
<!-- Info -->
|
||||||
|
@ -37,10 +37,10 @@ export class MediafileFilterListService extends BaseFilterListService<Mediafile,
|
|||||||
*/
|
*/
|
||||||
public hiddenOptions: OsFilter = {
|
public hiddenOptions: OsFilter = {
|
||||||
property: 'is_hidden',
|
property: 'is_hidden',
|
||||||
label: this.translate.instant('Hidden'),
|
label: this.translate.instant('Hidden status'),
|
||||||
options: [
|
options: [
|
||||||
{ condition: true, label: this.translate.instant('is hidden') },
|
{ 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 { TranslateService } from '@ngx-translate/core';
|
||||||
import { ConfigService } from 'app/core/ui-services/config.service';
|
import { ConfigService } from 'app/core/ui-services/config.service';
|
||||||
import { ViewWorkflow } from '../models/view-workflow';
|
import { ViewWorkflow } from '../models/view-workflow';
|
||||||
|
import { OperatorService } from 'app/core/core-services/operator.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@ -134,7 +135,8 @@ export class MotionFilterListService extends BaseFilterListService<Motion, ViewM
|
|||||||
private commentRepo: MotionCommentSectionRepositoryService,
|
private commentRepo: MotionCommentSectionRepositoryService,
|
||||||
private translate: TranslateService,
|
private translate: TranslateService,
|
||||||
private config: ConfigService,
|
private config: ConfigService,
|
||||||
motionRepo: MotionRepositoryService
|
motionRepo: MotionRepositoryService,
|
||||||
|
private operator: OperatorService
|
||||||
) {
|
) {
|
||||||
super(store, motionRepo);
|
super(store, motionRepo);
|
||||||
this.subscribeWorkflows();
|
this.subscribeWorkflows();
|
||||||
@ -248,16 +250,22 @@ export class MotionFilterListService extends BaseFilterListService<Motion, ViewM
|
|||||||
workflowOptions.push(workflow.name);
|
workflowOptions.push(workflow.name);
|
||||||
recommendationOptions.push(workflow.name);
|
recommendationOptions.push(workflow.name);
|
||||||
workflow.states.forEach(state => {
|
workflow.states.forEach(state => {
|
||||||
if (state.isFinalState) {
|
// filter out restricted states for unpriviledged users
|
||||||
finalStates.push(state.id);
|
if (
|
||||||
} else {
|
this.operator.hasPerms('motions.can_manage', 'motions.can_manage_metadata') ||
|
||||||
nonFinalStates.push(state.id);
|
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) {
|
if (state.recommendation_label) {
|
||||||
recommendationOptions.push({
|
recommendationOptions.push({
|
||||||
condition: state.id,
|
condition: state.id,
|
||||||
|
@ -15,15 +15,14 @@ export class MotionSortListService extends BaseSortListService<ViewMotion> {
|
|||||||
sortAscending: true,
|
sortAscending: true,
|
||||||
options: [
|
options: [
|
||||||
{ property: 'callListWeight', label: 'Call list' },
|
{ property: 'callListWeight', label: 'Call list' },
|
||||||
{ property: 'supporters' },
|
|
||||||
{ property: 'identifier' },
|
{ property: 'identifier' },
|
||||||
{ property: 'title' },
|
{ property: 'title' },
|
||||||
{ property: 'submitters' },
|
{ property: 'submitters' },
|
||||||
{ property: 'category' },
|
{ property: 'category' },
|
||||||
{ property: 'motion_block_id', label: 'Motion block' },
|
{ property: 'motion_block_id', label: 'Motion block' },
|
||||||
{ property: 'state' },
|
{ property: 'state' },
|
||||||
{ property: 'creationDate', label: 'Creation date' },
|
{ property: 'creationDate', label: this.translate.instant('Creation date') },
|
||||||
{ property: 'lastChangeDate', label: 'Last modified' }
|
{ property: 'lastChangeDate', label: this.translate.instant('Last modified') }
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
protected name = 'Motion';
|
protected name = 'Motion';
|
||||||
|
@ -163,6 +163,7 @@ class MotionViewSet(ModelViewSet):
|
|||||||
"reason",
|
"reason",
|
||||||
"category_id",
|
"category_id",
|
||||||
"statute_paragraph_id",
|
"statute_paragraph_id",
|
||||||
|
"workflow_id",
|
||||||
]
|
]
|
||||||
if parent_motion is not None:
|
if parent_motion is not None:
|
||||||
# For creating amendments.
|
# For creating amendments.
|
||||||
|
Loading…
Reference in New Issue
Block a user