Sha256: b213f37b242106a6918917f2bc16d67ebf7cae59a2d1de25d46663697cf1916a

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 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', =>
      height = @set_max_height()
      PubSub.publish 'application_view.resize', height: height

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

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

    height

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
locomotivecms-3.0.0.rc6 app/assets/javascripts/locomotive/views/application_view.js.coffee
locomotivecms-3.0.0.rc5 app/assets/javascripts/locomotive/views/application_view.js.coffee
locomotivecms-3.0.0.rc4 app/assets/javascripts/locomotive/views/application_view.js.coffee
locomotivecms-3.0.0.rc3 app/assets/javascripts/locomotive/views/application_view.js.coffee