Sha256: 45fdf279253ce23ef9b103bc5942c6cd02cd94917309cba8fef1208c06523505

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

class Locomotive.Views.ApplicationView extends Backbone.View

  el: 'body'

  events:
    'click .navbar .navbar-toggle': 'slide_sidebar'

  initialize: ->
    @header_view  = new Locomotive.Views.Shared.HeaderView()
    @sidebar_view = new Locomotive.Views.Shared.SidebarView()
    @drawer_view  = new Locomotive.Views.Shared.DrawerView()

  render: ->
    @render_flash_messages(@options.flash)

    @sidebar_view.render()
    @drawer_view.render()

    @set_max_height()

    @automatic_max_height()

    # render page view
    if @options.view?
      @view = new @options.view(@options.view_data || {})
      @view.render()

    return @

  slide_sidebar: (event) ->
    $('body').toggleClass('slide-right-sidebar')

  render_flash_messages: (messages) ->
    _.each messages, (couple) ->
      Locomotive.notify couple[1], couple[0]

  automatic_max_height: ->
    $(window).on 'resize', => @set_max_height()

  set_max_height: ->
    max_height  = $(window).height()
    height      = max_height - @header_view.height()

    @$('> .wrapper').height(height)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
locomotivecms-3.0.0.rc2 app/assets/javascripts/locomotive/views/application_view.js.coffee
locomotivecms-3.0.0.rc1 app/assets/javascripts/locomotive/views/application_view.js.coffee
locomotivecms-3.0.0.pre.beta.1 app/assets/javascripts/locomotive/views/application_view.js.coffee