[Koha-patches] [PATCH] Bug 9628 - Replace YUI buttons and menus on budgets administration pages with Bootstrap

Owen Leonard oleonard at myacpl.org
Fri Feb 15 18:05:10 CET 2013


This patch converts the toolbar include file used by budgets
administration pages to Bootstrap, replacing YUI button and menu code
with Bootstrap markup.

To test, create, view, and edit budgets. Buttons and menus should look
correct and work correctly. Functions include:

- New budget
- New fund
- Edit budget
- Duplicate budget
- Plan by (months, libraries, etc)
---
 .../prog/en/includes/budgets-admin-toolbar.inc     |  171 +++++++-------------
 1 file changed, 61 insertions(+), 110 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/budgets-admin-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/budgets-admin-toolbar.inc
index ca517f9..d36c2ca 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/budgets-admin-toolbar.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/budgets-admin-toolbar.inc
@@ -1,110 +1,61 @@
-<div id="toolbar"><script type="text/javascript">
-	//<![CDATA[
-
-	// prepare DOM for YUI Toolbar
-	 $(document).ready(function() {
-            $("#periods_menuc").empty();
-            $("#budgets_menuc").empty();
-            $("#newrootbudgetc").empty();
-
-// IF THERE IS NO BUDGETS DEFINED YET, THEN DISPLAY PERIOD BUTTON *ONLY*
-[% UNLESS ( period_button_only ) %]
-            $("#planning_menuc").empty();
-[% END %]
-
-	    yuiToolbar();
-	 });
-
-	// YUI Toolbar Functions
-
-	function yuiToolbar() {
-[% IF ( budget_period_id ) %]
-		                var budgets_menu = [
-						{ text: _("New budget"), url: "/cgi-bin/koha/admin/aqbudgetperiods.pl?op=add_form" },
-                        { text: _("New fund for") + " '[% budget_period_description %]'", url: "/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&budget_period_id=[% budget_period_id %]"
-                           [% IF ( budget_period_locked ) %],  disabled:true[% END %]
-                           [% UNLESS ( CAN_user_acquisition_budget_add_del ) %],  disabled:true [% END %]
-                          }
-                ]
-		[% ELSE %]
-        var newrootbudgetButton = new YAHOO.widget.Button("newrootbudget");
-		[% END %]
-
-        [% IF ( budget_period_id ) %]
-                var periods_menu = [
-                        { text: _("Edit budget") + " '[% budget_period_description %]'", url: "/cgi-bin/koha/admin/aqbudgetperiods.pl?op=add_form&budget_period_id=[% budget_period_id %]" },
-                        { text: _("Duplicate budget") + " '[% budget_period_description %]'", url: "/cgi-bin/koha/admin/aqbudgetperiods.pl?op=duplicate_form&budget_period_id=[% budget_period_id %]" },
-                ]
-        [% END %]
-
-// IF THERE IS NO BUDGETS DEFINED YET, THEN DISPLAY PERIOD BUTTON *ONLY*
-[% IF ( budget_period_id ) %]
-
-               var planning_menu = [
-
-                        { text: _("Plan by months"),
-                            url: "/cgi-bin/koha/admin/aqplan.pl?budget_period_id=[% budget_period_id %]&authcat=MONTHS"
-                            [% UNLESS ( CAN_user_acquisition_planning_manage ) %],  id:'disabled' [% END %]
-                        },
-
-                        { text: _("Plan by libraries"),
-                            url: "/cgi-bin/koha/admin/aqplan.pl?budget_period_id=[% budget_period_id %]&authcat=BRANCHES"
-                            [% UNLESS ( CAN_user_acquisition_planning_manage ) %],  id:'disabled' [% END %]
-                        },
-
-                        { text: _("Plan by item types"),
-                            url: "/cgi-bin/koha/admin/aqplan.pl?budget_period_id=[% budget_period_id %]&authcat=ITEMTYPES"
-                            [% UNLESS ( CAN_user_acquisition_planning_manage ) %],  id:'disabled' [% END %]
-                        },
-        [% FOREACH auth_cats_loo IN auth_cats_loop %]
-            { text: _("Plan by [% auth_cats_loo.authcat %]    "),
-            url: "/cgi-bin/koha/admin/aqplan.pl?budget_period_id=[% budget_period_id %]&authcat=[% auth_cats_loo.authcat %]"
-            [% UNLESS ( CAN_user_acquisition_planning_manage ) %],  id:'disabled' [% END %]
-            },
-        [% END %]
-                ]
-
-	            new YAHOO.widget.Button({
-                type: "menu",
-                label: _("Edit"),
-                name: "periods_button",
-                menu: periods_menu,
-                container: "periods_menuc"
-            });
-
-            new YAHOO.widget.Button({
-                type: "menu",
-                label: _("New"),
-                name: "budgets_button",
-                menu: budgets_menu,
-                container: "budgets_menuc"
-            });
-
-            new YAHOO.widget.Button({
-                type: "menu",
-                label: _("Planning"),
-                name: "planning_button",
-                menu: planning_menu,
-                container: "planning_menuc"
-            });
-
-[% END %]
-
-// IF THERE IS NO BUDGETS DEFINED YET, THEN DISPLAY PERIOD BUTTON *ONLY*
-[% UNLESS ( period_button_only ) %]
-
-
-[% END %]
-
-	} //yui-toolbar...
-
-	//]]>
-</script>
-	<ul class="toolbar">
-        [% UNLESS ( budget_period_id ) %]<li><a id="newrootbudget" href="/cgi-bin/koha/admin/aqbudgetperiods.pl?op=add_form">New budget</a></li>[% END %]
-		[% UNLESS ( period_button_only ) %]<li id="budgets_menuc"><a id="budgets_menu" href="/cgi-bin/koha/cataloguing/addbiblio.pl">New</a></li>[% END %]
-        <li id="periods_menuc"><a id="periods_menu" href="/cgi-bin/koha/admin/aqbudgetperiods.pl?op=add_form">Budgets</a></li>
-		[% UNLESS ( period_button_only ) %]<li id="planning_menuc"><a id="planning_menu" href="/cgi-bin/koha/admin/aqplan.pl?budget_period_id=[% budget_period_id %]">Budget planning</a></li>
-	[% END %]
-	</ul>
-</div>
+<div id="toolbar" class="btn-toolbar">
+    [% IF ( budget_period_id ) %]
+        <div class="btn-group">
+            <button class="btn btn-small dropdown-toggle" data-toggle="dropdown"><i class="icon-plus"></i> New <span class="caret"></span></button>
+                <ul class="dropdown-menu">
+                    <li><a href="/cgi-bin/koha/admin/aqbudgetperiods.pl?op=add_form">New budget</a></li>
+                    [% IF ( budget_period_locked || !CAN_user_acquisition_budget_add_del ) %]
+                        <li class="disabled">
+                    [% ELSE %]
+                        <li>
+                    [% END %]
+                    <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&budget_period_id=[% budget_period_id %]">New fund for [% budget_period_description %]</a></li>
+                </ul>
+        </div>
+
+        <div class="btn-group">
+            <button class="btn btn-small dropdown-toggle" data-toggle="dropdown"><i class="icon-pencil"></i> Edit <span class="caret"></span></button>
+                <ul class="dropdown-menu">
+                    <li><a href="/cgi-bin/koha/admin/aqbudgetperiods.pl?op=add_form&budget_period_id=[% budget_period_id %]">Edit budget [% budget_period_description %]</a></li>
+                    <li><a href="/cgi-bin/koha/admin/aqbudgetperiods.pl?op=duplicate_form&budget_period_id=[% budget_period_id %]">Duplicate budget [% budget_period_description %]</a></li>
+                </ul>
+        </div>
+
+        <div class="btn-group">
+            <button class="btn btn-small dropdown-toggle" data-toggle="dropdown"><i class="icon-pencil"></i> Planning <span class="caret"></span></button>
+                <ul class="dropdown-menu">
+                    [% IF ( CAN_user_acquisition_planning_manage ) %]
+                    <li>
+                    [% ELSE %]
+                    <li class="disabled">
+                    [% END %]
+                    <a href="/cgi-bin/koha/admin/aqplan.pl?budget_period_id=[% budget_period_id %]&authcat=MONTHS">Plan by months</a></li>
+                    [% IF ( CAN_user_acquisition_planning_manage ) %]
+                    <li>
+                    [% ELSE %]
+                    <li class="disabled">
+                    [% END %]
+                    <a href="/cgi-bin/koha/admin/aqplan.pl?budget_period_id=[% budget_period_id %]&authcat=BRANCHES">Plan by libraries</a></li>
+                    [% IF ( CAN_user_acquisition_planning_manage ) %]
+                    <li>
+                    [% ELSE %]
+                    <li class="disabled">
+                    [% END %]
+                    <a href="/cgi-bin/koha/admin/aqplan.pl?budget_period_id=[% budget_period_id %]&authcat=ITEMTYPES">Plan by item types</a></li>
+                    [% FOREACH auth_cats_loo IN auth_cats_loop %]
+                        [% IF ( CAN_user_acquisition_planning_manage ) %]
+                        <li>
+                        [% ELSE %]
+                        <li class="disabled">
+                        [% END %]
+                        <a href="/cgi-bin/koha/admin/aqplan.pl?budget_period_id=[% budget_period_id %]&authcat=[% auth_cats_loo.authcat %]">Plan by [% auth_cats_loo.authcat %]</a>
+                        </li>
+                    [% END %]
+                </ul>
+        </div>
+
+    [% ELSE %]
+        <div class="btn-group"><a class="btn btn-small" id="newrootbudget" href="/cgi-bin/koha/admin/aqbudgetperiods.pl?op=add_form"><i class="icon-plus"></i> New budget</a></div>
+    [% END %]
+
+</div>
\ No newline at end of file
-- 
1.7.9.5


More information about the Koha-patches mailing list