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

Created CommaSeparatedListingComponent for enumerations in html template #2603

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,9 @@ <h2>{{ 'My meetings' | translate }}</h2>
<div class="meeting-group-block">
<a (click)="closeDialog()" [routerLink]="[meeting.id]">{{ meeting.name }}</a>
<div class="flex-vertical-center">
<span
class="flex-vertical-center"
*ngFor="let group of getGroupsForMeeting(meeting); let last = last"
>
{{ group.name }}
<span *ngIf="!last">,&nbsp;</span>
</span>
<os-comma-separated-listing [list]="getGroupsForMeeting(meeting)">
<ng-template let-group>{{ group.name }}</ng-template>
</os-comma-separated-listing>
</div>
</div>
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { MatMenuModule } from '@angular/material/menu';
import { MatToolbarModule } from '@angular/material/toolbar';
import { MatTooltipModule } from '@angular/material/tooltip';
import { RouterModule } from '@angular/router';
import { CommaSeparatedListingModule } from 'src/app/ui/modules/comma-separated-listing';

import { OpenSlidesTranslationModule } from '../translations';
import { UserComponentsModule } from '../user-components';
Expand All @@ -37,6 +38,7 @@ const DECLARATIONS = [GlobalHeadbarComponent];
declarations: [...DECLARATIONS, AccountButtonComponent, AccountDialogComponent, GlobalSearchComponent],
imports: [
CommonModule,
CommaSeparatedListingModule,
OpenSlidesTranslationModule.forChild(),
UserComponentsModule,
RouterModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
<!-- Submitters -->
<ng-container *ngIf="getSubmittersObservable() | async as submitters">
<h3 *ngIf="submitters.length > 0">{{ 'Submitters' | translate }}</h3>
<span *ngFor="let submitter of submitters; let last = last">
<span>{{ submitter }}</span>
<span *ngIf="!last">,</span>
</span>
<os-comma-separated-listing [list]="submitters"></os-comma-separated-listing>
</ng-container>

<!-- Recommendation -->
Expand All @@ -32,10 +29,9 @@ <h1 class="projector_h1">
<h2 *ngIf="data.data.show_sidebox && data.data.recommendation_referencing_motions" class="projector_h2">
<span>{{ 'Referring motions' | translate }}</span>
:
<span *ngFor="let titleInformation of referencingMotions; let last = last">
<span>{{ getNumberOrTitle(titleInformation) }}</span>
<span *ngIf="!last">,</span>
</span>
<os-comma-separated-listing [list]="referencingMotions">
<ng-template let-information>{{ getNumberOrTitle(information) }}</ng-template>
</os-comma-separated-listing>
</h2>

<!-- Metainfo as table -->
Expand All @@ -47,10 +43,7 @@ <h2 *ngIf="data.data.show_sidebox && data.data.recommendation_referencing_motion
<b>{{ 'Submitters' | translate }}:</b>
</td>
<td>
<span *ngFor="let submitter of submitters; let last = last">
<span>{{ submitter }}</span>
<span *ngIf="!last">,</span>
</span>
<os-comma-separated-listing [list]="submitters"></os-comma-separated-listing>
</td>
</tr>
</ng-container>
Expand All @@ -69,10 +62,9 @@ <h2 *ngIf="data.data.show_sidebox && data.data.recommendation_referencing_motion
<b>{{ 'Referring motions' | translate }}:</b>
</td>
<td>
<span *ngFor="let titleInformation of referencingMotions; let last = last">
<span>{{ getNumberOrTitle(titleInformation) }}</span>
<span *ngIf="!last">,</span>
</span>
<os-comma-separated-listing [list]="referencingMotions">
<ng-template let-information>{{ getNumberOrTitle(information) }}</ng-template>
</os-comma-separated-listing>
</td>
</tr>
</table>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { OpenSlidesTranslationModule } from 'src/app/site/modules/translations';
import { CommaSeparatedListingModule } from 'src/app/ui/modules/comma-separated-listing';
import { PipesModule } from 'src/app/ui/pipes';

import { SlideToken } from '../../../../definitions';
import { MotionSlideComponent } from './components/motion-slide/motion-slide.component';
@NgModule({
imports: [CommonModule, PipesModule, OpenSlidesTranslationModule.forChild()],
imports: [CommonModule, CommaSeparatedListingModule, PipesModule, OpenSlidesTranslationModule.forChild()],
declarations: [MotionSlideComponent],
providers: [{ provide: SlideToken.token, useValue: MotionSlideComponent }]
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@
<small *ngIf="poll.entitled_groups && poll.type && poll.type !== 'analog'">
{{ 'Entitled to vote' | translate }}:

<span *ngFor="let group of poll.entitled_groups; let last = last">
<span>{{ group.getTitle() | translate }}</span>
<span *ngIf="!last">,&ensp;</span>
</span>
<os-comma-separated-listing [list]="poll.entitled_groups">
<ng-template let-group>{{ group.getTitle() | translate }}</ng-template>
</os-comma-separated-listing>
<br />
</small>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { PollModule } from 'src/app/site/pages/meetings/modules/poll';
import { PollService } from 'src/app/site/pages/meetings/modules/poll/services/poll.service';
import { DirectivesModule } from 'src/app/ui/directives';
import { ChoiceDialogModule } from 'src/app/ui/modules/choice-dialog';
import { CommaSeparatedListingModule } from 'src/app/ui/modules/comma-separated-listing';
import { IconContainerModule } from 'src/app/ui/modules/icon-container';
import { SearchSelectorModule } from 'src/app/ui/modules/search-selector';
import { SortingListModule } from 'src/app/ui/modules/sorting/modules';
Expand All @@ -43,6 +44,7 @@ import { TopicPollServiceModule } from './services/topic-poll-service.module';
],
imports: [
CommonModule,
CommaSeparatedListingModule,
TopicPollServiceModule,
TopicCommonServiceModule,
FormsModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { OpenSlidesTranslationModule } from 'src/app/site/modules/translations';
import { MeetingsComponentCollectorModule } from 'src/app/site/pages/meetings/modules/meetings-component-collector';
import { DirectivesModule } from 'src/app/ui/directives';
import { ChoiceDialogModule } from 'src/app/ui/modules/choice-dialog';
import { CommaSeparatedListingModule } from 'src/app/ui/modules/comma-separated-listing';
import { HeadBarModule } from 'src/app/ui/modules/head-bar';
import { IconContainerModule } from 'src/app/ui/modules/icon-container/icon-container.module';
import { ListModule } from 'src/app/ui/modules/list';
Expand All @@ -32,6 +33,7 @@ const NG_MODULES = [
MatInputModule
];
const OS_MODULES = [
CommaSeparatedListingModule,
HeadBarModule,
ListModule,
MeetingsComponentCollectorModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,9 @@ <h2>{{ 'Agenda' | translate }}</h2>
<!-- Tags -->
<div *ngIf="item.tags && item.tags.length">
<os-icon-container icon="local_offer">
<span *ngFor="let tag of item.tags; let last = last">
{{ tag.getTitle() }}
<span *ngIf="!last">,&nbsp;</span>
</span>
<os-comma-separated-listing [list]="item.tags">
<ng-template let-tag>{{ tag.getTitle() }}</ng-template>
</os-comma-separated-listing>
</os-icon-container>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { PollModule } from 'src/app/site/pages/meetings/modules/poll';
import { PollService } from 'src/app/site/pages/meetings/modules/poll/services/poll.service';
import { DirectivesModule } from 'src/app/ui/directives';
import { ChoiceDialogModule } from 'src/app/ui/modules/choice-dialog';
import { CommaSeparatedListingModule } from 'src/app/ui/modules/comma-separated-listing';
import { ExpandableContentWrapperModule } from 'src/app/ui/modules/expandable-content-wrapper';
import { IconContainerModule } from 'src/app/ui/modules/icon-container';
import { SearchSelectorModule } from 'src/app/ui/modules/search-selector';
Expand Down Expand Up @@ -46,6 +47,7 @@ const COMPONENTS = [
exports: [...COMPONENTS, PollModule, AssignmentPollServiceModule],
imports: [
CommonModule,
CommaSeparatedListingModule,
AssignmentPollServiceModule,
AssignmentCommonServiceModule,
RouterModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@
<small *ngIf="poll.entitled_groups && poll.type && poll.type !== 'analog'">
{{ 'Entitled to vote' | translate }}:

<span *ngFor="let group of poll.entitled_groups; let last = last">
<span>{{ group.getTitle() | translate }}</span>
<span *ngIf="!last">,&ensp;</span>
</span>
<os-comma-separated-listing [list]="poll.entitled_groups">
<ng-template let-group>{{ group.getTitle() | translate }}</ng-template>
</os-comma-separated-listing>
<br />
</small>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { MatInputModule } from '@angular/material/input';
import { MatMenuModule } from '@angular/material/menu';
import { MatTooltipModule } from '@angular/material/tooltip';
import { OpenSlidesTranslationModule } from 'src/app/site/modules/translations';
import { CommaSeparatedListingModule } from 'src/app/ui/modules/comma-separated-listing';
import { HeadBarModule } from 'src/app/ui/modules/head-bar';
import { IconContainerModule } from 'src/app/ui/modules/icon-container';
import { VerticalTabGroupModule } from 'src/app/ui/modules/vertical-tab-group';
Expand All @@ -32,6 +33,7 @@ import { ChatGroupListComponent } from './components/chat-group-list/chat-group-
],
imports: [
CommonModule,
CommaSeparatedListingModule,
ChatGroupListRoutingModule,
ChatGroupDialogModule,
PipesModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@
*ngIf="group.write_groups.length"
matTooltip="{{ 'Groups with write permissions' | translate }}"
>
<span *ngFor="let userGroup of group.write_groups | slice : 0 : 3; let last = last">
<span>{{ userGroup.getTitle() | translate }}</span>
<span *ngIf="!last">,&nbsp;</span>
<span *ngIf="last && group.write_groups.length > 3">...</span>
</span>
<os-comma-separated-listing [list]="group.write_groups" [showElementsAmount]="3">
<ng-template let-group>{{ group.getTitle() | translate }}</ng-template>
</os-comma-separated-listing>
</os-icon-container>
</div>

Expand All @@ -28,11 +26,9 @@
*ngIf="getReadonlyGroups(group).length"
matTooltip="{{ 'Groups with read permissions' | translate }}"
>
<span *ngFor="let userGroup of getReadonlyGroups(group) | slice : 0 : 3; let last = last">
<span>{{ userGroup.getTitle() | translate }}</span>
<span *ngIf="!last">,&nbsp;</span>
<span *ngIf="last && group.read_groups.length > 3">...</span>
</span>
<os-comma-separated-listing [list]="getReadonlyGroups(group)" [showElementsAmount]="3">
<ng-template let-group>{{ group.getTitle() | translate }}</ng-template>
</os-comma-separated-listing>
</os-icon-container>
</div>
<div class="spacer"></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,9 @@ <h2>{{ 'Files' | translate }}</h2>
(click)="onEditFile(mediafile)"
>
<os-icon-container *ngIf="mediafile.access_groups.length" icon="group">
<span *ngFor="let group of mediafile.access_groups | slice : 0 : 3; let last = last">
<span>{{ $any(group).getTitle() | translate }}</span>
<span *ngIf="!last">,&nbsp;</span>
<span *ngIf="last && mediafile.access_groups.length > 3">...</span>
</span>
<os-comma-separated-listing [list]="mediafile.access_groups" [showElementsAmount]="3">
<ng-template let-group>{{ $any(group).getTitle() | translate }}</ng-template>
</os-comma-separated-listing>
</os-icon-container>
</div>
</os-file-list>
Expand All @@ -64,11 +62,9 @@ <h2>{{ 'Files' | translate }}</h2>
<span class="visibility" *ngIf="canEdit && directory && directory.has_inherited_access_groups">
<button class="visible-for" mat-button (click)="onEditFile(directory)">
<os-icon-container icon="group" matTooltip="{{ 'Allowed access groups for this directory' | translate }}">
<span *ngFor="let group of directory.inherited_access_groups | slice : 0 : 3; let last = last">
<span>{{ group.getTitle() | translate }}</span>
<span *ngIf="!last">,</span>
<span *ngIf="last && directory.inherited_access_groups.length > 3">...</span>
</span>
<os-comma-separated-listing [list]="directory.inherited_access_groups" [showElementsAmount]="3">
<ng-template let-group>{{ group.getTitle() | translate }}</ng-template>
</os-comma-separated-listing>
</os-icon-container>
</button>
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { RouterModule } from '@angular/router';
import { OpenSlidesTranslationModule } from 'src/app/site/modules/translations';
import { MeetingsComponentCollectorModule } from 'src/app/site/pages/meetings/modules/meetings-component-collector';
import { DirectivesModule } from 'src/app/ui/directives';
import { CommaSeparatedListingModule } from 'src/app/ui/modules/comma-separated-listing';
import { FileListModule } from 'src/app/ui/modules/file-list/file-list.module';
import { HeadBarModule } from 'src/app/ui/modules/head-bar';
import { IconContainerModule } from 'src/app/ui/modules/icon-container/icon-container.module';
Expand All @@ -27,6 +28,7 @@ import { MediafileListServiceModule } from './services/mediafile-list-service.mo
declarations: [MediafileListComponent],
imports: [
CommonModule,
CommaSeparatedListingModule,
MediafileListRoutingModule,
MediafileListServiceModule,
MediafileCommonServiceModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
<small *ngIf="poll.entitled_groups && poll.type && poll.type !== 'analog'">
{{ 'Groups' | translate }}:

<span *ngFor="let group of poll.entitled_groups; let last = last">
<span>{{ group.getTitle() | translate }}</span>
<span *ngIf="!last">,&ensp;</span>
</span>
<os-comma-separated-listing [list]="poll.entitled_groups">
<ng-template let-group>{{ group.getTitle() | translate }}</ng-template>
</os-comma-separated-listing>
</small>
<small>{{ '100% base' | translate }}: {{ poll.percentBaseVerbose | translate }}</small>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { MeetingsComponentCollectorModule } from 'src/app/site/pages/meetings/mo
import { PollModule } from 'src/app/site/pages/meetings/modules/poll';
import { PollService } from 'src/app/site/pages/meetings/modules/poll/services/poll.service';
import { DirectivesModule } from 'src/app/ui/directives';
import { CommaSeparatedListingModule } from 'src/app/ui/modules/comma-separated-listing';
import { IconContainerModule } from 'src/app/ui/modules/icon-container';
import { SearchSelectorModule } from 'src/app/ui/modules/search-selector';
import { PipesModule } from 'src/app/ui/pipes';
Expand All @@ -45,6 +46,7 @@ const MODULES = [MotionPollServiceModule];
imports: [
...MODULES,
CommonModule,
CommaSeparatedListingModule,
RouterModule,
MatButtonModule,
MatProgressSpinnerModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';
import { MatMenuModule } from '@angular/material/menu';
import { OpenSlidesTranslationModule } from 'src/app/site/modules/translations';
import { CommaSeparatedListingModule } from 'src/app/ui/modules/comma-separated-listing';
import { HeadBarModule } from 'src/app/ui/modules/head-bar';
import { IconContainerModule } from 'src/app/ui/modules/icon-container';
import { SearchSelectorModule } from 'src/app/ui/modules/search-selector';
Expand All @@ -24,6 +25,7 @@ import { CommentSectionSortComponent } from './components/comment-section-sort/c
declarations: [CommentSectionListComponent, CommentSectionSortComponent],
imports: [
CommonModule,
CommaSeparatedListingModule,
CommentsRoutingModule,
SortingModule,
HeadBarModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,9 @@ <h3>{{ 'Groups with write permissions' | translate }}</h3>
</mat-menu>

<ng-template #groupList let-groups="groups">
<span class="inline-flex" *ngFor="let group of groups; let last = last">
{{ group.getTitle() | translate }}
<span *ngIf="!last">,&nbsp;</span>
</span>
<os-comma-separated-listing [list]="groups">
<ng-template let-group>{{ group.getTitle() | translate }}</ng-template>
</os-comma-separated-listing>
</ng-template>

<!-- Template for motion comment dialog -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@
<ul>
<li *cdkVirtualFor="let change of changes; let index = index">
<span class="one-line">
<a href="" (click)="scrollToChangeClicked(change, $event)" *ngIf="!change.isTitleChange()">
<span>{{ 'Line' | translate }} {{ formatLineRange(change) }}</span>
<a href="" (click)="scrollToChangeClicked(change, $event)">
<span *ngIf="!change.isTitleChange()">
{{ 'Line' | translate }} {{ formatLineRange(change) }}
</span>
<span *ngIf="change.isTitleChange()">{{ 'Title' | translate }}</span>
<span *ngIf="isChangeRecommendation(change)">({{ 'Change recommendation' | translate }})</span>
<span *ngIf="isChangeRecommendation(change)">
&ensp;({{ 'Change recommendation' | translate }})
</span>
<span *ngIf="isAmendment(change)">
({{ 'Amendment' | translate }} {{ change.getIdentifier() }})
&ensp;({{ 'Amendment' | translate }} {{ change.getIdentifier() }})
</span>
</a>
<i class="user-subtitle" *ngIf="isChangeRecommendation(change)">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ <h4 *ngIf="perms.isAllowed('support', motion) || motion.hasSupporters()">{{ 'Sup
{{ motion.supporters.length }} {{ 'supporters' | translate }}
</button>
<p *ngIf="showSupporters" class="supporters">
<span *ngFor="let supporter of motion.supporters; let last = last">
{{ supporter.full_name }}
<span *ngIf="!last">,</span>
</span>
<os-comma-separated-listing [list]="motion.supporters">
<ng-template let-supporter>{{ supporter.full_name }}</ng-template>
</os-comma-separated-listing>
</p>
</div>

Expand Down
Loading