Sha256: 63462b68fe5a8f3e1ec277a3e27cd3f8b04f17c23f34519e80d34b62d9bc99f1

Contents?: true

Size: 1.12 KB

Versions: 58

Compression:

Stored size: 1.12 KB

Contents

CmAdmin::Engine.routes.draw do
  controller 'static' do
    get '/', action: 'dashboard'
    get '/access-denied', action: 'error_403'
  end

  controller 'exports' do
    post '/export_to_file', action: 'export'
  end

  # Defining action routes for each model
  CmAdmin.config.cm_admin_models.each do |model|
    if model.importer
      scope model.name.tableize do
        send(:get, 'import', to: "#{model.name.underscore}#import_form", as: "#{model.name.underscore}_import_form")
        send(:post, 'import', to: "#{model.name.underscore}#import", as: "#{model.name.underscore}_import")
      end
    end
    
    model.available_actions.sort_by {|act| act.name}.each do |act|
      scope model.name.tableize do
        # Define route only when action trail related field is present
        if act.name == 'history'
          send(:get, ':id/history', to: "#{model.name.underscore}#history", as: "#{model.name.underscore}_history")
        else
          send(act.verb, act.path.present? ? act.path : act.name, to: "#{model.name.underscore}##{act.name}", as: "#{model.name.underscore}_#{act.name}")
        end
      end
    end
  end
end

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
cm-admin-1.5.20 config/routes.rb
cm-admin-1.5.11 config/routes.rb
cm-admin-1.5.9 config/routes.rb
cm-admin-1.5.8 config/routes.rb
cm-admin-1.5.7 config/routes.rb
cm-admin-1.5.6 config/routes.rb
cm-admin-1.5.1 config/routes.rb
cm-admin-1.5.0 config/routes.rb
cm-admin-1.4.9 config/routes.rb
cm-admin-1.4.8 config/routes.rb
cm-admin-1.4.7 config/routes.rb
cm-admin-1.4.6 config/routes.rb
cm-admin-1.4.5 config/routes.rb
cm-admin-1.4.4 config/routes.rb
cm-admin-1.4.3 config/routes.rb
cm-admin-1.4.2 config/routes.rb
cm-admin-1.4.1 config/routes.rb
cm-admin-1.4.0 config/routes.rb
cm-admin-1.3.9 config/routes.rb
cm-admin-1.3.8 config/routes.rb