codecombat/app/views/admin/clas_view.coffee

31 lines
739 B
CoffeeScript
Raw Normal View History

RootView = require 'views/kinds/RootView'
2014-03-21 19:22:47 -04:00
template = require 'templates/admin/clas'
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
startsLoading: true
constructor: (options) ->
super options
@getCLAs()
getCLAs: ->
CLACollection = Backbone.Collection.extend({
url: '/db/cla.submissions'
})
@clas = new CLACollection()
@clas.fetch()
2014-03-24 12:58:34 -04:00
@listenTo(@clas, 'sync', @onCLAsLoaded)
2014-03-21 19:22:47 -04:00
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