Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/vote decrypt #3757

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions client/src/app/domain/models/projector/projector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export class Projector extends BaseModel<Projector> {
public header_h1_color!: string;
public chyron_background_color!: string;
public chyron_font_color!: string;
public chyron_background_color_2!: string;
public chyron_font_color_2!: string;
public show_header_footer!: boolean;
public show_title!: boolean;
public show_logo!: boolean;
Expand Down Expand Up @@ -87,7 +89,9 @@ export class Projector extends BaseModel<Projector> {
`header_font_color`,
`header_h1_color`,
`chyron_background_color`,
`chyron_background_color_2`,
`chyron_font_color`,
`chyron_font_color_2`,
`show_header_footer`,
`show_title`,
`show_logo`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ export class ProjectorRepositoryService extends BaseMeetingRelatedRepository<Vie
header_h1_color: projector.header_h1_color,
chyron_background_color: projector.chyron_background_color,
chyron_font_color: projector.chyron_font_color,
chyron_background_color_2: projector.chyron_background_color_2,
chyron_font_color_2: projector.chyron_font_color_2,
show_header_footer: projector.show_header_footer,
show_title: projector.show_title,
show_logo: projector.show_logo,
Expand Down Expand Up @@ -137,9 +139,14 @@ export class ProjectorRepositoryService extends BaseMeetingRelatedRepository<Vie
public async project(
descriptor: ProjectionBuildDescriptor,
projectors: ViewProjector[],
options: object | null
options: object | null,
keepActiveProjections?: boolean
): Promise<void> {
const payload = this.createProjectPayload(descriptor, projectors, options);
if (keepActiveProjections) {
payload.keep_active_projections = keepActiveProjections;
}

return await this.sendActionToBackend(ProjectorAction.PROJECT, payload);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ <h2 mat-dialog-title>
<div class="element-name" *ngIf="descriptor">
{{ descriptor.getDialogTitle() }}
</div>
<div class="content-wrapper">
<div class="content-wrapper" *ngIf="projectorSelectable">
<div
class="projectors"
*ngFor="let projector of projectors"
Expand Down Expand Up @@ -49,6 +49,7 @@ <h3>{{ option.displayName | translate }}</h3>

<mat-dialog-actions>
<button mat-button osAutofocus (click)="onProject()" color="accent">{{ 'Project' | translate }}</button>
<button mat-button (click)="onAddToPreview()">{{ 'Add to queue' | translate }}</button>
<button mat-button *ngIf="projectorSelectable" (click)="onAddToPreview()">{{ 'Add to queue' | translate }}</button>
<button mat-button *ngIf="!projectorSelectable" (click)="onHide()">{{ 'Hide' | translate }}</button>
<button mat-button (click)="onCancel()">{{ 'Cancel' | translate }}</button>
</mat-dialog-actions>
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { ProjectionDialogReturnType } from '../../definitions';
export interface ProjectionDialogConfig {
descriptor: ProjectionBuildDescriptor;
allowReferenceProjector: boolean;
projector?: ViewProjector;
}

@Component({
Expand All @@ -42,6 +43,7 @@ export class ProjectionDialogComponent implements OnInit, OnDestroy {
public options!: SlideOptions;
public descriptor: ProjectionBuildDescriptor;
public allowReferenceProjector = true;
public projectorSelectable = false;
private _projectorSubscription: string;
private _subscriptions: Subscription[] = [];

Expand All @@ -54,6 +56,10 @@ export class ProjectionDialogComponent implements OnInit, OnDestroy {
) {
this.descriptor = isProjectionBuildDescriptor(data) ? data : data.descriptor;
this.allowReferenceProjector = !isProjectionBuildDescriptor(data) && data.allowReferenceProjector;
this.projectorSelectable = isProjectionBuildDescriptor(data) || !data.projector;
if (!this.projectorSelectable && !isProjectionBuildDescriptor(data)) {
this.selectedProjectors = [data.projector.id];
}
}

public ngOnDestroy(): void {
Expand All @@ -72,14 +78,14 @@ export class ProjectionDialogComponent implements OnInit, OnDestroy {
this.projectors = projectors.filter(p => this.allowReferenceProjector || !p.isReferenceProjector);

// TODO: Maybe watch. But this may not be necessary for the short living time of this dialog.
if (this.selectedProjectors === null) {
if (this.selectedProjectors === null && this.projectorSelectable) {
this.selectedProjectors = this.projectorService
.getProjectorsWhichAreProjecting(this.descriptor)
.map(p => p.id);
}

// Add default projector, if the projectable is not projected on it.
if (this.descriptor?.projectionDefault) {
if (this.descriptor?.projectionDefault && this.projectorSelectable) {
const defaultProjectors: ViewProjector[] = this.activeMeetingService.meeting!.default_projectors(
this.descriptor.projectionDefault
);
Expand Down Expand Up @@ -141,7 +147,8 @@ export class ProjectionDialogComponent implements OnInit, OnDestroy {
action: `project`,
resultDescriptor: this.descriptor,
projectors: this.selectedProjectors.map(id => this.projectors.find(p => p.id === id)).filter(p => p),
options: this.optionValues
options: this.optionValues,
keepActiveProjections: !this.projectorSelectable
});
}

Expand All @@ -154,6 +161,15 @@ export class ProjectionDialogComponent implements OnInit, OnDestroy {
});
}

public onHide(): void {
this.dialogRef.close({
action: `hide`,
resultDescriptor: this.descriptor,
projectors: this.selectedProjectors.map(id => this.projectors.find(p => p.id === id)).filter(p => p),
options: this.optionValues
});
}

public onCancel(): void {
this.dialogRef.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { ViewProjector } from 'src/app/site/pages/meetings/pages/projectors';
import { ProjectionBuildDescriptor } from 'src/app/site/pages/meetings/view-models';

export interface ProjectionDialogReturnType {
action: 'project' | 'addToPreview';
action: 'project' | 'addToPreview' | 'hide';
resultDescriptor: ProjectionBuildDescriptor;
projectors: ViewProjector[];
options: object | null;
keepActiveProjections?: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,18 @@ export class ProjectionDialogService {
restoreFocus: false
});
const response = await firstValueFrom(dialogRef.afterClosed());
console.log(response);
if (response) {
const { action, resultDescriptor, projectors, options }: ProjectionDialogReturnType = response;
const { action, resultDescriptor, projectors, options, keepActiveProjections }: ProjectionDialogReturnType =
response;
if (action === `project`) {
await this.projectorRepo.project(resultDescriptor, projectors, options);
await this.projectorRepo.project(resultDescriptor, projectors, options, keepActiveProjections);
} else if (action === `addToPreview`) {
await this.projectorRepo.addToPreview(resultDescriptor, projectors, options);
} else if (action === `hide`) {
if (this.projectorRepo.isProjectedOn(resultDescriptor, projectors[0])) {
await this.projectorRepo.toggle(resultDescriptor, projectors, options);
}
} else {
throw new Error(`Unknown projector action ` + action);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class ProjectorButtonComponent implements OnInit, OnDestroy {
/**
* The object to project.
*/

private _object: ProjectionBuildDescriptor | Projectable | null = null;

public get object(): ProjectionBuildDescriptor | Projectable {
Expand Down Expand Up @@ -58,6 +59,9 @@ export class ProjectorButtonComponent implements OnInit, OnDestroy {
@Input()
public allowReferenceProjector = true;

@Input()
public useToggleDialog = false;

/**
* If this is re-defined, it will replace the usual click functionality.
*/
Expand All @@ -67,7 +71,13 @@ export class ProjectorButtonComponent implements OnInit, OnDestroy {
return;
}
const descriptor = this.projectorService.ensureDescriptor(this.object);
if (this.projector) {
if (this.useToggleDialog) {
this.projectionDialogService.openProjectDialogFor({
descriptor,
projector: this.projector,
allowReferenceProjector: true
});
} else if (this.projector) {
this.projectorService.toggle(descriptor, [this.projector]);
} else {
// open the projection dialog
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
<div
id="chyron"
*ngIf="data"
[id]="data.options['chyron_type'] === 'new' ? 'chyron_new' : 'chyron'"
[ngStyle]="{
'background-color': projector?.chyron_background_color || data.data.background_color,
color: projector?.chyron_font_color || data.data.font_color
'--chyron-background-color': projector?.chyron_background_color || data.data.background_color,
'--chyron-font-color': projector?.chyron_font_color || data.data.font_color,
'--chyron-background-color-2': projector?.chyron_background_color_2 || data.data.background_color_2,
'--chyron-font-color-2': projector?.chyron_font_color_2 || data.data.font_color_2
}"
>
<span id="inner">
<div id="inner-name">{{ data.data.current_speaker_name }}</div>
<div id="inner-level">{{ data.data.current_speaker_level }}</div>
</span>
<div id="chyron_agenda_item" *ngIf="data && data.options['agenda_item'] && data.data.title_information">
<span class="inner">
{{ data.data.title_information?.agenda_item_number }}
{{ !!data.data.title_information?.agenda_item_number ? '&middot;' : '' }}
{{ data.data.title_information?.number }}
{{ !!data.data.title_information?.number ? '&middot;' : '' }}
{{ data.data.title_information?.title }}
</span>
</div>

<div id="chyron_speaker" *ngIf="data && data.options['chyron_type'] !== 'none' && data.data.current_speaker_name">
<span *ngIf="data.options['chyron_type'] === 'old'" class="inner">
<div class="name">{{ data.data.current_speaker_name }}</div>
<div class="level">{{ data.data.current_speaker_level }}</div>
</span>
<span *ngIf="data.options['chyron_type'] === 'new'" class="inner">
<os-comma-separated-listing [list]="getSpeaker()"></os-comma-separated-listing>
</span>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,33 +1,60 @@
@import 'src/assets/styles/fonts.scss';

#chyron {
#chyron,
#chyron_new {
position: absolute;
left: 50px;
bottom: 20px;
right: 0;
right: 50px;
z-index: 10;
height: 80px;
font-size: 32px;
}

#chyron_agenda_item,
#chyron_speaker {
text-align: left;
line-height: 1;
line-height: 1.25;
opacity: 1;

#inner {
.inner {
background-color: var(--chyron-background-color);
color: var(--chyron-font-color);
display: inline-block;

vertical-align: middle;
padding-left: 18px;
padding-right: 20px;
padding-right: 18px;
padding-top: 10px;
padding-bottom: 10px;
height: 60px;
height: 40px;
display: table-cell;
}
}

#inner-name {
#chyron_agenda_item {
font-size: 24px;
.inner {
background-color: var(--chyron-background-color-2);
color: var(--chyron-font-color-2);
}
margin-bottom: -1px;
}

#chyron_speaker {
font-size: 32px;
.inner {
.name {
font-family: customChyronNameFont, $font-chyronname;
}

#inner-level {
.level {
margin-top: 5px;
font-size: 70%;
}
}
}

#chyron_new {
#chyron_speaker {
min-height: 80px;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,12 @@ import { CurrentSpeakerChyronSlideData } from '../current-speaker-chyron-slide-d
templateUrl: `./current-speaker-chyron-slide.component.html`,
styleUrls: [`./current-speaker-chyron-slide.component.scss`]
})
export class CurrentSpeakerChyronSlideComponent extends BaseSlideComponent<CurrentSpeakerChyronSlideData> {}
export class CurrentSpeakerChyronSlideComponent extends BaseSlideComponent<CurrentSpeakerChyronSlideData> {
public getSpeaker(): string[] {
const parts: string[] = [this.data.data.current_speaker_name];
if (!!this.data.data.current_speaker_level) {
parts.push(this.data.data.current_speaker_level);
}
return parts;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ export interface CurrentSpeakerChyronSlideData {
current_speaker_level?: string;
background_color: string;
font_color: string;
background_color_2: string;
font_color_2: string;
title_information?: any;
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';

import { CommaSeparatedListingModule } from '../../../../../../../../../ui/modules/comma-separated-listing/comma-separated-listing.module';
import { SlideToken } from '../../definitions';
import { CurrentSpeakerChyronSlideComponent } from './components/current-speaker-chyron-slide.component';
@NgModule({
imports: [CommonModule],
declarations: [CurrentSpeakerChyronSlideComponent],
providers: [{ provide: SlideToken.token, useValue: CurrentSpeakerChyronSlideComponent }]
providers: [{ provide: SlideToken.token, useValue: CurrentSpeakerChyronSlideComponent }],
imports: [CommonModule, CommaSeparatedListingModule]
})
export class CurrentSpeakerChyronSlideModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -235,24 +235,21 @@ <h4>{{ 'Groups' | translate }}</h4>
<span>{{ 'Default group' | translate }}</span>
</div>

<div *ngIf="isAllowed('update') || ownPage">
<!-- Own Vote delegations -->
<div *ngIf="user?.vote_delegated_to() && showVoteDelegations">
<h4>{{ 'Voting right delegated to (proxy)' | translate }}</h4>
<span>{{ user!.vote_delegated_to() }}</span>
</div>

<!-- Received Vote delegations -->
<div *ngIf="showVoteDelegations && user!.vote_delegations_from().length > 0">
<h4>{{ 'Voting right received from (principals)' | translate }}</h4>
<span>{{ user!.vote_delegations_from() }}</span>
</div>
<!-- Own Vote delegations -->
<div *ngIf="user?.vote_delegated_to() && showVoteDelegations">
<h4>{{ 'Voting right delegated to (proxy)' | translate }}</h4>
<span>{{ user!.vote_delegated_to() }}</span>
</div>

<!-- Vote weight -->
<div *ngIf="showVoteWeight">
<h4>{{ 'Vote weight' | translate }}</h4>
<span>{{ user?.vote_weight() }}</span>
</div>
<!-- Received Vote delegations -->
<div *ngIf="showVoteDelegations && user!.vote_delegations_from().length > 0">
<h4>{{ 'Voting right received from (principals)' | translate }}</h4>
<span>{{ user!.vote_delegations_from() }}</span>
</div>
<!-- Vote weight -->
<div *ngIf="showVoteWeight">
<h4>{{ 'Vote weight' | translate }}</h4>
<span>{{ user?.vote_weight() }}</span>
</div>

<div *ngIf="isAllowed('seeName')">
Expand Down
Loading
Loading