Sha256: a7ca42be8089eab10849539e88581abdef42fff8d358e383c59d2cb02664730c

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

$(->
  new Dispatcher
)

class Dispatcher
  constructor: ->
    @initialize_page_scripts()

  initialize_page_scripts: ->
    page = $('body').attr('data-page')
    return false unless page

    path = page.split(':')
    contoller_name = path[0]
    action_name = path[1]

    switch page
      when 'draft_orders:new', 'draft_orders:create', 'draft_orders:edit', 'draft_orders:update'
        new OrderItemBuilder
        new UserSelector
        new DynamicOrder
      when 'orders:new', 'orders:create', 'orders:edit', 'orders:update'
        new DynamicOrder
      when 'pages:new', 'pages:show', 'pages:edit', 'pages:update', 'pages:create'
        new Page
      when 'products:new', 'products:show', 'products:edit', 'products:update', 'products:create'
        new Product
        new Variant
        new Stock
      when 'variants:show', 'variants:edit', 'variants:update'
        new Stock
      when 'navigations:new', 'navigations:show', 'navigations:edit', 'navigations:update', 'navigations:create'
        new Navigation
      when 'themes:tree'
        new ThemeTree
      when 'themes:show_file'
        new ThemeTree
        new ThemeEditor

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
comable-backend-0.7.1 app/assets/javascripts/comable/admin/dispatcher.coffee
comable-backend-0.7.0 app/assets/javascripts/comable/admin/dispatcher.coffee