[Koha-patches] [PATCH] Bug 9625 - Replace YUI buttons and menus on reports pages with Bootstrap

Owen Leonard oleonard at myacpl.org
Fri Feb 15 17:45:38 CET 2013


This patch converts the toolbar include file used by guided/SQL report
pages to Bootstrap, replacing YUI button and menu code with Bootstrap
markup.

To test, view any page in reports/ which uses reports-toolbar.inc
(Saved reports, Guided reports, SQL reports). Buttons and menus should
look correct and work correctly.
---
 .../prog/en/includes/reports-toolbar.inc           |   59 ++++++--------------
 1 file changed, 16 insertions(+), 43 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc
index a4e4226..5d93b20 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc
@@ -1,44 +1,17 @@
-[% UNLESS ( no_add ) %]
-<div id="toolbar">
-	<script type="text/javascript">
-	//<![CDATA[
-	 $(document).ready(function() {
-		$("#newmenuc").empty();
-		$("#newsql").remove();
-		yuiToolbar();
-	 });
-
-	// YUI Toolbar Functions
-	function yuiToolbar() {
-	[% IF ( CAN_user_reports_create_reports ) %]
-		var newmenu = [
-			{ text: _("Guided report"),  url: "/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new" },
-			{ text: _("SQL report"),  url: "/cgi-bin/koha/reports/guided_reports.pl?phase=Create%20report%20from%20SQL" }
-		]
-	    new YAHOO.widget.Button({
-	        type: "menu",
-	        label: _("New"),
-	        name: "newmenubutton",
-	        menu: newmenu,
-	        container: "newmenuc"
-	    });
-	    new YAHOO.widget.Button("editreport");[% END %]
-	    new YAHOO.widget.Button("runreport");
-	}
-	//]]>
-	</script>
-
-	<ul class="toolbar">
-		[% IF ( CAN_user_reports_create_reports ) %]<li id="newmenuc"><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">New guided report</a> </li>[% END %]
-		<li id="newsql"><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create%20report%20from%20SQL">New SQL report</a> </li>
-		[% IF ( showsql || execute || editsql || save_successful ) %]
-			[% UNLESS ( errors ) %][%# Unless there are errors saving a report %]
-				[% UNLESS ( editsql ) %][%# Do not show edit button on edit page %]
-					[% IF ( CAN_user_reports_create_reports ) %]<li><a id="editreport" href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id %]&phase=Edit%20SQL">Edit</a></li>[% END %]
-				[% END %]
-				<li><a id="runreport" href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id %]&phase=Run%20this%20report">Run report</a></li>
-			[% END %]
-		[% END %]
-	</ul>
+<div id="toolbar" class="btn-toolbar">
+    [% IF ( CAN_user_reports_create_reports ) %]<div class="btn-group">
+        <button class="btn btn-small dropdown-toggle" data-toggle="dropdown"><i class="icon-plus"></i> New report <span class="caret"></span></button>
+            <ul class="dropdown-menu">
+                <li id="newmenuc"><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">New guided report</a> </li>
+                <li id="newsql"><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create%20report%20from%20SQL">New SQL report</a> </li>
+            </ul>
+    </div>[% END %]
+[% IF ( showsql || execute || editsql || save_successful ) %]xx
+    [% UNLESS ( errors ) %][%# Unless there are errors saving a report %]
+        [% UNLESS ( editsql ) %][%# Do not show edit button on edit page %]
+            [% IF ( CAN_user_reports_create_reports ) %]<div class="btn-group"><a id="editreport" class="btn btn-small" href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id %]&phase=Edit%20SQL"><i class="icon-pencil"></i> Edit</a></div>[% END %]
+        [% END %]
+        <div class="btn-group"><a id="runreport" class="btn btn-small" href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id %]&phase=Run%20this%20report"><i class="icon-play"></i> Run report</a></div>
+    [% END %]
+[% END %]
 </div>
-[% END %]
\ No newline at end of file
-- 
1.7.9.5


More information about the Koha-patches mailing list