2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/cac1c2a9247b/ Changeset: cac1c2a9247b User: jgoecks Date: 2013-04-20 21:04:07 Summary: (a) Fetch sample names before drawing variant track and (b) update dataset metadata when changed. Affected #: 2 files diff -r 9b46c246c9cffbf9cbaaf1398e3d1cf51a3c42f6 -r cac1c2a9247bf1f2c7f78275a6d11bf209867fb2 static/scripts/mvc/data.js --- a/static/scripts/mvc/data.js +++ b/static/scripts/mvc/data.js @@ -20,8 +20,15 @@ }, initialize: function() { - // -- Create and initialize metadata. -- + // Set metadata. + // FIXME: pass back a metadata dict and then Backbone-relational + // can be used unpack metadata automatically. + this._set_metadata(); + // Update metadata on change. + this.on('change', this._set_metadata, this); + }, + _set_metadata: function() { var metadata = new DatasetMetadata(); // Move metadata from dataset attributes to metadata object. @@ -34,7 +41,8 @@ } }, this); - this.set('metadata', metadata); + // Because this is an internal change, silence it. + this.set('metadata', metadata, { 'silent': true }); }, /** diff -r 9b46c246c9cffbf9cbaaf1398e3d1cf51a3c42f6 -r cac1c2a9247bf1f2c7f78275a6d11bf209867fb2 static/scripts/viz/trackster/tracks.js --- a/static/scripts/viz/trackster/tracks.js +++ b/static/scripts/viz/trackster/tracks.js @@ -4263,6 +4263,15 @@ }, /** + * Additional initialization required before drawing track for the first time. + */ + predraw_init: function() { + if (!this.dataset.get_metadata('sample_names')) { + return this.dataset.fetch(); + } + }, + + /** * Actions to be taken after draw has been completed. Draw is completed when all tiles have been * drawn/fetched and shown. */ https://bitbucket.org/galaxy/galaxy-central/commits/9b46c246c9cf/ Changeset: 9b46c246c9cf User: jgoecks Date: 2013-04-20 20:28:11 Summary: Trackster: refactor variant sample labels and fix line-height issues. Affected #: 1 file diff -r 71fdd146b95ce53735003afa282f51fa188398ad -r 9b46c246c9cffbf9cbaaf1398e3d1cf51a3c42f6 static/scripts/viz/trackster/tracks.js --- a/static/scripts/viz/trackster/tracks.js +++ b/static/scripts/viz/trackster/tracks.js @@ -4271,45 +4271,44 @@ // Add summary/sample labels if needed and not already included. if ( !(tiles[0] instanceof SummaryTreeTile) && this.prefs.show_labels) { + var font_size; + // Add and/or style labels. if (this.container_div.find('.yaxislabel.variant').length === 0) { // Add summary and sample labels. - // FIXME: label attributes could be cleaner by using CSS classes. - - // Add summary label. - var summary_div_font_size = 10, - summary_div = $("<div/>").text('Summary').addClass('yaxislabel variant top').css({ - 'font-size': summary_div_font_size + 'px' - }); - this.container_div.prepend(summary_div); - - // Adjust summary label to middle of summary. - var base_offset = summary_div.position().top; - summary_div.css('top', base_offset + (this.prefs.summary_height - summary_div_font_size) / 2 + 'px'); - + // Add summary label to middle of summary area. + font_size = this.prefs.summary_height / 2; + this.tiles_div.prepend( + $("<div/>").text('Summary').addClass('yaxislabel variant top').css({ + 'font-size': font_size + 'px', + 'top': (this.prefs.summary_height - font_size) / 2 + 'px' + }) + ); + // Show sample labels. if (this.prefs.show_sample_data) { - var samples_div_html = ''; - _.each(this.dataset.get('metadata').get('sample_names'), function(name) { - samples_div_html += (name + '<br>'); - }); + var samples_div_html = this.dataset.get('metadata').get('sample_names').join('<br/>'); - var samples_div = $("<div/>").html(samples_div_html).addClass('yaxislabel variant top sample').css({ - // +2 for padding - 'top': base_offset + this.prefs.summary_height + 2, - }); - this.container_div.prepend(samples_div); + this.tiles_div.prepend( + $("<div/>").html(samples_div_html).addClass('yaxislabel variant top sample').css({ + // +2 for padding + 'top': this.prefs.summary_height + 2, + }) + ); } } // Style labels. // Match sample font size to mode. - $(this.container_div).find('.sample').css('font-size', (this.mode === 'Squish' ? 5 : 10) + 'px'); + font_size = (this.mode === 'Squish' ? 5 : 10) + 'px'; + $(this.tiles_div).find('.sample').css({ + 'font-size': font_size, + 'line-height': font_size + }); // Color labels to preference color. - $(this.container_div).find('.yaxislabel').css('color', this.prefs.label_color); - + $(this.tiles_div).find('.yaxislabel').css('color', this.prefs.label_color); } else { // Remove all labels. 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.