travis-web/assets/scripts/app/controllers/settings.coffee
2014-08-21 16:39:15 +02:00

18 lines
770 B
CoffeeScript

Travis.SettingsIndexController = Em.ObjectController.extend
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.')