commit/galaxy-central: jgoecks: Load datasets into Scratchbook using divs rather than an iframe. Push URLs for TabularChunkedView into model, enable Scratchbook to use a function to load content, enable scrolling in frames, and some code/documentation fixes.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/638dcaad4b8d/ Changeset: 638dcaad4b8d User: jgoecks Date: 2014-05-30 22:28:17 Summary: Load datasets into Scratchbook using divs rather than an iframe. Push URLs for TabularChunkedView into model, enable Scratchbook to use a function to load content, enable scrolling in frames, and some code/documentation fixes. Affected #: 4 files diff -r 79e1326aebb77ece64475a041ed8ca4b612d9e5e -r 638dcaad4b8dcabf236d732af6f451a92cdcf2bc static/scripts/mvc/data.js --- a/static/scripts/mvc/data.js +++ b/static/scripts/mvc/data.js @@ -69,6 +69,8 @@ // If first data chunk is available, next chunk is 1. this.attributes.chunk_index = (this.attributes.first_data_chunk ? 1 : 0); + this.attributes.chunk_url = galaxy_config.root + 'dataset/display?dataset_id=' + this.id; + this.attributes.url_viz = galaxy_config.root + 'visualization'; }, /** @@ -617,8 +619,10 @@ * and appends to parent_elt. */ var createTabularDatasetChunkedView = function(options) { - // Create and set model. - options.model = new TabularDataset(options.dataset_config); + // If no model, create and set model from dataset config. + if (!options.model) { + options.model = new TabularDataset(options.dataset_config); + } var parent_elt = options.parent_elt; var embedded = options.embedded; diff -r 79e1326aebb77ece64475a041ed8ca4b612d9e5e -r 638dcaad4b8dcabf236d732af6f451a92cdcf2bc static/scripts/mvc/dataset/hda-base.js --- a/static/scripts/mvc/dataset/hda-base.js +++ b/static/scripts/mvc/dataset/hda-base.js @@ -1,8 +1,9 @@ define([ "mvc/dataset/hda-model", "mvc/base-mvc", + "mvc/data", "utils/localization" -], function( hdaModel, baseMVC, _l ){ +], function( hdaModel, baseMVC, dataset, _l ){ /* global Backbone */ /** @class Read only view for history content views to extend. @@ -313,14 +314,24 @@ var self = this; displayBtnData.onclick = function( ev ){ if( Galaxy.frame && Galaxy.frame.active ){ + // Create frame with TabularChunkedView. Galaxy.frame.add({ title : "Data Viewer: " + self.model.get('name'), - type : "url", - content : self.urls.display + type : "other", + content : function(parent_elt) { + var new_dataset = new dataset.TabularDataset({id: self.model.id}); + $.when(new_dataset.fetch()).then(function() { + dataset.createTabularDatasetChunkedView({ + model: new_dataset, + parent_elt: parent_elt, + embedded: true, + height: '100%' + }); + }); + } }); ev.preventDefault(); } - }; } displayBtnData.faIcon = 'fa-eye'; diff -r 79e1326aebb77ece64475a041ed8ca4b612d9e5e -r 638dcaad4b8dcabf236d732af6f451a92cdcf2bc static/scripts/mvc/ui/ui-frames.js --- a/static/scripts/mvc/ui/ui-frames.js +++ b/static/scripts/mvc/ui/ui-frames.js @@ -136,7 +136,15 @@ }); }, - // adds and displays a new frame/window + /** + * Adds and displays a new frame. + * + * options: + * type: 'url' or 'other' ; if 'url', 'content' is treated as a URL and loaded into an iframe; + * if 'other', content is treated as a function or raw HTML. content function is passed a single + * argument that is the frame's content DOM element + * content: the content to be loaded into the frame. + */ add: function(options) { // frame default options @@ -180,11 +188,21 @@ // append var $frame_el = null; - if (options.type == 'url') { + if (options.type === 'url') { $frame_el = $(this._template_frame_url(frame_id.substring(1), options.title, options.content)); - } else { + } + else if (options.type === 'other') { $frame_el = $(this._template_frame(frame_id.substring(1), options.title)); - $frame_el.find('.f-content').append(options.content); + + // Load content into frame. + var content_elt = $frame_el.find('.f-content'); + console.log(content_elt); + if (_.isFunction(options.content)) { + options.content(content_elt); + } + else { + content_elt.append(options.content); + } } $(this.el).append($frame_el); @@ -529,13 +547,23 @@ this.hide(); }, - // scroll + /** + * Fired when scrolling occurs on panel. + */ _event_panel_scroll: function(e) { // check if (this.event.type !== null || !this.visible) return; - + + // Stop propagation if scrolling is happening inside a frame. + // TODO: could propagate scrolling if at top/bottom of frame. + var frames = $(e.srcElement).parents('.frame') + if (frames.length !== 0) { + e.stopPropagation(); + return; + } + // prevent e.preventDefault(); diff -r 79e1326aebb77ece64475a041ed8ca4b612d9e5e -r 638dcaad4b8dcabf236d732af6f451a92cdcf2bc templates/webapps/galaxy/dataset/tabular_chunked.mako --- a/templates/webapps/galaxy/dataset/tabular_chunked.mako +++ b/templates/webapps/galaxy/dataset/tabular_chunked.mako @@ -19,9 +19,6 @@ data.createTabularDatasetChunkedView({ dataset_config: _.extend( ${h.to_json_string( trans.security.encode_dict_ids( dataset.to_dict() ) )}, { - url_viz: "${h.url_for( controller='/visualization')}", - chunk_url: "${h.url_for( controller='/dataset', action='display', - dataset_id=trans.security.encode_id( dataset.id ))}", first_data_chunk: ${chunk} } ), 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