From 96afaeb36d654e556e16ad8e0265947df789f962 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 20 Jan 2023 15:21:21 +0000 Subject: [PATCH] Bug 32912: Use template wrapper for notices tabs This patch updates the notices template to replace tab markup with the use of WRAPPERs. This patch also makes a minor correction to the color of Bootstrap panels. To test you must have more than one translation installed, and the TranslateNotices preference should be enabled. - Apply the patch and go to Tools -> Notices. - Edit a notice. - You should see tabs for each available language, for example Default, English, French. - Test adding content to each language to confirm that the correct information is saved under the correct tab. - Disable the TranslateNotices preference to confirm that the display is still correct without the tabbed interface. Signed-off-by: David Nind Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- .../prog/css/src/staff-global.scss | 4 +- .../prog/en/modules/tools/letter.tt | 438 +++++++++--------- 2 files changed, 222 insertions(+), 220 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss index 154997a4a4..517bd504b4 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss +++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss @@ -3021,11 +3021,11 @@ button, /* Bootstrap Collapse */ .panel { - background: #F4F8F9 none; + background: #F7F9F6 none; box-shadow: none; &:hover { - background: #e3f1df none; + background: #E3F1DF none; } } 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 b4e866c9a6..1dc23f228e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt @@ -346,233 +346,137 @@ [% ELSE %] + +
  • + [% IF adding %] + + + Required [% ELSE %] - + Code: + + [% code | html %] [% END %] - -
  • -
  • - [% IF adding %] - - - Required - [% ELSE %] - Code: - - [% code | html %] - [% END %] -
  • -
  • - - - Required -
  • - [% IF code and preview_is_available%] +
  • - - [% SWITCH code %] - [% CASE 'CHECKIN' %] - - [% CASE 'CHECKOUT' %] - - [% CASE 'HOLD_SLIP' %] - - [% CASE %] - Not supported yet. - [% END %] -
  • - [% END # /IF code %] - - - - [% IF Koha.Preference('TranslateNotices') %] -
    -
    - - -
    - [% ELSE %] -
    - [% END # /IF TranslateNotices %] + + [% END # /IF code %] + + - [% FOREACH lang IN letters.keys %] -
    -
    - [% 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.
    + [% IF Koha.Preference('TranslateNotices') %] +
    + [% WRAPPER tabs id= "tabs" %] + [% WRAPPER tabs_nav %] + [% WRAPPER tab_item tabname= "lang_default" bt_active= 1 %] Default [% END %] + [% FOR language IN languages %] + [% FOR sublanguage IN language.sublanguages_loop %] + [% IF language.plural %] + [% WRAPPER tab_item tabname= "lang_${sublanguage.rfc4646_subtag}" %] [% sublanguage.native_description | html %] [% sublanguage.region_description | html %] ([% sublanguage.rfc4646_subtag | html %]) [% END %] [% ELSE %] -
    + [% WRAPPER tab_item tabname= "lang_${sublanguage.rfc4646_subtag}" %] [% sublanguage.native_description | html %] ([% sublanguage.rfc4646_subtag | html %]) [% END %] [% 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 %] - [% letter.content.length | html %] - [% ELSE %] - 0 - [% END %]/160 characters - [% END %] - - - - - - -
      - - - - - -
      -
    10. - [% IF preview_is_available %] -
    11. - Preview -
    12. - [% END %] -
    -
    -
    -
    -
    - [% END # /FOR mtt %] -
    -
    - [% END # /FOREACH lang %] + [% END %] + [% END %] + [% END # /.tabs_nav %] - [% IF Koha.Preference('TranslateNotices') %] -
    -
    - [% END %] + [% WRAPPER tab_panels %] + [% FOREACH lang IN letters.keys %] + [% IF( loop.first ) %] + [% SET bt_active = 1 %] + [% ELSE %] + [% SET bt_active = 0 %] + [% END %] + [% WRAPPER tab_panel tabname="lang_${lang}" bt_active= bt_active %] + [% PROCESS message_templates %] + [% END # /WRAPPER tab_panel %] + [% END # /FOREACH lang %] + [% END # /WRAPPER tab_panels %] + [% END # /WRAPPER tabs#tabs %] + [% ELSE %] +
    + [% FOREACH lang IN letters.keys %] + [% PROCESS message_templates %] + [% END # /FOREACH lang %] + [% END # /IF TranslateNotices %] @@ -643,6 +547,104 @@ [% END %] +[% BLOCK message_templates %] +
    + [% 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 %] +
    6. +
    7. + +
    8. +
    9. + + [% IF letter.message_transport_type == 'sms' %] + + [% IF letter.content && letter.content.length > 0 %] + [% letter.content.length | html %] + [% ELSE %] + 0 + [% END %]/160 characters + [% END %] + + + + + + +
      + + + + + +
      +
    10. + [% IF preview_is_available %] +
    11. + Preview +
    12. + [% END %] +
    +
    +
    +
    +
    + [% END # /FOR mtt %] +
    +[% END %] + [% MACRO jsinclude BLOCK %] [% Asset.js("js/tools-menu.js") | $raw %] [% INCLUDE 'datatables.inc' %] -- 2.39.5