1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/8deba81aad81/ Changeset: 8deba81aad81 User: guerler Date: 2014-01-16 07:38:06 Summary: Charts: Improve button selection Affected #: 4 files diff -r ed3e84645aa2488b5fc046ed50e3fdfd9fd52588 -r 8deba81aad81fd565a7e33bad10bb8e741a6172b config/plugins/visualizations/charts/static/app.js --- a/config/plugins/visualizations/charts/static/app.js +++ b/config/plugins/visualizations/charts/static/app.js @@ -48,9 +48,6 @@ // set elements this.setElement(this.portlet.$el); - - // reset create view - this.create.reset(); }, // execute command diff -r ed3e84645aa2488b5fc046ed50e3fdfd9fd52588 -r 8deba81aad81fd565a7e33bad10bb8e741a6172b config/plugins/visualizations/charts/static/create.js --- a/config/plugins/visualizations/charts/static/create.js +++ b/config/plugins/visualizations/charts/static/create.js @@ -97,8 +97,8 @@ } }), 'back' : new Ui.ButtonIcon({ - icon : 'fa-list', - tooltip : 'Show Charts', + icon : 'fa-caret-left', + tooltip : 'Return', onclick : function() { self.$el.hide(); self.app.main.$el.show(); @@ -117,7 +117,10 @@ // elements this.setElement(this.portlet.$el); - // events + // hide back button on startup + this.portlet.hideOperation('back'); + + // model events var self = this; this.chart.on('change:title', function(chart) { self.title.value(chart.get('title')); @@ -125,6 +128,22 @@ this.chart.on('change:type', function(chart) { self.table.value(chart.get('type')); }); + + // collection events + this.app.charts.on('add', function(chart) { + self.portlet.showOperation('back'); + }); + this.app.charts.on('remove', function(chart) { + if (self.app.charts.length == 1) { + self.portlet.hideOperation('back'); + } + }); + this.app.charts.on('reset', function(chart) { + self.portlet.hideOperation('back'); + }); + + // reset + this.reset(); }, // reset diff -r ed3e84645aa2488b5fc046ed50e3fdfd9fd52588 -r 8deba81aad81fd565a7e33bad10bb8e741a6172b config/plugins/visualizations/charts/static/library/portlet.js --- a/config/plugins/visualizations/charts/static/library/portlet.js +++ b/config/plugins/visualizations/charts/static/library/portlet.js @@ -45,6 +45,7 @@ // link functions var self = this; $.each(this.options.buttons, function(name, item) { + item.$el.prop('id', name); self.$buttons.append(item.$el); }); } else { @@ -57,6 +58,7 @@ // link functions var self = this; $.each(this.options.operations, function(name, item) { + item.$el.prop('id', name); self.$operations.append(item.$el); }); } @@ -96,13 +98,23 @@ }, // enable buttons - enableButton: function(name) { - this.$buttons.find('#' + String(name).toLowerCase()).prop('disabled', false); + enableButton: function(id) { + this.$buttons.find('#' + id).prop('disabled', false); }, // disable buttons - disableButton: function(name) { - this.$buttons.find('#' + String(name).toLowerCase()).prop('disabled', true); + disableButton: function(id) { + this.$buttons.find('#' + id).prop('disabled', true); + }, + + // enable operation + hideOperation: function(id) { + this.$operations.find('#' + id).hide(); + }, + + // disable operation + showOperation: function(id) { + this.$operations.find('#' + id).show(); }, // fill regular modal template diff -r ed3e84645aa2488b5fc046ed50e3fdfd9fd52588 -r 8deba81aad81fd565a7e33bad10bb8e741a6172b config/plugins/visualizations/charts/static/library/ui.js --- a/config/plugins/visualizations/charts/static/library/ui.js +++ b/config/plugins/visualizations/charts/static/library/ui.js @@ -34,6 +34,7 @@ { // options optionsDefault: { + id : null, label : '', float : 'right', cls : 'btn-default', @@ -55,7 +56,7 @@ // element template: function(options) { - var str = '<button type="' + options.type + '" style="margin-right: 5px; float: ' + options.float + ';" type="button" class="btn ' + options.cls + '">'; + var str = '<button id="' + options.id + '" type="' + options.type + '" style="margin-right: 5px; float: ' + options.float + ';" type="button" class="btn ' + options.cls + '">'; if (options.icon) { str += '<i class="icon fa ' + options.icon + '"></i> ' ; } @@ -375,6 +376,7 @@ { // options optionsDefault: { + id : null, label : '', float : 'right', cls : 'icon-btn', @@ -403,7 +405,7 @@ // element template: function(options) { - var str = '<a style="margin-right: 5px; float: ' + options.float + ';" class="' + options.cls + '">'; + var str = '<a id="' + options.id + '" style="margin-right: 5px; float: ' + options.float + ';" class="' + options.cls + '">'; if (options.icon) { str += '<i class="icon fa ' + options.icon + '"></i>'; } 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.