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

Commit

Permalink
Button added. Behaviour almost finished. We need to set the mps publi…
Browse files Browse the repository at this point in the history
…sh event
  • Loading branch information
Miguel Barrenechea committed Nov 11, 2015
1 parent e382094 commit 6b05912
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
define([
'backbone',
'mps',
'compare/presenters/PresenterClass',
], function(Backbone, mps, PresenterClass) {

'use strict';

var CompareSelectorsPresenter = PresenterClass.extend({

init: function(view) {
this._super();
this.view = view;
},

/**
* Application subscriptions.
*/
_subscriptions: [],

showIndicatorModal: function() {
// mps publish an event that makes the indicator modal show
console.log("Let's show the indicator modal")
}

});

return CompareSelectorsPresenter;

});
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<button class="addIndicators btn medium blue">Customize indicators</button>
4 changes: 3 additions & 1 deletion app/assets/javascripts/compare/views/CompareIndexView.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ define([
'compare/views/index/CompareGridView',
'compare/views/index/CompareModalView',
'compare/views/index/CompareFixedHeaderView',
], function(Backbone, CompareSelectorsView, CompareGridView, CompareModalView, CompareFixedHeaderView) {
'compare/views/index/CompareGridButtonBoxView',
], function(Backbone, CompareSelectorsView, CompareGridView, CompareModalView, CompareFixedHeaderView, CompareGridButtonBoxView) {

var CompareIndexView = Backbone.View.extend({

Expand All @@ -13,6 +14,7 @@ define([
new CompareGridView();
new CompareModalView();
new CompareFixedHeaderView();
new CompareGridButtonBoxView();
}

});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
define([
'backbone',
'compare/presenters/CompareGridButtonBoxPresenter',
'text!compare/templates/compareGridButtonBox.handlebars',
], function(Backbone, CompareGridButtonBoxPresenter, tpl) {

var CompareGridButtonBoxView = Backbone.View.extend({

el: '#compareGridButtonBox',

template: Handlebars.compile(tpl),

events: {
'click .addIndicators' : 'showIndicatorModal'
},

initialize:function() {
this.presenter = new CompareGridButtonBoxPresenter(this);
this.render();
},

render: function() {
this.$el.html(this.template());
},

// Events
showIndicatorModal: function(e) {
e && e.preventDefault();
this.presenter.showIndicatorModal();
}

});

return CompareGridButtonBoxView;

});
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.m-compare-grid-button-box {
display: flex;
flex-direction: row-reverse;
padding: 0 0 50px;
}
3 changes: 2 additions & 1 deletion app/views/compare/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ section.l-compare-countries

.l-main-content
.inner
#compareGridView
.m-compare-grid-button-box#compareGridButtonBox
.m-compare-grid#compareGridView

.l-cutpoint#offsetBottom

0 comments on commit 6b05912

Please sign in to comment.