From 810cb5ba7778f8008f7de24532658cbc8cd6bb83 Mon Sep 17 00:00:00 2001
From: David Cook <dcook@prosentient.com.au>
Date: Wed, 19 Jul 2023 05:35:35 +0000
Subject: [PATCH] Bug 34307: Update plugin template to match master conventions

This change uses WRAPPER to build the breadcrumbs and
updates the plugin template to follow some other master conventions
like differentiating between Administration and Tools for plugins.

Test plan:
0. Apply patch
1. Upload koha-plugin-test-wrapper
2. Enable the plugin
3. Click "Actions" and click "Run tool"
4. Note how the plugin page looks like a perfect Koha Tools page
5. Note that the plugin only contains 6 lines of template code
to achieve this effect

Signed-off-by: David Nind <david@davidnind.com>
---
 .../en/includes/wrapper-staff-tool-plugin.inc | 60 ++++++++++++-------
 1 file changed, 38 insertions(+), 22 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/wrapper-staff-tool-plugin.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/wrapper-staff-tool-plugin.inc
index 0543393ccb..f6aab0b3ef 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/wrapper-staff-tool-plugin.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/wrapper-staff-tool-plugin.inc
@@ -1,32 +1,44 @@
 [% USE raw %]
 [% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
-<title>[% IF ( plugin_title ) %][% plugin_title | html %] &rsaquo; [% END %]Plugins &rsaquo; Tools &rsaquo; Koha </title>
+[% IF ( ! method ) %]
+[% method = 'tool'; %]
+[% END %]
+<title>
+    [% IF ( plugin_title ) %][% plugin_title | html %] &rsaquo; [% END %]
+    Plugins &rsaquo;
+    [% IF ( method == 'tool' ) %]
+        Tools
+    [% ELSE %]
+        Administration
+    [% END %]
+    &rsaquo; Koha
+ </title>
 [% INCLUDE 'doc-head-close.inc' %]
 </head>
-<body id="plugins_run_tool" class="plugins">
 
-[% INCLUDE 'header.inc' %]
-[% INCLUDE 'prefs-admin-search.inc' %]
+<body id="plugins_run_tool" class="plugins">
+[% WRAPPER 'header.inc' %]
+    [% INCLUDE 'prefs-admin-search.inc' %]
+[% END %]
 
-<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
-    <ol>
-        <li>
-            <a href="/cgi-bin/koha/mainpage.pl">Home</a>
-        </li>
-        <li>
-            <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
-        </li>
-        <li>
+[% WRAPPER 'sub-header.inc' %]
+    [% WRAPPER breadcrumbs %]
+        [% WRAPPER breadcrumb_item %]
+            [% IF ( method == 'tool' ) %]
+                <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
+            [% ELSE %]
+                <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
+            [% END %]
+        [% END %]
+        [% WRAPPER breadcrumb_item %]
             <a href="/cgi-bin/koha/plugins/plugins-home.pl">Plugins</a>
-        </li>
-        <li>
-            <a href="#" aria-current="page">
-                [% IF ( plugin_title ) %][% plugin_title | html %][% ELSE %]Plugin[% END %]
-            </a>
-        </li>
-    </ol>
-</nav>
+        [% END %]
+        [% WRAPPER breadcrumb_item bc_active= 1 %]
+            <span>[% IF ( plugin_title ) %][% plugin_title | html %][% ELSE %]Plugin[% END %]</span>
+        [% END %]
+    [% END #/ WRAPPER breadcrumbs %]
+[% END #/ WRAPPER sub-header.inc %]
 
 <div class="main container-fluid">
     <div class="row">
@@ -38,7 +50,11 @@
 
         <div class="col-sm-2 col-sm-pull-10">
             <aside>
-                [% INCLUDE 'tools-menu.inc' %]
+                [% IF ( method == 'tool' ) %]
+                    [% INCLUDE 'tools-menu.inc' %]
+                [% ELSE %]
+                    [% INCLUDE 'admin-menu.inc' %]
+                [% END %]
             </aside>
         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
      </div> <!-- /.row -->
-- 
2.30.2