Bugzilla – Attachment 184188 Details for
Bug 40418
Update the item type translation process to avoid Greybox modal
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40418: Update the item type translation process to avoid Greybox modal
Bug-40418-Update-the-item-type-translation-process.patch (text/plain), 14.11 KB, created by
Owen Leonard
on 2025-07-17 11:15:37 UTC
(
hide
)
Description:
Bug 40418: Update the item type translation process to avoid Greybox modal
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2025-07-17 11:15:37 UTC
Size:
14.11 KB
patch
obsolete
>From 1abae04d962103685931989b8130ee145dda1c08 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Wed, 16 Jul 2025 13:28:46 +0000 >Subject: [PATCH] Bug 40418: Update the item type translation process to avoid > Greybox modal > >This patch updates the item type translation process so that it takes >place on a separate standalone page instead of in a Greybox modal. > >Although currently only item types can be translated in this way, the >original plan was to expand the range of data that could be translated. >For this reason I used [% SWITCH %] in localization.tt for determining >whether to use the term "item type." This accommodates, I hope, >expansion of the feature. > >To test you must have more than one installed translation. > >- Apply the patch and go to Administration -> Item types. >- Edit an item type. >- On the "Description" line, click "Translate into other languages." >- You should be redirected to a new page, "Add translations for item > type 'XXX.' >- Confirm that the page title, breadcrumbs, and heading are correct. >- Test the process of adding and deleting a translation. >- Test the process of performing an inline edit of an existing > translation by clicking the table cell. >- Test that the "Return to item type 'XXX'" button returns you to the > item type you were editing. > >Sponsored-by: Athens County Public Libraries >--- > .../prog/en/modules/admin/itemtypes.tt | 5 +- > .../prog/en/modules/admin/localization.tt | 213 ++++++++++-------- > 2 files changed, 124 insertions(+), 94 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt >index 0f7915e3657..f1dc5dc9f4a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt >@@ -194,9 +194,7 @@ > <label for="description" class="required">Description: </label> > <input type="text" id="description" name="description" size="48" value="[% itemtype.description | html %]" required="required" /> <span class="required">Required</span> > [% IF can_be_translated %] >- <a href="/cgi-bin/koha/admin/localization.pl?entity=itemtypes&code=[% itemtype.itemtype | uri %]" title="Translate item type [% itemtype.itemtype | html %]" rel="gb_page_center[600,500]" >- ><i class="fa-solid fa-pencil" aria-hidden="true"></i> Translate into other languages</a >- > >+ <a href="/cgi-bin/koha/admin/localization.pl?entity=itemtypes&code=[% itemtype.itemtype | uri %]"> <i class="fa-solid fa-pencil" aria-hidden="true"></i> Translate into other languages </a> > [% END %] > </li> > <li> >@@ -532,7 +530,6 @@ > > [% MACRO jsinclude BLOCK %] > [% Asset.js("js/admin-menu.js") | $raw %] >- [% INCLUDE 'greybox.inc' %] > [% INCLUDE 'datatables.inc' %] > [% INCLUDE 'select2.inc' %] > <script> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/localization.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/localization.tt >index e49f2ac5278..e13f64125c6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/localization.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/localization.tt >@@ -3,12 +3,18 @@ > [% PROCESS 'i18n.inc' %] > [% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] >-<title >- >[% FILTER collapse %] >- [% t("Localization") | html %] >+<title> >+ [% FILTER collapse %] >+ [% SWITCH entity %] >+ [% CASE "itemtypes" %] >+ [% tx("Add translations for item type '{code}'", { code = code }) | html %] >+ › [% t("Item types") | html %] › [% t("Administration") | html %] >+ [% CASE %] >+ [% tx("Add translations for '{code}'", { code = code }) | html %] >+ [% END %] > › [% t("Koha") | html %] >- [% END %]</title >-> >+ [% END %] >+</title> > [% INCLUDE 'doc-head-close.inc' popup => 1 %] > <style> > #localization { >@@ -18,93 +24,120 @@ > </head> > > <body id="admin_localization" class="admin"> >-<div class="main container-fluid"> >- <div class="row"> >- <div class="col-sm-12"> >- <h1>Localization</h1> >- <form id="add_translation" method="get"> >- [% INCLUDE 'csrf-token.inc' %] >- <input type="hidden" name="entity" value="[% entity | html %]" /> >- <input type="hidden" name="code" value="[% code | html %]" /> >- <input type="hidden" name="interface" value="[% interface_side | html %]" /> >- <fieldset class="rows clearfix"> >- <ol> >- <li> >- <span class="label">Authorized value:</span> >- [% code | html %] >- </li> >- <li> >- <label for="lang">Language:</label> >- <select name="lang" id="lang"> >- [% FOR language IN languages %] >- [% FOR sublanguage IN language.sublanguages_loop %] >- [% IF language.plural %] >- <option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] [% sublanguage.region_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option> >- [% ELSE %] >- <option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option> >- [% END %] >- [% END %] >- [% END %] >- </select> >- </li> >- <li> >- <label for="translation">Translation:</label> >- <input type="text" size="40" name="translation" id="translation" /> >- </li> >- <li> >- <span class="label"> </span> >- <input type="submit" class="btn btn-primary" value="Add" /> >- </li> >- </ol> >- </fieldset> >- </form> >- </div> >- <!-- /.col-sm-12 --> >- </div> >- <!-- /.row --> >+[% WRAPPER 'header.inc' %] >+ [% INCLUDE 'cat-search.inc' %] >+[% END %] >+[% WRAPPER 'sub-header.inc' %] >+ [% WRAPPER breadcrumbs %] >+ [% SWITCH entity %] >+ [% CASE "itemtypes" %] >+ [% WRAPPER breadcrumb_item %] >+ <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> >+ [% END %] >+ [% WRAPPER breadcrumb_item %] >+ <a href="/cgi-bin/koha/admin/itemtypes.pl">Item types</a> >+ [% END %] >+ [% WRAPPER breadcrumb_item %] >+ <a href="/cgi-bin/koha/admin/itemtypes.pl?op=add_form&itemtype=[% code | uri %]"> [% tx("Modify item type '{code}'", { code = code }) | html %] </a> >+ [% END %] >+ [% WRAPPER breadcrumb_item bc_active= 1 %] >+ <span>Add translations</span> >+ [% END %] >+ [% CASE %] >+ [% WRAPPER breadcrumb_item bc_active= 1 %] >+ [% tx("Add translations for '{code}'", { code = code }) | html %] >+ [% END %] >+ [% END %] >+ [% END #/ WRAPPER breadcrumbs %] >+[% END #/ WRAPPER sub-header.inc %] > >- <div class="row"> >- <div class="col-sm-12"> >- <div id="messages"></div> >- </div> >- <!-- /.col-sm-12 --> >- </div> >- <!-- /.row --> >+[% WRAPPER 'main-container.inc' %] >+ [% SWITCH entity %] >+ [% CASE "itemtypes" %] >+ <h1>[% tx("Add translations for item type '{code}'", { code = code }) | html %]</h1> >+ [% CASE %] >+ <h1>[% tx("Add translations for '{code}'", { code = code }) | html %]</h1> >+ [% END %] > >- <div class="row"> >- <div class="col-sm-12"> >- <table id="localization"> >- <thead> >- <tr> >- <th>Id</th> >- <th>Entity</th> >- <th>Code</th> >- <th>Language</th> >- <th>Translation</th> >- <th class="no-sort"> </th> >+ <form id="add_translation" method="get"> >+ [% INCLUDE 'csrf-token.inc' %] >+ <input type="hidden" name="entity" value="[% entity | html %]" /> >+ <input type="hidden" name="code" value="[% code | html %]" /> >+ <input type="hidden" name="interface" value="[% interface_side | html %]" /> >+ <fieldset class="rows clearfix"> >+ <ol> >+ <li> >+ <span class="label">Authorized value:</span> >+ [% code | html %] >+ </li> >+ <li> >+ <label for="lang">Language:</label> >+ <select name="lang" id="lang"> >+ [% FOR language IN languages %] >+ [% FOR sublanguage IN language.sublanguages_loop %] >+ [% IF language.plural %] >+ <option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] [% sublanguage.region_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option> >+ [% ELSE %] >+ <option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option> >+ [% END %] >+ [% END %] >+ [% END %] >+ </select> >+ </li> >+ <li> >+ <label for="translation">Translation:</label> >+ <input type="text" size="40" name="translation" id="translation" /> >+ </li> >+ <li> >+ <span class="label"> </span> >+ <input type="submit" class="btn btn-primary" value="Add" /> >+ </li> >+ </ol> >+ </fieldset> >+ </form> >+ <div id="messages"></div> >+ <div class="page-section"> >+ <table id="localization"> >+ <thead> >+ <tr> >+ <th>Id</th> >+ <th>Entity</th> >+ <th>Code</th> >+ <th>Language</th> >+ <th>Translation</th> >+ <th class="no-sort"> </th> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOR t IN translations %] >+ <tr id="row_id_[% t.id | html %]" data-id="[% t.id | html %]"> >+ <td>[% t.id | html %]</td> >+ <td> >+ [% SWITCH entity %] >+ [% CASE "itemtypes" %] >+ Item type >+ [% CASE %] >+ [% t.entity | html %] >+ [% END %] >+ </td> >+ <td>[% t.code | html %]</td> >+ <td class="lang">[% t.lang | html %]</td> >+ <td class="translation" contenteditable="true">[% t.translation | html %]</td> >+ <td class="actions" >+ ><a href="#" class="btn btn-xs btn-default delete"><i class="fa fa-trash-can"></i> Delete</a></td >+ > > </tr> >- </thead> >- <tbody> >- [% FOR t IN translations %] >- <tr id="row_id_[% t.id | html %]" data-id="[% t.id | html %]"> >- <td>[% t.id | html %]</td> >- <td>[% t.entity | html %]</td> >- <td>[% t.code | html %]</td> >- <td class="lang">[% t.lang | html %]</td> >- <td class="translation" contenteditable="true">[% t.translation | html %]</td> >- <td class="actions" >- ><a href="#" class="delete"><i class="fa fa-trash-can"></i> Delete</a></td >- > >- </tr> >- [% END %] >- </tbody> >- </table> >- </div> >- <!-- /.col-sm-12 --> >+ [% END %] >+ </tbody> >+ </table> > </div> >- <!-- /.row --> >-</div> >-<!-- /.main.container-fluid --> >+ [% SWITCH entity %] >+ [% CASE "itemtypes" %] >+ <fieldset class="action"> >+ <a class="btn btn-default" href="/cgi-bin/koha/admin/itemtypes.pl?op=add_form&itemtype=[% code | uri %]"> [% tx("Return to item type '{code}'", { code = code }) | html %] </a> >+ </fieldset> >+ [% END %] >+[% END %] > > [% MACRO jsinclude BLOCK %] > [% INCLUDE 'datatables.inc' %] >@@ -276,7 +309,7 @@ > if ( success.error ) { > show_message({ type: 'error_on_insert', data: success }); > } else { >- var new_row = table_dt.row.add( [ success.id, success.entity, success.code, success.lang, success.translation, "<a href=\"#\" class=\"delete\"><i class=\"fa fa-trash-can\"></i> Delete</a>" ] ).draw().node(); >+ var new_row = table_dt.row.add( [ success.id, success.entity, success.code, success.lang, success.translation, "<a href=\"#\" class=\"btn btn-default btn-xs delete\"><i class=\"fa fa-trash-can\"></i> Delete</a>" ] ).draw().node(); > $( new_row ).attr("id", "row_id_" + success.id ).data("id", success.id ); > show_message({ type: 'success_on_insert', data: success }); > } >@@ -291,4 +324,4 @@ > }); > </script> > [% END %] >-[% INCLUDE 'popup-bottom.inc' %] >+[% INCLUDE 'intranet-bottom.inc' %] >-- >2.39.5
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 40418
:
184188
|
184376
|
184447