2015-02-06 17:49:47 -05:00
|
|
|
ModalView = require 'views/core/ModalView'
|
|
|
|
template = require 'templates/play/modal/share-progress-modal'
|
2015-04-08 21:31:13 -04:00
|
|
|
storage = require 'core/storage'
|
2015-02-06 17:49:47 -05:00
|
|
|
|
2016-01-16 07:07:15 -05:00
|
|
|
module.exports = class ShareProgressModal extends ModalView
|
2015-02-06 17:49:47 -05:00
|
|
|
id: 'share-progress-modal'
|
|
|
|
template: template
|
|
|
|
plain: true
|
|
|
|
closesOnClickOutside: false
|
|
|
|
|
|
|
|
events:
|
|
|
|
'click .close-btn': 'hide'
|
|
|
|
'click .continue-link': 'hide'
|
|
|
|
'click .send-btn': 'onClickSend'
|
|
|
|
|
|
|
|
onClickSend: (e) ->
|
|
|
|
email = $('.email-input').val()
|
|
|
|
unless /[\w\.]+@\w+\.\w+/.test email
|
|
|
|
$('.email-input').parent().addClass('has-error')
|
|
|
|
$('.email-invalid').show()
|
|
|
|
return false
|
|
|
|
|
|
|
|
request = @supermodel.addRequestResource 'send_one_time_email', {
|
|
|
|
url: '/db/user/-/send_one_time_email'
|
2015-04-08 21:31:13 -04:00
|
|
|
data: {email: email, type: 'share progress modal parent'}
|
2015-02-06 17:49:47 -05:00
|
|
|
method: 'POST'
|
|
|
|
}, 0
|
|
|
|
request.load()
|
|
|
|
|
2015-04-08 21:31:13 -04:00
|
|
|
storage.save 'sent-parent-email', true
|
2015-02-06 17:49:47 -05:00
|
|
|
@hide()
|