Module: Padrino::Generators::Admin::Actions

### Home Classes Methods

### In Files

- lib/padrino-admin/generators/actions.rb

### Methods

- #adapter
- #add_project_module
- #ext
- #fetch_app_name
- #orm
- #remove_project_module
- #supported_ext
- #supported_orm

### Files

- README.rdoc

### Class/Module Index

Quicksearch

- Padrino
- Padrino::Admin
- Padrino::Admin::AccessControl
- Padrino::Admin::AccessControl::Authorization
- Padrino::Admin::AccessControl::Base
- Padrino::Admin::AccessControl::ProjectModule
- Padrino::Admin::AccessControlError
- Padrino::Admin::Generators
- Padrino::Admin::Generators::Orm
- Padrino::Admin::Generators::OrmError
- Padrino::Admin::Helpers
- Padrino::Admin::Helpers::AuthenticationHelpers
- Padrino::Admin::Helpers::ViewHelpers
- Padrino::Generators
- Padrino::Generators::Admin
- Padrino::Generators::Admin::Actions
- Padrino::Generators::AdminApp
- Padrino::Generators::AdminPage

No matching classes.

# Padrino::Generators::Admin::Actions

Important tasks for setting up or configuring the admin application.

### Public Instance Methods

adapter() click to toggle source
Alias for: orm
add_project_module(controller) click to toggle source

Add access_control permission in our app.rb.

    # File lib/padrino-admin/generators/actions.rb, line 43
    def add_project_module(controller)
      permission = "      role.project_module :#{controller}, '/#{controller}'\n"
      inject_into_file destination_root(@admin_path+'/app.rb'),  permission, :after => "access_control.roles_for :admin do |role|\n"
    end

ext() click to toggle source

Tell us which rendering engine you are using.

    # File lib/padrino-admin/generators/actions.rb, line 22
    def ext
      fetch_component_choice(:admin_renderer).to_sym rescue :haml
    end

fetch_app_name(app='app') click to toggle source

Returns the app_name for the application at root.

@param [String] app

    folder name of application.

@return [String] module name for application.

@example

    fetch_app_name('subapp')

@api public

    # File lib/padrino-admin/generators/actions.rb, line 71
    def fetch_app_name(app='app')
      app_path = destination_root(app, 'app.rb')
      @app_name ||= File.read(app_path).scan(/module\s(.*?)\n/).flatten[0]
    end

orm() click to toggle source

Tell us which orm we are using.

    # File lib/padrino-admin/generators/actions.rb, line 14
    def orm
      fetch_component_choice(:orm).to_sym rescue :activerecord
    end

Also aliased as: adapter
remove_project_module(controller) click to toggle source

Remove from access_control permissions.

    # File lib/padrino-admin/generators/actions.rb, line 51
    def remove_project_module(controller)
      path = destination_root(@admin_path+'/app.rb')
      say_status :replace, @admin_path+'/app.rb', :red
      content = File.binread(path)
      content.gsub!(/^\s+role\.project_module :#{controller}, '\/#{controller}'\n/, '')
      File.open(path, 'wb') { |f| f.write content }
    end

supported_ext() click to toggle source

Tell us for now which rendering engine we support.

    # File lib/padrino-admin/generators/actions.rb, line 36
    def supported_ext
      [:haml, :slim, :erb]
    end

supported_orm() click to toggle source

Tell us for now which orm we support

    # File lib/padrino-admin/generators/actions.rb, line 29
    def supported_orm
      [:minirecord, :datamapper, :activerecord, :mongomapper, :mongoid, :couchrest, :sequel, :ohm, :dynamoid]
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.