Added avatar placeholder.

This commit is contained in:
Martin Edenhofer 2014-10-08 14:27:03 +02:00
parent f8b479b816
commit 0b38e6f656
2 changed files with 65 additions and 0 deletions

View file

@ -0,0 +1,60 @@
class Index extends App.Controller
events:
'submit form': 'update'
constructor: ->
super
return if !@authenticate()
@render()
render: =>
@html App.view('profile/avatar')()
update: (e) =>
e.preventDefault()
params = @formParam(e.target)
error = @form.validate(params)
if error
@formValidate( form: e.target, errors: error )
return false
@formDisable(e)
# get data
@locale = params['locale']
@ajax(
id: 'preferences'
type: 'PUT'
url: @apiPath + '/users/preferences'
data: JSON.stringify(params)
processData: true
success: @success
error: @error
)
success: (data, status, xhr) =>
App.User.retrieve(
App.Session.get( 'id' ),
=>
App.i18n.set( @locale )
App.Event.trigger( 'ui:rerender' )
App.Event.trigger( 'ui:page:rerender' )
@notify(
type: 'success'
msg: App.i18n.translateContent( 'Successfully!' )
)
,
true
)
error: (xhr, status, error) =>
@render()
data = JSON.parse( xhr.responseText )
@notify(
type: 'error'
msg: App.i18n.translateContent( data.message )
)
App.Config.set( 'Avatar', { prio: 1100, name: 'Avatar', parent: '#profile', target: '#profile/avatar', controller: Index }, 'NavBarProfile' )

View file

@ -0,0 +1,5 @@
<form class="form-normal">
<h2><%- @T( 'Avatar' ) %></h2>
<div class="snapshot"></div>
<button type="submit" class="btn"><%- @T( 'Snapshot' ) %></button>
</form>