Sha256: d6934ab9041fb7e04ee9f917d6739b1602d5114fe1e5de1131fa909b8941d2ef
Contents?: true
Size: 810 Bytes
Versions: 8
Compression:
Stored size: 810 Bytes
Contents
module FlashRailsMessages class Base include ActionView::Helpers::TagHelper include ActionView::Context def render(flash) flash = Hash[flash].symbolize_keys flash.map { |message| alert_element(*message) }.join.html_safe end private def alert_element(type, message) content_tag :div, class: alert_classes(type) do close_element + message.html_safe end end def close_element content_tag :a, class: 'close', href: '#' do '×'.html_safe end end def alert_classes(type) "#{default_alert_class} #{alert_type_classes[type]} #{custom_alert_classes}".strip end def default_alert_class 'alert' end def alert_type_classes {} end def custom_alert_classes end end end
Version data entries
8 entries across 8 versions & 1 rubygems