Revert "Revert "Use switches on settings pane""

This reverts commit e5ae06afeb.
This commit is contained in:
Piotr Sarnacki 2014-02-12 17:33:42 +01:00
parent e5ae06afeb
commit 0679fc260c
2 changed files with 14 additions and 4 deletions

View File

@ -1,9 +1,19 @@
Travis.TravisSwitchComponent = Ember.Component.extend
tagName: 'a'
classNames: ['travis-switch']
classNameBindings: ['active']
classNameBindings: ['_active:active']
activeBinding: 'target.active'
# TODO: how to handle overriding properties to
# avoid naming it _action?
_active: (->
@get('target.active') || @get('active')
).property('target.active', 'active')
click: ->
@sendAction('action', @get('target'))
if target = @get('target')
@set('target.active', !@get('target.active'))
else
@set('active', !@get('active'))
# allow for bindings to propagate
Ember.run.next this, ->
@sendAction('action', target)

View File

@ -1,4 +1,4 @@
{{#if active}}
{{#if _active}}
ON
{{else}}
OFF