mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-25 00:28:31 -05:00
30 lines
739 B
CoffeeScript
30 lines
739 B
CoffeeScript
RootView = require 'views/kinds/RootView'
|
|
template = require 'templates/admin/clas'
|
|
|
|
module.exports = class CLAsView extends RootView
|
|
id: 'admin-clas-view'
|
|
template: template
|
|
startsLoading: true
|
|
|
|
constructor: (options) ->
|
|
super options
|
|
@getCLAs()
|
|
|
|
getCLAs: ->
|
|
CLACollection = Backbone.Collection.extend({
|
|
url: '/db/cla.submissions'
|
|
})
|
|
@clas = new CLACollection()
|
|
@clas.fetch()
|
|
@listenTo(@clas, 'sync', @onCLAsLoaded)
|
|
|
|
onCLAsLoaded: ->
|
|
@startsLoading = false
|
|
@render()
|
|
|
|
getRenderData: ->
|
|
c = super()
|
|
c.clas = []
|
|
unless @startsLoading
|
|
c.clas = _.uniq (_.sortBy (cla.attributes for cla in @clas.models), (m) -> m.githubUsername?.toLowerCase()), 'githubUsername'
|
|
c
|