details: http://www.bx.psu.edu/hg/galaxy/rev/c2e3183756da changeset: 2732:c2e3183756da user: jeremy goecks jeremy.goecks@emory.edu date: Mon Sep 21 10:39:58 2009 -0400 description: tags made available in history grid
3 file(s) affected in this change:
lib/galaxy/web/controllers/history.py static/scripts/autocomplete_tagging.js templates/tagging_common.mako
diffs (91 lines):
diff -r ebf68a725c09 -r c2e3183756da lib/galaxy/web/controllers/history.py --- a/lib/galaxy/web/controllers/history.py Sun Sep 20 11:48:51 2009 -0400 +++ b/lib/galaxy/web/controllers/history.py Mon Sep 21 10:39:58 2009 -0400 @@ -45,9 +45,10 @@
def get_value( self, trans, grid, history ): self.tag_elt_id_gen += 1 - return trans.fill_template( "/tagging_common.mako", trans=trans, - tagged_item=history, - elt_id="tagging-elt" + str(self.tag_elt_id_gen) ) + elt_id="tagging-elt" + str( self.tag_elt_id_gen ) + div_elt = "<div id=%s></div>" % elt_id + return div_elt + trans.fill_template( "/tagging_common.mako", trans=trans, + tagged_item=history, elt_id = elt_id, in_form="true", input_size="20" )
# Grid definition title = "Stored histories" @@ -59,7 +60,7 @@ link=( lambda item: iff( item.deleted, None, dict( operation="switch", id=item.id ) ) ), attach_popup=True ), DatasetsByStateColumn( "Datasets (by state)", ncells=4 ), - #TagsColumn( "Tags" ), + TagsColumn( "Tags"), StatusColumn( "Status", attach_popup=False ), grids.GridColumn( "Created", key="create_time", format=time_ago ), grids.GridColumn( "Last Updated", key="update_time", format=time_ago ), diff -r ebf68a725c09 -r c2e3183756da static/scripts/autocomplete_tagging.js --- a/static/scripts/autocomplete_tagging.js Sun Sep 20 11:48:51 2009 -0400 +++ b/static/scripts/autocomplete_tagging.js Mon Sep 21 10:39:58 2009 -0400 @@ -23,7 +23,7 @@ text = "Add tags"; return text; }, - tag_click_fn : function (tag) { }, + tag_click_fn : function (name, value) { }, input_size: 20, in_form: false, tags : {}, @@ -240,10 +240,11 @@ // Build tag button. var tag_name_elt = $("<span>").text(tag_str).addClass("tag-name"); tag_name_elt.click( function() - { - settings.tag_click_fn(tag_str); - return true; - }); + { + tag_name_and_value = tag_str.split(":") + settings.tag_click_fn(tag_name_and_value[0], tag_name_and_value[1]); + return true; + });
var tag_button = $("<span></span>").addClass("tag-button"); tag_button.append(tag_name_elt); diff -r ebf68a725c09 -r c2e3183756da templates/tagging_common.mako --- a/templates/tagging_common.mako Sun Sep 20 11:48:51 2009 -0400 +++ b/templates/tagging_common.mako Mon Sep 21 10:39:58 2009 -0400 @@ -1,3 +1,8 @@ +## Render a tagging element if there is a tagged_item. +%if tagged_item is not None and elt_id is not None: + ${render_tagging_element(tagged_item, elt_id=elt_id, in_form=in_form, input_size=input_size)} +%endif + ## Render the tags 'tags' as an autocomplete element. <%def name="render_tagging_element(tagged_item, elt_id, use_toggle_link='true', in_form='false', input_size='15')"> <script type="text/javascript"> @@ -73,11 +78,23 @@ return text; };
+ // + // Function to handle a tag click. + // + var tag_click_fn = function(tag_name, tag_value) + { + alert(tag_name); + + // Do URL request to get histories tag. + self.location = "http://www.yahoo.com"; + }; + var options = { tags : ${h.to_json_string(tag_names_and_values)}, get_toggle_link_text_fn: get_toggle_link_text, - tag_click_fn: function(tag) { /* Do nothing. */ }, + tag_click_fn: tag_click_fn, + ##tag_click_fn: function(name, value) { /* Do nothing. */ }, <% tagged_item_id = trans.security.encode_id(tagged_item.id) %> ajax_autocomplete_tag_url: "${h.url_for( controller='tag', action='tag_autocomplete_data', id=tagged_item_id, item_class=tagged_item.__class__.__name__ )}", ajax_add_tag_url: "${h.url_for( controller='tag', action='add_tag_async', id=tagged_item_id, item_class=tagged_item.__class__.__name__ )}",
galaxy-dev@lists.galaxyproject.org