Merge pull request #6074 from tsiegleauq/show-unpublish-ap

Show "unpublished" for finished polls in AP
This commit is contained in:
Emanuel Schütze 2021-05-26 17:35:42 +02:00 committed by GitHub
commit a7f392b997
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 4 deletions

View File

@ -10,7 +10,6 @@ import { ListOfSpeakersRepositoryService } from 'app/core/repositories/agenda/li
import { ProjectorRepositoryService } from 'app/core/repositories/projector/projector-repository.service';
import { DetailNavigable, isDetailNavigable } from 'app/shared/models/base/detail-navigable';
import { ProjectorElement } from 'app/shared/models/core/projector';
import { ListOfSpeakersComponent } from 'app/site/agenda/components/list-of-speakers/list-of-speakers.component';
import { ViewListOfSpeakers } from 'app/site/agenda/models/view-list-of-speakers';
import { BaseProjectableViewModel } from 'app/site/base/base-projectable-view-model';
import { BaseViewComponentDirective } from 'app/site/base/base-view';
@ -20,7 +19,8 @@ import { CurrentListOfSpeakersService } from 'app/site/projector/services/curren
@Component({
selector: 'os-cinema',
templateUrl: './cinema.component.html',
styleUrls: ['./cinema.component.scss']
styleUrls: ['./cinema.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class CinemaComponent extends BaseViewComponentDirective implements OnInit {
public listOfSpeakers: ViewListOfSpeakers;
@ -109,9 +109,11 @@ export class CinemaComponent extends BaseViewComponentDirective implements OnIni
} else {
this.projectedViewModel = null;
}
this.cd.markForCheck();
}),
this.closService.currentListOfSpeakersObservable.subscribe(clos => {
this.listOfSpeakers = clos;
this.cd.markForCheck();
})
);
}

View File

@ -12,8 +12,12 @@
<ng-template #pollArea let-poll="poll" let-last="last">
<mat-card class="os-card">
<p class="subtitle-text">
<a [routerLink]="getPollDetailLink(poll)" [state]="{ back: 'true' }">{{ getPollVoteTitle(poll) }}</a>
<p>
<a [routerLink]="getPollDetailLink(poll)" [state]="{ back: 'true' }" class="subtitle-text">
{{ getPollVoteTitle(poll) }}
</a>
<br>
<i *ngIf="canManagePoll(poll) && poll.isFinished" class="small">{{ 'finished (unpublished)' | translate }}</i>
</p>
<os-poll-progress *ngIf="poll.canBeVotedFor()" [poll]="poll"></os-poll-progress>

View File

@ -112,6 +112,19 @@ export class PollCollectionComponent extends BaseViewComponentDirective implemen
}
}
/**
* TODO: Some non abstract base poll service was required
* @param poll
*/
public canManagePoll(poll: ViewBasePoll): boolean {
if (poll.pollClassType === PollClassType.Motion) {
return this.operator.hasPerms(this.permission.motionsCanManagePolls);
} else if (poll.pollClassType === PollClassType.Assignment) {
return this.operator.hasPerms(this.permission.assignmentsCanManage);
}
return false;
}
/**
* Helper function to detect new latest published polls and set them.
*/

View File

@ -33,6 +33,9 @@ export class PollProgressComponent extends BaseViewComponentDirective implements
return this.operator.hasPerms(this.permission.agendaCanManageListOfSpeakers);
}
/**
* TODO: some non apstract poll function service is required.
*/
private get canManagePoll(): boolean {
if (this.poll.pollClassType === PollClassType.Motion) {
return this.operator.hasPerms(this.permission.motionsCanManagePolls);