Module: Alchemy::Element::Presenters::ClassMethods

Defined in:
app/models/alchemy/element/presenters.rb

Instance Method Summary collapse

Instance Method Details

#display_name_for(name) ⇒ Object

Human name for displaying elements in select boxes and element editor views.

The name is beeing translated from given name value as described in config/alchemy/elements.yml

Translate the name in your config/locales language file.

Example:

de:
  alchemy:
    element_names:
      contactform: 'Kontakt Formular'

If no translation is found a humanized name is used.



25
26
27
# File 'app/models/alchemy/element/presenters.rb', line 25

def display_name_for(name)
  I18n.t(name, scope: 'element_names', default: name.to_s.humanize)
end