From 405e679191f2b1192c457d185f159cfcff73feae Mon Sep 17 00:00:00 2001 From: Jeremy Goecks Date: Wed, 18 Nov 2009 11:51:09 -0500 Subject: [PATCH] Tweaks to grid filter UI: (1) added search image/submit button for initiating search and (2) styled text filter criteria. --- lib/galaxy/web/framework/helpers/grids.py | 3 ++ static/images/mag_glass.png | Bin 0 -> 706 bytes templates/grid_base.mako | 35 ++++++++++++++++++++++ templates/grid_common.mako | 13 ++++---- 4 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 static/images/mag_glass.png diff --git a/lib/galaxy/web/framework/helpers/grids.py b/lib/galaxy/web/framework/helpers/grids.py index 16af3ff17ff..cae39b8fb75 100644 --- a/lib/galaxy/web/framework/helpers/grids.py +++ b/lib/galaxy/web/framework/helpers/grids.py @@ -120,6 +120,9 @@ class Grid( object ): column_filter = from_json_string_recurse( column_filter ) if len( column_filter ) == 1: column_filter = column_filter[0] + # If filter criterion is empty, do nothing. + if column_filter == '': + continue # Update query. query = column.filter( trans.sa_session, query, column_filter ) # Upate current filter dict. diff --git a/static/images/mag_glass.png b/static/images/mag_glass.png new file mode 100644 index 0000000000000000000000000000000000000000..61a9e338195f4c43c61c0ff04ad458ad3c4db5bb GIT binary patch literal 706 zcmV;z0zLhSP)Q4pVvO)9b_TbiQH$t0ll7TNv*@g(FBFc&Fk zw3pqh|3DSY&0F=f3o1gPcu^4bCJ6yWuuH{=x3nj-q=cBT-F!3&>&)A1x|_DT6f!XT z=FP|N&CHv(oMl-sEecEvm~f{GKI6_@RaIxZiozY_^hog$*G=Rt+Dno|%YVrOJ{Sxr z;Bh1pSr z0Me0-e0<L#_~)z1Lv zI>6^&0M)7uwXguJP2_VX@LsP6!{Ly{E-l#*w9)~yv%qZR{8-`IVm&>W;#p_V( zgdjd|!|>+-E?qbTv;p~?3B1{CzAh9BskODs0G0rnj_D#T3q82XH{s=*0+5ePH+=#r zbV+Wa=kGA;`CKmdG@s8~rBcaiG#ZRaCLNKYD71`Y99dGfkLfrvIwZ?7;6s|vX0vz0 z;qa|sFqk46UShG;YQ4qz-=GJCGf!h$+*YI;<5*PuGjk^k4B(M3BF9EdGU;LnZasSU zo3SVzRdN5>mt&cG<{X0=;UNdeHRQb!*KR-gM7llo+u$o@PDE9#$SNzn)9Ems`{S7w zw_#Flw@q8M^CJ5`FjI|2qipXSFgM3@lQAb|KIuez(`+*}X0L;$#_1=g<4ddJBcKBe zMgYDucb84=;W!QtfL#JUjXcwGniJ`UwrGF<0wly_^H?Mpr~m)}07*qoM6N<$f`-~YVE_OC literal 0 HcmV?d00001 diff --git a/templates/grid_base.mako b/templates/grid_base.mako index 5436415be80..3f1b1b6687a 100644 --- a/templates/grid_base.mako +++ b/templates/grid_base.mako @@ -62,6 +62,21 @@ ${self.grid_table()} t2.autocomplete("${h.url_for( controller='history', action='name_autocomplete_data' )}", autocomplete_options); } + + // Initialize submit image elements. + $('.submit-image').each( function() + { + // On mousedown, add class to simulate click. + $(this).mousedown( function() { + $(this).addClass('gray-background'); + }); + + // On mouseup, add class to simulate click. + $(this).mouseup( function() { + $(this).removeClass('gray-background'); + }); + + }); }); ## Can this be moved into base.mako? %if refresh_frames: @@ -168,6 +183,26 @@ ${self.grid_table()} text-align: center; display: inline-block; } + .submit-image { + vertical-align: text-bottom; + margin: 0; + padding: 0; + } + .no-padding-or-margin { + margin: 0; + padding: 0; + } + .gray-background { + background-color: #DDDDDD; + } + .text-filter-val { + border: solid 1px #AAAAAA; + padding: 1px 3px 1px 3px; + margin-right: 5px; + -moz-border-radius: .5em; + -webkit-border-radius: .5em; + font-style: italic; + } diff --git a/templates/grid_common.mako b/templates/grid_common.mako index 3742a5e3427..e0591dbce22 100644 --- a/templates/grid_common.mako +++ b/templates/grid_common.mako @@ -32,10 +32,11 @@ <% column_filter = cur_filter_dict[column.key] %> %if isinstance( column_filter, basestring ): %if column_filter != "All": - ${cur_filter_dict[column.key]} - <% filter_all = GridColumnFilter( "", { column.key : "All" } ) %> - - | + + ${cur_filter_dict[column.key]} + <% filter_all = GridColumnFilter( "", { column.key : "All" } ) %> + + %endif %elif isinstance( column_filter, list ): %for i, filter in enumerate( column_filter ): @@ -53,7 +54,9 @@ %endif %endif - + + + %else: %for i, filter in enumerate( column.get_accepted_filters() ):