Skip to content

Commit

Permalink
Ember app: Improved routing
Browse files Browse the repository at this point in the history
  • Loading branch information
stas authored and sindresorhus committed Jul 21, 2012
1 parent 53e546e commit e73d849
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 3 additions & 3 deletions architecture-examples/emberjs/index.html
Expand Up @@ -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>
Expand Down
10 changes: 10 additions & 0 deletions architecture-examples/emberjs/js/views/application.js
Expand Up @@ -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',
Expand Down

0 comments on commit e73d849

Please sign in to comment.