Commit 6da7ad53 authored by Sindre Sorhus's avatar Sindre Sorhus

Ember+Require app: Apply the fix from Ember app for showing selected filter in...

Ember+Require app: Apply the fix from Ember app for showing selected filter in the filter bar. Fixes #220
parent a7a4d9ce
<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>
......@@ -10,7 +10,17 @@ define('app/views/filters', [
*/
function( filters_html ) {
return Ember.View.extend({
template: Ember.Handlebars.compile( filters_html )
})
template: Ember.Handlebars.compile( filters_html ),
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')
});
}
);
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