From ac3cd654eba4b8bf060f6a4fbc08bc92898f1932 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 23 Jan 2024 19:32:03 +0000 Subject: [PATCH] Bug 35882: Use template wrapper for accordions: Notices This patch updates the notices template so that Bootstrap accordion markup for the notice edit view is generated by WRAPPERs. To test, apply the patch and go to Tools -> Notices. - Edit any notice. - The list of message transport types (Email, Print, SMS) should be displayed as before: Collapsible panels where clicking the transport type heading expands the corresponding information. - Confirm that changes to notices are correctly saved. Signed-off-by: David Nind --- .../prog/en/modules/tools/letter.tt | 166 +++++++++--------- 1 file changed, 80 insertions(+), 86 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt index 3dea27a8a5..c7193c8e06 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt @@ -563,102 +563,96 @@ [% END %] [% BLOCK message_templates %] -
+ [% WRAPPER accordion id="group_${lang}" %] [% FOR mtt IN letters.$lang.templates.keys.sort %] [% SET letter = letters.$lang.templates.$mtt %] [% NEXT IF letter.message_transport_type == "itiva" && !Koha.Preference('TalkingTechItivaPhoneNotification') %] [% NEXT IF letter.message_transport_type == "phone" && !Koha.Preference('PhoneNotification') %] -
- -
-
- [% IF letter.message_transport_type == "sms" and not Koha.Preference("SMSSendDriver") %] -
-
You should enable the SMSSendDriver preference to use the SMS templates.
- [% ELSE %] -
- [% END %] - - -
    - [% IF ( letter.tt_error ) %] -
  1. - Template Toolkit error: - [% letter.tt_error | html %] -
  2. - [% END %] - [% IF ( letter.updated_on ) %] -
  3. - Last updated: - [% letter.updated_on | $KohaDates with_hours = 1 %] -
  4. - [% END %] -
  5. - - [% IF letter.is_html %] - - [% ELSE %] - - [% END %] + [% WRAPPER accordion_item %] + [% WRAPPER accordion_heading panel_id="${letter.message_transport_type}_${lang}" %] + [% SWITCH letter.message_transport_type %] + [% CASE 'email' %]Email + [% CASE 'print' %][% tp('Message transport type', 'Print') | html %] + [% CASE 'sms' %]SMS + [% CASE 'feed' %]Feed + [% CASE 'itiva' %]Phone (i-tiva) + [% CASE 'phone' %]Phone + [% CASE %][% letter.message_transport_type | html %] + [% END %] + [% END %] + [% WRAPPER accordion_panel panel_id="${letter.message_transport_type}_${lang}" %] + [% IF letter.message_transport_type == "sms" and not Koha.Preference("SMSSendDriver") %] +
    +
    You should enable the SMSSendDriver preference to use the SMS templates.
    + [% ELSE %] +
    + [% END %] + + +
      + [% IF ( letter.tt_error ) %] +
    1. + Template Toolkit error: + [% letter.tt_error | html %]
    2. + [% END %] + [% IF ( letter.updated_on ) %]
    3. - + Last updated: + [% letter.updated_on | $KohaDates with_hours = 1 %]
    4. + [% END %] +
    5. + + [% IF letter.is_html %] + + [% ELSE %] + + [% END %] +
    6. +
    7. + +
    8. +
    9. + + [% IF letter.message_transport_type == 'sms' %] + + [% IF letter.content && letter.content.length > 0 %] + [% tx("{content_length} / 160 characters", {content_length = letter.content.length} ) %] + [% ELSE %] + [% tx("{content_length} / 160 characters", {content_length = 0} ) %] + [% END %] + + [% END %] + + + + + + +
      + + + + + +
      +
    10. + [% IF preview_is_available %]
    11. - - [% IF letter.message_transport_type == 'sms' %] - - [% IF letter.content && letter.content.length > 0 %] - [% tx("{content_length} / 160 characters", {content_length = letter.content.length} ) %] - [% ELSE %] - [% tx("{content_length} / 160 characters", {content_length = 0} ) %] - [% END %] - - [% END %] - - - - - - -
      - - - - - -
      + Preview
    12. - [% IF preview_is_available %] -
    13. - Preview -
    14. - [% END %] -
    -
    -
-
-
+ [% END %] + + + [% END %] + [% END # /collapse_item %] [% END # /FOR mtt %] -
+ [% END # /WRAPPER accordion %] [% END %] [% MACRO jsinclude BLOCK %] -- 2.30.2