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',
|
|
|
|
'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'
|
2012-12-11 00:34:06 +08:00
|
|
|
], ($, _, Backbone, globals, sessionTemplate, SessionNavbarView,
|
2013-01-16 02:11:05 +08:00
|
|
|
SessionChatView, SessionUsersView, SessionVideoView,
|
|
|
|
SessionWhiteboardView) ->
|
2012-12-10 02:39:29 +08:00
|
|
|
|
|
|
|
SessionView = Backbone.View.extend
|
2012-12-10 04:34:32 +08:00
|
|
|
id: 'session-view'
|
2012-12-11 00:34:06 +08:00
|
|
|
# className: 'users-enabled' # to start with #users opened
|
|
|
|
|
|
|
|
initialize: ->
|
|
|
|
@navbarView = new SessionNavbarView()
|
|
|
|
@navbarView.$parentEl = @$el
|
|
|
|
@chatView = new SessionChatView()
|
|
|
|
@usersView = new SessionUsersView()
|
2013-01-16 02:11:05 +08:00
|
|
|
@videoView = new SessionVideoView()
|
2012-12-12 03:37:32 +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
|
|
|
|
2013-01-06 07:40:29 +08:00
|
|
|
# TODO: temporary adaptation for iPads
|
|
|
|
@$el.addClass("chat-enabled")
|
|
|
|
|
2012-12-11 00:34:06 +08:00
|
|
|
@assign(@navbarView, "#navbar")
|
|
|
|
@assign(@chatView, "#chat")
|
|
|
|
@assign(@usersView, "#users")
|
2013-01-16 02:11:05 +08:00
|
|
|
@assign(@videoView, "#video")
|
2012-12-15 08:58:14 +08:00
|
|
|
@assign(@whiteboardView, "#whiteboard")
|
2012-12-10 22:46:20 +08:00
|
|
|
|
|
|
|
# Connect to the server
|
|
|
|
globals.connection.connect()
|
|
|
|
|
2012-12-10 02:39:29 +08:00
|
|
|
SessionView
|