commit/galaxy-central: guerler: Charts: Load tab titles from model
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/33b8fa988ad0/ Changeset: 33b8fa988ad0 User: guerler Date: 2014-02-24 07:14:42 Summary: Charts: Load tab titles from model Affected #: 1 file diff -r 462a28f96c2172113d1cad657e271e792493b49e -r 33b8fa988ad0cf58277553f1cc569a581cfd652d config/plugins/visualizations/charts/static/views/chart.js --- a/config/plugins/visualizations/charts/static/views/chart.js +++ b/config/plugins/visualizations/charts/static/views/chart.js @@ -10,7 +10,7 @@ header : true, content : 'No content available.' }, - + // initialize initialize: function(app, options) { @@ -85,7 +85,8 @@ this.tabs = new Tabs.View({ title_new : 'Add Data', onnew : function() { - self._addGroupModel(); + var group = self._addGroupModel(); + self.tabs.show(group.id); }, operations : { 'save' : new Ui.ButtonIcon({ @@ -95,8 +96,7 @@ onclick : function() { // ensure that data group is available if (self.chart.groups.length == 0) { - var group = self._addGroupModel(); - self.tabs.show(group.id); + self._addGroupModel(); } // save chart @@ -171,11 +171,27 @@ this.app.chart.groups.on('reset', function(group) { self._removeAllGroups(); }); - + this.app.chart.groups.on('change:label', function(group) { + self._refreshLabels(); + }); + // reset this._resetChart(); }, + // update + _refreshLabels: function() { + var self = this; + var counter = 0; + this.chart.groups.each(function(group) { + var title = group.get('label', ''); + if (title == '') { + title = 'Chart data'; + } + self.tabs.title(group.id, ++counter + ': ' + title); + }); + }, + // new group _addGroupModel: function() { var group = new Group({ @@ -199,18 +215,23 @@ // add new tab this.tabs.add({ - title : count + ': Chart Data', id : group.id, $el : group_view.$el, ondel : function() { self.chart.groups.remove(group.id); } }); + + // update titles + this._refreshLabels() }, // remove group _removeGroup: function(group) { this.tabs.del(group.id); + + // update titles + this._refreshLabels() }, // remove group 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