-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8256 from stopfstedt/replace_render_modifiers_in_…
…curr_inv_report_overview replaced render modifiers in curr inventory report overview component with getters.
- Loading branch information
Showing
3 changed files
with
189 additions
and
178 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
293 changes: 141 additions & 152 deletions
293
packages/frontend/app/components/curriculum-inventory/report-overview.hbs
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 |
---|---|---|
@@ -1,170 +1,159 @@ | ||
<section | ||
class="curriculum-inventory-report-overview" | ||
{{did-insert (perform this.load)}} | ||
data-test-curriculum-inventory-report-overview | ||
...attributes | ||
> | ||
{{#unless this.load.isRunning}} | ||
{{#let (unique-id) as |templateId|}} | ||
<div class="report-overview-header"> | ||
<div class="title" data-test-title> | ||
{{t "general.overview"}} | ||
</div> | ||
<div class="report-overview-actions"> | ||
<LinkTo | ||
@route="verification-preview" | ||
@model={{@report}} | ||
class="verification-preview" | ||
data-test-transition-to-verification-preview | ||
{{#let (unique-id) as |templateId|}} | ||
<div class="report-overview-header"> | ||
<div class="title" data-test-title> | ||
{{t "general.overview"}} | ||
</div> | ||
<div class="report-overview-actions"> | ||
<LinkTo | ||
@route="verification-preview" | ||
@model={{@report}} | ||
class="verification-preview" | ||
data-test-transition-to-verification-preview | ||
> | ||
<FaIcon | ||
@icon="table" | ||
@fixedWidth={{true}} | ||
@title={{t "general.verificationPreviewFor" name=@report.name}} | ||
/> | ||
</LinkTo> | ||
{{#if this.showRollover}} | ||
<button | ||
class="link-button rollover" | ||
type="button" | ||
aria-label={{t "general.curriculumInventoryReportRollover"}} | ||
{{on "click" this.transitionToRollover}} | ||
data-test-transition-to-rollover | ||
> | ||
<FaIcon | ||
@icon="table" | ||
@icon="shuffle" | ||
@fixedWidth={{true}} | ||
@title={{t "general.verificationPreviewFor" name=@report.name}} | ||
@title={{t "general.curriculumInventoryReportRollover"}} | ||
/> | ||
</LinkTo> | ||
{{#if this.showRollover}} | ||
<button | ||
class="link-button rollover" | ||
type="button" | ||
aria-label={{t "general.curriculumInventoryReportRollover"}} | ||
{{on "click" this.transitionToRollover}} | ||
data-test-transition-to-rollover | ||
</button> | ||
{{/if}} | ||
</div> | ||
</div> | ||
<div class="curriculum-inventory-report-overview-content"> | ||
<div class="block start-date" data-test-start-date> | ||
<label> | ||
{{t "general.start"}}: | ||
</label> | ||
<span> | ||
{{#if @canUpdate}} | ||
<EditableField | ||
@value={{format-date @report.startDate day="2-digit" month="2-digit" year="numeric"}} | ||
@save={{perform this.changeStartDate}} | ||
@close={{this.revertStartDateChanges}} | ||
> | ||
<FaIcon | ||
@icon="shuffle" | ||
@fixedWidth={{true}} | ||
@title={{t "general.curriculumInventoryReportRollover"}} | ||
<DatePicker | ||
@value={{this.startDate}} | ||
@onChange={{queue (set this "startDate") (fn this.addErrorDisplayFor "startDate")}} | ||
data-test-start-date-picker | ||
/> | ||
</button> | ||
<ValidationError @validatable={{this}} @property="startDate" /> | ||
</EditableField> | ||
{{else}} | ||
{{format-date @report.startDate day="2-digit" month="2-digit" year="numeric"}} | ||
{{/if}} | ||
</div> | ||
</span> | ||
</div> | ||
<div class="curriculum-inventory-report-overview-content"> | ||
<div class="block start-date" data-test-start-date> | ||
<label> | ||
{{t "general.start"}}: | ||
</label> | ||
<span> | ||
{{#if @canUpdate}} | ||
<EditableField | ||
@value={{format-date | ||
@report.startDate | ||
day="2-digit" | ||
month="2-digit" | ||
year="numeric" | ||
}} | ||
@save={{perform this.changeStartDate}} | ||
@close={{this.revertStartDateChanges}} | ||
> | ||
<DatePicker | ||
@value={{this.startDate}} | ||
@onChange={{queue | ||
(set this "startDate") | ||
(fn this.addErrorDisplayFor "startDate") | ||
}} | ||
data-test-start-date-picker | ||
/> | ||
<ValidationError @validatable={{this}} @property="startDate" /> | ||
</EditableField> | ||
{{else}} | ||
{{format-date @report.startDate day="2-digit" month="2-digit" year="numeric"}} | ||
{{/if}} | ||
</span> | ||
</div> | ||
<div class="block end-date" data-test-end-date> | ||
<label> | ||
{{t "general.end"}}: | ||
</label> | ||
<span> | ||
{{#if @canUpdate}} | ||
<EditableField | ||
@value={{format-date @report.endDate day="2-digit" month="2-digit" year="numeric"}} | ||
@save={{perform this.changeEndDate}} | ||
@close={{this.revertEndDateChanges}} | ||
> | ||
<DatePicker | ||
@value={{this.endDate}} | ||
@onChange={{queue (set this "endDate") (fn this.addErrorDisplayFor "endDate")}} | ||
data-test-end-date-picker | ||
/> | ||
<ValidationError @validatable={{this}} @property="endDate" /> | ||
</EditableField> | ||
{{else}} | ||
{{format-date @report.endDate day="2-digit" month="2-digit" year="numeric"}} | ||
{{/if}} | ||
</span> | ||
</div> | ||
<div class="block academic-year" data-test-academic-year> | ||
<label for="year-{{templateId}}"> | ||
{{t "general.academicYear"}}: | ||
</label> | ||
{{#if this.linkedCoursesLoaded}} | ||
{{#if (and @canUpdate (not this.hasLinkedCourses))}} | ||
<EditableField | ||
@value={{this.yearLabel}} | ||
@save={{perform this.changeYear}} | ||
@close={{this.revertYearChanges}} | ||
<div class="block end-date" data-test-end-date> | ||
<label> | ||
{{t "general.end"}}: | ||
</label> | ||
<span> | ||
{{#if @canUpdate}} | ||
<EditableField | ||
@value={{format-date @report.endDate day="2-digit" month="2-digit" year="numeric"}} | ||
@save={{perform this.changeEndDate}} | ||
@close={{this.revertEndDateChanges}} | ||
> | ||
<DatePicker | ||
@value={{this.endDate}} | ||
@onChange={{queue (set this "endDate") (fn this.addErrorDisplayFor "endDate")}} | ||
data-test-end-date-picker | ||
/> | ||
<ValidationError @validatable={{this}} @property="endDate" /> | ||
</EditableField> | ||
{{else}} | ||
{{format-date @report.endDate day="2-digit" month="2-digit" year="numeric"}} | ||
{{/if}} | ||
</span> | ||
</div> | ||
<div class="block academic-year" data-test-academic-year> | ||
<label for="year-{{templateId}}"> | ||
{{t "general.academicYear"}}: | ||
</label> | ||
{{#if this.linkedCoursesLoaded}} | ||
{{#if (and @canUpdate (not this.hasLinkedCourses))}} | ||
<EditableField | ||
@value={{this.yearLabel}} | ||
@save={{perform this.changeYear}} | ||
@close={{this.revertYearChanges}} | ||
> | ||
<select | ||
id="year-{{templateId}}" | ||
{{on "change" (pick "target.value" (set this "year"))}} | ||
> | ||
<select | ||
id="year-{{templateId}}" | ||
{{on "change" (pick "target.value" (set this "year"))}} | ||
> | ||
{{#each this.yearOptions as |obj|}} | ||
<option value={{obj.id}} selected={{eq obj.id this.year}}>{{obj.title}}</option> | ||
{{/each}} | ||
</select> | ||
</EditableField> | ||
{{else}} | ||
<span> | ||
{{this.yearLabel}} | ||
</span> | ||
{{/if}} | ||
{{#each this.yearOptions as |obj|}} | ||
<option value={{obj.id}} selected={{eq obj.id this.year}}>{{obj.title}}</option> | ||
{{/each}} | ||
</select> | ||
</EditableField> | ||
{{else}} | ||
<span> | ||
{{this.yearLabel}} | ||
</span> | ||
{{/if}} | ||
{{/if}} | ||
</div> | ||
<div class="block program" data-test-program> | ||
<label> | ||
{{t "general.program"}}: | ||
</label> | ||
<span> | ||
{{@report.program.title}} | ||
{{#if @report.program.shortTitle}} | ||
({{@report.program.shortTitle}}) | ||
{{/if}} | ||
</div> | ||
<div class="block program" data-test-program> | ||
<label> | ||
{{t "general.program"}}: | ||
</label> | ||
<span> | ||
{{@report.program.title}} | ||
{{#if @report.program.shortTitle}} | ||
({{@report.program.shortTitle}}) | ||
{{/if}} | ||
</span> | ||
</div> | ||
<div class="description" data-test-description> | ||
<label for="description-{{templateId}}"> | ||
{{t "general.description"}}: | ||
</label> | ||
<span> | ||
{{#if @canUpdate}} | ||
<EditableField | ||
@value={{this.description}} | ||
@save={{perform this.changeDescription}} | ||
@close={{this.revertDescriptionChanges}} | ||
@clickPrompt={{if this.description this.description (t "general.clickToEdit")}} | ||
@closeOnEscape={{true}} | ||
as |isSaving| | ||
</span> | ||
</div> | ||
<div class="description" data-test-description> | ||
<label for="description-{{templateId}}"> | ||
{{t "general.description"}}: | ||
</label> | ||
<span> | ||
{{#if @canUpdate}} | ||
<EditableField | ||
@value={{this.description}} | ||
@save={{perform this.changeDescription}} | ||
@close={{this.revertDescriptionChanges}} | ||
@clickPrompt={{if this.description this.description (t "general.clickToEdit")}} | ||
@closeOnEscape={{true}} | ||
as |isSaving| | ||
> | ||
<textarea | ||
id="description-{{templateId}}" | ||
value={{this.description}} | ||
disabled={{this.isSaving}} | ||
{{on "input" (pick "target.value" (set this "description"))}} | ||
{{on "keyup" (fn this.addErrorDisplayFor "description")}} | ||
placeholder={{t "general.reportDescriptionPlaceholder"}} | ||
> | ||
<textarea | ||
id="description-{{templateId}}" | ||
value={{this.description}} | ||
disabled={{this.isSaving}} | ||
{{on "input" (pick "target.value" (set this "description"))}} | ||
{{on "keyup" (fn this.addErrorDisplayFor "description")}} | ||
placeholder={{t "general.reportDescriptionPlaceholder"}} | ||
> | ||
{{this.description}} | ||
</textarea> | ||
<ValidationError @validatable={{this}} @property="description" /> | ||
</EditableField> | ||
{{else}} | ||
{{this.description}} | ||
{{/if}} | ||
</span> | ||
</div> | ||
{{this.description}} | ||
</textarea> | ||
<ValidationError @validatable={{this}} @property="description" /> | ||
</EditableField> | ||
{{else}} | ||
{{this.description}} | ||
{{/if}} | ||
</span> | ||
</div> | ||
{{/let}} | ||
{{/unless}} | ||
</div> | ||
{{/let}} | ||
</section> |
Oops, something went wrong.