mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-30 14:51:13 -04:00
Refactor CLAsView to use view in template
This commit is contained in:
parent
58eaec8e6b
commit
45044d06a4
2 changed files with 8 additions and 13 deletions
app
|
@ -6,11 +6,13 @@ block content
|
|||
|
||||
table.table.table-striped.table-bordered.table-condensed#clas
|
||||
tbody
|
||||
each cla in clas
|
||||
- var models = view.clas.models
|
||||
- var models = _.uniq(models, true, function(model) { return model.get('githubUsername'); });
|
||||
each cla in models
|
||||
tr
|
||||
td #{cla.name}
|
||||
td #{cla.get('name')}
|
||||
if me.isAdmin()
|
||||
td #{cla.email}
|
||||
td #{cla.githubUsername}
|
||||
td #{cla.created}
|
||||
td #{cla.get('email')}
|
||||
td #{cla.get('githubUsername')}
|
||||
td #{cla.get('created')}
|
||||
|
|
@ -11,6 +11,7 @@ class CLASubmission extends CocoModel
|
|||
class CLACollection extends CocoCollection
|
||||
url: '/db/cla.submissions'
|
||||
model: CLASubmission
|
||||
comparator: (claSubmission) -> return (claSubmission.get('githubUsername') or 'zzzzz').toLowerCase()
|
||||
|
||||
module.exports = class CLAsView extends RootView
|
||||
id: 'admin-clas-view'
|
||||
|
@ -19,11 +20,3 @@ module.exports = class CLAsView extends RootView
|
|||
constructor: (options) ->
|
||||
super options
|
||||
@clas = @supermodel.loadCollection(new CLACollection(), 'clas', {cache: false}).model
|
||||
|
||||
getRenderData: ->
|
||||
c = super()
|
||||
c.clas = []
|
||||
if @supermodel.finished()
|
||||
c.clas = _.uniq (_.sortBy (cla.attributes for cla in @clas.models), (m) ->
|
||||
m.githubUsername?.toLowerCase()), 'githubUsername'
|
||||
c
|
||||
|
|
Loading…
Add table
Reference in a new issue