3 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/f938aac3397b/ Changeset: f938aac3397b User: jgoecks Date: 2013-10-13 22:28:13 Summary: Trackster: fold content_visible flag into config. Affected #: 1 file diff -r 5c10579e88db53ed05013c4314573d3919d72e17 -r f938aac3397bfd12da241b3f60daecf90574d0ec static/scripts/viz/trackster/tracks.js --- a/static/scripts/viz/trackster/tracks.js +++ b/static/scripts/viz/trackster/tracks.js @@ -207,6 +207,11 @@ this.name = obj_dict.name; this.view = view; this.container = container; + this.drag_handle_class = obj_dict.drag_handle_class; + this.is_overview = false; + this.action_icons = {}; + + // Set up drawable configuration. this.config = new Config({ params: this.config_params, onchange: this.config_onchange, @@ -216,12 +221,6 @@ this.config.on('change:values', this.config_onchange, this); } this.prefs = this.config.get('values'); - this.drag_handle_class = obj_dict.drag_handle_class; - this.is_overview = false; - this.action_icons = {}; - - // FIXME: this should be a saved setting - this.content_visible = true; // Build Drawable HTML and behaviors. this.container_div = this.build_container_div(); @@ -258,13 +257,14 @@ title: "Hide/show content", css_class: "toggle", on_click_fn: function(drawable) { - if ( drawable.content_visible ) { + if ( drawable.prefs.content_visible ) { drawable.action_icons.toggle_icon.addClass("toggle-expand").removeClass("toggle"); drawable.hide_contents(); - drawable.content_visible = false; - } else { + drawable.prefs.content_visible = false; + } + else { drawable.action_icons.toggle_icon.addClass("toggle").removeClass("toggle-expand"); - drawable.content_visible = true; + drawable.prefs.content_visible = true; drawable.show_contents(); } } @@ -296,7 +296,8 @@ extend(Drawable.prototype, { config_params: [ - { key: 'name', label: 'Name', type: 'text', default_value: this.name } + { key: 'name', label: 'Name', type: 'text', default_value: this.name }, + { key: 'content_visible', type: 'bool', default_value: true, hidden: true } ], config_onchange: function() { @@ -310,7 +311,7 @@ }, can_draw: function() { - if (this.enabled && this.content_visible) { + if (this.enabled && this.prefs.content_visible) { return true; } @@ -2541,7 +2542,7 @@ var drag_control = $( "<div class='track-resize'>" ); // Control shows on hover over track, stays while dragging $(track.container_div).hover( function() { - if ( track.content_visible ) { + if ( track.prefs.content_visible ) { in_handle = true; drag_control.show(); } @@ -2831,6 +2832,9 @@ // Add tiles_div, overlay_div to content_div. this.tiles_div = $("<div/>").addClass("tiles").appendTo(this.content_div); + if (!this.prefs.content_visible) { + this.tiles_div.hide(); + } this.overlay_div = $("<div/>").addClass("overlay").appendTo(this.content_div); if (obj_dict.mode) { @@ -3808,14 +3812,13 @@ extend(LineTrack.prototype, Drawable.prototype, TiledTrack.prototype, { display_modes: CONTINUOUS_DATA_MODES, - config_params: [ - { key: 'name', label: 'Name', type: 'text', default_value: this.name }, + config_params: _.union( Drawable.prototype.config_params, [ { key: 'color', label: 'Color', type: 'color', default_value: util.get_random_color() }, { key: 'min_value', label: 'Min Value', type: 'float', default_value: undefined }, { key: 'max_value', label: 'Max Value', type: 'float', default_value: undefined }, { key: 'mode', type: 'string', default_value: this.mode, hidden: true }, { key: 'height', type: 'int', default_value: 30, hidden: true } - ], + ] ), config_onchange: function() { this.set_name(this.prefs.name); @@ -3863,15 +3866,14 @@ extend(DiagonalHeatmapTrack.prototype, Drawable.prototype, TiledTrack.prototype, { display_modes: ["Heatmap"], - config_params: [ - { key: 'name', label: 'Name', type: 'text', default_value: this.name }, + config_params: _.union( Drawable.prototype.config_params, [ { key: 'pos_color', label: 'Positive Color', type: 'color', default_value: "#FF8C00" }, { key: 'neg_color', label: 'Negative Color', type: 'color', default_value: "#4169E1" }, { key: 'min_value', label: 'Min Value', type: 'float', default_value: -1 }, { key: 'max_value', label: 'Max Value', type: 'float', default_value: 1 }, { key: 'mode', type: 'string', default_value: this.mode, hidden: true }, { key: 'height', type: 'int', default_value: 500, hidden: true } - ], + ] ), config_onchange: function() { this.set_name(this.prefs.name); @@ -3908,8 +3910,7 @@ extend(FeatureTrack.prototype, Drawable.prototype, TiledTrack.prototype, { display_modes: ["Auto", "Coverage", "Dense", "Squish", "Pack"], - config_params: [ - { key: 'name', label: 'Name', type: 'text', default_value: this.name }, + config_params: _.union( Drawable.prototype.config_params, [ { key: 'block_color', label: 'Block color', type: 'color', default_value: util.get_random_color() }, { key: 'reverse_strand_color', label: 'Antisense strand color', type: 'color', default_value: util.get_random_color() }, { key: 'label_color', label: 'Label color', type: 'color', default_value: 'black' }, @@ -3921,7 +3922,7 @@ options: [ { label: 'Line with arrows', value: 'fishbone' }, { label: 'Arcs', value: 'arcs' } ] }, { key: 'mode', type: 'string', default_value: this.mode, hidden: true }, { key: 'height', type: 'int', default_value: 0, hidden: true} - ], + ] ), config_onchange: function() { this.set_name(this.prefs.name); @@ -4207,14 +4208,13 @@ extend(VariantTrack.prototype, Drawable.prototype, TiledTrack.prototype, { display_modes: ["Auto", "Coverage", "Dense", "Squish", "Pack"], - config_params: [ - { key: 'name', label: 'Name', type: 'text', default_value: this.name }, + config_params: _.union( Drawable.prototype.config_params, [ { key: 'color', label: 'Histogram color', type: 'color', default_value: util.get_random_color() }, { key: 'show_sample_data', label: 'Show sample data', type: 'bool', default_value: true }, { key: 'show_labels', label: 'Show summary and sample labels', type: 'bool', default_value: true }, { key: 'summary_height', label: 'Locus summary height', type: 'float', default_value: 20 }, { key: 'mode', type: 'string', default_value: this.mode, hidden: true } - ], + ] ), config_onchange: function() { this.set_name(this.prefs.name); @@ -4352,8 +4352,7 @@ }; extend(ReadTrack.prototype, Drawable.prototype, TiledTrack.prototype, FeatureTrack.prototype, { - config_params: [ - { key: 'name', label: 'Name', type: 'text', default_value: this.name }, + config_params: _.union( Drawable.prototype.config_params, [ { key: 'block_color', label: 'Block and sense strand color', type: 'color', default_value: util.get_random_color() }, { key: 'reverse_strand_color', label: 'Antisense strand color', type: 'color', default_value: util.get_random_color() }, { key: 'label_color', label: 'Label color', type: 'color', default_value: 'black' }, @@ -4364,7 +4363,7 @@ { key: 'min_value', label: 'Histogram minimum', type: 'float', default_value: null, help: 'clear value to set automatically' }, { key: 'max_value', label: 'Histogram maximum', type: 'float', default_value: null, help: 'clear value to set automatically' }, { key: 'height', type: 'int', default_value: 0, hidden: true} - ], + ] ), config_onchange: function() { this.set_name(this.prefs.name); https://bitbucket.org/galaxy/galaxy-central/commits/ae23a7b44e3e/ Changeset: ae23a7b44e3e User: jgoecks Date: 2013-10-13 23:00:27 Summary: Trackster: fold name attribute into object preferences. Affected #: 2 files diff -r f938aac3397bfd12da241b3f60daecf90574d0ec -r ae23a7b44e3eb1679cd4befd5f26a0c514649554 lib/galaxy/web/base/controller.py --- a/lib/galaxy/web/base/controller.py +++ b/lib/galaxy/web/base/controller.py @@ -1082,7 +1082,6 @@ return { "dataset_id": trans.security.decode_id( dataset_dict['id'] ), "hda_ldda": dataset_dict.get('hda_ldda', 'hda'), - "name": track_dict['name'], "track_type": track_dict['track_type'], "prefs": track_dict['prefs'], "mode": track_dict['mode'], @@ -1101,7 +1100,6 @@ drawable = unpack_collection( drawable_json ) unpacked_drawables.append( drawable ) return { - "name": collection_json.get( 'name', '' ), "obj_type": collection_json[ 'obj_type' ], "drawables": unpacked_drawables, "prefs": collection_json.get( 'prefs' , [] ), @@ -1192,7 +1190,6 @@ return { "track_type": dataset.datatype.track_type, "dataset": trans.security.encode_dict_ids( dataset.to_dict() ), - "name": track_dict['name'], "prefs": prefs, "mode": track_dict.get( 'mode', 'Auto' ), "filters": track_dict.get( 'filters', { 'filters' : track_data_provider.get_filters() } ), @@ -1208,7 +1205,6 @@ else: drawables.append( pack_collection( drawable_dict ) ) return { - 'name': collection_dict.get( 'name', 'dummy' ), 'obj_type': collection_dict[ 'obj_type' ], 'drawables': drawables, 'prefs': collection_dict.get( 'prefs', [] ), diff -r f938aac3397bfd12da241b3f60daecf90574d0ec -r ae23a7b44e3eb1679cd4befd5f26a0c514649554 static/scripts/viz/trackster/tracks.js --- a/static/scripts/viz/trackster/tracks.js +++ b/static/scripts/viz/trackster/tracks.js @@ -204,23 +204,28 @@ var Drawable = function(view, container, obj_dict) { if (!Drawable.id_counter) { Drawable.id_counter = 0; } this.id = Drawable.id_counter++; - this.name = obj_dict.name; this.view = view; this.container = container; this.drag_handle_class = obj_dict.drag_handle_class; this.is_overview = false; this.action_icons = {}; - // Set up drawable configuration. + // -- Set up drawable configuration. -- + this.config = new Config({ params: this.config_params, onchange: this.config_onchange, saved_values: obj_dict.prefs }); + this.prefs = this.config.get('values'); + + // If there's no saved name, use object name. + if (!this.prefs.name) { + this.prefs.name = obj_dict.name; + } if (this.config_onchange) { this.config.on('change:values', this.config_onchange, this); } - this.prefs = this.config.get('values'); // Build Drawable HTML and behaviors. this.container_div = this.build_container_div(); @@ -296,7 +301,7 @@ extend(Drawable.prototype, { config_params: [ - { key: 'name', label: 'Name', type: 'text', default_value: this.name }, + { key: 'name', label: 'Name', type: 'text', default_value: '' }, { key: 'content_visible', type: 'bool', default_value: true, hidden: true } ], @@ -332,9 +337,9 @@ * Set drawable name. */ set_name: function(new_name) { - this.old_name = this.name; - this.name = new_name; - this.name_div.text(this.name); + this.old_name = this.prefs.name; + this.prefs.name = new_name; + this.name_div.text(this.prefs.name); }, /** @@ -342,8 +347,8 @@ */ revert_name: function() { if (this.old_name) { - this.name = this.old_name; - this.name_div.text(this.name); + this.prefs.name = this.old_name; + this.name_div.text(this.prefs.name); } }, @@ -473,7 +478,6 @@ dictified_drawables.push(this.drawables[i].to_dict()); } return { - name: this.name, prefs: this.prefs, obj_type: this.obj_type, drawables: dictified_drawables @@ -669,7 +673,7 @@ build_header_div: function() { var header_div = $("<div/>").addClass("track-header"); header_div.append($("<div/>").addClass(this.drag_handle_class)); - this.name_div = $("<div/>").addClass("track-name").text(this.name).appendTo(header_div); + this.name_div = $("<div/>").addClass("track-name").text(this.prefs.name).appendTo(header_div); return header_div; }, @@ -830,7 +834,7 @@ */ show_composite_track: function() { var composite_track = new CompositeTrack(this.view, this.view, { - name: this.name, + name: this.prefs.name, drawables: this.drawables }); var index = this.container.replace_drawable(this, composite_track, true); @@ -1792,7 +1796,7 @@ // already in group, add track to group. if (current_track.container === view) { // Create new group. - var group = new DrawableGroup(view, view, { name: this.name }); + var group = new DrawableGroup(view, view, { name: this.prefs.name }); // Replace track with group. var index = current_track.container.replace_drawable(current_track, group, false); @@ -2512,8 +2516,8 @@ build_header_div: function() { var header_div = $("<div class='track-header'/>"); if (this.view.editor) { this.drag_div = $("<div/>").addClass(this.drag_handle_class).appendTo(header_div); } - this.name_div = $("<div/>").addClass("track-name").appendTo(header_div).text(this.name) - .attr( "id", this.name.replace(/\s+/g,'-').replace(/[^a-zA-Z0-9\-]/g,'').toLowerCase() ); + this.name_div = $("<div/>").addClass("track-name").appendTo(header_div).text(this.prefs.name) + .attr( "id", this.prefs.name.replace(/\s+/g,'-').replace(/[^a-zA-Z0-9\-]/g,'').toLowerCase() ); return header_div; }, @@ -2889,7 +2893,6 @@ to_dict: function() { return { track_type: this.get_type(), - name: this.name, dataset: { id: this.dataset.id, hda_ldda: this.dataset.get('hda_ldda') @@ -3643,7 +3646,7 @@ show_group: function() { // Create group with individual tracks. var group = new DrawableGroup(this.view, this.container, { - name: this.name + name: this.prefs.name }), track; for (var i = 0; i < this.drawables.length; i++) { https://bitbucket.org/galaxy/galaxy-central/commits/7781a13a9ba0/ Changeset: 7781a13a9ba0 User: jgoecks Date: 2013-10-13 23:09:39 Summary: Trackster: prevent inadvertent keyboard navigation when configuring track. Affected #: 1 file diff -r ae23a7b44e3eb1679cd4befd5f26a0c514649554 -r 7781a13a9ba0adf43cba0b1949fa84fd074c5323 static/scripts/viz/trackster/tracks.js --- a/static/scripts/viz/trackster/tracks.js +++ b/static/scripts/viz/trackster/tracks.js @@ -1986,7 +1986,11 @@ // var track_config = this.model; - var container = $("<div />"); + + // Prevent propagation of keydown events to viz to avoid inadvertent navigation. + var container = $("<div/>").keydown(function(e) { + e.stopPropagation(); + }); var param; // Function to process parameters recursively function handle_params( params, container ) { 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.