Permalink
Browse files

Ember app: Improved routing

  • Loading branch information...
1 parent 53e546e commit e73d8496d3388e4715ac43789a211c615e13b601 @stas stas committed with sindresorhus Jul 21, 2012
Showing with 13 additions and 3 deletions.
  1. +3 −3 architecture-examples/emberjs/index.html
  2. +10 −0 architecture-examples/emberjs/js/views/application.js
@@ -34,13 +34,13 @@
<script id="filtersTemplate" type="text/x-handlebars">
<ul id="filters">
<li>
- <a {{action showAll href=true}}>All </a>
+ <a {{action showAll href=true}} {{bindAttr class="view.isAll:selected"}}>All</a>
</li>
<li>
- <a {{action showActive href=true}}>Active</a>
+ <a {{action showActive href=true}} {{bindAttr class="view.isActive:selected"}}>Active</a>
</li>
<li>
- <a {{action showCompleted href=true}}>Completed</a>
+ <a {{action showCompleted href=true}} {{bindAttr class="view.isCompleted:selected"}}>Completed</a>
</li>
</ul>
</script>
@@ -58,6 +58,16 @@
}),
filtersView: Ember.View.create({
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({
entriesBinding: 'controller.namespace.entriesController',

0 comments on commit e73d849

Please sign in to comment.