LP1907977: Display course name and number in course material editor
authorJane Sandberg <sandbej@linnbenton.edu>
Sat, 23 Jan 2021 00:33:15 +0000 (16:33 -0800)
committerGalen Charlton <gmc@equinoxinitiative.org>
Wed, 10 Mar 2021 22:19:59 +0000 (17:19 -0500)
To test:

1) Go to Administration > Local > Course List
2) Make sure you have a variety of courses added.
3) Double click on a course that already has materials
attached to it.
4) Go to the materials tab.
5) Select a material and choose Edit
6) Note that the Course combobox shows both the course
number (HST243) and course name (History of Indonesia).
7) Note that you can blank out that field and type to
complete to get other courses in the same format.

Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Signed-off-by: Beth Willis <willis@noblenet.org>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts
Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-associate-material.component.html

index fb8b900..d21ad5f 100644 (file)
@@ -201,6 +201,9 @@ export class ComboboxComponent implements ControlValueAccessor, OnInit, AfterVie
             // FIXME: it would be cleaner if we could somehow use
             // the per-IDL-class ng-templates directly
             switch (this.idlClass) {
+                case 'acmc':
+                    return fm.course_number() + ': ' + fm.name();
+                    break;
                 case 'acqf':
                     return fm.code() + ' (' + fm.year() + ')';
                     break;
index 5f392cd..aec9838 100644 (file)
 <ng-template #idlClassLabel let-r="result" i18n>
   {{r.label}}
 </ng-template>
+<ng-template #acmcTemplate
+  let-field="field" let-record="record">
+  <eg-combobox idlClass="acmc" [required]="true"
+    [selectedId]="record['course']()"
+    (onChange)="($event) ? record['course']($event.id) : ''">
+  </eg-combobox>
+</ng-template>
 
 <ng-container *ngIf="!isDialog()">
   <!-- in "inline" mode, render the grid pane right here -->
   </ng-container>
 </ng-container>
 
-<eg-fm-record-editor #editDialog idlClass='acmcm' [fieldOptions]="{course: {linkedSearchField: 'course_number'}}"
+<eg-fm-record-editor #editDialog idlClass='acmcm' [fieldOptions]="{course: {customTemplate:{template:acmcTemplate}}}"
   [preloadLinkedValues]="true"
   hiddenFields="id,item,original_callnumber,original_status,original_location,original_circ_modifier,record,temporary_record">
 </eg-fm-record-editor>