Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
define [
'jquery',
'underscore',
'backbone',
'cs!models/session',
'cs!views/notice',
'cs!views/header',
'cs!views/main_menu',
'cs!views/hotel/hotel',
'cs!views/rooms/rooms',
'cs!views/assets/assets',
'hbs!template/layout'
], ( $, _, Backbone
, Session
, NoticeView
, HeaderView
, MainMenuView
, HotelView
, RoomsView
, AssetsView
, LayoutTemplate ) ->
return Backbone.View.extend
el: $("#main-container")
template: LayoutTemplate
initialize: ->
_.bindAll @, 'render', 'hotel', 'rooms'
Session.on('change:auth', (session) ->
console.log ' session has changed '
console.log session
@render()
)
events:
'click a.hotel' : 'hotel'
'click a.room' : 'rooms'
'click a.assets' : 'assets'
render: ->
if Session.getAuth()
@$el.html @template()
@$('#header').html new HeaderView().render().el
@$('#menu').html new MainMenuView().render().el
@hotel()
else
Backbone.history.navigate 'login', trigger: true
@
hotel: (e) ->
if e is not undefined
e.preventDefault()
@$('#content').html new HotelView().render().el
rooms: (e) ->
e.preventDefault()
@$('#content').html new RoomsView().render().el
assets: (e) ->
e.preventDefault()
@$('#content').html new AssetsView().render().el
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.