Commit 52522d2a authored by Stas SUȘCOV's avatar Stas SUȘCOV

Update clear button view bindings. Force the view scope.

parent 920eaf35
<button {{action "clearCompleted" target="controller"}}> {{#with view}}
Clear completed ({{completed}}) <button {{action "clearCompleted" target="entries"}} >
</button> Clear completed ({{entries.completed}})
</button>
{{/with}}
...@@ -10,15 +10,14 @@ define('app/views/clear_button', [ ...@@ -10,15 +10,14 @@ define('app/views/clear_button', [
*/ */
function( button_html ) { function( button_html ) {
return Ember.View.extend({ return Ember.View.extend({
entriesBinding: 'controller.namespace.entriesController',
template: Ember.Handlebars.compile( button_html ), template: Ember.Handlebars.compile( button_html ),
completedBinding: 'controller.completed',
elementId: 'clear-completed', elementId: 'clear-completed',
classNameBindings: 'buttonClass', classNameBindings: 'buttonClass',
// Observer to update class if completed value changes
buttonClass: function () { buttonClass: function () {
if ( !this.get( 'completed' ) ) if ( !this.getPath( 'entries.completed' ) )
return 'hidden'; return 'hidden';
}.property( 'completed' ) }.property( 'entries.completed' )
}) })
} }
); );
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