From 08b8cd6f00aed9554256ecf2c7eafd2e4f99ce99 Mon Sep 17 00:00:00 2001 From: guerler Date: Mon, 20 Jun 2016 21:58:11 -0400 Subject: [PATCH] Remove unused rendering options for settings view --- .../charts/static/views/settings.js | 53 +++++++------------ 1 file changed, 20 insertions(+), 33 deletions(-) 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( '
' + settings_def.info + '
' ); - } - if ( this.options.style == 'bold' ) { - this.table.add( new Ui.Label( { title: settings_def.title, cls: 'form-label' } ).$el ); - this.table.add( $input ); - } else { - this.table.add( '' + settings_def.title + '', '25%' ); - this.table.add( $input ); - } - this.list[ id ] = field; + settings_def.info && $input.append( $( '
' ).addClass( 'ui-form-info' ).append( settings_def.info ) ); + this.table.add( $( '' ).addClass( 'ui-form-title' ).append( settings_def.title ), '20%' ); + this.table.add( $input ); + this.list[ name ] = field; } else { - this.table.add( '
' + settings_def.title + ':
' ); + this.table.add( $( '
' ).addClass( 'ui-form-separator' ).append( settings_def.title + ':' ) ); this.table.add( $( '
' ) ); } - this.table.append( id ); - settings_def.hide && this.table.get( id ).hide(); + this.table.append( name ); + settings_def.hide && this.table.get( name ).hide(); } }); }); \ No newline at end of file