Skip to content

Commit

Permalink
Add description view
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed Aug 22, 2016
1 parent 54be4b8 commit f4510a0
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions config/plugins/visualizations/charts/static/views/description.js
@@ -0,0 +1,36 @@
/** This class renders the chart configuration form. */
define( [], function() {
return Backbone.View.extend({
initialize: function( app, options ) {
var self = this;
this.chart = app.chart;
this.app = app;
this.setElement( this._template() );
this.$title = this.$( '.charts-description-title' );
this.$image = this.$( '.charts-description-image' );
this.$text = this.$( '.charts-description-text' );
this.listenTo( this.chart, 'change:type', function() { self.render() } );
this.render();
},
render: function() {
this.$image.attr( 'src', app_root + 'charts/' + this.app.split( this.chart.get( 'type' ) ) + '/logo.png' );
this.$title.html( this.chart.definition.title + ' (' + this.chart.definition.library + ')' );
this.$text.html( this.chart.definition.description || this.chart.definition.category );
},
_template: function() {
return '<div class="charts-description">' +
'<table>' +
'<tr>' +
'<td class="charts-description-image-td">' +
'<img class="charts-description-image"/>' +
'</td>' +
'<td>' +
'<div class="charts-description-title ui-form-info"/>' +
'<div class="charts-description-text ui-form-info"/>' +
'</td>' +
'</tr>' +
'</table>' +
'</div>';
}
});
});

0 comments on commit f4510a0

Please sign in to comment.