Sha256: 1ebe705b2b5dec7a1ae84b77d02cbb6662f5ae23dc0b4a83d1ccff331f849784

Contents?: true

Size: 845 Bytes

Versions: 19

Compression:

Stored size: 845 Bytes

Contents

ELA.Models ?= {}
class ELA.Models.BaseSubappContainer extends ELA.Models.BaseAppModel
  subapps: {}

  initialize: (options = {}) ->
    @subappInstances = {}

    for name, app of @subapps
      AppModel = app.model.toFunction()
      @subappInstances[name] = new AppModel
        parentApp: this

    @on 'change:path', @handlePath
    @handlePath()

  handlePath: =>
    path = @get('path')
    subapp = path[0]
    if _.isEmpty(path)
      subappPath = @subappInfo()[0].path
      ELA.router.navigate "app/#{subappPath}",
        trigger: false
        replace: true
      [..., last] = subappPath.split('/')
      path.push(last)

    @subappInstances[subapp]?.set(path: path.slice(1))

  subappInfo: ->
    for name, app of @subappInstances
      name: app.name
      path: app.path

  currentApp: ->
    @subappInstances[@get('path')[0]]

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
ela-4.1.6 app/js/lib/models/base_subapp_container.coffee
ela-4.1.5 app/js/lib/models/base_subapp_container.coffee
ela-4.1.4 app/js/lib/models/base_subapp_container.coffee
ela-4.1.3 app/js/lib/models/base_subapp_container.coffee
ela-4.1.2 app/js/lib/models/base_subapp_container.coffee
ela-4.1.1 app/js/lib/models/base_subapp_container.coffee
ela-4.1.0 app/js/lib/models/base_subapp_container.coffee
ela-4.0.0 app/js/lib/models/base_subapp_container.coffee
ela-3.4.3 app/js/lib/models/base_subapp_container.coffee
ela-3.4.2 app/js/lib/models/base_subapp_container.coffee
ela-3.4.0 app/js/lib/models/base_subapp_container.coffee
ela-3.3.1 app/js/lib/models/base_subapp_container.coffee
ela-3.3.0 app/js/lib/models/base_subapp_container.coffee
ela-3.2.0 app/js/lib/models/base_subapp_container.coffee
ela-3.1.1 app/js/lib/models/base_subapp_container.coffee
ela-3.1.0 app/js/lib/models/base_subapp_container.coffee
ela-3.0.0 app/js/lib/models/base_subapp_container.coffee
ela-2.0.0 app/js/lib/models/base_subapp_container.coffee
ela-1.1.0 app/js/lib/models/base_subapp_container.coffee