Skip to content

Commit

Permalink
Merge branch 'main' into 3702-allow-committee-admin-personal-info-edit
Browse files Browse the repository at this point in the history
  • Loading branch information
Elblinator authored Jul 15, 2024
2 parents fe952d4 + 686c488 commit ec32f7f
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ <h4 class="poll-delegation-title">
</div>
}
<!-- Options and Actions -->
@if (!settings.isSplitSingleOption) {
@if (!(settings.isSplitSingleOption && !displayed_in_autopilot)) {
<div
[ngClass]="{
'yna-grid': poll.isMethodYNA,
'yna-grid':
poll.isMethodYNA || (settings.isSplitSingleOption && displayed_in_autopilot),
'remove-grid-gap': settings.isSplitSingleOption && displayed_in_autopilot,
'yn-grid': poll.isMethodYN,
'single-vote-grid':
(poll.isMethodY || poll.isMethodN) && poll.max_votes_per_option <= 1,
Expand All @@ -75,7 +77,11 @@ <h4 class="poll-delegation-title">
@if (showAvailableVotes) {
<div class="grid-name-area"></div>
}
@if (!showAvailableVotes && poll.option_ids) {
@if (
!showAvailableVotes &&
poll.option_ids &&
!(settings.isSplitSingleOption && displayed_in_autopilot)
) {
<b class="grid-name-area">
{{ poll.option_ids.length }} {{ optionPluralLabel | translate }}
</b>
Expand All @@ -85,17 +91,22 @@ <h4 class="poll-delegation-title">
track action;
let i = $index
) {
<b class="poll-option-title" [ngClass]="'option' + i">
{{ action.label | translate }}
</b>
@if (!poll.isTopicPoll) {
<b class="poll-option-title" [ngClass]="'option' + i">
{{ action.label | translate }}
</b>
}
}
</div>
}
@for (option of poll.options; track option; let i = $index) {
<div
[ngClass]="{
'split-grid': settings.isSplitSingleOption,
'yna-grid': !settings.isSplitSingleOption && poll.isMethodYNA,
'split-grid': settings.isSplitSingleOption && !displayed_in_autopilot,
'remove-grid-gap': settings.isSplitSingleOption && displayed_in_autopilot,
'yna-grid':
(!settings.isSplitSingleOption && poll.isMethodYNA) ||
(settings.isSplitSingleOption && displayed_in_autopilot),
'yn-grid': !settings.isSplitSingleOption && poll.isMethodYN,
'single-vote-grid':
!settings.isSplitSingleOption &&
Expand Down Expand Up @@ -169,14 +180,48 @@ <h4 class="poll-delegation-title">
</mat-icon>
</div>
</button>
@if (settings.isSplitSingleOption) {
@if (settings.isSplitSingleOption && !displayed_in_autopilot) {
<span class="vote-label">
{{ action.label | translate }}
</span>
}
</div>
}
}
@if (settings.isSplitSingleOption && displayed_in_autopilot) {
<ng-container>
@for (
action of voteActions.length ? voteActions : voteOptions;
track action;
let i = $index
) {
<div class="vote-button-area" [ngClass]="'option' + i">
<button
class="vote-button"
mat-raised-button
[disabled]="isDeliveringVote(delegation)"
(click)="saveSingleVote(option.id, action.vote, delegation)"
>
<div
class="vote-button-content"
[ngClass]="
getActionButtonContentClass(action, option, delegation)
"
>
<os-custom-icon
class="vote-button-cross"
[customIcon]="drawnCross"
[ngClass]="getActionButtonClass(action, option, delegation)"
></os-custom-icon>
<mat-icon class="vote-button-circle">
radio_button_unchecked
</mat-icon>
</div>
</button>
</div>
}
</ng-container>
}
@if (poll.max_votes_per_option > 1) {
<mat-form-field appearance="outline" class="vote-input">
<input
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@
}
}

.remove-grid-gap {
@media (max-width: 700px) {
//grid-gap: 0 !important;
grid-template-areas: 'yes no abstain';
grid-template-columns: 70px 70px 70px;
justify-content: end;
}
}

.single-vote-grid {
@extend %vote-grid-base;
grid-template-areas: 'name yes';
Expand All @@ -120,16 +129,6 @@
}
}

.global-option-grid {
@extend %vote-grid-base;
grid-template-columns: auto var(--poll-option-title-width, 70px);
}

.option-list-information-grid {
@extend %vote-grid-base;
grid-template-columns: max-content auto max-content;
}

.split-grid {
margin: 0;
padding: 10px 0;
Expand All @@ -155,6 +154,16 @@
}
}

.global-option-grid {
@extend %vote-grid-base;
grid-template-columns: auto var(--poll-option-title-width, 70px);
}

.option-list-information-grid {
@extend %vote-grid-base;
grid-template-columns: max-content auto max-content;
}

.grid-name-area {
grid-area: name;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ export abstract class BasePollVoteComponent<C extends PollContentObject = any> e
return this._poll;
}

@Input()
public set displayInAutopilot(is_in_autopilot: boolean) {
this.displayed_in_autopilot = is_in_autopilot;
}

protected displayed_in_autopilot = true;

public PollType = PollType;
public formControlMap: { [optionId: number]: UntypedFormControl } = {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ <h1>
[currentProjection]="projectedViewModel"
[disableFinished]="disabledContentElements['poll-finished'] === true"
[disableRunning]="disabledContentElements['poll-running'] === true"
[displayInAutopilot]="true"
></os-poll-collection>
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@
@if (poll.isMotionPoll) {
<div>
@if (poll.canBeVotedFor() && !last) {
<os-motion-poll-vote [poll]="poll"></os-motion-poll-vote>
<os-motion-poll-vote
[displayInAutopilot]="displayInAutopilot"
[poll]="poll"
></os-motion-poll-vote>
}
@if (last) {
<os-motion-poll-detail-content [poll]="lastPublishedPoll"></os-motion-poll-detail-content>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ export class PollCollectionComponent<C extends PollContentObject> extends BaseCo
@Input()
public disableFinished = false;

@Input()
public displayInAutopilot = true;

@Input()
public set currentProjection(viewModel: (Partial<HasPolls<C>> & { readonly fqid: string }) | null) {
this._currentProjection = viewModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<os-poll-progress [poll]="poll"></os-poll-progress>
}
@if (poll.canBeVotedFor()) {
<os-motion-poll-vote [poll]="poll"></os-motion-poll-vote>
<os-motion-poll-vote [displayInAutopilot]="false" [poll]="poll"></os-motion-poll-vote>
}
<os-motion-poll-meta-information [poll]="poll"></os-motion-poll-meta-information>
} @else {
Expand Down

0 comments on commit ec32f7f

Please sign in to comment.