Sha256: ba373042f07e5921e2ac1631d7cfeca48adb777d4992110852c6217d7354819c

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

#= require joosy/core/joosy

#
# Joosy Application container
#
Joosy.Application =
  Pages: {}
  Layouts: {}
  Controls: {}

  #
  # 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

1 entries across 1 versions & 1 rubygems

Version Path
joosy-0.1.0.RC2 app/assets/javascripts/joosy/core/application.js.coffee