Skip to content

Commit

Permalink
Merge pull request #7324 from jrjohnson/4358-subject-search
Browse files Browse the repository at this point in the history
Replace New Subject Selectors
  • Loading branch information
dartajax committed Aug 30, 2023
2 parents a304078 + c6d9d1a commit 6a90392
Show file tree
Hide file tree
Showing 49 changed files with 2,607 additions and 504 deletions.
127 changes: 7 additions & 120 deletions app/components/reports/new-subject.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -84,126 +84,13 @@
<ValidationError @errors={{get-errors-for this.currentPrepositionalObject}} />
</div>
</p>
{{#if this.currentPrepositionalObject}}
{{#if (includes this.currentPrepositionalObject (w "course session"))}}
<p>
<label>
{{t "general.in"}}
</label>
<select
aria-label={{t "general.year"}}
data-test-report-academic-years
{{on "change" (pick "target.value" this.changeSelectedYear)}}
>
<option selected={{is-empty this.selectedYear}} value="">
{{t "general.allAcademicYears"}}
</option>
{{#each
(sort-by
"title:desc" this.allAcademicYears
) as |year|
}}
<option
selected={{eq year.id this.selectedYear}}
value={{year.id}}
>
{{year.title}}
</option>
{{/each}}
</select>
</p>
{{/if}}
<p>
<label for="which-is-{{templateId}}">
{{t "general.whichIs"}}
</label>
{{#if (eq this.currentPrepositionalObject "instructor")}}
{{#if this.selectedUser}}
<ul class="selected-instructor" data-test-selected-instructor>
<li>
<button
class="link-button"
type="button"
{{on "click" (fn this.changePrepositionalObjectId null)}}
>
{{this.selectedUser.fullName}}
<FaIcon @icon="xmark" class="remove"/>
</button>
</li>
</ul>
{{else}}
<div data-test-instructors>
<UserSearch @addUser={{this.chooseInstructor}} />
<ValidationError @errors={{get-errors-for this.currentPrepositionalObjectId}} />
</div>
{{/if}}
{{else if (eq this.currentPrepositionalObject "mesh term")}}
{{#if this.selectedMeshTerm}}
<ul class="selected-mesh-term" data-test-selected-mesh-term>
<li>
<button
class="link-button"
type="button"
{{on "click" (fn this.changePrepositionalObjectId null)}}
>
<span class="term-title" data-test-name>
{{this.selectedMeshTerm.name}}
</span>
<span class="term-details" data-test-details>
{{this.selectedMeshTerm.id}}
{{#if this.selectedMeshTerm.trees.length}}
- <MeshDescriptorLastTreeNumber @descriptor={{this.selectedMeshTerm}} />
{{/if}}
</span>
<FaIcon @icon="xmark" class="remove" />
</button>
</li>
</ul>
{{else}}
<div data-test-mesh>
<MeshManager @add={{this.chooseMeshTerm}} @editable={{true}} />
<ValidationError @errors={{get-errors-for this.currentPrepositionalObjectId}} />
</div>
{{/if}}
{{else if this.isPrepositionalObjectIdListLoaded}}
<select
id="which-is-{{templateId}}"
data-test-prepositional-objects
{{on "change" (pick "target.value" this.changePrepositionalObjectId)}}
>
{{#each
(sort-by
"active:desc"
"academicYear"
"label"
this.filteredPrepositionalObjectIdList
) as |o|
}}
<option
selected={{eq o.value this.currentPrepositionalObjectId}}
value={{o.value}}
>
{{#if o.academicYear}}
{{o.academicYear}}|
{{/if}}
{{#if (and this.isCourse o.externalId)}}
[{{o.externalId}}] |{{o.label}}
{{else if this.isSession}}
{{o.label}}|{{o.courseTitle}}
{{else}}
{{o.label}}
{{/if}}
{{#unless o.active}}
({{t "general.inactive"}})
{{/unless}}
</option>
{{/each}}
</select>
{{else}}
<LoadingSpinner />
{{/if}}
</p>
{{/if}}
<this.newPrepositionalObjectComponent
@school={{this.currentSchool}}
@templateId={{templateId}}
@currentId={{this.currentPrepositionalObjectId}}
@changeId={{set this.currentPrepositionalObjectId}}
/>
<ValidationError @errors={{get-errors-for this.currentPrepositionalObjectId}} data-test-validation-error />
<div class="input-buttons">
<button type="button" class="done text" {{on "click" (perform this.save)}} data-test-save>
{{#if this.save.isRunning}}
Expand Down
Loading

0 comments on commit 6a90392

Please sign in to comment.