Sha256: e9e8e905f92a5a30b4bb8d6da7a644c35917620646be1442111d1f55585492fa

Contents?: true

Size: 1.21 KB

Versions: 3

Compression:

Stored size: 1.21 KB

Contents

#= require joosy/core/joosy

#
# Joosy Application container
#
# @mixin
#
Joosy.Application =
  Pages: {}
  Layouts: {}
  Controls: {}
  
  loading: true
  identity: true
  debug: false

  #
  # Starts Joosy application by binding to element and bootstraping routes
  #
  # @param [String] name        Name of app (the dir its located in)
  # @param [String] selector    jQuery-compatible selector of root application element
  # @param [Object] options
  #
  initialize: (@name, @selector, options={}) ->
    @[key] = value for key, value of options
    @templater = new Joosy.Templaters.RailsJST @name

    Joosy.Router.__setupRoutes()

    @sandboxSelector = Joosy.uuid()
    @content().after "<div id='#{@sandboxSelector}' style='display:none'></div>"
    @sandboxSelector = '#' + @sandboxSelector

  #
  # Gets current application root node
  #
  content: ->
    $(@selector)

  #
  # Gets current application sandbox node
  #
  sandbox: ->
    $(@sandboxSelector)

  #
  # Switches to given page
  #
  # @param [Joosy.Page] page      The class (not object) of page to load
  # @param [Object] params        Hash of page params
  #
  setCurrentPage: (page, params) ->
    #if @page not instanceof page
    @page = new page params, @page

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
joosy-1.0.0.RC4 app/assets/javascripts/joosy/core/application.js.coffee
joosy-1.0.0.RC3 app/assets/javascripts/joosy/core/application.js.coffee
joosy-1.0.0.RC2 app/assets/javascripts/joosy/core/application.js.coffee