-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CSCEXAM-000 Split large components to smaller ones
- Loading branch information
Showing
29 changed files
with
1,334 additions
and
1,078 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
ui/src/app/enrolment/active/helpers/optional-sections.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
// SPDX-FileCopyrightText: 2024 The members of the EXAM Consortium | ||
// | ||
// SPDX-License-Identifier: EUPL-1.2 | ||
|
||
import { LowerCasePipe, UpperCasePipe } from '@angular/common'; | ||
import { Component, input, signal } from '@angular/core'; | ||
import { TranslateModule } from '@ngx-translate/core'; | ||
import { ExamSection } from 'src/app/exam/exam.model'; | ||
|
||
@Component({ | ||
selector: 'xm-optional-sections', | ||
standalone: true, | ||
imports: [TranslateModule, LowerCasePipe, UpperCasePipe], | ||
template: `<div class="row mt-2 enrollment-card-dropdown"> | ||
<div class="col col-md-12"> | ||
<button | ||
class="btn btn-outline-secondary" | ||
(click)="showSections.set(!showSections())" | ||
(keydown.enter)="showSections.set(!showSections())" | ||
[attr.aria-expanded]="showSections()" | ||
> | ||
{{ 'i18n_selected_sections' | translate }} | ||
<img class="arrow_icon" [hidden]="showSections()" alt="" src="/assets/images/arrow_right.png" /> | ||
<img class="arrow_icon" [hidden]="!showSections()" alt="" src="/assets/images/arrow_down.png" /> | ||
</button> | ||
<div class="pt-2" [hidden]="!showSections"> | ||
@for (section of allSections(); track section.id) { | ||
<div class="mb-3"> | ||
@if (section.optional === false) { | ||
<div class="row"> | ||
<div class="col"> | ||
<strong | ||
>{{ 'i18n_exam_section' | translate }} | ||
<small class="text text-danger" | ||
>({{ 'i18n_required' | translate | lowercase }})</small | ||
>:</strong | ||
> | ||
{{ section.name }} | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col"> | ||
{{ section.description }} | ||
</div> | ||
</div> | ||
} | ||
</div> | ||
} | ||
@for (section of selectedSections(); track section.id) { | ||
<div class="mb-3"> | ||
<div class="row"> | ||
<div class="col"> | ||
<strong | ||
>{{ 'i18n_exam_section' | translate }} | ||
<small class="text text-success" | ||
>({{ 'i18n_optional' | translate | lowercase }})</small | ||
>:</strong | ||
> | ||
{{ section.name }} | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col"> | ||
{{ section.description }} | ||
</div> | ||
</div> | ||
@if (section.examMaterials.length > 0) { | ||
<div> | ||
<div class="row"> | ||
<div class="col"> | ||
<strong>{{ 'i18n_exam_materials' | translate }}</strong> | ||
</div> | ||
</div> | ||
@for (material of section.examMaterials; track material.id) { | ||
<div> | ||
<div class="row"> | ||
<span class="col"> | ||
{{ 'i18n_name' | translate | uppercase }}: {{ material.name }} | ||
@if (material.author) { | ||
<span> | ||
{{ 'i18n_author' | translate | uppercase }}: | ||
{{ material.author }} | ||
</span> | ||
} | ||
@if (material.isbn) { | ||
<span> ISBN: {{ material.isbn }} </span> | ||
} | ||
</span> | ||
</div> | ||
</div> | ||
} | ||
</div> | ||
} | ||
</div> | ||
} | ||
</div> | ||
</div> | ||
</div>`, | ||
}) | ||
export class OptionalSectionsComponent { | ||
allSections = input.required<ExamSection[]>(); | ||
selectedSections = input.required<ExamSection[]>(); | ||
showSections = signal(false); | ||
} |
87 changes: 87 additions & 0 deletions
87
ui/src/app/exam/editor/publication/exam-publication-participants.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// SPDX-FileCopyrightText: 2024 The members of the EXAM Consortium | ||
// | ||
// SPDX-License-Identifier: EUPL-1.2 | ||
|
||
import { Component, input, signal } from '@angular/core'; | ||
import { FormsModule } from '@angular/forms'; | ||
import { NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap'; | ||
import { TranslateModule } from '@ngx-translate/core'; | ||
import { Exam } from 'src/app/exam/exam.model'; | ||
import { CollaborativeExamOwnerSelectorComponent } from './collaborative-exam-owner-picker.component'; | ||
import { ExamParticipantSelectorComponent } from './exam-participant-picker.component'; | ||
import { ExamPreParticipantSelectorComponent } from './exam-pre-participant-picker.component'; | ||
import { OrganisationSelectorComponent } from './organisation-picker.component'; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [ | ||
FormsModule, | ||
NgbPopoverModule, | ||
TranslateModule, | ||
ExamParticipantSelectorComponent, | ||
ExamPreParticipantSelectorComponent, | ||
CollaborativeExamOwnerSelectorComponent, | ||
OrganisationSelectorComponent, | ||
], | ||
selector: 'xm-exam-publication-participants', | ||
template: ` | ||
@if (!collaborative()) { | ||
<div class="row mt-2"> | ||
<div class="col-md-3"> | ||
{{ 'i18n_exam_add_participants_title' | translate }} | ||
</div> | ||
<div class="col-md-9 participant-selector-toggle"> | ||
<label> | ||
<input | ||
type="radio" | ||
[ngModel]="visibleParticipantSelector()" | ||
(ngModelChange)="visibleParticipantSelector.set($event)" | ||
value="participant" | ||
/> | ||
{{ 'i18n_exam_participant_selector_label' | translate }} | ||
<sup | ||
ngbPopover="{{ 'i18n_exam_participants_description' | translate }}" | ||
popoverTitle="{{ 'i18n_instructions' | translate }}" | ||
triggers="mouseenter:mouseleave" | ||
><img src="/assets/images/icon_tooltip.svg" alt="" | ||
/></sup> | ||
</label> | ||
<label class="ms-2"> | ||
<input | ||
type="radio" | ||
[ngModel]="visibleParticipantSelector()" | ||
(ngModelChange)="visibleParticipantSelector.set($event)" | ||
value="pre-participant" | ||
/> | ||
{{ 'i18n_exam_pre_participant_selector_label' | translate }} | ||
<sup | ||
ngbPopover="{{ 'i18n_exam_pre_participants_description' | translate }}" | ||
popoverTitle="{{ 'i18n_instructions' | translate }}" | ||
triggers="mouseenter:mouseleave" | ||
><img src="/assets/images/icon_tooltip.svg" alt="" | ||
/></sup> | ||
</label> | ||
</div> | ||
</div> | ||
} | ||
<!-- Exam participants --> | ||
@if (visibleParticipantSelector() === 'participant') { | ||
<xm-exam-participant-selector [exam]="exam()"></xm-exam-participant-selector> | ||
} | ||
<!-- Exam pre-participants --> | ||
@if (visibleParticipantSelector() === 'pre-participant') { | ||
<xm-exam-pre-participant-selector [exam]="exam()"></xm-exam-pre-participant-selector> | ||
} | ||
@if (collaborative()) { | ||
<xm-collaborative-exam-owner-selector [exam]="exam()"> </xm-collaborative-exam-owner-selector> | ||
<xm-exam-organisation-selector [exam]="exam()"></xm-exam-organisation-selector> | ||
} | ||
`, | ||
}) | ||
export class ExamPublicationParticipantsComponent { | ||
collaborative = input(false); | ||
exam = input.required<Exam>(); | ||
visibleParticipantSelector = signal('participant'); | ||
} |
Oops, something went wrong.