Module: Padrino::Admin::Helpers::ViewHelpers

### Home Classes Methods

### In Files

- lib/padrino-admin/helpers/view_helpers.rb

### Methods

- #mat
- #model_attribute_translate
- #model_translate
- #mt
- #padrino_admin_translate
- #pat
- #t_attr
- #tag_icon

### 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::Admin::Helpers::ViewHelpers

### Public Instance Methods

mat(model, attribute) click to toggle source
Alias for: t_attr
model_attribute_translate(model, attribute) click to toggle source

Translates attribute name for the given model.

@param [Symbol] model

    The model name for the translation.

@param [Symbol] attribute

    The attribute name in the model to translate.

@return [String] The translated attribute name for the current locale.

@example

    # => t("models.account.attributes.email", :default => "Email")
    mat(:account, :email)

    # File lib/padrino-admin/helpers/view_helpers.rb, line 62
    def model_attribute_translate(model, attribute)
      t("models.#{model}.attributes.#{attribute}", :default => attribute.to_s.humanize)
    end

Also aliased as: t_attr
model_translate(model) click to toggle source

Translates model name.

@param [Symbol] attribute

    The attribute name in the model to translate.

@return [String] The translated model name for the current locale.

@example

    # => t("models.account.name", :default => "Account")
    mt(:account)

    # File lib/padrino-admin/helpers/view_helpers.rb, line 80
    def model_translate(model)
      t("models.#{model}.name", :default => model.to_s.humanize)
    end

Also aliased as: mt
mt(model) click to toggle source
Alias for: model_translate
padrino_admin_translate(word, *args) click to toggle source

Translates a given word for padrino admin.

@param [String] word

    The specified word to admin translate.

@param [String] default

    The default fallback if no word is available for the locale.

@return [String] The translated word for the current locale.

@example

    # => t("padrino.admin.profile",  :default => "Profile")
    pat(:profile)

    # => t("padrino.admin.profile",  :default => "My Profile")
    pat(:profile, "My Profile")

    # File lib/padrino-admin/helpers/view_helpers.rb, line 41
    def padrino_admin_translate(word, *args)
      options = args.extract_options!
      options[:default] ||= word.to_s.humanize
      t("padrino.admin.#{word}", options)
    end

Also aliased as: pat
pat(word, *args) click to toggle source
Alias for: padrino_admin_translate
t_attr(model, attribute) click to toggle source
Also aliased as: mat
Alias for: model_attribute_translate
tag_icon(icon, tag = nil) click to toggle source

Icon's Bootstrap helper.

@param [Symbol] icon

    The specified icon type.

@param [Symbol] tag

    The HTML tag.

@return [String] HTML tag with prepend icon

@example

    tag_icon(:edit, :list)

    # File lib/padrino-admin/helpers/view_helpers.rb, line 19
    def tag_icon(icon, tag = nil)
      content = content_tag(:i, '', :class=> "fa fa-#{icon}")
      content << " #{tag}"
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.