Bug 37732

Summary: Update templates to use Bootstrap styles when alert class comes from the perl script
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Staff interfaceAssignee: Owen Leonard <oleonard>
Status: RESOLVED FIXED QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: gmcharlt, lucas
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.11.00
Circulation function:
Bug Depends on: 35402    
Bug Blocks:    
Attachments: Bug 37732: Update templates to use Bootstrap styles when alert class comes from the perl script
Bug 37732: Update templates to use Bootstrap styles when alert class comes from the perl script
Bug 37732: Fix administration_tasks.t
Bug 37732: Fix 'Invalid PIN code' styling for 2FA
Bug 37732: (follow-up) Fix some missed instances
Bug 37732: (follow-up) Fix some missed instances

Description Jonathan Druart 2024-08-26 12:55:37 UTC
https://snipboard.io/gTOlck.jpg
Comment 1 Jonathan Druart 2024-08-27 06:49:46 UTC
Same on admin/categories with "Patron category updated successfully."
Comment 2 Owen Leonard 2024-08-30 10:31:40 UTC
All of these pages send the dialog class from the script instead of setting it in the template, so each one needs to be adapted to send the classes for Bootstrap 5.

acqui/basket.pl
acqui/vendor_issues.pl
admin/authorised_values.pl
admin/authtypes.pl
admin/biblio_framework.pl
admin/branches.pl
admin/categories.pl
admin/cities.pl
admin/credit_types.pl
admin/currency.pl
admin/debit_types.pl
admin/desks.pl
admin/identity_providers.pl
admin/ill_batch_statuses.pl
admin/itemtypes.pl
admin/restrictions.pl
admin/searchengine/elasticsearch/mappings.pl
admin/smtp_servers.pl
circ/pendingreserves.pl
opac/opac-shelves.pl
svc/letters/preview
tools/additional-contents.pl
tools/csv-profiles.pl
tools/export.pl
tools/quotes.pl
virtualshelves/shelves.pl
Comment 3 Owen Leonard 2024-08-30 14:35:35 UTC
Created attachment 170913 [details] [review]
Bug 37732: Update templates to use Bootstrap styles when alert class comes from the perl script

Many pages can have alerts that get their style from a variable passed
by the script, e.g.:

push @messages, { type => 'message', code => 'success_on_update' };

Rather than change these to match Bootstrap 5 styles, I propose we add a
copy of the existing Bootstrap style using the existing vocabulary:

message -> info
alert  -> warning
error -> danger

To test, apply the patch and rebuild CSS for the staff interface and
OPAC: (https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_interface)

- Clear your browser cache if necessary.
- Navigate to pages which have been updated by this patch. Many pages
  will implement this kind of alert after saving an edit, especially
  administration pages, e.g.

  Administration -> Libraries -> Edit library -> Save.

- You can test the various alert classes by adding this HTML to
  IntranetMainUserBlock and OpacMainUserBlock and viewing the staff
  interface and OPAC main pages.:

<div class="alert alert-danger">A standard Bootstrap danger alert with
  <a href="#" class="alert-link">an example link</a>.</div>
<div class="alert alert-warning">A standard Bootstrap warning alert with
  <a href="#" class="alert-link">an example link</a>.</div>
<div class="alert alert-info">A standard Bootstrap info alert with
  <a href="#" class="alert-link">an example link</a>.</div>
<div class="alert alert-error">A Koha error alert with
  <a href="#" class="alert-link">an example link</a>.</div>
<div class="alert alert-alert">A Koha alert alert with
  <a href="#" class="alert-link">an example link</a>.</div>
<div class="alert alert-message">A Koha info alert with
  <a href="#" class="alert-link">an example link</a>.</div>

Sponsored-by: Athens County Public Libraries
Comment 4 Jonathan Druart 2024-09-03 10:03:23 UTC
Created attachment 170968 [details] [review]
Bug 37732: Update templates to use Bootstrap styles when alert class comes from the perl script

Many pages can have alerts that get their style from a variable passed
by the script, e.g.:

push @messages, { type => 'message', code => 'success_on_update' };

Rather than change these to match Bootstrap 5 styles, I propose we add a
copy of the existing Bootstrap style using the existing vocabulary:

message -> info
alert  -> warning
error -> danger

To test, apply the patch and rebuild CSS for the staff interface and
OPAC: (https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_interface)

- Clear your browser cache if necessary.
- Navigate to pages which have been updated by this patch. Many pages
  will implement this kind of alert after saving an edit, especially
  administration pages, e.g.

  Administration -> Libraries -> Edit library -> Save.

- You can test the various alert classes by adding this HTML to
  IntranetMainUserBlock and OpacMainUserBlock and viewing the staff
  interface and OPAC main pages.:

<div class="alert alert-danger">A standard Bootstrap danger alert with
  <a href="#" class="alert-link">an example link</a>.</div>
<div class="alert alert-warning">A standard Bootstrap warning alert with
  <a href="#" class="alert-link">an example link</a>.</div>
<div class="alert alert-info">A standard Bootstrap info alert with
  <a href="#" class="alert-link">an example link</a>.</div>
<div class="alert alert-error">A Koha error alert with
  <a href="#" class="alert-link">an example link</a>.</div>
<div class="alert alert-alert">A Koha alert alert with
  <a href="#" class="alert-link">an example link</a>.</div>
<div class="alert alert-message">A Koha info alert with
  <a href="#" class="alert-link">an example link</a>.</div>

Sponsored-by: Athens County Public Libraries

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 5 Jonathan Druart 2024-09-03 10:03:25 UTC
Created attachment 170969 [details] [review]
Bug 37732: Fix administration_tasks.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 6 Jonathan Druart 2024-09-03 10:03:27 UTC
Created attachment 170970 [details] [review]
Bug 37732: Fix 'Invalid PIN code' styling for 2FA

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 7 Jonathan Druart 2024-09-03 10:03:55 UTC
I think those ones are candidate for a fix here: 

koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt:[% IF ( book_reserved ) %]<div class="dialogalert"><strong>Cannot delete</strong>: item has a waiting hold.</div>[% END %]
koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt:            <div id="receipt_sent_dialog" class="dialog warning">
koha-tmpl/intranet-tmpl/prog/en/modules/members/discharge.tt:    <div class="dialog [% message.type | html %]">
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-discharge.tt:                        <div class="dialog [% message.type | html %]">
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recall.tt:                                <div class="dialog">
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendbasketform.tt:                                <div class="dialog dialog-success">
Comment 8 Owen Leonard 2024-09-03 11:31:08 UTC
Created attachment 170978 [details] [review]
Bug 37732: (follow-up) Fix some missed instances

This patch fixes a few templates which I had missed, including some
which simply had the wrong classes (instead of getting the wrong class
from the perl script).
Comment 9 Jonathan Druart 2024-09-03 12:39:25 UTC
Created attachment 170982 [details] [review]
Bug 37732: (follow-up) Fix some missed instances

This patch fixes a few templates which I had missed, including some
which simply had the wrong classes (instead of getting the wrong class
from the perl script).

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 10 Jonathan Druart 2024-09-03 12:39:44 UTC
Thanks, Owen!
Comment 11 Katrin Fischer 2024-09-13 10:07:35 UTC
Pushed for 24.11!

Well done everyone, thank you!