Bugzilla – Attachment 160170 Details for
Bug 34082
Cut some redundancy in OPAC JavaScript string translations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34082: Cut some redundancy in OPAC JavaScript string translations
Bug-34082-Cut-some-redundancy-in-OPAC-JavaScript-s.patch (text/plain), 8.64 KB, created by
David Nind
on 2023-12-20 22:37:48 UTC
(
hide
)
Description:
Bug 34082: Cut some redundancy in OPAC JavaScript string translations
Filename:
MIME Type:
Creator:
David Nind
Created:
2023-12-20 22:37:48 UTC
Size:
8.64 KB
patch
obsolete
>From 6d822c20e06a69b4acef175ac01cb84aa2061062 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Fri, 16 Jun 2023 16:07:35 +0000 >Subject: [PATCH] Bug 34082: Cut some redundancy in OPAC JavaScript string > translations > >This patch consolidates some JS code so that we're not defining a string >ine one place and using it once elsewhere. With JS-friendly translations >tools we don't need this workaround. > >To test, apply the patch and go to Administration -> Circulation and >fine rules. > >- Configure an item type rule with the "OPAC item level holds" setting > set to "Force." >- Log in to the OPAC and locate a record with that item type and > multiple items. An example in the sample data: > /cgi-bin/koha/opac-detail.pl?biblionumber=12 >- Place a hold on the item. > - The holds screen should show a table of items. > - Open your browser's developer tools. > - In the Console tab, paste in this code and hit ENTER: > > $(".checkitem").prop("checked", false); > > - All radio buttons in the table of items should be cleared. >- Click the "Confirm hold" button. You should get an alert: > "Expecting a specific item selection." > >- Log in to the OPAC and click the "Search history" tab from the user > summary page. >- Check one or more checkboxes next to search history items and click > the "Remove selected searches." > - You should get an alert: "Are you sure you want to delete selected > search history entries?" > >- Log in to the OPAC, create a new list if necessary, and add some > titles to the list. >- Test that confirmation messages show correctly: > - Deleting a single title by clicking the "Remove > from this list" link. > - Deleting multiple titles by checking boxes and > clicking "Remove from list." > - Deleting a list. > >- In Administration -> System preferences, enable TagsEnabled if > necessary. >- Log in to the OPAC and tag one or more items. >- From the Tag cloud page, check one or more boxes for your tags, and > click the "Delete selected tags" button at the bottom of the page. >- The confirmation message should display correctly. > >- To test the change to opac-account.tt you have to install a payment > plugin, e.g. > https://gitlab.com/thekesolutions/plugins/koha-plugin-pay-via-paypal, > and attempt to submit a payment which is below the minimum payment > threshold set in the plugin's configuration. > >Signed-off-by: David Nind <david@davidnind.com> >--- > .../opac-tmpl/bootstrap/en/modules/opac-account.tt | 3 +-- > .../opac-tmpl/bootstrap/en/modules/opac-reserve.tt | 10 +++------- > .../bootstrap/en/modules/opac-search-history.tt | 4 +--- > .../opac-tmpl/bootstrap/en/modules/opac-shelves.tt | 4 ---- > koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt | 3 +-- > 5 files changed, 6 insertions(+), 18 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt >index f1ed9cc89f..684b4f4b14 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt >@@ -79,7 +79,6 @@ > <script> > $( document ).ready(function() { > >- var MSG_MIN_THRESHOLD = _("Minimum amount needed by this service is %s"); > var txtActivefilter = _("Filter paid transactions"); > var txtInactivefilter = _("Show all transactions"); > >@@ -169,7 +168,7 @@ $( document ).ready(function() { > help.addClass('hide'); > } else { > $(self).prop('disabled', true); >- help.html(MSG_MIN_THRESHOLD.format(parseInt(threshold,10).toFixed(2))).removeClass('hide'); >+ help.html( _("Minimum amount needed by this service is %s").format(parseInt(threshold,10).toFixed(2)) ).removeClass('hide'); > } > resolve(); > }) >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt >index 7b1e9d3708..3f34403217 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt >@@ -498,10 +498,6 @@ > [% INCLUDE 'calendar.inc' %] > [% INCLUDE 'datatables.inc' %] > <script> >- var MSG_NO_ITEM_SELECTED = _("Expecting a specific item selection."); >- var MSG_EMPTY_START_DATE = _("Hold start date should be filled."); >- var MSG_EMPTY_END_DATE = _("Hold expiration date should be filled."); >- > $(document).ready(function() { > > $(".toggle_unholdable").click(function(e){ >@@ -667,13 +663,13 @@ > } > > if( $(".holddatefrom").prop('required') && $("#from"+ biblioNum).val() == '' ) { >- alert(MSG_EMPTY_START_DATE); >+ alert( _("Hold start date should be filled.") ); > badBib = biblioNum; > if( $("#from"+biblioNum).parent(":hidden").length ) $("#toggle-hold-options-"+biblioNum).trigger('click'); > $("#from"+biblioNum).siblings('.flatpickr_wrapper').find('.flatpickr-input').trigger('focus'); > return false; > } else if( $(".futuredate").prop('required') && $("#to"+ biblioNum).val() == '' ) { >- alert(MSG_EMPTY_END_DATE); >+ alert( _("Hold expiration date should be filled.") ); > badBib = biblioNum; > if( $("#to"+biblioNum).parent(":hidden").length ) $("#toggle-hold-options-"+biblioNum).trigger('click'); > $("#to"+biblioNum).siblings('.flatpickr_wrapper').find('.flatpickr-input').trigger('focus'); >@@ -685,7 +681,7 @@ > // Find the selected copy > var item = $(".checkitem_" + biblioNum + ":checked"); > if ($(item).size() == 0) { >- alert(MSG_NO_ITEM_SELECTED); >+ alert( _("Expecting a specific item selection.") ); > badBib = biblioNum; > return false; > } else { >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt >index 01543bc29a..546cd4398a 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt >@@ -287,8 +287,6 @@ > [% INCLUDE 'datatables.inc' %] > [% INCLUDE 'columns_settings.inc' %] > <script> >- >- var MSG_CONFIRM_DELETE_HISTORY = _("Are you sure you want to delete selected search history entries?"); > $(document).ready(function() { > // We show table ordered by descending dates by default > // (so that the more recent query is shown first) >@@ -339,7 +337,7 @@ > if ( $(ids).length < 1 ) { > return false; > } >- if ( confirm(MSG_CONFIRM_DELETE_HISTORY) ) { >+ if ( confirm( _("Are you sure you want to delete selected search history entries?") ) ) { > $(form).submit(); > } > return false; >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >index 78c3c1de65..6c638ce7e8 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >@@ -830,10 +830,6 @@ > [% Asset.js("js/openlibrary.js") | $raw %] > [% END %] > <script> >-var MSG_REMOVE_FROM_LIST = _("Are you sure you want to remove these items from the list?"); >-var MSG_REMOVE_ONE_FROM_LIST = _("Are you sure you want to remove this item from the list?"); >-var MSG_CONFIRM_DELETE_LIST = _("Are you sure you want to delete this list?"); >-var MSG_CONFIRM_REMOVE_SHARE = _("Are you sure you want to remove this share?"); > > [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'OPACHoldRequests' ) == 1 ) ) %] > function holdSelections() { >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt >index adaf29861e..e8d8565e7f 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt >@@ -200,10 +200,9 @@ > } > > $(document).ready(function(){ >- var MSG_DELETE_TAG = _("Are you sure you want to delete the selected tag(s)?"); > $(".delete").on("click", function(e){ > if ( checkboxesChecked() == 1 ) { >- return confirmDelete(MSG_DELETE_TAG); >+ return confirmDelete( _("Are you sure you want to delete the selected tag(s)?") ); > } else { > alert(_("Please select a tag to delete.")); > e.preventDefault(); >-- >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 34082
:
159521
|
160147
|
160170
|
164842