mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-24 08:08:15 -05:00
31 lines
808 B
CoffeeScript
31 lines
808 B
CoffeeScript
RootView = require 'views/kinds/RootView'
|
|
template = require 'templates/cla'
|
|
{me} = require 'lib/auth'
|
|
|
|
module.exports = class CLAView extends RootView
|
|
id: 'cla-view'
|
|
template: template
|
|
|
|
events:
|
|
'click #agreement-button': 'onAgree'
|
|
|
|
getRenderData: ->
|
|
c = super()
|
|
c.signedOn = moment(me.get('signedCLA')).format('LLLL') if me.get('signedCLA')
|
|
c
|
|
|
|
onAgree: ->
|
|
@$el.find('#agreement-button').prop('disabled', true).text('Saving')
|
|
$.ajax({
|
|
url: '/db/user/me/agreeToCLA'
|
|
data: {'githubUsername': @$el.find('#github-username').val()}
|
|
method: 'POST'
|
|
success: @onAgreeSucceeded
|
|
error: @onAgreeFailed
|
|
})
|
|
|
|
onAgreeSucceeded: =>
|
|
@$el.find('#agreement-button').text('Success')
|
|
|
|
onAgreeFailed: =>
|
|
@$el.find('#agreement-button').text('Failed')
|