Module: Padrino::Admin::Helpers::ViewHelpers
- Defined in:
- padrino-admin/lib/padrino-admin/helpers/view_helpers.rb
Instance Method Summary collapse
-
#model_attribute_translate(model, attribute) ⇒ String
(also: #t_attr)
Translates attribute name for the given model.
-
#model_translate(model) ⇒ String
(also: #mt)
Translates model name.
-
#padrino_admin_translate(word, *args) ⇒ String
(also: #pat)
Translates a given word for padrino admin.
-
#tag_icon(icon, tag = nil) ⇒ String
Icon’s Bootstrap helper.
Instance Method Details
#model_attribute_translate(model, attribute) ⇒ String Also known as: t_attr
Translates attribute name for the given model.
62 63 64 |
# File 'padrino-admin/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 |
#model_translate(model) ⇒ String Also known as: mt
Translates model name.
80 81 82 |
# File 'padrino-admin/lib/padrino-admin/helpers/view_helpers.rb', line 80 def model_translate(model) t("models.#{model}.name", :default => model.to_s.humanize) end |
#padrino_admin_translate(word, *args) ⇒ String Also known as: pat
Translates a given word for padrino admin.
41 42 43 44 45 |
# File 'padrino-admin/lib/padrino-admin/helpers/view_helpers.rb', line 41 def padrino_admin_translate(word, *args) = args.last.is_a?(Hash) ? args.pop : {} [:default] ||= word.to_s.humanize t("padrino.admin.#{word}", ) end |
#tag_icon(icon, tag = nil) ⇒ String
Icon’s Bootstrap helper.
19 20 21 22 |
# File 'padrino-admin/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 |