From 06c4ab7e0554e2e3d1352546f8975b3a8571e320 Mon Sep 17 00:00:00 2001
From: Jeremy Goecks
Date: Mon, 9 Nov 2009 14:07:16 -0500
Subject: [PATCH] Refactoring and bug fixes for grid templates.
---
lib/galaxy/web/controllers/dataset.py | 2 +-
lib/galaxy/web/framework/helpers/grids.py | 6 +-
templates/dataset/grid.mako | 299 +-----------------
templates/grid_base.mako | 358 ++++++++++++++++++++++
templates/grid_common.mako | 95 +++---
templates/history/grid.mako | 312 +------------------
6 files changed, 409 insertions(+), 663 deletions(-)
create mode 100644 templates/grid_base.mako
diff --git a/lib/galaxy/web/controllers/dataset.py b/lib/galaxy/web/controllers/dataset.py
index 49276fc4fdd..590d4633468 100644
--- a/lib/galaxy/web/controllers/dataset.py
+++ b/lib/galaxy/web/controllers/dataset.py
@@ -83,7 +83,7 @@ class HistoryDatasetAssociationListGrid( grids.Grid ):
grids.MulticolFilterColumn(
"Search",
cols_to_filter=[ columns[0], columns[2] ],
- key="free-text-search", visible=False, filterable="default" )
+ key="free-text-search", visible=False, filterable="standard" )
)
operations = []
standard_filters = []
diff --git a/lib/galaxy/web/framework/helpers/grids.py b/lib/galaxy/web/framework/helpers/grids.py
index d8503ce7945..01f65fe0f92 100644
--- a/lib/galaxy/web/framework/helpers/grids.py
+++ b/lib/galaxy/web/framework/helpers/grids.py
@@ -16,7 +16,7 @@ class Grid( object ):
title = ""
exposed = True
model_class = None
- template = "grid.mako"
+ template = "grid_base.mako"
global_actions = []
columns = []
operations = []
@@ -99,9 +99,9 @@ class Grid( object ):
if isinstance( decoded_item, list):
decoded_list = from_json_string_recurse( decoded_item )
else:
- decoded_list = [ str( decoded_item ) ]
+ decoded_list = [ unicode( decoded_item ) ]
except ValueError:
- decoded_list = [ str( item ) ]
+ decoded_list = [ unicode ( item ) ]
elif isinstance( item, list):
return_val = []
for element in item:
diff --git a/templates/dataset/grid.mako b/templates/dataset/grid.mako
index 70ca26178d3..8fc475526ee 100644
--- a/templates/dataset/grid.mako
+++ b/templates/dataset/grid.mako
@@ -1,298 +1 @@
-<%! from galaxy.web.framework.helpers.grids import GridColumnFilter %>
-
-<%inherit file="/base.mako"/>
-<%def name="title()">${grid.title}%def>
-
-%if message:
-
-
${message}
-
-
-%endif
-
-<%def name="javascripts()">
- ${parent.javascripts()}
- ${h.js("jquery.autocomplete", "autocomplete_tagging" )}
-
-%def>
-
-<%def name="stylesheets()">
- ${h.css( "base", "autocomplete_tagging" )}
-
-%def>
-
-<%namespace file="../grid_common.mako" import="*" />
-
-## Print grid header.
-${render_grid_filters()}
-
-## Print grid.
-
+<%inherit file="/grid_base.mako"/>
\ No newline at end of file
diff --git a/templates/grid_base.mako b/templates/grid_base.mako
new file mode 100644
index 00000000000..e30763510dc
--- /dev/null
+++ b/templates/grid_base.mako
@@ -0,0 +1,358 @@
+<%!
+ from galaxy.model import History, HistoryDatasetAssociation
+ def inherit(context):
+ if context.get('use_panels'):
+ return '/base_panels.mako'
+ else:
+ return '/base.mako'
+%>
+<%inherit file="${inherit(context)}"/>
+
+## Render the grid's basic elements. Each of these elements can be subclassed.
+%if message:
+
+
${message}
+
+
+%endif
+
+${self.grid_header()}
+${self.grid_table()}
+
+## Function definitions.
+
+<%def name="title()">${grid.title}%def>
+
+<%def name="javascripts()">
+ ${parent.javascripts()}
+ ${h.js("jquery.autocomplete", "autocomplete_tagging" )}
+
+%def>
+
+<%def name="stylesheets()">
+ ${h.css( "base", "autocomplete_tagging" )}
+
+%def>
+
+<%namespace file="./grid_common.mako" import="*" />
+
+## Print grid header.
+<%def name="grid_header()">
+
+%def>
+
+## Print grid.
+<%def name="grid_table()">
+
+%def>
\ No newline at end of file
diff --git a/templates/grid_common.mako b/templates/grid_common.mako
index 78a32c3600c..68f625d97e6 100644
--- a/templates/grid_common.mako
+++ b/templates/grid_common.mako
@@ -73,57 +73,52 @@
## Print grid search/filtering UI.
<%def name="render_grid_filters()">
-