travis-web/assets/scripts/app/controllers/repo_settings.coffee
Piotr Sarnacki 05489d4a0a Change tabs to work with routes and outlets instead of helpers
When I started working on settings I had a bit different vision on tabs
and I've added that code prematurely. It seems that the best way to go
is to create separate routes and controllers for each tab - that way we
can just rely on Ember.js for customizing, not some custom code in tabs
helpers etc.
2014-07-28 12:42:21 +02:00

31 lines
1.0 KiB
CoffeeScript

Travis.RepoSettingsController = Em.ObjectController.extend
tabs:
index: "General Settings"
env_vars: "Environment variables"
ssh_key: "Ssh key"
init: ->
@_super.apply this, arguments
tabs = []
@set('_tabs', tabs)
for own id, name of @get('tabs')
tabs.pushObject Travis.Tab.create(id: id, name: name)
settings: Ember.computed.alias('model.settings')
settingsChanged: (->
value = @get('settings.maximum_number_of_builds')
console.log value
if parseInt(value) > 0 || value == '0' || value == 0
@set('settings.maximum_number_of_builds_valid', '')
@get('model').saveSettings(@get('settings')).then null, ->
Travis.flash(error: 'There was an error while saving settings. Please try again.')
else
@set('settings.maximum_number_of_builds_valid', 'invalid')
).observes('settings.maximum_number_of_builds')
save: ->
@get('model').saveSettings(@get('settings')).then null, ->
Travis.flash(error: 'There was an error while saving settings. Please try again.')