Refactored contribute views to share some templates and link to users' profile photos and GitHub accounts when available.

This commit is contained in:
Nick Winter 2014-04-12 14:53:09 -07:00
parent 072729acc3
commit 08616def10
21 changed files with 162 additions and 265 deletions

View file

@ -49,9 +49,15 @@
&:hover &:hover
background-color: rgba(200, 244, 255, 0.2) background-color: rgba(200, 244, 255, 0.2)
h4 a:not(.has-github)
text-align: center cursor: default
text-decoration: none
img img
max-width: 100px max-width: 100px
max-height: 100px max-height: 100px
.caption
background-color: transparent
h4
text-align: center

View file

@ -53,30 +53,12 @@ block content
span(data-i18n="contribute.adventurer_join_suf") span(data-i18n="contribute.adventurer_join_suf")
| so if you prefer to be notified those ways, sign up there! | so if you prefer to be notified those ways, sign up there!
if me.attributes.anonymous .contributor-signup-anonymous
div#sign-up.alert.alert-info .contributor-signup(data-contributor-class-id="tester", data-contributor-class-name="adventurer")
strong(data-i18n="contribute.alert_account_message_intro")
| Hey there!
span
span(data-i18n="contribute.alert_account_message_pref")
| To subscribe for class emails, you'll need to
a(data-toggle="coco-modal", data-target="modal/signup", data-i18n="contribute.alert_account_message_create_url")
| create an account
span
span(data-i18n="contribute.alert_account_message_suf")
| first.
label.checkbox(for="tester").well //h3(data-i18n="contribute.brave_adventurers")
input(type='checkbox', name="tester", id="tester") // | Our Brave Adventurers:
span(data-i18n="contribute.adventurer_subscribe_desc") //
| Get emails when there are new levels to test. //#contributor-list
.saved-notification ✓ Saved
//#Contributors
// h3(data-i18n="contribute.brave_adventurers")
// | Our Brave Adventurers:
// ul.adventurers
// li Kieizroe
// li ... many, many more
div.clearfix div.clearfix

View file

@ -47,29 +47,12 @@ block content
| solving levels can summon higher level wizards to help them. | 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! | This will be a great way for ambassadors to do their thing. We'll keep you posted!
if me.attributes.anonymous .contributor-signup-anonymous
div#sign-up.alert.alert-info .contributor-signup(data-contributor-class-id="support", data-contributor-class-name="ambassador")
strong(data-i18n="contribute.alert_account_message_intro")
| Hey there!
span
span(data-i18n="contribute.alert_account_message_pref")
| To subscribe for class emails, you'll need to
a(data-toggle="coco-modal", data-target="modal/signup", data-i18n="contribute.alert_account_message_create_url")
| create an account
span
span(data-i18n="contribute.alert_account_message_suf")
| first.
label.checkbox(for="support").well //h3(data-i18n="contribute.helpful_ambassadors")
input(type='checkbox', name="support", id="support") // | Our Helpful Ambassadorsd:
span(data-i18n="contribute.ambassador_subscribe_desc") //
| Get emails on support updates and multiplayer developments. //#contributor-list
.saved-notification ✓ Saved
//#Contributors
// h3(data-i18n="contribute.helpful_ambassadors")
// | Our Helpful Ambassadorsd:
// ul.ambassadors
// li
div.clearfix div.clearfix

View file

@ -57,37 +57,12 @@ block content
span(data-i18n="contribute.join_desc_4") span(data-i18n="contribute.join_desc_4")
| and we'll go from there! | and we'll go from there!
if me.attributes.anonymous .contributor-signup-anonymous
div#sign-up.alert.alert-info .contributor-signup(data-contributor-class-id="developer", data-contributor-class-name="archmage")
strong(data-i18n="contribute.alert_account_message_intro")
| Hey there!
span
span(data-i18n="contribute.alert_account_message_pref")
| To subscribe for class emails, you'll need to
a(data-toggle="coco-modal", data-target="modal/signup", data-i18n="contribute.alert_account_message_create_url")
| create an account
span
span(data-i18n="contribute.alert_account_message_suf")
| first.
label.checkbox(for="developer").well h3(data-i18n="contribute.powerful_archmages")
input(type='checkbox', name="developer", id="developer") | Our Powerful Archmages:
span(data-i18n="contribute.archmage_subscribe_desc")
| Get emails on new coding opportunities and announcements.
.saved-notification ✓ Saved
#Contributors #contributor-list
h3(data-i18n="contribute.powerful_archmages")
| Our Powerful Archmages:
.row
for contributor in contributors
.col-xs-6.col-md-3
.thumbnail
if contributor.avatar
img.img-responsive(src="/images/pages/contribute/archmage/" + contributor.avatar + "_small.png", alt="")
else
img.img-responsive(src="/images/pages/contribute/archmage.png", alt="")
.caption
h4= contributor.name
div.clearfix div.clearfix

View file

@ -54,38 +54,13 @@ block content
li li
a(href="http://discourse.codecombat.com", data-i18n="contribute.artisan_join_step4") Post your levels on the forum for feedback. a(href="http://discourse.codecombat.com", data-i18n="contribute.artisan_join_step4") Post your levels on the forum for feedback.
if me.attributes.anonymous .contributor-signup-anonymous
div#sign-up.alert.alert-info .contributor-signup(data-contributor-class-id="level_creator", data-contributor-class-name="artisan")
strong(data-i18n="contribute.alert_account_message_intro")
| Hey there!
span
span(data-i18n="contribute.alert_account_message_pref")
| To subscribe for class emails, you'll need to
a(data-toggle="coco-modal", data-target="modal/signup", data-i18n="contribute.alert_account_message_create_url")
| create an account
span
span(data-i18n="contribute.alert_account_message_suf")
| first.
label.checkbox(for="level_creator").well h3(data-i18n="contribute.creative_artisans")
input(type='checkbox', name="level_creator", id="level_creator") | Our Creative Artisans:
span(data-i18n="contribute.artisan_subscribe_desc")
| Get emails on level editor updates and announcements.
.saved-notification ✓ Saved
#Contributors #contributor-list
h3(data-i18n="contribute.creative_artisans")
| Our Creative Artisans:
.row
for contributor in contributors
.col-xs-6.col-md-3
.thumbnail
if contributor.avatar
img.img-responsive(src="/images/pages/contribute/artisan/" + contributor.avatar + "_small.png", alt="")
else
img.img-responsive(src="/images/pages/contribute/artisan.png", alt="")
.caption
h4= contributor.name
div.clearfix div.clearfix

View file

@ -37,18 +37,7 @@ block content
| - Nick, George, Scott, Michael, Jeremy and Glen | - Nick, George, Scott, Michael, Jeremy and Glen
hr hr
if me.attributes.anonymous .contributor-signup-anonymous
div#sign-up.alert.alert-info
strong(data-i18n="contribute.alert_account_message_intro")
| Hey there!
span
span(data-i18n="contribute.alert_account_message_pref")
| To subscribe for class emails, you'll need to
a(data-toggle="coco-modal", data-target="modal/signup", data-i18n="contribute.alert_account_message_create_url")
| create an account
span
span(data-i18n="contribute.alert_account_message_suf")
| first.
#archmage.header-scrolling-fix #archmage.header-scrolling-fix
.class_image .class_image
@ -69,13 +58,7 @@ block content
p.lead(data-i18n="contribute.more_about_archmage") p.lead(data-i18n="contribute.more_about_archmage")
| Learn More About Becoming an Archmage | Learn More About Becoming an Archmage
label.checkbox(for="developer").well .contributor-signup(data-contributor-class-id="developer", data-contributor-class-name="archmage")
input(type='checkbox', name="developer", id="developer")
span(data-i18n="contribute.archmage_subscribe_desc")
| Get emails on new coding opportunities and announcements.
.saved-notification
| ✓
span(data-i18n="contribute.saved") Saved
#artisan.header-scrolling-fix #artisan.header-scrolling-fix
@ -102,13 +85,7 @@ block content
p.lead(data-i18n="contribute.more_about_artisan") p.lead(data-i18n="contribute.more_about_artisan")
| Learn More About Becoming An Artisan | Learn More About Becoming An Artisan
label.checkbox(for="level_creator").well .contributor-signup(data-contributor-class-id="level_creator", data-contributor-class-name="artisan")
input(type='checkbox', name="level_creator", id="level_creator")
span(data-i18n="contribute.artisan_subscribe_desc")
| Get emails on level editor updates and announcements.
.saved-notification
| ✓
span(data-i18n="contribute.saved") Saved
#adventurer.header-scrolling-fix #adventurer.header-scrolling-fix
@ -130,13 +107,7 @@ block content
p.lead(data-i18n="contribute.more_about_adventurer") p.lead(data-i18n="contribute.more_about_adventurer")
| Learn More About Becoming an Adventurer | Learn More About Becoming an Adventurer
label.checkbox(for="tester").well .contributor-signup(data-contributor-class-id="tester", data-contributor-class-name="adventurer")
input(type='checkbox', name="tester", id="tester")
span(data-i18n="contribute.adventurer_subscribe_desc")
| Get emails when there are new levels to test.
.saved-notification
| ✓
span(data-i18n="contribute.saved") Saved
#scribe.header-scrolling-fix #scribe.header-scrolling-fix
@ -162,13 +133,7 @@ block content
p.lead(data-i18n="contribute.more_about_scribe") p.lead(data-i18n="contribute.more_about_scribe")
| Learn More About Becoming a Scribe | Learn More About Becoming a Scribe
label.checkbox(for="article_editor").well .contributor-signup(data-contributor-class-id="article_editor", data-contributor-class-name="scribe")
input(type='checkbox', name="article_editor", id="article_editor")
span(data-i18n="contribute.scribe_subscribe_desc")
| Get emails about article writing announcements.
.saved-notification
| ✓
span(data-i18n="contribute.saved") Saved
#diplomat.header-scrolling-fix #diplomat.header-scrolling-fix
@ -191,14 +156,8 @@ block content
p.lead(data-i18n="contribute.more_about_diplomat") p.lead(data-i18n="contribute.more_about_diplomat")
| Learn More About Becoming a Diplomat | Learn More About Becoming a Diplomat
label.checkbox(for="translator").well .contributor-signup(data-contributor-class-id="translator", data-contributor-class-name="diplomat")
input(type='checkbox', name="translator", id="translator")
span(data-i18n="contribute.diplomat_subscribe_desc")
| Get emails about i18n developments and levels to translate.
.saved-notification
| ✓
span(data-i18n="contribute.saved") Saved
#ambassador.header-scrolling-fix #ambassador.header-scrolling-fix
.class_image .class_image
@ -218,13 +177,7 @@ block content
p.lead(data-i18n="contribute.more_about_ambassador") p.lead(data-i18n="contribute.more_about_ambassador")
| Learn More About Becoming an Ambassador | Learn More About Becoming an Ambassador
label.checkbox(for="support").well .contributor-signup(data-contributor-class-id="support", data-contributor-class-name="ambassador")
input(type='checkbox', name="support", id="support")
span(data-i18n="contribute.ambassador_subscribe_desc")
| Get emails on support updates and multiplayer developments.
.saved-notification
| ✓
span(data-i18n="contribute.saved") Saved
#counselor.header-scrolling-fix #counselor.header-scrolling-fix

View file

@ -0,0 +1,13 @@
.row
for contributor in contributors
.col-xs-6.col-md-3
.thumbnail
- var src = "/images/pages/contribute/" + contributorClassName + ".png";
- if(contributor.avatar)
- src = src.replace(contributorClassName, contributorClassName + "/" + contributor.avatar + "_small");
- if(contributor.id)
- src = "/db/user/" + contributor.id + "/avatar?s=100&fallback=" + src;
a(href=contributor.github ? "https://github.com/codecombat/codecombat/commits?author=" + contributor.github : null, class=contributor.github ? 'has-github' : '')
img.img-responsive(src=src, alt=contributor.name)
.caption
h4= contributor.name

View file

@ -0,0 +1,5 @@
label.checkbox(for=contributorClassID).well
input(type='checkbox', name=contributorClassID, id=contributorClassID)
span(data-i18n="contribute.#{contributorClassName}_subscribe_desc")
.saved-notification ✓ Saved

View file

@ -0,0 +1,12 @@
if me.attributes.anonymous
div#sign-up.alert.alert-info
strong(data-i18n="contribute.alert_account_message_intro")
| Hey there!
span
span(data-i18n="contribute.alert_account_message_pref")
| To subscribe for class emails, you'll need to
a(data-toggle="coco-modal", data-target="modal/signup", data-i18n="contribute.alert_account_message_create_url")
| create an account
span
span(data-i18n="contribute.alert_account_message_suf")
| first.

View file

@ -44,51 +44,37 @@ block content
| , edit it online, and submit a pull request. Also, check this box below to | , edit it online, and submit a pull request. Also, check this box below to
| keep up-to-date on new internationalization developments! | keep up-to-date on new internationalization developments!
if me.attributes.anonymous .contributor-signup-anonymous
div#sign-up.alert.alert-info .contributor-signup(data-contributor-class-id="translator", data-contributor-class-name="diplomat")
strong(data-i18n="contribute.alert_account_message_intro")
| Hey there!
span
span(data-i18n="contribute.alert_account_message_pref")
| To subscribe for class emails, you'll need to
a(data-toggle="coco-modal", data-target="modal/signup", data-i18n="contribute.alert_account_message_create_url")
| create an account
span
span(data-i18n="contribute.alert_account_message_suf")
| first.
label.checkbox(for="translator").well h3(data-i18n="contribute.translating_diplomats")
input(type='checkbox', name="translator", id="translator") | Our Translating Diplomats:
span(data-i18n="contribute.diplomat_subscribe_desc")
| Get emails about i18n developments and levels to translate.
.saved-notification ✓ Saved
#Contributors //#contributor-list
h3(data-i18n="contribute.translating_diplomats") // TODO: collect CodeCombat userids for these guys so we can include a tiled list
| Our Translating Diplomats: ul.diplomats
ul.diplomats li Turkish - Nazım Gediz Aydındoğmuş, cobaimelan, wakeup
li Turkish - Nazım Gediz Aydındoğmuş, cobaimelan, wakeup li Brazilian Portuguese - Gutenberg Barros, Kieizroe, Matthew Burt, brunoporto, cassiocardoso
li Brazilian Portuguese - Gutenberg Barros, Kieizroe, Matthew Burt, brunoporto, cassiocardoso li Portugal Portuguese - Matthew Burt, ReiDuKuduro
li Portugal Portuguese - Matthew Burt, ReiDuKuduro li German - Dirk, faabsen, HiroP0, Anon, bkimminich
li German - Dirk, faabsen, HiroP0, Anon, bkimminich li Thai - Kamolchanok Jittrepit
li Thai - Kamolchanok Jittrepit li Vietnamese - An Nguyen Hoang Thien
li Vietnamese - An Nguyen Hoang Thien li Dutch - Glen De Cauwsemaecker, Guido Zuidhof, Ruben Vereecken, Jasper D'haene
li Dutch - Glen De Cauwsemaecker, Guido Zuidhof, Ruben Vereecken, Jasper D'haene li Greek - Stergios
li Greek - Stergios li Latin American Spanish - Jesús Ruppel, Matthew Burt, Mariano Luzza
li Latin American Spanish - Jesús Ruppel, Matthew Burt, Mariano Luzza li Spain Spanish - Matthew Burt, DanielRodriguezRivero, Anon, Pouyio
li Spain Spanish - Matthew Burt, DanielRodriguezRivero, Anon, Pouyio li French - Xeonarno, Elfisen, Armaldio, MartinDelille, pstweb, veritable, jaybi, xavismeh, Anon, Feugy
li French - Xeonarno, Elfisen, Armaldio, MartinDelille, pstweb, veritable, jaybi, xavismeh, Anon, Feugy li Hungarian - ferpeter, csuvsaregal, atlantisguru, Anon
li Hungarian - ferpeter, csuvsaregal, atlantisguru, Anon li Japanese - g1itch, kengos
li Japanese - g1itch, kengos li Chinese - Adam23, spacepope, yangxuan8282, Cheng Zheng
li Chinese - Adam23, spacepope, yangxuan8282, Cheng Zheng li Polish - Anon, Kacper Ciepielewski
li Polish - Anon, Kacper Ciepielewski li Danish - Einar Rasmussen, sorsjen, Randi Hillerøe, Anon
li Danish - Einar Rasmussen, sorsjen, Randi Hillerøe, Anon li Slovak - Anon
li Slovak - Anon li Persian - Reza Habibi (Rehb)
li Persian - Reza Habibi (Rehb) li Czech - vanous
li Czech - vanous li Russian - fess89, ser-storchak, Mr A
li Russian - fess89, ser-storchak, Mr A li Ukrainian - fess89
li Ukrainian - fess89 li Italian - flauta
li Italian - flauta li Norwegian - bardeh
li Norwegian - bardeh
div.clearfix div.clearfix

View file

@ -44,37 +44,12 @@ block content
| tell us a little about yourself, your experience with programming and | 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! | what sort of things you'd like to write about. We'll go from there!
if me.attributes.anonymous .contributor-signup-anonymous
div#sign-up.alert.alert-info .contributor-signup(data-contributor-class-id="article_editor", data-contributor-class-name="scribe")
strong(data-i18n="contribute.alert_account_message_intro")
| Hey there!
span
span(data-i18n="contribute.alert_account_message_pref")
| To subscribe for class emails, you'll need to
a(data-toggle="coco-modal", data-target="modal/signup", data-i18n="contribute.alert_account_message_create_url")
| create an account
span
span(data-i18n="contribute.alert_account_message_suf")
| first.
label.checkbox(for="article_editor").well h3(data-i18n="contribute.diligent_scribes")
input(type='checkbox', name="article_editor", id="article_editor") | Our Diligent Scribes:
span(data-i18n="contribute.scribe_subscribe_desc")
| Get emails about article writing announcements. #contributor-list(data-contributor-class-name="scribe")
.saved-notification ✓ Saved
#Contributors
h3(data-i18n="contribute.diligent_scribes")
| Our Diligent Scribes:
ul.scribes
li Ryan Faidley
li Glen De Cauwsemaecker
li Mischa Lewis-Norelle
li Tavio
li Ronnie Cheng
li engstrom
li Dman19993
li mattinsler
div.clearfix div.clearfix

View file

@ -81,6 +81,7 @@ module.exports = class SettingsView extends View
schema = _.cloneDeep me.schema() schema = _.cloneDeep me.schema()
schema.properties = _.pick me.schema().properties, 'photoURL' schema.properties = _.pick me.schema().properties, 'photoURL'
schema.required = ['photoURL'] schema.required = ['photoURL']
console.log 'have data', data, 'schema', schema
treemaOptions = treemaOptions =
filePath: "db/user/#{me.id}" filePath: "db/user/#{me.id}"
schema: schema schema: schema
@ -88,8 +89,8 @@ module.exports = class SettingsView extends View
callbacks: {change: @onPictureChanged} callbacks: {change: @onPictureChanged}
@pictureTreema = @$el.find('#picture-treema').treema treemaOptions @pictureTreema = @$el.find('#picture-treema').treema treemaOptions
@pictureTreema.build() @pictureTreema?.build()
@pictureTreema.open() @pictureTreema?.open()
@$el.find('.gravatar-fallback').toggle not me.get 'photoURL' @$el.find('.gravatar-fallback').toggle not me.get 'photoURL'
onPictureChanged: (e) => onPictureChanged: (e) =>

View file

@ -4,4 +4,5 @@ template = require 'templates/contribute/adventurer'
module.exports = class AdventurerView extends ContributeClassView module.exports = class AdventurerView extends ContributeClassView
id: "adventurer-view" id: "adventurer-view"
template: template template: template
contributorClassName: 'adventurer'

View file

@ -5,3 +5,4 @@ template = require 'templates/contribute/ambassador'
module.exports = class AmbassadorView extends ContributeClassView module.exports = class AmbassadorView extends ContributeClassView
id: "ambassador-view" id: "ambassador-view"
template: template template: template
contributorClassName: 'ambassador'

View file

@ -4,28 +4,30 @@ template = require 'templates/contribute/archmage'
module.exports = class ArchmageView extends ContributeClassView module.exports = class ArchmageView extends ContributeClassView
id: "archmage-view" id: "archmage-view"
template: template template: template
contributorClassName: 'archmage'
contributors: [ contributors: [
{name: "Tom Steinbrecher", avatar: "tom"} {id: "52bfc3ecb7ec628868001297", name: "Tom Steinbrecher", github: "TomSteinbrecher"}
{name: "Sébastien Moratinos", avatar: "sebastien"} {id: "5272806093680c5817033f73", name: "Sébastien Moratinos", github: "smoratinos"}
{name: "deepak1556", avatar: "deepak"} {name: "deepak1556", avatar: "deepak", github: "deepak1556"}
{name: "Ronnie Cheng", avatar: "ronald"} {name: "Ronnie Cheng", avatar: "ronald", github: "rhc2104"}
{name: "Chloe Fan", avatar: "chloe"} {name: "Chloe Fan", avatar: "chloe", github: "chloester"}
{name: "Rachel Xiang", avatar: "rachel"} {name: "Rachel Xiang", avatar: "rachel", github: "rdxiang"}
{name: "Dan Ristic", avatar: "dan"} {name: "Dan Ristic", avatar: "dan", github: "dristic"}
{name: "Brad Dickason", avatar: "brad"} {name: "Brad Dickason", avatar: "brad", github: "bdickason"}
{name: "Rebecca Saines", avatar: "becca"} {name: "Rebecca Saines", avatar: "becca"}
{name: "Laura Watiker", avatar: "laura"} {name: "Laura Watiker", avatar: "laura", github: "lwatiker"}
{name: "Shiying Zheng", avatar: "shiying"} {name: "Shiying Zheng", avatar: "shiying", github: "shiyingzheng"}
{name: "Mischa Lewis-Norelle", avatar: "mischa"} {name: "Mischa Lewis-Norelle", avatar: "mischa", github: "mlewisno"}
{name: "Paul Buser", avatar: "paul"} {name: "Paul Buser", avatar: "paul"}
{name: "Benjamin Stern", avatar: "ben"} {name: "Benjamin Stern", avatar: "ben"}
{name: "Alex Cotsarelis", avatar: "alex"} {name: "Alex Cotsarelis", avatar: "alex"}
{name: "Ken Stanley", avatar: "ken"} {name: "Ken Stanley", avatar: "ken"}
{name: "devast8a", avatar: ""} {name: "devast8a", avatar: "", github: "devast8a"}
{name: "phansch", avatar: ""} {name: "phansch", avatar: "", github: "phansch"}
{name: "Zach Martin", avatar: ""} {name: "Zach Martin", avatar: "", github: "zachster01"}
{name: "David Golds", avatar: ""} {name: "David Golds", avatar: ""}
{name: "gabceb", avatar: ""} {name: "gabceb", avatar: "", github: "gabceb"}
{name: "MDP66", avatar: ""} {name: "MDP66", avatar: "", github: "MDP66"}
{name: "Alexandru Caciulescu", avatar: "", github: "Darredevil"}
] ]

View file

@ -5,10 +5,11 @@ template = require 'templates/contribute/artisan'
module.exports = class ArtisanView extends ContributeClassView module.exports = class ArtisanView extends ContributeClassView
id: "artisan-view" id: "artisan-view"
template: template template: template
contributorClassName: 'artisan'
contributors: [ contributors: [
{name: "Sootn", avatar: ""} {name: "Sootn", avatar: ""}
{name: "Zach Martin", avatar: ""} {name: "Zach Martin", avatar: "", github: "zachster01"}
{name: "Aftermath", avatar: ""} {name: "Aftermath", avatar: ""}
{name: "mcdavid1991", avatar: ""} {name: "mcdavid1991", avatar: ""}
{name: "dwhittaker", avatar: ""} {name: "dwhittaker", avatar: ""}
@ -19,6 +20,6 @@ module.exports = class ArtisanView extends ContributeClassView
{name: "Axandre Oge", avatar: "axandre"} {name: "Axandre Oge", avatar: "axandre"}
{name: "Katharine Chan", avatar: "katharine"} {name: "Katharine Chan", avatar: "katharine"}
{name: "Derek Wong", avatar: "derek"} {name: "Derek Wong", avatar: "derek"}
{name: "Alexandru Caciulescu", avatar: ""} {name: "Alexandru Caciulescu", avatar: "", github: "Darredevil"}
{name: "Prabh Simran Singh Baweja", avatar: ""} {name: "Prabh Simran Singh Baweja", avatar: "", github: "prabh27"}
] ]

View file

@ -1,6 +1,9 @@
SignupModalView = require 'views/modal/signup_modal' SignupModalView = require 'views/modal/signup_modal'
View = require 'views/kinds/RootView' View = require 'views/kinds/RootView'
{me} = require('lib/auth') {me} = require('lib/auth')
contributorSignupAnonymousTemplate = require 'templates/contribute/contributor_signup_anonymous'
contributorSignupTemplate = require 'templates/contribute/contributor_signup'
contributorListTemplate = require 'templates/contribute/contributor_list'
module.exports = class ContributeClassView extends View module.exports = class ContributeClassView extends View
navPrefix: '/contribute' navPrefix: '/contribute'
@ -16,6 +19,12 @@ module.exports = class ContributeClassView extends View
afterRender: -> afterRender: ->
super() super()
@$el.find('.contributor-signup-anonymous').replaceWith(contributorSignupAnonymousTemplate(me: me))
@$el.find('.contributor-signup').each ->
context = me: me, contributorClassID: $(@).data('contributor-class-id'), contributorClassName: $(@).data('contributor-class-name')
$(@).replaceWith(contributorSignupTemplate(context))
@$el.find('#contributor-list').replaceWith(contributorListTemplate(contributors: @contributors, contributorClassName: @contributorClassName))
checkboxes = @$el.find('input[type="checkbox"]').toArray() checkboxes = @$el.find('input[type="checkbox"]').toArray()
_.forEach checkboxes, (el) -> _.forEach checkboxes, (el) ->
el = $(el) el = $(el)

View file

@ -5,3 +5,4 @@ template = require 'templates/contribute/counselor'
module.exports = class CounselorView extends ContributeClassView module.exports = class CounselorView extends ContributeClassView
id: "counselor-view" id: "counselor-view"
template: template template: template
contributorClassName: 'counselor'

View file

@ -5,3 +5,4 @@ template = require 'templates/contribute/diplomat'
module.exports = class DiplomatView extends ContributeClassView module.exports = class DiplomatView extends ContributeClassView
id: "diplomat-view" id: "diplomat-view"
template: template template: template
contributorClassName: 'diplomat'

View file

@ -5,3 +5,14 @@ template = require 'templates/contribute/scribe'
module.exports = class ScribeView extends ContributeClassView module.exports = class ScribeView extends ContributeClassView
id: "scribe-view" id: "scribe-view"
template: template template: template
contributorClassName: 'scribe'
contributors: [
{name: "Ryan Faidley"}
{name: "Mischa Lewis-Norelle", github: "mlewisno"}
{name: "Tavio"}
{name: "Ronnie Cheng", github: "rhc2104"}
{name: "engstrom"}
{name: "Dman19993"}
{name: "mattinsler"}
]

View file

@ -198,7 +198,10 @@ UserHandler = class UserHandler extends Handler
@modelClass.findById(id).exec (err, document) => @modelClass.findById(id).exec (err, document) =>
return @sendDatabaseError(res, err) if err return @sendDatabaseError(res, err) if err
photoURL = document?.get('photoURL') photoURL = document?.get('photoURL')
photoURL ||= @buildGravatarURL document if photoURL
photoURL = "/file/#{photoURL}"
else
photoURL = @buildGravatarURL document, req.query.s, req.query.fallback
res.redirect photoURL res.redirect photoURL
res.end() res.end()
@ -239,10 +242,11 @@ UserHandler = class UserHandler extends Handler
obj.jobProfile = _.pick obj.jobProfile, subfields obj.jobProfile = _.pick obj.jobProfile, subfields
obj obj
buildGravatarURL: (user) -> buildGravatarURL: (user, size, fallback) ->
emailHash = @buildEmailHash user emailHash = @buildEmailHash user
defaultAvatar = "http://codecombat.com/file/db/thang.type/52a00d55cf1818f2be00000b/portrait.png" fallback ?= "http://codecombat.com/file/db/thang.type/52a00d55cf1818f2be00000b/portrait.png"
"https://www.gravatar.com/avatar/#{emailHash}?default=#{defaultAvatar}" fallback = "http://codecombat.com#{fallback}" unless /^http/.test fallback
"https://www.gravatar.com/avatar/#{emailHash}?s=#{size}&default=#{fallback}"
buildEmailHash: (user) -> buildEmailHash: (user) ->
# emailHash is used by gravatar # emailHash is used by gravatar