codecombat/app/views/admin/LevelSessionsView.coffee

26 lines
759 B
CoffeeScript
Raw Normal View History

RootView = require 'views/core/RootView'
2014-01-03 13:32:13 -05:00
template = require 'templates/admin/level_sessions'
LevelSession = require 'models/LevelSession'
2014-08-26 20:34:00 -04:00
CocoCollection = require 'collections/CocoCollection'
2014-01-03 13:32:13 -05:00
2014-08-26 20:34:00 -04:00
class LevelSessionCollection extends CocoCollection
url: '/db/level_session/x/active?project=screenshot,levelName,creatorName'
2014-01-03 13:32:13 -05:00
model: LevelSession
module.exports = class LevelSessionsView extends RootView
2014-06-30 22:16:26 -04:00
id: 'admin-level-sessions-view'
2014-01-03 13:32:13 -05:00
template: template
constructor: (options) ->
super options
@getLevelSessions()
getLevelSessions: ->
@sessions = @supermodel.loadCollection(new LevelSessionCollection(), 'sessions', {cache: false}).model
2014-01-03 13:32:13 -05:00
getRenderData: =>
c = super()
c.sessions = @sessions.models
c.moment = moment
c