Skip to content

Instantly share code, notes, and snippets.

@whitmanc
Created March 20, 2015 21:01
Show Gist options
  • Save whitmanc/5a9a8a96f15b8af37290 to your computer and use it in GitHub Desktop.
Save whitmanc/5a9a8a96f15b8af37290 to your computer and use it in GitHub Desktop.
##
# Main view of app with left/right slide panels.
# The dashboard also houses the message list
# and new message form. To access anything other
# than a list of messages, we navigate to a new
# page
#
# @class DashboardView
#
define [
'backbone'
'underscore'
'config'
'jade!templates/dashboard'
'views/messages/messages_view'
'views/messages/new_message_view'
], (Backbone, _, config, template, MessagesView) ->
class View extends Backbone.View
initialize: (options) ->
super
@
render: ->
# Fire `create` event for jquery-mobile
# to know to reinitialize on newly
# rendered elements
@$el.html(template()).trigger('create')
@renderMessagesView()
@renderNewMessageView()
renderMessagesView: ->
(new MessagesView(el: @$('#messages'))).render()
renderNewMessageView: ->
(new NewMessageView(el: @$('#new-message'))).render()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment