Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display currently selected chart type details in settings and groups
- Loading branch information
Showing
9 changed files
with
55 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
-28.1 KB
(21%)
config/plugins/visualizations/charts/static/charts/others/example/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 21 additions & 14 deletions
35
config/plugins/visualizations/charts/static/views/settings.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,34 @@ | ||
/** This class renders the chart configuration form. */ | ||
define( [ 'utils/utils', 'mvc/ui/ui-misc', 'mvc/form/form-view', 'mvc/form/form-data' ], function( Utils, Ui, Form, FormData ) { | ||
define( [ 'utils/utils', 'mvc/ui/ui-misc', 'mvc/form/form-view', 'mvc/form/form-data', 'plugin/views/description' ], function( Utils, Ui, Form, FormData, Description ) { | ||
return Backbone.View.extend({ | ||
initialize: function( app, options ) { | ||
var self = this; | ||
this.app = app; | ||
this.chart = app.chart; | ||
this.setElement( '<div/>' ); | ||
this.description = new Description( this.app ); | ||
this.message = new Ui.Message( { message: 'There are no options for this chart type.', persistent: true, status: 'info' } ); | ||
this.setElement( $( '<div/>' ).append( this.description.$el ).append( this.message.$el ).append( this.$form = $( '<div/>' ) ) ); | ||
this.listenTo( this.chart, 'change', function() { self.render() } ); | ||
}, | ||
render: function() { | ||
var self = this; | ||
var inputs = Utils.clone( this.chart.definition.settings ); | ||
FormData.visitInputs( inputs, function( input, name ) { | ||
var model_value = self.chart.settings.get( name ); | ||
model_value !== undefined && !input.hidden && ( input.value = model_value ); | ||
}); | ||
this.form = new Form({ | ||
inputs : inputs, | ||
cls : 'ui-portlet-plain', | ||
onchange : function() { self.chart.settings.set( self.form.data.create() ); } | ||
}); | ||
this.chart.settings.set( self.form.data.create() ); | ||
var view = _.size( inputs ) > 0 ? this.form : new Ui.Message( { message: 'There are no options for this chart type.', persistent: true, status: 'info' } ); | ||
this.$el.empty().append( view.$el.addClass( 'ui-margin-bottom' ) ); | ||
if ( _.size( inputs ) > 0 ) { | ||
FormData.visitInputs( inputs, function( input, name ) { | ||
var model_value = self.chart.settings.get( name ); | ||
model_value !== undefined && !input.hidden && ( input.value = model_value ); | ||
}); | ||
this.form = new Form({ | ||
inputs : inputs, | ||
cls : 'ui-portlet-plain', | ||
onchange : function() { self.chart.settings.set( self.form.data.create() ); } | ||
}); | ||
this.$form.empty().append( this.form.$el ); | ||
this.message.$el.hide(); | ||
} else { | ||
this.$form.empty(); | ||
this.message.$el.show(); | ||
} | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters