commit/galaxy-central: jgoecks: Create ui.js for generic UI Backbone functionality and add models & views to display icon menus. Use new functionality for visualization menu.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/016baa06f614/ changeset: 016baa06f614 user: jgoecks date: 2012-04-05 21:55:47 summary: Create ui.js for generic UI Backbone functionality and add models & views to display icon menus. Use new functionality for visualization menu. affected #: 8 files diff -r e95c01831a8ad31b1bf0205004dd93ccb7dc0976 -r 016baa06f6140b5fe9b0849b54181b8a8b9dd6a9 static/june_2007_style/blue/trackster.css --- a/static/june_2007_style/blue/trackster.css +++ b/static/june_2007_style/blue/trackster.css @@ -79,17 +79,19 @@ .filters-icon{background:transparent url(../images/fugue/ui-slider-050-bw.png) no-repeat;} .filters-icon:hover{background:transparent url(../images/fugue/ui-slider-050.png) no-repeat;} .remove-icon,.overview-close{background:transparent url(../images/fugue/cross-small-bw.png) no-repeat;} -.remove-icon:hover,.overview-close:hover{background:transparent url(../images/fugue/cross-circle.png) no-repeat;} -#close-icon{background:transparent url(../images/fugue/cross-circle-bw.png) no-repeat;margin-right:0px;} -#close-icon:hover{background:transparent url(../images/fugue/cross-circle.png) no-repeat;} -#add-tracks-icon{background:transparent url(../images/fugue/plus-button-bw.png) no-repeat;} -#add-tracks-icon:hover{background:transparent url(../images/fugue/plus-button.png) no-repeat;} -#add-group-icon{background:transparent url(../images/fugue/block--plus-bw.png) no-repeat;} -#add-group-icon:hover{background:transparent url(../images/fugue/block--plus.png) no-repeat;} -#bookmarks-icon{background:transparent url(../images/fugue/bookmarks-bw.png) no-repeat;} -#bookmarks-icon:hover{background:transparent url(../images/fugue/bookmarks.png) no-repeat;} -#save-icon{background:transparent url(../images/fugue/disk--arrow-bw.png) no-repeat;} -#save-icon:hover{background:transparent url(../images/fugue/disk--arrow.png) no-repeat;} +.icon-button.remove-icon:hover,.overview-close:hover{background:transparent url(../images/fugue/cross-circle.png) no-repeat;} +.icon-button.cross-circle{background:transparent url(../images/fugue/cross-circle-bw.png) no-repeat;margin-right:0px;} +.icon-button.cross-circle:hover{background:transparent url(../images/fugue/cross-circle.png) no-repeat;} +.icon-button.plus-button{background:transparent url(../images/fugue/plus-button-bw.png) no-repeat;} +.icon-button.plus-button:hover{background:transparent url(../images/fugue/plus-button.png) no-repeat;} +.icon-button.block--plus{background:transparent url(../images/fugue/block--plus-bw.png) no-repeat;} +.icon-button.block--plus:hover{background:transparent url(../images/fugue/block--plus.png) no-repeat;} +.icon-button.bookmarks{background:transparent url(../images/fugue/bookmarks-bw.png) no-repeat;} +.icon-button.bookmarks:hover{background:transparent url(../images/fugue/bookmarks.png) no-repeat;} +.icon-button.toolbox{background:transparent url(../images/fugue/toolbox-bw.png) no-repeat;} +.icon-button.toolbox:hover{background:transparent url(../images/fugue/toolbox.png) no-repeat;} +.icon-button.disk--arrow{background:transparent url(../images/fugue/disk--arrow-bw.png) no-repeat;} +.icon-button.disk--arrow:hover{background:transparent url(../images/fugue/disk--arrow.png) no-repeat;} .child-track-icon{background:url('../images/fugue/arrow-000-small-bw.png') no-repeat;width:30px;cursor:move;} .track-resize{background:white url('../images/visualization/draggable_vertical.png') no-repeat top center;position:absolute;right:3px;bottom:-4px;width:14px;height:7px;border:solid #999 1px;z-index:100;} .bookmark{background:white;border:solid #999 1px;border-right:none;margin:0.5em;margin-right:0;padding:0.5em;} diff -r e95c01831a8ad31b1bf0205004dd93ccb7dc0976 -r 016baa06f6140b5fe9b0849b54181b8a8b9dd6a9 static/june_2007_style/trackster.css.tmpl --- a/static/june_2007_style/trackster.css.tmpl +++ b/static/june_2007_style/trackster.css.tmpl @@ -390,37 +390,43 @@ .remove-icon, .overview-close { background: transparent url(../images/fugue/cross-small-bw.png) no-repeat; } -.remove-icon:hover, .overview-close:hover { +.icon-button.remove-icon:hover, .overview-close:hover { background: transparent url(../images/fugue/cross-circle.png) no-repeat; } -#close-icon { +.icon-button.cross-circle { background: transparent url(../images/fugue/cross-circle-bw.png) no-repeat;margin-right:0px; } -#close-icon:hover { +.icon-button.cross-circle:hover { background: transparent url(../images/fugue/cross-circle.png) no-repeat; } -#add-tracks-icon { +.icon-button.plus-button { background: transparent url(../images/fugue/plus-button-bw.png) no-repeat; } -#add-tracks-icon:hover { +.icon-button.plus-button:hover { background: transparent url(../images/fugue/plus-button.png) no-repeat; } -#add-group-icon { +.icon-button.block--plus { background: transparent url(../images/fugue/block--plus-bw.png) no-repeat; } -#add-group-icon:hover { +.icon-button.block--plus:hover { background: transparent url(../images/fugue/block--plus.png) no-repeat; } -#bookmarks-icon { +.icon-button.bookmarks { background: transparent url(../images/fugue/bookmarks-bw.png) no-repeat; } -#bookmarks-icon:hover { +.icon-button.bookmarks:hover { background: transparent url(../images/fugue/bookmarks.png) no-repeat; } -#save-icon { +.icon-button.toolbox { + background: transparent url(../images/fugue/toolbox-bw.png) no-repeat; +} +.icon-button.toolbox:hover { + background: transparent url(../images/fugue/toolbox.png) no-repeat; +} +.icon-button.disk--arrow { background: transparent url(../images/fugue/disk--arrow-bw.png) no-repeat; } -#save-icon:hover { +.icon-button.disk--arrow:hover { background: transparent url(../images/fugue/disk--arrow.png) no-repeat; } .child-track-icon { diff -r e95c01831a8ad31b1bf0205004dd93ccb7dc0976 -r 016baa06f6140b5fe9b0849b54181b8a8b9dd6a9 static/scripts/backbone/ui.js --- /dev/null +++ b/static/scripts/backbone/ui.js @@ -0,0 +1,74 @@ +/** + * Utility models and views for Galaxy objects. + */ + +/** + * Clickable button represented as an icon. + */ +var IconButton = Backbone.Model.extend({ + defaults: { + title: "", + icon_class: "", + on_click: null + } +}); + +var IconButtonCollection = Backbone.Collection.extend({ + model: IconButton +}); + +/** + * A single icon button. + */ +var IconButtonView = Backbone.View.extend({ + tagName: 'a', + className: 'icon-button menu-button', + + events: { + 'click': 'on_click' + }, + + render: function() { + this.$el.attr('href', 'javascript:void(0)') + .attr('title', this.model.attributes.title) + .addClass(this.model.attributes.icon_class); + return this; + }, + + on_click: function() { + this.model.attributes.on_click(); + } +}); + +/** + * Menu with multiple icon buttons. + */ +var IconButtonMenuView = Backbone.View.extend({ + tagName: 'div', + + render: function() { + var self = this; + this.collection.each(function(icon_button) { + var view = new IconButtonView({model: icon_button}); + view.render(); + self.$el.append(view.$el); + }); + return this; + } +}); + +/** + * + */ +var Grid = Backbone.Collection.extend({ + +}); + +/** + * + */ +var GridView = Backbone.View.extend({ + +}); + + diff -r e95c01831a8ad31b1bf0205004dd93ccb7dc0976 -r 016baa06f6140b5fe9b0849b54181b8a8b9dd6a9 static/scripts/packed/backbone/tools.js --- a/static/scripts/packed/backbone/tools.js +++ b/static/scripts/packed/backbone/tools.js @@ -1,1 +1,1 @@ -var BaseModel=Backbone.Model.extend({defaults:{id:null,name:null,hidden:false},show:function(){this.set("hidden",false)},hide:function(){this.set("hidden",true)},is_visible:function(){return !this.attributes.hidden}});var Tool=BaseModel.extend({defaults:{description:null,target:null,params:[]},apply_search_results:function(a){(_.indexOf(a,this.attributes.id)!==-1?this.show():this.hide());return this.is_visible()}});var ToolPanelLabel=BaseModel.extend({});var ToolPanelSection=BaseModel.extend({defaults:{elems:[],open:false},clear_search_results:function(){_.each(this.attributes.elems,function(a){a.show()});this.show();this.set("open",false)},apply_search_results:function(b){var c=true,a;_.each(this.attributes.elems,function(d){if(d instanceof ToolPanelLabel){a=d;a.hide()}else{if(d instanceof Tool){if(d.apply_search_results(b)){c=false;if(a){a.show()}}}}});if(c){this.hide()}else{this.show();this.set("open",true)}}});var ToolSearch=BaseModel.extend({defaults:{spinner_url:"",search_url:"",visible:true,query:"",results:null},initialize:function(){this.on("change:query",this.do_search)},do_search:function(){var c=this.attributes.query;if(c.length<3){this.set("results",null);return}var b=c+"*";if(this.timer){clearTimeout(this.timer)}$("#search-spinner").show();var a=this;this.timer=setTimeout(function(){$.get(a.attributes.search_url,{query:b},function(d){a.set("results",d);$("#search-spinner").hide()},"json")},200)}});var ToolPanel=Backbone.Collection.extend({url:"/tools",parse:function(a){var b=function(e){var d=e.type;if(d==="tool"){return new Tool(e)}else{if(d==="section"){var c=_.map(e.elems,b);e.elems=c;return new ToolPanelSection(e)}else{if(d==="label"){return new ToolPanelLabel(e)}}}};return _.map(a,b)},initialize:function(a){this.tool_search=a.tool_search;this.tool_search.on("change:results",this.apply_search_results,this)},clear_search_results:function(){this.each(function(a){if(a instanceof ToolPanelSection){a.clear_search_results()}else{a.show()}})},apply_search_results:function(){var b=this.tool_search.attributes.results;if(b===null){this.clear_search_results();return}var a=null;this.each(function(c){if(c instanceof ToolPanelLabel){a=c;a.hide()}else{if(c instanceof Tool){if(c.apply_search_results(b)){if(a){a.show()}}}else{a=null;c.apply_search_results(b)}}})}});var BaseView=Backbone.View.extend({initialize:function(){this.model.on("change:hidden",this.update_visible,this)},update_visible:function(){(this.model.attributes.hidden?this.$el.hide():this.$el.show())}});var ToolLinkView=BaseView.extend({tagName:"div",template:Handlebars.templates.tool_link,render:function(){this.$el.append(this.template(this.model.toJSON()));return this}});var ToolPanelLabelView=BaseView.extend({tagName:"div",className:"toolPanelLabel",template:Handlebars.templates.panel_label,render:function(){this.$el.append(this.template(this.model.toJSON()));return this},});var ToolPanelSectionView=BaseView.extend({tagName:"div",className:"toolSectionWrapper",template:Handlebars.templates.panel_section,initialize:function(){BaseView.prototype.initialize.call(this);this.model.on("change:open",this.update_open,this)},render:function(){this.$el.append(this.template(this.model.toJSON()));var a=this.$el.find(".toolSectionBody");_.each(this.model.attributes.elems,function(b){if(b instanceof Tool){var c=new ToolLinkView({model:b,className:"toolTitle"});c.render();a.append(c.$el)}else{if(b instanceof ToolPanelLabel){var d=new ToolPanelLabelView({model:b});d.render();a.append(d.$el)}else{}}});return this},events:{"click .toolSectionTitle > a":"toggle"},toggle:function(){this.model.set("open",!this.model.attributes.open)},update_open:function(){(this.model.attributes.open?this.$el.children(".toolSectionBody").slideDown("fast"):this.$el.children(".toolSectionBody").slideUp("fast"))}});var ToolSearchView=Backbone.View.extend({tagName:"div",id:"tool-search",className:"bar",template:Handlebars.templates.tool_search,events:{click:"focus_and_select","keyup :input":"query_changed"},render:function(){this.$el.append(this.template(this.model.toJSON()));if(!this.model.is_visible()){this.$el.hide()}return this},focus_and_select:function(){this.$el.find(":input").focus().select()},query_changed:function(){this.model.set("query",this.$el.find(":input").val())}});var ToolPanelView=Backbone.View.extend({tagName:"div",className:"toolMenu",initialize:function(a){this.collection.tool_search.on("change:results",this.handle_search_results,this)},render:function(){var b=this.$el;var a=new ToolSearchView({model:this.collection.tool_search});a.render();b.append(a.$el);this.collection.each(function(d){if(d instanceof ToolPanelSection){var c=new ToolPanelSectionView({model:d});c.render();b.append(c.$el)}else{if(d instanceof Tool){var e=new ToolLinkView({model:d,className:"toolTitleNoSection"});e.render();b.append(e.$el)}else{if(d instanceof ToolPanelLabel){var f=new ToolPanelLabelView({model:d});f.render();b.append(f.$el)}}}});return this},handle_search_results:function(){var a=this.collection.tool_search.attributes.results;if(a&&a.length===0){$("#search-no-results").show()}else{$("#search-no-results").hide()}}}); \ No newline at end of file +var BaseModel=Backbone.Model.extend({defaults:{name:null,hidden:false},show:function(){this.set("hidden",false)},hide:function(){this.set("hidden",true)},is_visible:function(){return !this.attributes.hidden}});var Tool=BaseModel.extend({defaults:{description:null,target:null,params:[]},apply_search_results:function(a){(_.indexOf(a,this.attributes.id)!==-1?this.show():this.hide());return this.is_visible()}});var ToolPanelLabel=BaseModel.extend({});var ToolPanelSection=BaseModel.extend({defaults:{elems:[],open:false},clear_search_results:function(){_.each(this.attributes.elems,function(a){a.show()});this.show();this.set("open",false)},apply_search_results:function(b){var c=true,a;_.each(this.attributes.elems,function(d){if(d instanceof ToolPanelLabel){a=d;a.hide()}else{if(d instanceof Tool){if(d.apply_search_results(b)){c=false;if(a){a.show()}}}}});if(c){this.hide()}else{this.show();this.set("open",true)}}});var ToolSearch=BaseModel.extend({defaults:{spinner_url:"",search_url:"",visible:true,query:"",results:null},initialize:function(){this.on("change:query",this.do_search)},do_search:function(){var c=this.attributes.query;if(c.length<3){this.set("results",null);return}var b=c+"*";if(this.timer){clearTimeout(this.timer)}$("#search-spinner").show();var a=this;this.timer=setTimeout(function(){$.get(a.attributes.search_url,{query:b},function(d){a.set("results",d);$("#search-spinner").hide()},"json")},200)}});var ToolPanel=Backbone.Collection.extend({url:"/tools",parse:function(a){var b=function(e){var d=e.type;if(d==="tool"){return new Tool(e)}else{if(d==="section"){var c=_.map(e.elems,b);e.elems=c;return new ToolPanelSection(e)}else{if(d==="label"){return new ToolPanelLabel(e)}}}};return _.map(a,b)},initialize:function(a){this.tool_search=a.tool_search;this.tool_search.on("change:results",this.apply_search_results,this)},clear_search_results:function(){this.each(function(a){if(a instanceof ToolPanelSection){a.clear_search_results()}else{a.show()}})},apply_search_results:function(){var b=this.tool_search.attributes.results;if(b===null){this.clear_search_results();return}var a=null;this.each(function(c){if(c instanceof ToolPanelLabel){a=c;a.hide()}else{if(c instanceof Tool){if(c.apply_search_results(b)){if(a){a.show()}}}else{a=null;c.apply_search_results(b)}}})}});var BaseView=Backbone.View.extend({initialize:function(){this.model.on("change:hidden",this.update_visible,this)},update_visible:function(){(this.model.attributes.hidden?this.$el.hide():this.$el.show())}});var ToolLinkView=BaseView.extend({tagName:"div",template:Handlebars.templates.tool_link,render:function(){this.$el.append(this.template(this.model.toJSON()));return this}});var ToolPanelLabelView=BaseView.extend({tagName:"div",className:"toolPanelLabel",template:Handlebars.templates.panel_label,render:function(){this.$el.append(this.template(this.model.toJSON()));return this},});var ToolPanelSectionView=BaseView.extend({tagName:"div",className:"toolSectionWrapper",template:Handlebars.templates.panel_section,initialize:function(){BaseView.prototype.initialize.call(this);this.model.on("change:open",this.update_open,this)},render:function(){this.$el.append(this.template(this.model.toJSON()));var a=this.$el.find(".toolSectionBody");_.each(this.model.attributes.elems,function(b){if(b instanceof Tool){var c=new ToolLinkView({model:b,className:"toolTitle"});c.render();a.append(c.$el)}else{if(b instanceof ToolPanelLabel){var d=new ToolPanelLabelView({model:b});d.render();a.append(d.$el)}else{}}});return this},events:{"click .toolSectionTitle > a":"toggle"},toggle:function(){this.model.set("open",!this.model.attributes.open)},update_open:function(){(this.model.attributes.open?this.$el.children(".toolSectionBody").slideDown("fast"):this.$el.children(".toolSectionBody").slideUp("fast"))}});var ToolSearchView=Backbone.View.extend({tagName:"div",id:"tool-search",className:"bar",template:Handlebars.templates.tool_search,events:{click:"focus_and_select","keyup :input":"query_changed"},render:function(){this.$el.append(this.template(this.model.toJSON()));if(!this.model.is_visible()){this.$el.hide()}return this},focus_and_select:function(){this.$el.find(":input").focus().select()},query_changed:function(){this.model.set("query",this.$el.find(":input").val())}});var ToolPanelView=Backbone.View.extend({tagName:"div",className:"toolMenu",initialize:function(a){this.collection.tool_search.on("change:results",this.handle_search_results,this)},render:function(){var b=this.$el;var a=new ToolSearchView({model:this.collection.tool_search});a.render();b.append(a.$el);this.collection.each(function(d){if(d instanceof ToolPanelSection){var c=new ToolPanelSectionView({model:d});c.render();b.append(c.$el)}else{if(d instanceof Tool){var e=new ToolLinkView({model:d,className:"toolTitleNoSection"});e.render();b.append(e.$el)}else{if(d instanceof ToolPanelLabel){var f=new ToolPanelLabelView({model:d});f.render();b.append(f.$el)}}}});return this},handle_search_results:function(){var a=this.collection.tool_search.attributes.results;if(a&&a.length===0){$("#search-no-results").show()}else{$("#search-no-results").hide()}}}); \ No newline at end of file diff -r e95c01831a8ad31b1bf0205004dd93ccb7dc0976 -r 016baa06f6140b5fe9b0849b54181b8a8b9dd6a9 static/scripts/packed/backbone/ui.js --- /dev/null +++ b/static/scripts/packed/backbone/ui.js @@ -0,0 +1,1 @@ +var IconButton=Backbone.Model.extend({defaults:{title:"",icon_class:"",on_click:null}});var IconButtonCollection=Backbone.Collection.extend({model:IconButton});var IconButtonView=Backbone.View.extend({tagName:"a",className:"icon-button menu-button",events:{click:"on_click"},render:function(){this.$el.attr("href","javascript:void(0)").attr("title",this.model.attributes.title).addClass(this.model.attributes.icon_class);return this},on_click:function(){this.model.attributes.on_click()}});var IconButtonMenuView=Backbone.View.extend({tagName:"div",render:function(){var a=this;this.collection.each(function(c){var b=new IconButtonView({model:c});b.render();a.$el.append(b.$el)});return this}});var Grid=Backbone.Collection.extend({});var GridView=Backbone.View.extend({}); \ No newline at end of file diff -r e95c01831a8ad31b1bf0205004dd93ccb7dc0976 -r 016baa06f6140b5fe9b0849b54181b8a8b9dd6a9 templates/base.mako --- a/templates/base.mako +++ b/templates/base.mako @@ -26,7 +26,7 @@ ## <!--[if lt IE 7]> ## <script type='text/javascript' src="/static/scripts/IE7.js"></script> ## <![endif]--> - ${h.js( "jquery", "galaxy.base", "libs/underscore", "libs/backbone", "libs/handlebars.runtime" )} + ${h.js( "jquery", "galaxy.base", "libs/underscore", "libs/backbone", "libs/handlebars.runtime", "backbone/ui" )} </%def> ## Additional metas can be defined by templates inheriting from this one. diff -r e95c01831a8ad31b1bf0205004dd93ccb7dc0976 -r 016baa06f6140b5fe9b0849b54181b8a8b9dd6a9 templates/base_panels.mako --- a/templates/base_panels.mako +++ b/templates/base_panels.mako @@ -50,7 +50,7 @@ <script type="text/javascript"> var image_path = '${h.url_for("/static/images")}'; </script> - ${h.js( 'jquery' )} + ${h.js( 'jquery', 'libs/underscore', 'libs/backbone', 'libs/handlebars.runtime', 'backbone/ui' )} </%def> ## Default late-load javascripts diff -r e95c01831a8ad31b1bf0205004dd93ccb7dc0976 -r 016baa06f6140b5fe9b0849b54181b8a8b9dd6a9 templates/tracks/browser.mako --- a/templates/tracks/browser.mako +++ b/templates/tracks/browser.mako @@ -157,6 +157,81 @@ }; $(function() { + // Create and initialize menu. + var + + buttons = new IconButtonCollection([ + new IconButton({icon_class: 'plus-button', title: 'Add tracks', on_click: function() { add_tracks(); } }), + new IconButton({icon_class: 'block--plus', title: 'Add group', on_click: function() { + view.add_drawable( new DrawableGroup(view, view, { name: "New Group" }) ); + } }), + /* + new IconButton({icon_class: 'toolbox', title: 'Use tools', on_click: function() { + console.log("toolbox!") + } }), + */ + new IconButton({icon_class: 'bookmarks', title: 'Bookmarks', on_click: function() { + // HACK -- use style to determine if panel is hidden and hide/show accordingly. + parent.force_right_panel(($("div#right").css("right") == "0px" ? "hide" : "show")); + } }), + new IconButton({icon_class: 'disk--arrow', title: 'Save', on_click: function() { + // Show saving dialog box + show_modal("Saving...", "progress"); + + // Save bookmarks. + var bookmarks = []; + $(".bookmark").each(function() { + bookmarks[bookmarks.length] = { + position: $(this).children(".position").text(), + annotation: $(this).children(".annotation").text() + }; + }); + + // FIXME: give unique IDs to Drawables and save overview as ID. + var overview_track_name = (view.overview_drawable ? view.overview_drawable.name : null); + var payload = { + 'view': view.to_dict(), + 'viewport': { 'chrom': view.chrom, 'start': view.low , 'end': view.high, 'overview': overview_track_name }, + 'bookmarks': bookmarks + }; + + $.ajax({ + url: "${h.url_for( action='save' )}", + type: "POST", + data: { + 'vis_id': view.vis_id, + 'title': view.name, + 'dbkey': view.dbkey, + 'payload': JSON.stringify(payload) + }, + dataType: "json", + success: function(vis_info) { + hide_modal(); + view.vis_id = vis_info.vis_id; + view.has_changes = false; + + // Needed to set URL when first saving a visualization. + window.history.pushState({}, "", vis_info.url); + }, + error: function() { + show_modal( "Could Not Save", "Could not save visualization. Please try again later.", + { "Close" : hide_modal } ); + } + }); + } }), + new IconButton({icon_class: 'cross-circle', title: 'Close', on_click: function() { + window.location = "${h.url_for( controller='visualization', action='list' )}"; + } }) + ]), + + menu = new IconButtonMenuView({ + collection: buttons + }); + + menu.render(); + menu.$el.attr("style", "float: right"); + $("#center .unified-panel-header-inner").append(menu.$el); + // Manual tipsy config because default gravity is S and cannot be changed. $(".menu-button").tipsy( {gravity: 'n'} ); @@ -229,67 +304,7 @@ // // Initialize icons. // - $("#add-tracks-icon").click( function() { add_tracks(); } ); - $("#add-group-icon").click( function() { - view.add_drawable( new DrawableGroup(view, view, { name: "New Group" }) ); - }); - - $("#save-icon").click( function() { - // Show saving dialog box - show_modal("Saving...", "progress"); - - // Save bookmarks. - var bookmarks = []; - $(".bookmark").each(function() { - bookmarks[bookmarks.length] = { - position: $(this).children(".position").text(), - annotation: $(this).children(".annotation").text() - }; - }); - - // FIXME: give unique IDs to Drawables and save overview as ID. - var overview_track_name = (view.overview_drawable ? view.overview_drawable.name : null); - var payload = { - 'view': view.to_dict(), - 'viewport': { 'chrom': view.chrom, 'start': view.low , 'end': view.high, 'overview': overview_track_name }, - 'bookmarks': bookmarks - }; - - $.ajax({ - url: "${h.url_for( action='save' )}", - type: "POST", - data: { - 'vis_id': view.vis_id, - 'title': view.name, - 'dbkey': view.dbkey, - 'payload': JSON.stringify(payload) - }, - dataType: "json", - success: function(vis_info) { - hide_modal(); - view.vis_id = vis_info.vis_id; - view.has_changes = false; - - // Needed to set URL when first saving a visualization. - window.history.pushState({}, "", vis_info.url); - }, - error: function() { - show_modal( "Could Not Save", "Could not save visualization. Please try again later.", - { "Close" : hide_modal } ); - } - }); - }); - - $("#bookmarks-icon").click( function() { - // HACK -- use style to determine if panel is hidden and hide/show accordingly. - parent.force_right_panel(($("div#right").css("right") == "0px" ? "hide" : "show")); - }); - - $("#close-icon").click( function() { - window.location = "${h.url_for( controller='visualization', action='list' )}"; - }); - $("#add-bookmark-button").click(function() { // Add new bookmark. var position = view.chrom + ":" + view.low + "-" + view.high, @@ -315,13 +330,6 @@ <div class="unified-panel-header" unselectable="on"><div class="unified-panel-header-inner"><div style="float:left;" id="title"></div> - <div style="float: right"> - <a id="add-tracks-icon" class='icon-button menu-button' href="javascript:void(0);" title="Add tracks"></a> - <a id="add-group-icon" class='icon-button menu-button' href="javascript:void(0);" title="Add new group"></a> - <a id="bookmarks-icon" class='icon-button menu-button' href="javascript:void(0);" title="Bookmarks"></a> - <a id="save-icon" class='icon-button menu-button' href="javascript:void(0);" title="Save"></a> - <a id="close-icon" class='icon-button menu-button' href="javascript:void(0);" title="Close"></a> - </div></div><div style="clear: both"></div></div> 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)
-
Bitbucket