mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 23:58:02 -05:00
Allowed access to character class emails by prompting for signup on check.
This commit is contained in:
parent
f0989b67c9
commit
ec20cac6f7
3 changed files with 28 additions and 28 deletions
|
@ -110,10 +110,9 @@ block content
|
|||
| , tell us a little about yourself, what you've done and what you'd
|
||||
| be interested in working on. We'll go from there!
|
||||
|
||||
if !me.attributes.anonymous
|
||||
label.checkbox(for="developer").well
|
||||
input(type='checkbox', name="developer", id="developer")
|
||||
| Get emails on new coding opportunities and announcements.
|
||||
label.checkbox(for="developer").well
|
||||
input(type='checkbox', name="developer", id="developer")
|
||||
| Get emails on new coding opportunities and announcements.
|
||||
|
||||
|
||||
#artisan
|
||||
|
@ -148,10 +147,9 @@ block content
|
|||
a(href="https://docs.google.com/document/d/117tMcL95T1KY8BDisr0iGi5Frb2ZvBJTC0us5hyQkJY/edit?usp=sharing") preliminary documentation
|
||||
| for more info, and please comment on it so we can make the whole system better.
|
||||
|
||||
if !me.attributes.anonymous
|
||||
label.checkbox(for="level_creator").well
|
||||
input(type='checkbox', name="level_creator", id="level_creator")
|
||||
| Get emails on level editor updates and announcements.
|
||||
label.checkbox(for="level_creator").well
|
||||
input(type='checkbox', name="level_creator", id="level_creator")
|
||||
| Get emails on level editor updates and announcements.
|
||||
|
||||
|
||||
#adventurer
|
||||
|
@ -188,10 +186,9 @@ block content
|
|||
a(href="https://plus.google.com/115285980638641924488/posts") Google+
|
||||
| , so if you prefer to be notified those ways, sign up there!
|
||||
|
||||
if !me.attributes.anonymous
|
||||
label.checkbox(for="tester").well
|
||||
input(type='checkbox', name="tester", id="tester")
|
||||
| Get emails when there are new levels to test.
|
||||
label.checkbox(for="tester").well
|
||||
input(type='checkbox', name="tester", id="tester")
|
||||
| Get emails when there are new levels to test.
|
||||
|
||||
|
||||
#scribe
|
||||
|
@ -220,10 +217,9 @@ block content
|
|||
| , tell us a little about yourself, your experience with programming and
|
||||
| what sort of things you'd like to write about. We'll go from there!
|
||||
|
||||
if !me.attributes.anonymous
|
||||
label.checkbox(for="article_editor").well
|
||||
input(type='checkbox', name="article_editor", id="article_editor")
|
||||
| Get emails about article writing announcements.
|
||||
label.checkbox(for="article_editor").well
|
||||
input(type='checkbox', name="article_editor", id="article_editor")
|
||||
| Get emails about article writing announcements.
|
||||
|
||||
|
||||
|
||||
|
@ -253,10 +249,9 @@ block content
|
|||
| , so check it out and add things for your language. Also, check this box below to
|
||||
| keep up-to-date on new internationalization developments!
|
||||
|
||||
if !me.attributes.anonymous
|
||||
label.checkbox(for="translator").well
|
||||
input(type='checkbox', name="translator", id="translator")
|
||||
| Get emails about i18n developments and levels to translate.
|
||||
label.checkbox(for="translator").well
|
||||
input(type='checkbox', name="translator", id="translator")
|
||||
| Get emails about i18n developments and levels to translate.
|
||||
|
||||
|
||||
#ambassador
|
||||
|
@ -289,10 +284,9 @@ block content
|
|||
| solving levels can summon higher level wizards to help them.
|
||||
| This will be a great way for ambassadors to do their thing. We'll keep you posted!
|
||||
|
||||
if !me.attributes.anonymous
|
||||
label.checkbox(for="support").well
|
||||
input(type='checkbox', name="support", id="support")
|
||||
| Get emails on support updates and multiplayer developments.
|
||||
label.checkbox(for="support").well
|
||||
input(type='checkbox', name="support", id="support")
|
||||
| Get emails on support updates and multiplayer developments.
|
||||
|
||||
|
||||
#counselor
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
View = require 'views/kinds/RootView'
|
||||
template = require 'templates/contribute'
|
||||
{me} = require('lib/auth')
|
||||
{me} = require 'lib/auth'
|
||||
SignupModalView = require 'views/modal/signup_modal'
|
||||
|
||||
module.exports = class ContributeView extends View
|
||||
id: "contribute-view"
|
||||
|
@ -21,9 +22,11 @@ module.exports = class ContributeView extends View
|
|||
el = $(e.target)
|
||||
checked = el.prop('checked')
|
||||
subscription = el.attr('name')
|
||||
subscriptions = me.get('emailSubscriptions')
|
||||
subscriptions = me.get('emailSubscriptions') ? []
|
||||
if checked and not (subscription in subscriptions)
|
||||
subscriptions.push(subscription)
|
||||
if me.get 'anonymous'
|
||||
@openModalView new SignupModalView()
|
||||
if not checked
|
||||
subscriptions = _.without subscriptions, subscription
|
||||
|
||||
|
|
|
@ -44,10 +44,13 @@ module.exports = class SignupModalView extends View
|
|||
userObject = forms.formToObject @$el
|
||||
delete userObject.subscribe
|
||||
delete userObject["confirm-age"]
|
||||
for key, val of me.attributes when key in ["preferredLanguage", "testGroupNumber", "dateCreated", "wizardColor1", "name", "music", "volume"]
|
||||
for key, val of me.attributes when key in ["preferredLanguage", "testGroupNumber", "dateCreated", "wizardColor1", "name", "music", "volume", "emailSubscriptions"]
|
||||
userObject[key] ?= val
|
||||
subscribe = @$el.find('#signup-subscribe').prop('checked')
|
||||
userObject.emailSubscriptions = if subscribe then ['announcement'] else []
|
||||
if subscribe
|
||||
(userObject.emailSubscriptions ?= []).push 'announcement'
|
||||
else
|
||||
userObject.emailSubscriptions = _.without (userObject.emailSubscriptions ? []), 'announcement'
|
||||
res = tv4.validateMultiple userObject, User.schema.attributes
|
||||
return forms.applyErrorsToForm(@$el, res.errors) unless res.valid
|
||||
window.tracker?.trackEvent 'Finished Signup'
|
||||
|
|
Loading…
Reference in a new issue