This repository has been archived by the owner on Mar 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Customization modal created and working
- Loading branch information
Miguel Barrenechea
committed
Nov 12, 2015
1 parent
6b05912
commit 4086d7b
Showing
17 changed files
with
365 additions
and
95 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
60 changes: 60 additions & 0 deletions
60
app/assets/javascripts/compare/presenters/CompareModalWidgetsPresenter.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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
define([ | ||
'backbone', | ||
'mps', | ||
'compare/presenters/PresenterClass', | ||
'widgets/collections/WidgetCollection', | ||
], function(Backbone, mps, PresenterClass, WidgetCollection) { | ||
|
||
'use strict'; | ||
|
||
var CompareSelectorsPresenter = PresenterClass.extend({ | ||
|
||
status: new (Backbone.Model.extend({})), | ||
|
||
init: function(view) { | ||
this._super(); | ||
this.view = view; | ||
}, | ||
|
||
/** | ||
* Application subscriptions. | ||
*/ | ||
_subscriptions: [{ | ||
'Widgets/update': function(widgets) { | ||
this.status.set('widgetsActive',widgets); | ||
if (!!this.status.get('widgets')) { | ||
this.view.render(); | ||
this.view.setWidgetsStatus(); | ||
} else { | ||
new WidgetCollection() | ||
.fetch() | ||
.done(_.bind(function(response){ | ||
this.status.set('widgets',response.widgets) | ||
this.view.render(); | ||
this.view.setWidgetsStatus(); | ||
}, this )); | ||
} | ||
}, | ||
|
||
'CompareWidgetsModal/show': function(tab) { | ||
this.view.show(); | ||
} | ||
}], | ||
|
||
|
||
changeActiveWidgets: function(widgetId,remove) { | ||
var widgets = _.clone(this.status.get('widgetsActive')); | ||
(remove) ? widgets = _.without(widgets,widgetId.toString()) : widgets.push(widgetId.toString()); | ||
this.status.set('widgetsActive', widgets); | ||
this.view.setWidgetsStatus(); | ||
}, | ||
|
||
setActiveWidgets: function() { | ||
mps.publish('Widgets/change', [this.status.get('widgetsActive')]); | ||
} | ||
|
||
}); | ||
|
||
return CompareSelectorsPresenter; | ||
|
||
}); |
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
23 changes: 23 additions & 0 deletions
23
app/assets/javascripts/compare/templates/compareWidgetsModal.handlebars
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<a class="close" href="#"><svg><use xlink:href="#shape-close"></use></svg></a> | ||
<div class="content-wrapper"> | ||
<div class="m-compare-modal"> | ||
<div class="m-modal--tab is-active"> | ||
<div class="m-field"> | ||
<h3>Indicators</h3> | ||
<ul class="m-field-list compare-area"> | ||
{{#each widgets}} | ||
<li class="m-field-list-item is-checkbox js-field-list-checkbox-widget" data-id="{{this.id}}"><svg class="icon-check"><use xlink:href="#icon-check"></use></svg>{{this.name}}</li> | ||
{{/each}} | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<footer class="m-compare-footer"> | ||
<span class="gradient"></span> | ||
<ul class="m-btncontainer is-center"> | ||
<li> | ||
<button id="btnModalWidgetsContinue" class="btn blue medium uppercase">Continue</button> | ||
</li> | ||
</ul> | ||
</footer> |
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
3 changes: 2 additions & 1 deletion
3
app/assets/javascripts/compare/views/index/CompareGridButtonBoxView.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
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
Oops, something went wrong.