2012-12-10 02:39:29 +08:00
|
|
|
define [
|
|
|
|
'jquery',
|
|
|
|
'underscore',
|
|
|
|
'backbone',
|
2012-12-10 22:46:20 +08:00
|
|
|
'globals',
|
2012-12-11 00:34:06 +08:00
|
|
|
'text!templates/session.html',
|
|
|
|
'cs!views/session_navbar',
|
2013-11-01 03:36:38 +08:00
|
|
|
'cs!views/session_navbar_hidden',
|
2012-12-11 00:34:06 +08:00
|
|
|
'cs!views/session_chat',
|
2012-12-12 03:37:32 +08:00
|
|
|
'cs!views/session_users',
|
2013-01-16 02:11:05 +08:00
|
|
|
'cs!views/session_video'
|
2012-12-12 03:37:32 +08:00
|
|
|
'cs!views/session_whiteboard'
|
2013-11-01 03:36:38 +08:00
|
|
|
], ($, _, Backbone, globals, sessionTemplate, SessionNavbarView, SessionNavbarHiddenView,
|
|
|
|
SessionChatView, SessionUsersView, SessionVideoView, SessionWhiteboardView) ->
|
2012-12-10 02:39:29 +08:00
|
|
|
|
|
|
|
SessionView = Backbone.View.extend
|
2013-11-01 03:36:38 +08:00
|
|
|
tagName: 'section'
|
2012-12-10 04:34:32 +08:00
|
|
|
id: 'session-view'
|
2013-11-01 03:36:38 +08:00
|
|
|
|
2012-12-11 00:34:06 +08:00
|
|
|
initialize: ->
|
|
|
|
@navbarView = new SessionNavbarView()
|
|
|
|
@navbarView.$parentEl = @$el
|
2013-11-01 03:36:38 +08:00
|
|
|
@navbarHiddenView = new SessionNavbarHiddenView()
|
|
|
|
@navbarHiddenView.$parentEl = @$el
|
2012-12-11 00:34:06 +08:00
|
|
|
@chatView = new SessionChatView()
|
|
|
|
@usersView = new SessionUsersView()
|
2013-01-16 02:11:05 +08:00
|
|
|
@videoView = new SessionVideoView()
|
2013-11-01 03:36:38 +08:00
|
|
|
@whiteboardView = new SessionWhiteboardView()
|
2012-12-11 00:34:06 +08:00
|
|
|
|
|
|
|
# Override the close() method so we can close the sub-views.
|
|
|
|
close: ->
|
|
|
|
@navbarView.close()
|
|
|
|
@chatView.close()
|
|
|
|
@usersView.close()
|
2012-12-12 03:37:32 +08:00
|
|
|
@whiteboardView.close()
|
2012-12-12 10:15:14 +08:00
|
|
|
Backbone.View.prototype.close.call(@)
|
2012-12-10 02:39:29 +08:00
|
|
|
|
|
|
|
render: ->
|
2012-12-15 08:58:14 +08:00
|
|
|
compiledTemplate = _.template(sessionTemplate)
|
2012-12-15 08:03:38 +08:00
|
|
|
@$el.html compiledTemplate
|
2012-12-11 00:34:06 +08:00
|
|
|
|
|
|
|
@assign(@navbarView, "#navbar")
|
2013-11-01 03:36:38 +08:00
|
|
|
@assign(@navbarHiddenView, "#navbar-hidden")
|
2012-12-11 00:34:06 +08:00
|
|
|
@assign(@chatView, "#chat")
|
|
|
|
@assign(@usersView, "#users")
|
2013-01-16 02:11:05 +08:00
|
|
|
@assign(@videoView, "#video")
|
2013-11-01 03:36:38 +08:00
|
|
|
@assign(@whiteboardView, "#whiteboard")
|
|
|
|
|
|
|
|
@$el.addClass('navbar-on') # navbar starts visible
|
|
|
|
|
2014-05-16 02:43:17 +08:00
|
|
|
# Connect to the server and authenticate the user
|
|
|
|
globals.connection.connect()
|
|
|
|
|
2012-12-10 02:39:29 +08:00
|
|
|
SessionView
|