Skip to content

Commit

Permalink
Fix list election mobile layout (#4385)
Browse files Browse the repository at this point in the history
  • Loading branch information
anbebe authored Dec 5, 2024
1 parent c8f70cb commit b3844e4
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,16 @@ <h4 class="poll-delegation-title">
<div
[ngClass]="{
'yna-grid':
poll.isMethodYNA ||
(settings.isSplitSingleOption && displayed_in_autopilot && poll.isMethodYNA),
((poll.isListPoll && !isMobile) || !poll.isListPoll) &&
(poll.isMethodYNA ||
(settings.isSplitSingleOption &&
displayed_in_autopilot &&
poll.isMethodYNA)),
'yna-grid-extended':
poll.isMethodYNA &&
isMobile &&
!settings.isSplitSingleOption &&
poll.isListPoll,
'remove-grid-gap': settings.isSplitSingleOption && displayed_in_autopilot,
'yn-grid':
poll.isMethodYN ||
Expand All @@ -92,9 +100,23 @@ <h4 class="poll-delegation-title">
!(settings.isSplitSingleOption && displayed_in_autopilot)
) {
<b class="grid-name-area">
{{ poll.option_ids.length }} {{ optionPluralLabel | translate }}
@if (poll.isListPoll) {
{{ poll.options[0]?.contentTitlesAsSortedArray.length }}
} @else {
{{ poll.option_ids.length }}
}
{{ optionPluralLabel | translate }}
</b>
}
@if (!settings.isSplitSingleOption && poll.isListPoll && isMobile) {
@if (poll.options[0]?.content_object) {
<div class="vote-option-title-single">
<span>
<span>{{ poll.options[0].content_object.getTitle() | translate }}</span>
</span>
</div>
}
}
@for (
action of voteActions.length ? voteActions : voteOptions;
track action.vote;
Expand Down Expand Up @@ -207,7 +229,7 @@ <h4 class="poll-delegation-title">
}
</div>
}
@if (!settings.isSplitSingleOption && option.isListOption) {
@if (!settings.isSplitSingleOption && option.isListOption && !isMobile) {
<div class="vote-option-title grid-name-area">
@if (option.content_object) {
<span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@
}
}

.yna-grid-extended {
@extend %vote-grid-base;
grid-template-areas: 'name name name name' 'subtitle subtitle subtitle subtitle' '. yes no abstain';
grid-template-columns: auto var(--poll-option-title-width, 70px) var(--poll-option-title-width, 70px) var(
--poll-option-title-width,
70px
);
}

.remove-grid-gap {
@media (max-width: 700px) {
//grid-gap: 0 !important;
Expand Down Expand Up @@ -198,6 +207,16 @@
}
}

.vote-option-title-single {
display: flex;
span,
i {
margin-top: auto;
margin-bottom: auto;
}
grid-area: subtitle;
}

.option0 {
grid-area: yes;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { PollControllerService } from 'src/app/site/pages/meetings/modules/poll/
import { ViewOption, ViewPoll } from 'src/app/site/pages/meetings/pages/polls';
import { ViewUser } from 'src/app/site/pages/meetings/view-models/view-user';
import { OperatorService } from 'src/app/site/services/operator.service';
import { ViewPortService } from 'src/app/site/services/view-port.service';
import { CustomIcon } from 'src/app/ui/modules/custom-icon/definitions';

import { MeetingSettingsService } from '../../../../services/meeting-settings.service';
Expand Down Expand Up @@ -74,6 +75,10 @@ export abstract class BasePollVoteComponent<C extends PollContentObject = any> e
return this.user?.isPresentInMeeting();
}

public get isMobile(): boolean {
return this.viewport.isMobile;
}

public PollPropertyVerbose = PollPropertyVerbose;

public delegations: ViewUser[] = [];
Expand Down Expand Up @@ -147,6 +152,7 @@ export abstract class BasePollVoteComponent<C extends PollContentObject = any> e
protected cd = inject(ChangeDetectorRef);
private pollRepo = inject(PollControllerService);
private operator = inject(OperatorService);
private viewport = inject(ViewPortService);
private votedSubscription: Subscription;
private votedSubscriptionPollId: Id;

Expand Down Expand Up @@ -184,6 +190,9 @@ export abstract class BasePollVoteComponent<C extends PollContentObject = any> e
for (const key of Object.keys(this._canVoteForSubjectMap)) {
this._canVoteForSubjectMap[+key].next(this.canVote(this._delegationsMap[+key]));
}
}),
this.viewport.isMobileSubject.subscribe(() => {
this.cd.markForCheck();
})
);
}
Expand Down

0 comments on commit b3844e4

Please sign in to comment.