mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-13 22:49:51 -04:00
Merge pull request #3717 from duybkict/refactor-ContributorClassView
#3138 refactor contributor views
This commit is contained in:
commit
6beae97911
9 changed files with 31 additions and 28 deletions
|
@ -1,13 +1,14 @@
|
|||
.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
|
||||
if contributors
|
||||
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
|
||||
|
|
|
@ -5,4 +5,6 @@ template = require 'templates/contribute/adventurer'
|
|||
module.exports = class AdventurerView extends ContributeClassView
|
||||
id: 'adventurer-view'
|
||||
template: template
|
||||
contributorClassName: 'adventurer'
|
||||
|
||||
initialize: ->
|
||||
@contributorClassName = 'adventurer'
|
||||
|
|
|
@ -5,4 +5,6 @@ template = require 'templates/contribute/ambassador'
|
|||
module.exports = class AmbassadorView extends ContributeClassView
|
||||
id: 'ambassador-view'
|
||||
template: template
|
||||
contributorClassName: 'ambassador'
|
||||
|
||||
initialize: ->
|
||||
@contributorClassName = 'ambassador'
|
||||
|
|
|
@ -4,7 +4,9 @@ template = require 'templates/contribute/archmage'
|
|||
module.exports = class ArchmageView extends ContributeClassView
|
||||
id: 'archmage-view'
|
||||
template: template
|
||||
contributorClassName: 'archmage'
|
||||
|
||||
initialize: ->
|
||||
@contributorClassName = 'archmage'
|
||||
|
||||
contributors: [
|
||||
{id: '547acbb2af18b03c0563fdb3', name: 'David Liu', github: 'trotod'}
|
||||
|
|
|
@ -5,7 +5,9 @@ template = require 'templates/contribute/artisan'
|
|||
module.exports = class ArtisanView extends ContributeClassView
|
||||
id: 'artisan-view'
|
||||
template: template
|
||||
contributorClassName: 'artisan'
|
||||
|
||||
initialize: ->
|
||||
@contributorClassName = 'artisan'
|
||||
|
||||
contributors: [
|
||||
{id: '5276ad5dcf83207a2801d3b4', name: 'Zach Martin', github: 'zachster01'}
|
||||
|
|
|
@ -6,17 +6,10 @@ contributorSignupTemplate = require 'templates/contribute/contributor_signup'
|
|||
contributorListTemplate = require 'templates/contribute/contributor_list'
|
||||
|
||||
module.exports = class ContributeClassView extends RootView
|
||||
navPrefix: '/contribute'
|
||||
|
||||
events:
|
||||
'change input[type="checkbox"]': 'onCheckboxChanged'
|
||||
|
||||
getRenderData: ->
|
||||
c = super()
|
||||
c.navPrefix = @navPrefix
|
||||
c.contributors = @contributors
|
||||
c
|
||||
|
||||
afterRender: ->
|
||||
super()
|
||||
@$el.find('.contributor-signup-anonymous').replaceWith(contributorSignupAnonymousTemplate(me: me))
|
||||
|
@ -39,5 +32,3 @@ module.exports = class ContributeClassView extends RootView
|
|||
me.patch()
|
||||
@openModalView new CreateAccountModal() if me.get 'anonymous'
|
||||
el.parent().find('.saved-notification').finish().show('fast').delay(3000).fadeOut(2000)
|
||||
|
||||
contributors: []
|
||||
|
|
|
@ -60,7 +60,9 @@ require("locale/et")
|
|||
module.exports = class DiplomatView extends ContributeClassView
|
||||
id: 'diplomat-view'
|
||||
template: template
|
||||
contributorClassName: 'diplomat'
|
||||
|
||||
initialize: ->
|
||||
@contributorClassName = 'diplomat'
|
||||
|
||||
calculateSpokenLanguageStats: ->
|
||||
@locale ?= require 'locale/locale'
|
||||
|
|
|
@ -4,7 +4,6 @@ template = require 'templates/contribute/contribute'
|
|||
module.exports = class MainContributeView extends ContributeClassView
|
||||
id: 'contribute-view'
|
||||
template: template
|
||||
navPrefix: ''
|
||||
|
||||
events:
|
||||
'change input[type="checkbox"]': 'onCheckboxChanged'
|
||||
|
|
|
@ -5,7 +5,9 @@ template = require 'templates/contribute/scribe'
|
|||
module.exports = class ScribeView extends ContributeClassView
|
||||
id: 'scribe-view'
|
||||
template: template
|
||||
contributorClassName: 'scribe'
|
||||
|
||||
initialize: ->
|
||||
@contributorClassName = 'scribe'
|
||||
|
||||
contributors: [
|
||||
{name: 'Ryan Faidley'}
|
||||
|
|
Loading…
Reference in a new issue