Merge pull request #4989 from tsiegleauq/amendment-list-title

Add the title too the amendments page
This commit is contained in:
Emanuel Schütze 2019-09-10 13:26:49 +02:00 committed by GitHub
commit 44f16b6125
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 17 deletions

View File

@ -1,6 +1,14 @@
<os-head-bar [nav]="false" [multiSelectMode]="isMultiSelect" goBack="true"> <os-head-bar [nav]="false" [multiSelectMode]="isMultiSelect" goBack="true">
<!-- Title --> <!-- Title -->
<div class="title-slot"><h2 translate>Amendments</h2></div> <div class="title-slot" *ngIf="!parentMotion"><h2 translate>Amendments</h2></div>
<!-- TODO would require translations with parameters -->
<div class="title-slot" *ngIf="parentMotion">
<h2>
{{ 'Amendments to' | translate }}
{{ (parentMotion | async)?.identifierOrTitle }}
</h2>
</div>
<!-- Menu --> <!-- Menu -->
<div class="menu-slot"> <div class="menu-slot">
@ -23,6 +31,7 @@
[columns]="tableColumnDefinition" [columns]="tableColumnDefinition"
[filterProps]="filterProps" [filterProps]="filterProps"
[multiSelect]="isMultiSelect" [multiSelect]="isMultiSelect"
[hiddenInMobile]="['summary']"
listStorageKey="amendments" listStorageKey="amendments"
[(selectedRows)]="selectedRows" [(selectedRows)]="selectedRows"
(dataSourceChange)="onDataSourceChange($event)" (dataSourceChange)="onDataSourceChange($event)"
@ -30,16 +39,19 @@
<!-- Meta --> <!-- Meta -->
<div *pblNgridCellDef="'meta'; row as motion" class="cell-slot fill"> <div *pblNgridCellDef="'meta'; row as motion" class="cell-slot fill">
<a class="detail-link" [routerLink]="motion.getDetailStateURL()"></a> <a class="detail-link" [routerLink]="motion.getDetailStateURL()"></a>
<div class="column-identifier innerTable"> <div class="innerTable">
<!-- Identifier and line --> <!-- Identifier and line -->
<div class="title-line"> <div class="title-line one-line">
{{ motion.identifier }} <span>{{ motion.identifier }}</span>
(<span translate>Line</span>&nbsp;<span>{{ getChangeLines(motion) }}</span <span *ngIf="motion.diffLines && motion.diffLines.length">
>) <span *ngIf="motion.identifier">&nbsp;&middot;&nbsp;</span>
<span translate>Line</span>
<span>&nbsp;{{ getChangeLines(motion) }}</span>
</span>
</div> </div>
<!-- Submitter --> <!-- Submitter -->
<div class="submitters-line"> <div class="submitters-line one-line">
<span *ngIf="motion.submitters.length"> <span *ngIf="motion.submitters.length">
<span translate>by</span> <span translate>by</span>
{{ motion.submitters }} {{ motion.submitters }}

View File

@ -1,2 +1,6 @@
@import '~assets/styles/motion-styles-common'; @import '~assets/styles/motion-styles-common';
@import 'app/site/motions/styles/motion-list-styles.scss'; @import 'app/site/motions/styles/motion-list-styles.scss';
.submitters-line {
// white-space: nowrap;
}

View File

@ -1,10 +1,12 @@
import { ChangeDetectionStrategy, Component, OnInit, ViewEncapsulation } from '@angular/core'; import { ChangeDetectionStrategy, Component, OnInit, ViewEncapsulation } from '@angular/core';
import { MatDialog, MatSnackBar } from '@angular/material'; import { MatDialog, MatSnackBar } from '@angular/material';
import { DomSanitizer, SafeHtml, Title } from '@angular/platform-browser'; import { DomSanitizer, SafeHtml, Title } from '@angular/platform-browser';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute, ParamMap } from '@angular/router';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { PblColumnDefinition } from '@pebula/ngrid'; import { PblColumnDefinition } from '@pebula/ngrid';
import { Observable } from 'rxjs';
import { switchMap } from 'rxjs/operators';
import { AmendmentFilterListService } from '../../services/amendment-filter-list.service'; import { AmendmentFilterListService } from '../../services/amendment-filter-list.service';
import { AmendmentSortListService } from '../../services/amendment-sort-list.service'; import { AmendmentSortListService } from '../../services/amendment-sort-list.service';
@ -31,9 +33,9 @@ import { ViewMotion } from '../../models/view-motion';
}) })
export class AmendmentListComponent extends BaseListViewComponent<ViewMotion> implements OnInit { export class AmendmentListComponent extends BaseListViewComponent<ViewMotion> implements OnInit {
/** /**
* Has the id of the parent motion if passed through the constructor * Hold the parent motion if present
*/ */
private parentMotionId: number; public parentMotion: Observable<ViewMotion>;
/** /**
* Hold item visibility * Hold item visibility
@ -47,10 +49,11 @@ export class AmendmentListComponent extends BaseListViewComponent<ViewMotion> im
{ {
prop: 'meta', prop: 'meta',
minWidth: 250, minWidth: 250,
width: '15%' width: 'auto'
}, },
{ {
prop: 'summary', prop: 'summary',
minWidth: 280,
width: 'auto' width: 'auto'
}, },
{ {
@ -80,7 +83,7 @@ export class AmendmentListComponent extends BaseListViewComponent<ViewMotion> im
translate: TranslateService, translate: TranslateService,
matSnackBar: MatSnackBar, matSnackBar: MatSnackBar,
storage: StorageService, storage: StorageService,
route: ActivatedRoute, private route: ActivatedRoute,
public motionRepo: MotionRepositoryService, public motionRepo: MotionRepositoryService,
public motionSortService: MotionSortListService, public motionSortService: MotionSortListService,
public amendmentSortService: AmendmentSortListService, public amendmentSortService: AmendmentSortListService,
@ -93,16 +96,25 @@ export class AmendmentListComponent extends BaseListViewComponent<ViewMotion> im
super(titleService, translate, matSnackBar, storage); super(titleService, translate, matSnackBar, storage);
super.setTitle('Amendments'); super.setTitle('Amendments');
this.canMultiSelect = true; this.canMultiSelect = true;
this.parentMotionId = parseInt(route.snapshot.params.id, 10); }
if (this.parentMotionId) {
this.amendmentFilterService.parentMotionId = this.parentMotionId; public ngOnInit(): void {
// determine if a paramter exists.
if (!!this.route.snapshot.paramMap.get('id')) {
// set the parentMotion observable. This will "only" fire
// if there is a subscription to the parent motion
this.parentMotion = this.route.paramMap.pipe(
switchMap((params: ParamMap) => {
const parentMotionId = +params.get('id');
this.amendmentFilterService.parentMotionId = parentMotionId;
return this.motionRepo.getViewModelObservable(parentMotionId);
})
);
} else { } else {
this.amendmentFilterService.parentMotionId = undefined; this.amendmentFilterService.parentMotionId = undefined;
} }
} }
public ngOnInit(): void {}
/** /**
* Extract the lines of the amendments * Extract the lines of the amendments
* If an amendments has multiple changes, they will be printed like an array of strings * If an amendments has multiple changes, they will be printed like an array of strings

View File

@ -628,6 +628,7 @@ button.mat-menu-item.selected {
.innerTable { .innerTable {
display: inline-block; display: inline-block;
line-height: 150%; line-height: 150%;
width: -webkit-fill-available;
} }
// with os-sort-filter-bar // with os-sort-filter-bar
.virtual-scroll-with-head-bar { .virtual-scroll-with-head-bar {