commit/galaxy-central: guerler: Fix links in masterhead, continue integration of new modal
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/99e18f886847/ Changeset: 99e18f886847 User: guerler Date: 2013-10-02 19:23:22 Summary: Fix links in masterhead, continue integration of new modal Affected #: 8 files diff -r 0fc6c5554877c4389fc074cdfac60fdc12ebcb6e -r 99e18f8868470f48a6a5d91070019d9bfc801f7e static/scripts/mvc/data.js --- a/static/scripts/mvc/data.js +++ b/static/scripts/mvc/data.js @@ -416,49 +416,54 @@ error: function() { alert( ( "Could not add this dataset to browser" ) + '.' ); }, success: function(table_html) { var parent = window.parent; + parent.Galaxy.modal.show({ + title : "View Data in a New or Saved Visualization", + buttons :{ + "Cancel": function(){ + parent.Galaxy.modal.hide(); + }, + "View in saved visualization": function(){ + // Show new modal with saved visualizations. + parent.Galaxy.modal.show( + { + title: "Add Data to Saved Visualization", + body: table_html, + buttons :{ + "Cancel": function(){ + parent.Galaxy.modal.hide(); + }, + "Add to visualization": function(){ + $(parent.document).find('input[name=id]:checked').each(function(){ + // hide + parent.Galaxy.modal.hide(); + + var vis_id = $(this).val(); + dataset_params.id = vis_id; + + // add widget + parent.Galaxy.frame_manager.frame_new({ + title : "Trackster", + type : "url", + content : vis_url + "/trackster?" + $.param(dataset_params) + }); + }); + } + } + }); + }, + "View in new visualization": function(){ + // hide + parent.Galaxy.modal.hide(); + + var url = vis_url + "/trackster?" + $.param(dataset_params); - parent.show_modal( ( "View Data in a New or Saved Visualization" ), "", { - "Cancel": function() { - parent.hide_modal(); - }, - "View in saved visualization": function() { - // Show new modal with saved visualizations. - parent.show_modal( ( "Add Data to Saved Visualization" ), table_html, { - "Cancel": function() { - parent.hide_modal(); - }, - "Add to visualization": function() { - $(parent.document).find('input[name=id]:checked').each(function() { - var vis_id = $(this).val(); - dataset_params.id = vis_id; - - // add widget - parent.Galaxy.frame_manager.frame_new( - { - title : "Trackster", - type : "url", - content : vis_url + "/trackster?" + $.param(dataset_params) - }); - - // hide - parent.hide_modal(); - }); - } - }); - }, - "View in new visualization": function() { - var url = vis_url + "/trackster?" + $.param(dataset_params); - - // add widget - parent.Galaxy.frame_manager.frame_new( - { - title : "Trackster", - type : "url", - content : url - }); - - // hide - parent.hide_modal(); + // add widget + parent.Galaxy.frame_manager.frame_new({ + title : "Trackster", + type : "url", + content : url + }); + } } }); } diff -r 0fc6c5554877c4389fc074cdfac60fdc12ebcb6e -r 99e18f8868470f48a6a5d91070019d9bfc801f7e static/scripts/mvc/dataset/hda-edit.js --- a/static/scripts/mvc/dataset/hda-edit.js +++ b/static/scripts/mvc/dataset/hda-edit.js @@ -635,67 +635,77 @@ * @returns function that displays modal, loads trackster */ //TODO: should be imported from trackster.js -function create_trackster_action_fn(vis_url, dataset_params, dbkey) { - return function() { - var listTracksParams = {}; - if (dbkey){ - // list_tracks seems to use 'f-dbkey' (??) - listTracksParams[ 'f-dbkey' ] = dbkey; - } - $.ajax({ - url: vis_url + '/list_tracks?' + $.param( listTracksParams ), - dataType: "html", - error: function() { alert( _l( "Could not add this dataset to browser" ) + '.' ); }, - success: function(table_html) { - var parent = window.parent; +//TODO: This function is redundant and also exists in data.js + // create action + function create_trackster_action_fn (vis_url, dataset_params, dbkey) { + return function() { + var listTracksParams = {}; + if (dbkey){ + // list_tracks seems to use 'f-dbkey' (??) + listTracksParams[ 'f-dbkey' ] = dbkey; + } + $.ajax({ + url: vis_url + '/list_tracks?' + $.param( listTracksParams ), + dataType: "html", + error: function() { alert( ( "Could not add this dataset to browser" ) + '.' ); }, + success: function(table_html) { + var parent = window.parent; + parent.Galaxy.modal.show({ + title : "View Data in a New or Saved Visualization", + buttons :{ + "Cancel": function(){ + parent.Galaxy.modal.hide(); + }, + "View in saved visualization": function(){ + // Show new modal with saved visualizations. + parent.Galaxy.modal.show( + { + title: "Add Data to Saved Visualization", + body: table_html, + buttons :{ + "Cancel": function(){ + parent.Galaxy.modal.hide(); + }, + "Add to visualization": function(){ + $(parent.document).find('input[name=id]:checked').each(function(){ + // hide + parent.Galaxy.modal.hide(); + + var vis_id = $(this).val(); + dataset_params.id = vis_id; + + // add widget + parent.Galaxy.frame_manager.frame_new({ + title : "Trackster", + type : "url", + content : vis_url + "/trackster?" + $.param(dataset_params) + }); + }); + } + } + }); + }, + "View in new visualization": function(){ + // hide + parent.Galaxy.modal.hide(); + + var url = vis_url + "/trackster?" + $.param(dataset_params); - parent.show_modal( _l( "View Data in a New or Saved Visualization" ), "", { - "Cancel": function() { - parent.hide_modal(); - }, - "View in saved visualization": function() { - // Show new modal with saved visualizations. - parent.show_modal( _l( "Add Data to Saved Visualization" ), table_html, { - "Cancel": function() { - parent.hide_modal(); - }, - "Add to visualization": function() { - $(parent.document).find('input[name=id]:checked').each(function() { - var vis_id = $(this).val(); - dataset_params.id = vis_id; - - // hide modal - parent.hide_modal(); - - // add widget - Galaxy.frame_manager.frame_new( - { - title : "Trackster", - type : "url", - content : vis_url + "/trackster?" + $.param(dataset_params) - }); + // add widget + parent.Galaxy.frame_manager.frame_new({ + title : "Trackster", + type : "url", + content : url }); } - }); - }, - "View in new visualization": function() { - // hide modal - parent.hide_modal(); + } + }); + } + }); + return false; + }; + } - // add widget - Galaxy.frame_manager.frame_new( - { - title : "Trackster", - type : "url", - content : vis_url + "/trackster?" + $.param(dataset_params) - }); - } - }); - } - }); - return false; - }; -} //============================================================================== //return { diff -r 0fc6c5554877c4389fc074cdfac60fdc12ebcb6e -r 99e18f8868470f48a6a5d91070019d9bfc801f7e static/scripts/utils/config.js --- a/static/scripts/utils/config.js +++ b/static/scripts/utils/config.js @@ -245,9 +245,13 @@ if (this.$el.children().length === 0) { this.render(); } - show_modal("Configure", drawable.config.build_form(), { - "Cancel": cancel_fn, - "OK": ok_fn + Galaxy.modal.show({ + title: "Configure", + body: drawable.config.build_form(), + buttons: { + "Cancel": cancel_fn, + "OK": ok_fn + } }); }, diff -r 0fc6c5554877c4389fc074cdfac60fdc12ebcb6e -r 99e18f8868470f48a6a5d91070019d9bfc801f7e static/scripts/viz/trackster/filters.js --- a/static/scripts/viz/trackster/filters.js +++ b/static/scripts/viz/trackster/filters.js @@ -596,15 +596,19 @@ $.getJSON(run_tool_url, url_params, function(response) { if (response.error) { // General error. - show_modal("Filter Dataset", - "Error running tool " + tool_id, - { "Close" : hide_modal } ); + Galaxy.modal.show({ + title: "Filter Dataset", + body : "Error running tool " + tool_id, + buttons : { "Close" : Galaxy.modal.hide() } + }); } else if (filters.length === 0) { // No more filters to run. - show_modal("Filtering Dataset", - "Filter(s) are running on the complete dataset. Outputs are in dataset's history.", - { "Close" : hide_modal } ); + Galaxy.modal.show({ + title: "Filtering Dataset", + body: "Filter(s) are running on the complete dataset. Outputs are in dataset's history.", + buttons: { "Close" : Galaxy.modal.hide() } + }); } else { // More filters to run. diff -r 0fc6c5554877c4389fc074cdfac60fdc12ebcb6e -r 99e18f8868470f48a6a5d91070019d9bfc801f7e static/scripts/viz/visualization.js --- a/static/scripts/viz/visualization.js +++ b/static/scripts/viz/visualization.js @@ -20,7 +20,47 @@ data: filters, error: function() { alert( "Grid failed" ); }, success: function(table_html) { - Galaxy.modal.show({ + show_modal( + "Select datasets for new tracks", + table_html, + { + "Cancel": function() { + hide_modal(); + }, + "Add": function() { + var requests = []; + $('input[name=id]:checked,input[name=ldda_ids]:checked').each(function() { + var data = { + data_type: 'track_config', + 'hda_ldda': 'hda' + }, + id = $(this).val(); + if ($(this).attr("name") !== "id") { + data.hda_ldda = 'ldda'; + } + requests[requests.length] = $.ajax({ + url: add_track_async_url + "/" + id, + data: data, + dataType: "json" + }); + }); + // To preserve order, wait until there are definitions for all tracks and then add + // them sequentially. + $.when.apply($, requests).then(function() { + // jQuery always returns an Array for arguments, so need to look at first element + // to determine whether multiple requests were made and consequently how to + // map arguments to track definitions. + var track_defs = (arguments[0] instanceof Array ? + $.map(arguments, function(arg) { return arg[0]; }) : + [ arguments[0] ] + ); + success_fn(track_defs); + }); + hide_modal(); + } + } + ); + /*Galaxy.modal.show({ title : "Select datasets for new tracks", body : table_html, buttons : @@ -60,7 +100,7 @@ Galaxy.modal.hide(); } } - }); + });*/ } }); }; diff -r 0fc6c5554877c4389fc074cdfac60fdc12ebcb6e -r 99e18f8868470f48a6a5d91070019d9bfc801f7e templates/base/base_panels.mako --- a/templates/base/base_panels.mako +++ b/templates/base/base_panels.mako @@ -102,10 +102,11 @@ }); ## load galaxy js-modules - require(['galaxy.master', 'galaxy.frame', 'galaxy.upload'], function(master, frame, upload) + require(['galaxy.master', 'galaxy.frame', 'galaxy.modal', 'galaxy.upload'], function(master, frame, modal, upload) { Galaxy.master = new master.GalaxyMaster(); Galaxy.frame_manager = new frame.GalaxyFrameManager(); + Galaxy.modal = new modal.GalaxyModal(); ##Galaxy.upload = new upload.GalaxyUpload(); }); </script> diff -r 0fc6c5554877c4389fc074cdfac60fdc12ebcb6e -r 99e18f8868470f48a6a5d91070019d9bfc801f7e templates/webapps/galaxy/base_panels.mako --- a/templates/webapps/galaxy/base_panels.mako +++ b/templates/webapps/galaxy/base_panels.mako @@ -63,7 +63,7 @@ <ul class="nav navbar-nav" border="0" cellspacing="0"> - <%def name="tab( id, display, href, target='_parent', visible=True, extra_class='', menu_options=None )"> + <%def name="tab( id, display, href, onclick=False, target='_parent', visible=True, extra_class='', menu_options=None )"> ## Create a tab at the top of the panels. menu_options is a list of 2-elements lists of [name, link] ## that are options in the menu. @@ -100,7 +100,11 @@ ${menu_item[0]} %elif len ( menu_item ) == 2: <% name, link = menu_item %> - <a href="${link}">${name}</a> + %if onclick: + <a href="${link}" onclick="Galaxy.frame_manager.frame_new({title: '${name}', type: 'url', content: '${link}'}); return false;">${name}</a> + %else: + <a href="${link}">${name}</a> + %endif %else: <% name, link, target = menu_item %><a target="${target}" href="${link}">${name}</a> @@ -117,7 +121,7 @@ ${tab( "analysis", _("Analyze Data"), h.url_for( controller='/root', action='index' ) )} ## Workflow tab. - ${tab( "workflow", _("Workflow"), "javascript:Galaxy.frame_manager.frame_new({title: 'Workflow', type: 'url', content: '" + h.url_for( controller='/workflow', action='index' ) + "'});")} + ${tab( "workflow", _("Workflow"), h.url_for( controller='/workflow', action='index' ) )} ## 'Shared Items' or Libraries tab. <% @@ -147,10 +151,10 @@ ## Visualization menu. <% menu_options = [ - [_('New Track Browser'), "javascript:Galaxy.frame_manager.frame_new({title: 'Trackster', type: 'url', content: '" + h.url_for( controller='/visualization', action='trackster' ) + "'});"], - [_('Saved Visualizations'), "javascript:Galaxy.frame_manager.frame_new({ type: 'url', content : '" + h.url_for( controller='/visualization', action='list' ) + "'});" ] + [_('New Track Browser'), h.url_for( controller='/visualization', action='trackster' )], + [_('Saved Visualizations'), h.url_for( controller='/visualization', action='list' )] ] - tab( "visualization", _("Visualization"), "javascript:Galaxy.frame_manager.frame_new({title: 'Trackster', type: 'url', content: '" + h.url_for( controller='/visualization', action='list' ) + "'});", menu_options=menu_options ) + tab( "visualization", _("Visualization"), h.url_for( controller='/visualization', action='list' ), menu_options=menu_options, onclick=True ) %> ## Cloud menu. diff -r 0fc6c5554877c4389fc074cdfac60fdc12ebcb6e -r 99e18f8868470f48a6a5d91070019d9bfc801f7e templates/webapps/galaxy/galaxy.panels.mako --- a/templates/webapps/galaxy/galaxy.panels.mako +++ b/templates/webapps/galaxy/galaxy.panels.mako @@ -152,6 +152,38 @@ </script></%def> +<%def name="overlay( title='', content='', visible=False )"> + <%def name="title()"></%def> + <%def name="content()"></%def> + + <% + if visible: + display = "style='display: block;'" + overlay_class = "in" + else: + display = "style='display: none;'" + overlay_class = "" + %> + + <div id="top-modal" class="modal fade ${overlay_class}" ${display}> + <div id="top-modal-backdrop" class="modal-backdrop fade ${overlay_class}" style="z-index: -1"></div> + <div id="top-modal-dialog" class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type='button' class='close' style="display: none;">×</button> + <h4 class='title'>${title}</h4> + </div> + <div class="modal-body">${content}</div> + <div class="modal-footer"> + <div class="buttons" style="float: right;"></div> + <div class="extra_buttons" style=""></div> + <div style="clear: both;"></div> + </div> + </div> + </div> + </div> +</%def> + ## document <html><head> @@ -182,7 +214,7 @@ %if self.galaxy_config['message_box']: <div id="messagebox" class="panel-message"></div> %endif - + ${self.overlay()} ## left panel %if self.galaxy_config['left_panel']: <div id="left"> Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org