Koha/koha-tmpl/intranet-tmpl/prog/en/includes/admin-items-search-field-form.inc
Owen Leonard fd74b271db Bug 15887: Revise layout and behavior of item search fields management
This patch adds some JavaScript to the item search fields management
page so that the add form is not displayed by default. This simplifies
the interface and makes it more consistent with other similar
interfaces.

Also changed in this patch:
- Changing instances of "Items search fields" to "Item search fields."
- Correct form structure to use ordered list
- Add "required" classes and enable built-in JS form validation.
- Add explicitly labeled "Choose" options to <select>s.
- Add missing ids to form fields (labels don't work without them).
- Correct classes of message and alert dialogs.
- Add JS confirmation of deletions.
- Convert MARC tag and subfield dropdowns to regular inputs (Bug 15384).

To test, apply the patch and go to Administration.

- Confirm that the "Item search fields" link is correct.
- Follow the link and confirm that the list of existing fields is shown
  by default, or a message saying there are no existing fields.
- Click the "New search field" button and confirm that it displays the
  entry form.
  - Confirm that submitting an empty form does not work.
  - Confirm that clicking the "Cancel" link correctly hides the form.
  - Confirm that submitting valid data works correctly.
- In the table of existing item search fields, confirm that the "Edit"
  button works correctly.
  - Confirm that submitting edits works correctly.
- In the table of existing item search fields, confirm that clicking
  "Delete" highlights the row in question and a confirmation dialog
  appears.
  - Test both canceling and confirming deletion.

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as described. JSHint OK, koha-qa OK.

Revision per QA: Undid the change making tag and subfield inputs text
fields.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
2016-03-02 22:36:17 +00:00

62 lines
2.3 KiB
HTML

<ol>
<li>
[% IF field %]
<span class="label">Name: </span>
[% field.name %]
<input type="hidden" name="name" value="[% field.name %]">
[% ELSE %]
<label class="required" for="name">Name: </label>
<input type="text" name="name" id="name" class="required" required="required" />
<span class="required">Required</span>
[% END %]
</li>
<li>
<label class="required" for="label">Label: </label>
[% IF field %]
<input type="text" name="label" id="label" value="[% field.label %]" class="required" required="required" />
[% ELSE %]
<input type="text" name="label" id="label" class="required" required="required" />
[% END %]
<span class="required">Required</span>
</li>
<li>
<label for="tagfield" required="required">MARC field: </label>
<select id="tagfield" name="tagfield" class="required" required="required">
[% FOREACH tagfield IN ['001'..'999'] %]
[% IF field && field.tagfield == tagfield %]
<option value="[% tagfield %]" selected="selected">[% tagfield %]</option>
[% ELSE %]
<option value="[% tagfield %]">[% tagfield %]</option>
[% END %]
[% END %]
</select>
<span class="required">Required</span>
</li>
<li>
<label for="tagsubfield">MARC subfield: </label>
<select id="tagsubfield" name="tagsubfield">
[% codes = [''] %]
[% codes = codes.merge([0..9], ['a'..'z']) %]
[% FOREACH tagsubfield IN codes %]
[% IF field && field.tagsubfield == tagsubfield %]
<option value="[% tagsubfield %]" selected="selected">[% tagsubfield %]</option>
[% ELSE %]
<option value="[% tagsubfield %]">[% tagsubfield %]</option>
[% END %]
[% END %]
</select>
</li>
<li>
<label for="authorised_values_category">Authorised values category: </label>
<select id="authorised_values_category" name="authorised_values_category">
<option value="">- None -</option>
[% FOREACH category IN authorised_values_categories %]
[% IF field && field.authorised_values_category == category %]
<option value="[% category %]" selected="selected">[% category %]</option>
[% ELSE %]
<option value="[% category %]">[% category %]</option>
[% END %]
[% END %]
</select>
</li>
</ol>