codecombat/app/views/admin/CLAsView.coffee

30 lines
859 B
CoffeeScript
Raw Normal View History

RootView = require 'views/core/RootView'
2014-03-21 19:22:47 -04:00
template = require 'templates/admin/clas'
2014-08-26 20:34:00 -04:00
CocoCollection = require 'collections/CocoCollection'
CocoModel = require 'models/CocoModel'
class CLASubmission extends CocoModel
@className: 'CLA'
@schema: require 'schemas/models/cla_submission'
urlRoot: '/db/cla.submission'
class CLACollection extends CocoCollection
url: '/db/cla.submissions'
model: CLASubmission
2014-03-21 19:22:47 -04:00
module.exports = class CLAsView extends RootView
2014-06-30 22:16:26 -04:00
id: 'admin-clas-view'
2014-03-21 19:22:47 -04:00
template: template
constructor: (options) ->
super options
2014-08-26 20:34:00 -04:00
@clas = @supermodel.loadCollection(new CLACollection(), 'clas').model
2014-03-21 19:22:47 -04:00
getRenderData: ->
c = super()
c.clas = []
2014-08-26 20:34:00 -04:00
if @supermodel.finished()
c.clas = _.uniq (_.sortBy (cla.attributes for cla in @clas.models), (m) ->
m.githubUsername?.toLowerCase()), 'githubUsername'
2014-03-21 19:22:47 -04:00
c