From 2162f2b04966421d9843cb722d2324a9a983593e Mon Sep 17 00:00:00 2001 From: Sean Date: Mon, 5 Oct 2020 16:22:22 +0200 Subject: [PATCH] Add "represented by" to single votes table Adds a "represented by" field to the single votes table, to indicate a vote delegation. Also fixes an height issue that occured in large single vote tables when the user was navigating from a list view table to a single vote table --- .../list-view-table.component.ts | 2 ++ .../assignment-poll-detail.component.html | 11 +++++++ .../assignment-poll-detail.component.ts | 16 ++++++++-- .../motion-poll-detail.component.html | 11 +++++++ .../motion-poll-detail.component.ts | 16 ++++++++-- .../components/base-poll-detail.component.ts | 30 ++++++++++++++++++- 6 files changed, 81 insertions(+), 5 deletions(-) diff --git a/client/src/app/shared/components/list-view-table/list-view-table.component.ts b/client/src/app/shared/components/list-view-table/list-view-table.component.ts index 8bb07975a..72f9f6881 100644 --- a/client/src/app/shared/components/list-view-table/list-view-table.component.ts +++ b/client/src/app/shared/components/list-view-table/list-view-table.component.ts @@ -649,6 +649,8 @@ export class ListViewTableComponent 0) { document.documentElement.style.setProperty('--pbl-height', this.vScrollFixed + 'px'); + } else { + document.documentElement.style.removeProperty('--pbl-height'); } } diff --git a/client/src/app/site/assignments/modules/assignment-poll/components/assignment-poll-detail/assignment-poll-detail.component.html b/client/src/app/site/assignments/modules/assignment-poll/components/assignment-poll-detail/assignment-poll-detail.component.html index af6030cb3..b6879f66a 100644 --- a/client/src/app/site/assignments/modules/assignment-poll/components/assignment-poll-detail/assignment-poll-detail.component.html +++ b/client/src/app/site/assignments/modules/assignment-poll/components/assignment-poll-detail/assignment-poll-detail.component.html @@ -71,12 +71,23 @@
{{ vote.user.getShortName() }}
+
{{ vote.user.getLevelAndNumber() }}
+ +
{{ 'Vote weight' | translate }}: {{ vote.user.vote_weight }}
+ + +
+ + ({{ 'represented by' | translate }} + {{ getUsersVoteDelegation(vote.user).getShortName().trim() }}) + +
diff --git a/client/src/app/site/assignments/modules/assignment-poll/components/assignment-poll-detail/assignment-poll-detail.component.ts b/client/src/app/site/assignments/modules/assignment-poll/components/assignment-poll-detail/assignment-poll-detail.component.ts index e270dc349..fe9a85565 100644 --- a/client/src/app/site/assignments/modules/assignment-poll/components/assignment-poll-detail/assignment-poll-detail.component.ts +++ b/client/src/app/site/assignments/modules/assignment-poll/components/assignment-poll-detail/assignment-poll-detail.component.ts @@ -50,10 +50,22 @@ export class AssignmentPollDetailComponent extends BasePollDetailComponentDirect configService: ConfigService, protected pollService: AssignmentPollService, votesRepo: AssignmentVoteRepositoryService, - private operator: OperatorService, + protected operator: OperatorService, private router: Router ) { - super(title, translate, matSnackbar, repo, route, groupRepo, prompt, pollDialog, pollService, votesRepo); + super( + title, + translate, + matSnackbar, + repo, + route, + groupRepo, + prompt, + pollDialog, + pollService, + votesRepo, + operator + ); configService .get('users_activate_vote_weight') .subscribe(active => (this.isVoteWeightActive = active)); diff --git a/client/src/app/site/motions/modules/motion-poll/motion-poll-detail/motion-poll-detail.component.html b/client/src/app/site/motions/modules/motion-poll/motion-poll-detail/motion-poll-detail.component.html index 9971e4948..959cb52ed 100644 --- a/client/src/app/site/motions/modules/motion-poll/motion-poll-detail/motion-poll-detail.component.html +++ b/client/src/app/site/motions/modules/motion-poll/motion-poll-detail/motion-poll-detail.component.html @@ -58,14 +58,25 @@
{{ vote.user.getShortName() }} +
+
{{ vote.user.getLevelAndNumber() }}
+
{{ 'Vote weight' | translate }}: {{ vote.user.vote_weight }}
+ + +
+ + ({{ 'represented by' | translate }} + {{ getUsersVoteDelegation(vote.user).getShortName().trim() }}) + +
{{ 'Anonymous' | translate }}
diff --git a/client/src/app/site/motions/modules/motion-poll/motion-poll-detail/motion-poll-detail.component.ts b/client/src/app/site/motions/modules/motion-poll/motion-poll-detail/motion-poll-detail.component.ts index deda20981..5a19ce701 100644 --- a/client/src/app/site/motions/modules/motion-poll/motion-poll-detail/motion-poll-detail.component.ts +++ b/client/src/app/site/motions/modules/motion-poll/motion-poll-detail/motion-poll-detail.component.ts @@ -56,10 +56,22 @@ export class MotionPollDetailComponent extends BasePollDetailComponentDirective< pollService: MotionPollService, votesRepo: MotionVoteRepositoryService, configService: ConfigService, - private operator: OperatorService, + protected operator: OperatorService, private router: Router ) { - super(title, translate, matSnackbar, repo, route, groupRepo, prompt, pollDialog, pollService, votesRepo); + super( + title, + translate, + matSnackbar, + repo, + route, + groupRepo, + prompt, + pollDialog, + pollService, + votesRepo, + operator + ); configService .get('users_activate_vote_weight') .subscribe(active => (this.isVoteWeightActive = active)); diff --git a/client/src/app/site/polls/components/base-poll-detail.component.ts b/client/src/app/site/polls/components/base-poll-detail.component.ts index e6d105060..2384945ed 100644 --- a/client/src/app/site/polls/components/base-poll-detail.component.ts +++ b/client/src/app/site/polls/components/base-poll-detail.component.ts @@ -8,6 +8,7 @@ import { Label } from 'ng2-charts'; import { BehaviorSubject, from, Observable } from 'rxjs'; import { filter, map } from 'rxjs/operators'; +import { OperatorService } from 'app/core/core-services/operator.service'; import { Deferred } from 'app/core/promises/deferred'; import { BaseRepository } from 'app/core/repositories/base-repository'; import { GroupRepositoryService } from 'app/core/repositories/users/group-repository.service'; @@ -104,7 +105,8 @@ export abstract class BasePollDetailComponentDirective, protected pollService: S, - protected votesRepo: BaseRepository + protected votesRepo: BaseRepository, + protected operator: OperatorService ) { super(title, translate, matSnackbar); this.setup(); @@ -211,4 +213,30 @@ export abstract class BasePollDetailComponentDirective