Fix toggle button on hooks list in profile

This commit is contained in:
Piotr Sarnacki 2013-03-06 15:18:57 +01:00
parent 71f4885472
commit 1e6672eb9f
4 changed files with 19 additions and 1 deletions

View File

@ -5,3 +5,6 @@ Travis.AccountIndexController = Em.Controller.extend
sync: ->
@get('user').sync()
toggle: (hook) ->
hook.toggle()

View File

@ -23,6 +23,9 @@ Travis.ProfileController = Travis.Controller.extend
sync: ->
@get('user').sync()
toggle: (hook) ->
hook.toggle()
activate: (action, params) ->
@setParams(params || @get('params'))
this["view#{$.camelize(action)}"]()

View File

@ -102,6 +102,18 @@ Travis.RestAdapter = DS.RESTAdapter.extend
merge: (store, record, serialized) ->
@get('serializer').merge(record, serialized)
didSaveRecord: (store, type, record, payload) ->
# API sometimes return { result: true } response
# which does not play nice with ember-data. For now
# let's just change payload to have serialized record
# included, but ideally it should be fixed in the API
# to be consistent across all the endpoints.
if payload?.result == true
payload = {}
payload[type.singularName()] = record.serialize()
@_super(store, type, record, payload)
Travis.RestAdapter.map 'Travis.Commit', {}
Travis.RestAdapter.map 'Travis.Build', {

View File

@ -24,7 +24,7 @@
<div class="controls">
<a {{bindAttr href="hook.urlGithubAdmin"}} class="github-admin tool-tip" title="Github service hooks admin page"></a>
<a {{action toggle target="hook"}} class="switch">
<a {{action toggle hook}} class="switch">
{{#if hook.active}}
ON
{{else}}