Bugzilla – Attachment 157151 Details for
Bug 34401
Inconsistencies in Item search fields page titles, breadcrumbs, and header
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34401: Fix inconsistencies in Item search fields page titles, breadcrumbs, and headers
Bug-34401-Fix-inconsistencies-in-Item-search-field.patch (text/plain), 11.59 KB, created by
Katrin Fischer
on 2023-10-14 15:28:38 UTC
(
hide
)
Description:
Bug 34401: Fix inconsistencies in Item search fields page titles, breadcrumbs, and headers
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2023-10-14 15:28:38 UTC
Size:
11.59 KB
patch
obsolete
>From eafc89ff35bbd6efd1ee1b1fe4c187545b6a2b9e Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Wed, 4 Oct 2023 10:51:14 +0000 >Subject: [PATCH] Bug 34401: Fix inconsistencies in Item search fields page > titles, breadcrumbs, and headers > >This patch fixes some inconsistencies in the item search fields >administration page, making sure the page title, breadcrumb navigation, >and page headers are consistent with each other. > >The patch makes some changes to the way new item search fields are added >in order to keep the display consistent with other similar interfaces: >The "add" form is no longer shown dynamically from the page listing item >search fields. Clicking the "New search field" toolbar button will now >take you to the same template used for editing existing search fields. >This allows us to put the correct context into page title, breadcrumbs, >and headings. > >To test, apply the patch and go to Administration -> Item search fields. >Test the process of adding a new search field and editing an existing >search field. > >Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov> >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > admin/items_search_field.pl | 14 +++++++- > admin/items_search_fields.pl | 18 ++-------- > .../en/modules/admin/items_search_field.tt | 36 ++++++++++++------- > .../en/modules/admin/items_search_fields.tt | 21 ++--------- > .../prog/js/item_search_fields.js | 28 +-------------- > 5 files changed, 43 insertions(+), 74 deletions(-) > >diff --git a/admin/items_search_field.pl b/admin/items_search_field.pl >index 569dce65bb..35ee482091 100755 >--- a/admin/items_search_field.pl >+++ b/admin/items_search_field.pl >@@ -22,7 +22,7 @@ use CGI; > use C4::Auth qw( get_template_and_user ); > use C4::Output qw( output_html_with_http_headers ); > >-use Koha::Item::Search::Field qw(GetItemSearchField ModItemSearchField); >+use Koha::Item::Search::Field qw(GetItemSearchField AddItemSearchField ModItemSearchField); > > my $cgi = CGI->new; > >@@ -48,6 +48,18 @@ if ($op eq 'mod') { > my $updated = ($field) ? 1 : 0; > print $cgi->redirect('/cgi-bin/koha/admin/items_search_fields.pl?updated=' . $updated); > exit; >+} elsif ( $op eq 'add' ) { >+ my %vars = $cgi->Vars; >+ my $field; >+ my @params = qw(name label tagfield tagsubfield authorised_values_category); >+ @$field{@params} = @vars{@params}; >+ if ( $field->{authorised_values_category} eq '' ) { >+ $field->{authorised_values_category} = undef; >+ } >+ $field = AddItemSearchField($field); >+ my $added = ($field) ? 1 : 0; >+ print $cgi->redirect( '/cgi-bin/koha/admin/items_search_fields.pl?added=' . $added ); >+ exit; > } > > my $field = GetItemSearchField($name); >diff --git a/admin/items_search_fields.pl b/admin/items_search_fields.pl >index 0e62eb67c6..c9e7d9380c 100755 >--- a/admin/items_search_fields.pl >+++ b/admin/items_search_fields.pl >@@ -22,7 +22,7 @@ use CGI; > use C4::Auth qw( get_template_and_user ); > use C4::Output qw( output_html_with_http_headers ); > >-use Koha::Item::Search::Field qw(AddItemSearchField GetItemSearchFields DelItemSearchField); >+use Koha::Item::Search::Field qw(GetItemSearchFields DelItemSearchField); > > my $cgi = CGI->new; > >@@ -35,21 +35,7 @@ my ($template, $borrowernumber, $cookie) = get_template_and_user({ > > my $op = $cgi->param('op') || ''; > >-if ($op eq 'add') { >- my %vars = $cgi->Vars; >- my $field; >- my @params = qw(name label tagfield tagsubfield authorised_values_category); >- @$field{@params} = @vars{@params}; >- if ( $field->{authorised_values_category} eq '' ) { >- $field->{authorised_values_category} = undef; >- } >- $field = AddItemSearchField($field); >- if ($field) { >- $template->param(field_added => $field); >- } else { >- $template->param(field_not_added => 1); >- } >-} elsif ($op eq 'del') { >+if ($op eq 'del') { > my $name = $cgi->param('name'); > my $rv = DelItemSearchField($name); > if ($rv) { >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 564fa8a263..1ae7519dbb 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 >@@ -5,6 +5,11 @@ > [% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>[% FILTER collapse %] >+ [% IF (field) %] >+ [% tx("Modify search field '{field}'", { field = field.name }) | html %] >+ [% ELSE %] >+ [% t("New search field") | html %] >+ [% END %] › > [% t("Item search fields") | html %] › > [% t("Administration") | html %] › > [% t("Koha") | html %] >@@ -23,17 +28,17 @@ > <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> > [% END %] > >+ [% WRAPPER breadcrumb_item %] >+ <a href="/cgi-bin/koha/admin/items_search_fields.pl">Item search fields</a> >+ [% END %] > [% IF (field) %] >- [% WRAPPER breadcrumb_item %] >- <a href="/cgi-bin/koha/admin/items_search_fields.pl">Item search fields</a> >- [% END %] > [% WRAPPER breadcrumb_item bc_active= 1 %] >- <span>Modify search field [% field.name | html %]</span> >+ [% tx("Modify search field '{field}'", { field = field.name }) | html %] > [% END %] > > [% ELSE %] > [% WRAPPER breadcrumb_item bc_active= 1 %] >- <span>Item search fields</span> >+ <span>New search field</span> > [% END %] > [% END %] > [% END #/ WRAPPER breadcrumbs %] >@@ -44,15 +49,22 @@ > <div class="col-sm-10 col-sm-push-2"> > <main> > >- <h1>Item search field: [% field.label | html %]</h1> >+ <h1> >+ [% IF (field) %] >+ [% tx("Modify search field '{field}'", { field = field.name }) | html %] >+ [% ELSE %] >+ [% t("New search field") | html %] >+ [% END %] >+ </h1> > >- <form action="/cgi-bin/koha/admin/items_search_field.pl" method="POST" id="edit_search_fields"> >+ <form action="/cgi-bin/koha/admin/items_search_field.pl" method="POST" id="search_fields"> > <fieldset class="rows"> >- <legend>Edit field</legend> >- [% INCLUDE 'admin-items-search-field-form.inc' field=field %] >- <div> >- <input type="hidden" name="op" value="mod" /> >- </div> >+ [% INCLUDE 'admin-items-search-field-form.inc' field=field %] >+ [% IF (field) %] >+ <input type="hidden" name="op" value="mod" /> >+ [% ELSE %] >+ <input type="hidden" name="op" value="add" /> >+ [% END %] > </fieldset> > <fieldset class="action"> > <input type="submit" class="btn btn-primary" value="Submit" /> >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 000cc01017..a7bca402f0 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 >@@ -19,9 +19,6 @@ > > [% WRAPPER 'sub-header.inc' %] > [% WRAPPER breadcrumbs %] >- [% WRAPPER breadcrumb_item %] >- <a href="/cgi-bin/koha/mainpage.pl">Home</a> >- [% END %] > [% WRAPPER breadcrumb_item %] > <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> > [% END %] >@@ -37,12 +34,12 @@ > <main> > > <div id="toolbar" class="btn-toolbar"> >- <a class="btn btn-default" id="new_search_field" href="/cgi-bin/koha/admin/items_search_fields.pl"><i class="fa fa-plus"></i> New search field</a> >+ <a class="btn btn-default" href="/cgi-bin/koha/admin/items_search_field.pl"><i class="fa fa-plus"></i> New search field</a> > </div> > > [% IF field_added %] > <div class="dialog message"> >- Field successfully added: [% field_added.label | html %] >+ Field successfully added > </div> > [% ELSIF field_not_added %] > <div class="dialog alert"> >@@ -60,7 +57,7 @@ > </div> > [% ELSIF field_updated %] > <div class="dialog message"> >- Field successfully updated: [% field_updated.label | html %] >+ Field successfully updated > </div> > [% ELSIF field_not_updated %] > <div class="dialog alert"> >@@ -108,18 +105,6 @@ > </div> > [% END %] > >- <form id="add_field_form" action="/cgi-bin/koha/admin/items_search_fields.pl" method="POST"> >- <fieldset class="rows"> >- <legend><h1>Add a new field</h1></legend> >- [% INCLUDE 'admin-items-search-field-form.inc' field=undef %] >- <input type="hidden" name="op" value="add" /> >- </fieldset> >- <fieldset class="action"> >- <input type="submit" class="btn btn-primary" value="Submit" /> >- <a href="#" class="cancel hide_form">Cancel</a> >- </fieldset> >- </form> >- > </main> > </div> <!-- /.col-sm-10.col-sm-push-2 --> > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/item_search_fields.js b/koha-tmpl/intranet-tmpl/prog/js/item_search_fields.js >index 92c98f3027..22af448f8c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/item_search_fields.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/item_search_fields.js >@@ -5,19 +5,6 @@ jQuery.validator.addMethod("marcfield", function(value, element) { > }, __("Please enter letters or numbers") ); > > $(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(); >- }); >- $(".hide_form").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( __("Are you sure you want to delete this field?") )) { >@@ -28,20 +15,7 @@ $(document).ready(function(){ > } > }); > >- $("#add_field_form").validate({ >- rules: { >- label: "required", >- tagfield: { >- required: true, >- marcfield: true >- }, >- tagsubfield: { >- marcfield: true >- } >- } >- }); >- >- $("#edit_search_fields").validate({ >+ $("#search_fields").validate({ > rules: { > label: "required", > tagfield: { >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 34401
:
156580
|
156990
| 157151