Remove unused rendering options for settings view

This commit is contained in:
guerler
2016-06-22 11:32:42 -04:00
parent ef029042fd
commit 08b8cd6f00
@@ -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 = $( '<div/>' ).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( $( '<div/>' ).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 = $( '<div/>' ).append( field.$el );
if ( settings_def.info ) {
$input.append( '<div class="ui-form-info">' + settings_def.info + '</div>' );
}
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( '<span class="ui-form-title">' + settings_def.title + '</span>', '25%' );
this.table.add( $input );
}
this.list[ id ] = field;
settings_def.info && $input.append( $( '<div/>' ).addClass( 'ui-form-info' ).append( settings_def.info ) );
this.table.add( $( '<span/>' ).addClass( 'ui-form-title' ).append( settings_def.title ), '20%' );
this.table.add( $input );
this.list[ name ] = field;
} else {
this.table.add( '<div class="ui-form-separator">' + settings_def.title + ':<div/>' );
this.table.add( $( '<div/>' ).addClass( 'ui-form-separator' ).append( settings_def.title + ':' ) );
this.table.add( $( '<div/>' ) );
}
this.table.append( id );
settings_def.hide && this.table.get( id ).hide();
this.table.append( name );
settings_def.hide && this.table.get( name ).hide();
}
});
});