Module: Alchemy::BaseHelper
- Included in:
- Admin::BaseHelper, PagesHelper
- Defined in:
- app/helpers/alchemy/base_helper.rb
Instance Method Summary collapse
-
#render_icon(icon_name, options = {}) ⇒ String
Render a Remix icon.
-
#render_message(type = :info, msg = nil) ⇒ Object
Returns a div with an icon and the passed content The default message type is info, but you can also pass other types like :warning or :error.
-
#warning(message, text = nil) ⇒ Object
Logs a message in the Rails logger (warn level) and optionally displays an error message to the user.
Instance Method Details
#render_icon(icon_name, options = {}) ⇒ String
Render a Remix icon
23 24 25 |
# File 'app/helpers/alchemy/base_helper.rb', line 23 def render_icon(icon_name, = {}) render Alchemy::Admin::Icon.new(icon_name, ) end |
#render_message(type = :info, msg = nil) ⇒ Object
Returns a div with an icon and the passed content The default message type is info, but you can also pass other types like :warning or :error
Usage:
<%= render_message :warning do
<p>Caution! This is a warning!</p>
<% end %>
37 38 39 |
# File 'app/helpers/alchemy/base_helper.rb', line 37 def (type = :info, msg = nil, &) render Alchemy::Admin::Message.new(msg || capture(&), type: type) end |
#warning(message, text = nil) ⇒ Object
Logs a message in the Rails logger (warn level) and optionally displays an error message to the user.
7 8 9 10 11 12 13 14 |
# File 'app/helpers/alchemy/base_helper.rb', line 7 def warning(, text = nil) Logger.warn(, caller(1..1)) unless text.nil? (:warning) do text.html_safe end end end |