Module: PlaceholderHelper
- Defined in:
- app/helpers/placeholder_helper.rb
Overview
Provides the ‘placeholder` helper method for showing standard markup for when thing are missing or not present yet.
Instance Method Summary collapse
-
#placeholder(label = nil, tag: :p) ⇒ String
Display a placeholder message using standardized markup and a message defined through I18n.
Instance Method Details
#placeholder(label = nil, tag: :p) ⇒ String
Display a placeholder message using standardized markup and a message defined through I18n.
When in a controller PostsController and action index, this will try to look up the following placeholder keys:
-
placeholders.posts.index
-
placeholders.posts.default
-
placeholders.defaults.index
You can also provide an argument to set the placeholder message. When given a string, it will be used directly as the placeholder message. When given a symbol, that key will be looked up in the ‘placeholders.defaults` namespace using I18n.
20 21 22 |
# File 'app/helpers/placeholder_helper.rb', line 20 def placeholder(label = nil, tag: :p) content_tag(tag, placeholder_text(label), class: 'placeholder') end |