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
|
.row
|
||||||
for contributor in contributors
|
if contributors
|
||||||
.col-xs-6.col-md-3
|
for contributor in contributors
|
||||||
.thumbnail
|
.col-xs-6.col-md-3
|
||||||
- var src = "/images/pages/contribute/" + contributorClassName + ".png";
|
.thumbnail
|
||||||
- if(contributor.avatar)
|
- var src = "/images/pages/contribute/" + contributorClassName + ".png";
|
||||||
- src = src.replace(contributorClassName, contributorClassName + "/" + contributor.avatar + "_small");
|
- if(contributor.avatar)
|
||||||
- if(contributor.id)
|
- src = src.replace(contributorClassName, contributorClassName + "/" + contributor.avatar + "_small");
|
||||||
- src = "/db/user/" + contributor.id + "/avatar?s=100&fallback=" + src;
|
- if(contributor.id)
|
||||||
a(href=contributor.github ? "https://github.com/codecombat/codecombat/commits?author=" + contributor.github : null, class=contributor.github ? 'has-github' : '')
|
- src = "/db/user/" + contributor.id + "/avatar?s=100&fallback=" + src;
|
||||||
img.img-responsive(src=src, alt=contributor.name)
|
a(href=contributor.github ? "https://github.com/codecombat/codecombat/commits?author=" + contributor.github : null, class=contributor.github ? 'has-github' : '')
|
||||||
.caption
|
img.img-responsive(src=src, alt=contributor.name)
|
||||||
h4= contributor.name
|
.caption
|
||||||
|
h4= contributor.name
|
||||||
|
|
|
@ -5,4 +5,6 @@ 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'
|
|
||||||
|
initialize: ->
|
||||||
|
@contributorClassName = 'adventurer'
|
||||||
|
|
|
@ -5,4 +5,6 @@ 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'
|
|
||||||
|
initialize: ->
|
||||||
|
@contributorClassName = 'ambassador'
|
||||||
|
|
|
@ -4,7 +4,9 @@ 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'
|
|
||||||
|
initialize: ->
|
||||||
|
@contributorClassName = 'archmage'
|
||||||
|
|
||||||
contributors: [
|
contributors: [
|
||||||
{id: '547acbb2af18b03c0563fdb3', name: 'David Liu', github: 'trotod'}
|
{id: '547acbb2af18b03c0563fdb3', name: 'David Liu', github: 'trotod'}
|
||||||
|
|
|
@ -5,7 +5,9 @@ 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'
|
|
||||||
|
initialize: ->
|
||||||
|
@contributorClassName = 'artisan'
|
||||||
|
|
||||||
contributors: [
|
contributors: [
|
||||||
{id: '5276ad5dcf83207a2801d3b4', name: 'Zach Martin', github: 'zachster01'}
|
{id: '5276ad5dcf83207a2801d3b4', name: 'Zach Martin', github: 'zachster01'}
|
||||||
|
|
|
@ -6,17 +6,10 @@ contributorSignupTemplate = require 'templates/contribute/contributor_signup'
|
||||||
contributorListTemplate = require 'templates/contribute/contributor_list'
|
contributorListTemplate = require 'templates/contribute/contributor_list'
|
||||||
|
|
||||||
module.exports = class ContributeClassView extends RootView
|
module.exports = class ContributeClassView extends RootView
|
||||||
navPrefix: '/contribute'
|
|
||||||
|
|
||||||
events:
|
events:
|
||||||
'change input[type="checkbox"]': 'onCheckboxChanged'
|
'change input[type="checkbox"]': 'onCheckboxChanged'
|
||||||
|
|
||||||
getRenderData: ->
|
|
||||||
c = super()
|
|
||||||
c.navPrefix = @navPrefix
|
|
||||||
c.contributors = @contributors
|
|
||||||
c
|
|
||||||
|
|
||||||
afterRender: ->
|
afterRender: ->
|
||||||
super()
|
super()
|
||||||
@$el.find('.contributor-signup-anonymous').replaceWith(contributorSignupAnonymousTemplate(me: me))
|
@$el.find('.contributor-signup-anonymous').replaceWith(contributorSignupAnonymousTemplate(me: me))
|
||||||
|
@ -39,5 +32,3 @@ module.exports = class ContributeClassView extends RootView
|
||||||
me.patch()
|
me.patch()
|
||||||
@openModalView new CreateAccountModal() if me.get 'anonymous'
|
@openModalView new CreateAccountModal() if me.get 'anonymous'
|
||||||
el.parent().find('.saved-notification').finish().show('fast').delay(3000).fadeOut(2000)
|
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
|
module.exports = class DiplomatView extends ContributeClassView
|
||||||
id: 'diplomat-view'
|
id: 'diplomat-view'
|
||||||
template: template
|
template: template
|
||||||
contributorClassName: 'diplomat'
|
|
||||||
|
initialize: ->
|
||||||
|
@contributorClassName = 'diplomat'
|
||||||
|
|
||||||
calculateSpokenLanguageStats: ->
|
calculateSpokenLanguageStats: ->
|
||||||
@locale ?= require 'locale/locale'
|
@locale ?= require 'locale/locale'
|
||||||
|
|
|
@ -4,7 +4,6 @@ template = require 'templates/contribute/contribute'
|
||||||
module.exports = class MainContributeView extends ContributeClassView
|
module.exports = class MainContributeView extends ContributeClassView
|
||||||
id: 'contribute-view'
|
id: 'contribute-view'
|
||||||
template: template
|
template: template
|
||||||
navPrefix: ''
|
|
||||||
|
|
||||||
events:
|
events:
|
||||||
'change input[type="checkbox"]': 'onCheckboxChanged'
|
'change input[type="checkbox"]': 'onCheckboxChanged'
|
||||||
|
|
|
@ -5,7 +5,9 @@ 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'
|
|
||||||
|
initialize: ->
|
||||||
|
@contributorClassName = 'scribe'
|
||||||
|
|
||||||
contributors: [
|
contributors: [
|
||||||
{name: 'Ryan Faidley'}
|
{name: 'Ryan Faidley'}
|
||||||
|
|
Reference in a new issue