From bdedd850e25e4ed338261527f78e173d197fb4c7 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 5 Jan 2023 12:54:42 +0000 Subject: [PATCH] Bug 32571: Use template wrapper to build tabbed components This patch adds Template::Toolkit WRAPPER blocks to html_helpers.inc so that templates can build tabbed components while keeping tab structural markup separate. Each individual component of a Bootstrap tabbed interface is defined: - Main tab container - Tab links container - Individual tab links - Tab panel container - Individual tab panels Included is a usage example: [ WRAPPER tabs id= "tabs container id" ] [ WRAPPER tabs_nav ] [ WRAPPER tab_item tabname= "tab name 1" ] [ content ] [ END ] [ WRAPPER tab_item tabname= "tab name 2" ] [ content ] [ END ] ... [ END ] [ WRAPPER tab_panels ] [ WRAPPER tab_panel id="tab name 1"] [ content ] [ END ] [ WRAPPER tab_panel id="tab name 2"] [ content ] [ END ] ... [ END ] [ END ] Signed-off-by: David Nind Signed-off-by: Kyle M Hall --- .../prog/en/includes/html_helpers.inc | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc index 52d645f255..32f67bfe4b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc @@ -341,3 +341,62 @@ [% END %] + +[%# BOOTSTRAP TAB WRAPPER USAGE + [ WRAPPER tabs id= "tabs container id" ] + [ WRAPPER tabs_nav ] + [ WRAPPER tab_item tabname= "tab name 1" ] [ content ] [ END ] + [ WRAPPER tab_item tabname= "tab name 2" ] [ content ] [ END ] + ... + [ END ] + [ WRAPPER tab_panels ] + [ WRAPPER tab_panel id="tab name 1"] [ content ] [ END ] + [ WRAPPER tab_panel id="tab name 2"] [ content ] [ END ] + ... + [ END ] + [ END ] + %] + +[% BLOCK tabs %] + [% IF ( id ) %] +
+ [% ELSE %] +
+ [% END %] + [% content | $raw %] +
+[% END %] + +[% BLOCK tabs_nav %] + +[% END %] + +[% BLOCK tab_item %] + [% IF ( active ) %] +
  • + [% END %] + + [% content | $raw %] + +
  • +[% END %] + +[% BLOCK tab_panels %] +
    + [% content | $raw %] +
    +[% END %] + +[% BLOCK tab_panel %] + [% IF ( active ) %] +
    + [% ELSE %] +
    + [% END %] + [% content| $raw %] +
    +[% END %] -- 2.20.1