Use switches on settings pane
This commit is contained in:
parent
d41d6de175
commit
357b176f93
|
@ -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)
|
||||
|
|
|
@ -54,7 +54,7 @@ Travis.RepoSettingsController = Em.ObjectController.extend
|
|||
tab: Ember.computed.alias('controllers.repoSettingsTab.model.tab')
|
||||
settings: Ember.computed.alias('model.settings')
|
||||
|
||||
submit: ->
|
||||
save: ->
|
||||
@set('saving', true)
|
||||
self = this
|
||||
@get('model').saveSettings(@get('settings')).then ->
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{{#if active}}
|
||||
{{#if _active}}
|
||||
ON
|
||||
{{else}}
|
||||
OFF
|
||||
|
|
|
@ -5,26 +5,18 @@
|
|||
{{#travis-tab "general" "General Settings"}}
|
||||
{{#settings-form}}
|
||||
<p>
|
||||
{{settings-input checked=builds_only_with_travis_yml type="checkbox" id="builds-only-with-travis-yml"}}
|
||||
<label for="builds-only-with-travis-yml">Build only commits with .travis.yml file</label>
|
||||
{{travis-switch action="save" active=settings.builds_only_with_travis_yml}}
|
||||
Build only commits with .travis.yml file
|
||||
</p>
|
||||
|
||||
<p>
|
||||
{{settings-input checked=build_pushes type="checkbox" id="build-pushes"}}
|
||||
<label for="build-pushes">Build pushes</label>
|
||||
{{travis-switch action="save" active=settings.build_pushes}}
|
||||
Build pushes
|
||||
</p>
|
||||
|
||||
<p>
|
||||
{{settings-input checked=build_pull_requests type="checkbox" id="build-pull-requests"}}
|
||||
<label for="build-pull-requests">Build pull requests</label>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
{{#if saving}}
|
||||
<span class="saving">Saving</span>
|
||||
{{else}}
|
||||
<button type="submit">Save</button>
|
||||
{{/if}}
|
||||
{{travis-switch action="save" active=settings.build_pull_requests}}
|
||||
Build pull requests
|
||||
</p>
|
||||
{{/settings-form}}
|
||||
{{/travis-tab}}
|
||||
|
|
Loading…
Reference in New Issue
Block a user