Commit e73d8496 authored by Stas SUȘCOV's avatar Stas SUȘCOV Committed by Sindre Sorhus

Ember app: Improved routing

parent 53e546e3
...@@ -34,13 +34,13 @@ ...@@ -34,13 +34,13 @@
<script id="filtersTemplate" type="text/x-handlebars"> <script id="filtersTemplate" type="text/x-handlebars">
<ul id="filters"> <ul id="filters">
<li> <li>
<a {{action showAll href=true}}>All </a> <a {{action showAll href=true}} {{bindAttr class="view.isAll:selected"}}>All</a>
</li> </li>
<li> <li>
<a {{action showActive href=true}}>Active</a> <a {{action showActive href=true}} {{bindAttr class="view.isActive:selected"}}>Active</a>
</li> </li>
<li> <li>
<a {{action showCompleted href=true}}>Completed</a> <a {{action showCompleted href=true}} {{bindAttr class="view.isCompleted:selected"}}>Completed</a>
</li> </li>
</ul> </ul>
</script> </script>
......
...@@ -58,6 +58,16 @@ ...@@ -58,6 +58,16 @@
}), }),
filtersView: Ember.View.create({ filtersView: Ember.View.create({
templateName: 'filtersTemplate', templateName: 'filtersTemplate',
filterBinding: 'controller.namespace.entriesController.filterBy',
isAll: function() {
return !!Ember.empty( this.get('filter') );
}.property( 'filter' ),
isActive: function() {
return !!( this.get('filter') === 'active' );
}.property('filter'),
isCompleted: function() {
return !!( this.get('filter') === 'completed' );
}.property('filter')
}), }),
clearBtnView: Ember.View.create({ clearBtnView: Ember.View.create({
entriesBinding: 'controller.namespace.entriesController', entriesBinding: 'controller.namespace.entriesController',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment