Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

Commit

Permalink
Bring back graphics / (╯°□°)╯︵ ┻━┻
Browse files Browse the repository at this point in the history
  • Loading branch information
andresgnlez committed Oct 15, 2015
1 parent 63826cd commit a37d403
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
</div>
<div class="country-widget__content" data-type="{{type}}">

{{#if indicators}}
{{#if tabs}}
<div class="indicators-grid">
{{#each indicators}}
<div class="indicators-grid__item" data-api="{{data}}" graphicId="{{id}}">{{name}}</div>
{{#each tabs}}
<div class="indicators-grid__item" data-position="{{position}}" data-type="{{type}}">{{name}}</div>
{{/each}}
</div>
<div class="indicators__content">
Expand Down
7 changes: 4 additions & 3 deletions app/assets/javascripts/views/WidgetView.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,17 @@ define([

this.$el.html(this.template({
id: this.widgetModel.get('id'),
tabs: this.widgetModel.get('tabs'),
indicators: this.widgetModel.get('indicators'),
name: this.widgetModel.get('name'),
type: this.widgetModel.get('type')
}));

// Set the current that should be activated.
// Substract 1 because the zero position.
var indicatorActived = this.presenter.status.get('options').indicator - 1;

var currentDataSetLink = this.widgetModel.attributes.indicators[indicatorActived].data;
var currentTab = this.widgetModel.get('tabs')[indicatorActived];

var widgetId = this.widgetModel.get('id');
var nextEl = '#' + widgetId + '.country-widget .graph-container';

Expand All @@ -95,7 +96,7 @@ define([
// Mejorar
$(document.querySelector('.reports-grid').firstChild).append(this.el);

if (this.widgetModel.get('type') === 'line') {
if (currentTab.type === 'line') {
new LineChartIndicator({el: nextEl}).render(data, widgetId);
}

Expand Down

0 comments on commit a37d403

Please sign in to comment.