diff --git a/config/plugins/visualizations/charts/static/views/settings.js b/config/plugins/visualizations/charts/static/views/settings.js index 87fc93ec959..af8df491e8e 100644 --- a/config/plugins/visualizations/charts/static/views/settings.js +++ b/config/plugins/visualizations/charts/static/views/settings.js @@ -8,22 +8,16 @@ define( [ 'mvc/ui/ui-table', 'mvc/ui/ui-misc', 'mvc/form/form-parameters', 'util this.app = app; this.chart = this.app.chart; this.list = []; - this.options = Utils.merge( { - title : 'Configuration', - content : 'This chart type does not provide any options.' - }, this.optionsDefault ); - this.table_title = new Ui.Label( { title: this.options.title } ); - this.table = new Table.View( { content: this.options.content } ); this.parameters = new Parameters(); - var $view = $( '
' ).addClass( 'ui-form' ); - this.options.title && $view.append( this.table_title.$el ); - $view.append( this.table.$el ); - this.setElement( $view ); - this.chart.on( 'change', function() { self._refresh() } ); + this.table_title = new Ui.Label({}); + this.table = new Table.View( { content: 'This chart type does not provide any options.' } ); + this.setElement( $( '' ).addClass( 'ui-form' ) + .append( this.table_title.$el ) + .append( this.table.$el ) ); + this.chart.on( 'change', function() { self.render() } ); }, - /** Refresh settings view */ - _refresh: function() { + render: function() { var chart_definition = this.chart.definition; if ( chart_definition ) { this.table_title.title( chart_definition.category + ' - ' + chart_definition.title + ':' ); @@ -40,13 +34,13 @@ define( [ 'mvc/ui/ui-table', 'mvc/ui/ui-misc', 'mvc/form/form-parameters', 'util }, /** Add table row */ - _add: function( id, settings_def, model ) { + _add: function( name, settings_def, model ) { var self = this; if ( settings_def.type !== 'separator' ) { switch( settings_def.type ) { case 'select': settings_def.onchange = function( new_value ) { - model.set( id, new_value ); + model.set( name, new_value ); var dict = _.findWhere( settings_def.data, { value: new_value } ); if ( dict && dict.operations ) { var operations = dict.operations; @@ -60,30 +54,23 @@ define( [ 'mvc/ui/ui-table', 'mvc/ui/ui-misc', 'mvc/form/form-parameters', 'util }; break; default: - settings_def.onchange = function( new_value ) { model.set( id, new_value ) }; + settings_def.onchange = function( new_value ) { model.set( name, new_value ) }; } - settings_def.id = id; - settings_def.value = model.get( id, settings_def.init ); - model.set( id, settings_def.value ); + settings_def.id = name; + settings_def.value = model.get( name ) || settings_def.init; + model.set( name, settings_def.value ); var field = this.parameters.create( settings_def ); var $input = $( '' ).append( field.$el ); - if ( settings_def.info ) { - $input.append( '