Sha256: f27a56a694755d807e80b60392c7e5c646edab3916e7c6919cd9e9dc22141ed2
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
require 'active_support/core_ext/hash/keys' require 'active_support/core_ext/hash/transform_values' module RailsStuff module Helpers module Bootstrap BOOTSTRAP_FLASH_TYPE = { success: 'alert-success', error: 'alert-danger', alert: 'alert-warning', notice: 'alert-info', }.stringify_keys.freeze CROSS = '×'.html_safe.freeze # rubocop:disable Rails/OutputSafety def flash_messages messages = flash.map do |type, message| content_tag :div, class: [:alert, BOOTSTRAP_FLASH_TYPE[type] || type] do content_tag(:button, CROSS, class: :close, data: {dismiss: :alert}) + simple_format(message) end end safe_join(messages) end ICONS = { destroy: %(<span class='glyphicon icon-destroy'></span>), edit: %(<span class='glyphicon icon-edit'></span>), new: %(<span class='glyphicon icon-add'></span>), }.tap { |x| x.transform_values!(&:html_safe) if ''.respond_to?(:html_safe) } def basic_link_icons ICONS end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rails_stuff-0.6.0 | lib/rails_stuff/helpers/bootstrap.rb |
rails_stuff-0.6.0.rc3 | lib/rails_stuff/helpers/bootstrap.rb |