From fd74b271db61bf88368c803b1b2bfb76e62b0e6f Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 23 Feb 2016 14:27:31 -0500 Subject: [PATCH] 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 - - [% ELSE %] - - [% END %] + [% IF field %] + Name: + [% field.name %] + + [% ELSE %] + + + Required + [% END %]
  • - + [% IF field %] - + [% ELSE %] - + [% END %] + Required
  • - - [% FOREACH tagfield IN ['001'..'999'] %] [% IF field && field.tagfield == tagfield %] @@ -27,10 +30,11 @@ [% END %] [% END %] + Required
  • - - [% codes = [''] %] [% codes = codes.merge([0..9], ['a'..'z']) %] [% FOREACH tagsubfield IN codes %] @@ -43,8 +47,8 @@
  • - - [% FOREACH category IN authorised_values_categories %] [% IF field && field.authorised_values_category == category %] @@ -55,4 +59,4 @@ [% END %]
  • - + diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc index 6e6fa4915a..74bd3dc39f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc @@ -45,7 +45,7 @@
  • Classification sources
  • Record matching rules
  • OAI sets configuration
  • -
  • Items search fields
  • +
  • Item search fields
  • Acquisition parameters
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/item_search_fields.js b/koha-tmpl/intranet-tmpl/prog/en/js/item_search_fields.js new file mode 100644 index 0000000000..32418b5d29 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/js/item_search_fields.js @@ -0,0 +1,24 @@ +$(document).ready(function(){ + $("#add_field_form").hide(); + $("#new_search_field").on("click",function(e){ + e.preventDefault(); + $("#add_field_form").show(); + $(".dialog").hide(); + $("#search_fields_list,#toolbar").hide(); + }); + $(".cancel").on("click",function(e){ + e.preventDefault(); + $("#add_field_form").hide(); + $(".dialog").show(); + $("#search_fields_list,#toolbar").show(); + }); + $(".field-delete").on("click",function(){ + $(this).parent().parent().addClass("highlighted-row"); + if( confirm( MSG_ITEM_SEARCH_DELETE_CONFIRM )){ + return true; + } else { + $(this).parent().parent().removeClass("highlighted-row"); + return false; + } + }); +}); \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt index d0f65f2241..eea0b0d78c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt @@ -83,8 +83,8 @@
    Manage rules for automatically matching MARC records during record imports.
    OAI sets configuration
    Manage OAI Sets
    -
    Items search fields
    -
    Manage custom fields for items search
    +
    Item search fields
    +
    Manage custom fields for item search.

    Acquisition parameters

    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/items_search_field.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/items_search_field.tt index 6e0f373a3a..ed1f9c5890 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/items_search_field.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/items_search_field.tt @@ -1,5 +1,5 @@ [% INCLUDE 'doc-head-open.inc' %] - Koha › Administration › Items search fields + Koha › Administration › Item search fields [% INCLUDE 'doc-head-close.inc' %] @@ -8,7 +8,7 @@ @@ -16,21 +16,21 @@
    -

    Items search field: [% field.label %]

    +

    Item search field: [% field.label %]

    -
    +
    Edit field [% INCLUDE 'admin-items-search-field-form.inc' field=field %]
    -
    - -
    +
    +
    + + Cancel
    - Return to items search fields overview page
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/items_search_fields.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/items_search_fields.tt index 200e614aef..f5b980c21f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/items_search_fields.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/items_search_fields.tt @@ -1,6 +1,10 @@ [% INCLUDE 'doc-head-open.inc' %] - Koha › Administration › Items search fields + Koha › Administration › Item search fields [% INCLUDE 'doc-head-close.inc' %] + + [% INCLUDE 'header.inc' %] @@ -8,83 +12,96 @@
    + + + [% IF field_added %] -
    +
    Field successfully added: [% field_added.label %]
    [% ELSIF field_not_added %] -
    -

    Failed to add field. Please check if the field name doesn't already exist.

    +
    +

    Failed to add field. Please make sure the field name doesn't already exist.

    Check logs for more details.

    [% ELSIF field_deleted %] -
    +
    Field successfully deleted.
    [% ELSIF field_not_deleted %] -
    +

    Failed to delete field.

    Check logs for more details.

    [% ELSIF field_updated %] -
    +
    Field successfully updated: [% field_updated.label %]
    [% ELSIF field_not_updated %] -
    +

    Failed to update field.

    Check logs for more details.

    [% END %] -

    Items search fields

    [% IF fields.size %] - - - - - - - - - - - - - [% FOREACH field IN fields %] - - - - - - - - - [% END %] - -
    NameLabelMARC fieldMARC subfieldAuthorised values categoryOperations
    [% field.name %][% field.label %][% field.tagfield %][% field.tagsubfield %][% field.authorised_values_category %] - Edit - Delete -
    +
    +

    Item search fields

    + + + + + + + + + + + + + + [% FOREACH field IN fields %] + + + + + + + + + [% END %] + +
    NameLabelMARC fieldMARC subfieldAuthorised values categoryOperations
    [% field.name %][% field.label %][% field.tagfield %][% field.tagsubfield %][% field.authorised_values_category %] + Edit + Delete +
    +
    + [% ELSE %] +
    + There are no item search fields defined. +
    [% END %] -
    + +
    Add a new field [% INCLUDE 'admin-items-search-field-form.inc' field=undef %] -
    - -
    -
    - -
    + +
    +
    + + Cancel
    +
    -- 2.39.5