Sha256: 0fdb47bbeed022c29985689f18b03bde80e307d92b107fc6c2e02684bdb0b17a

Contents?: true

Size: 842 Bytes

Versions: 2

Compression:

Stored size: 842 Bytes

Contents

module FlashRailsMessages
  class Base
    # BOOTSTRAP FRAMEWORK
    # =========================================

    def alert_element(type, message)
      content_tag :div, class: alert_classes(type), role: 'alert' do
        close_element + message.html_safe
      end
    end

    def close_element
      content_tag :button, type: 'button', class: 'close', 'data-dismiss': 'alert' do
        content_tag(:span, '×'.html_safe, 'aria-hidden': 'true') +
        content_tag(:span, 'Close', class: 'sr-only')
      end
    end

    def default_alert_classes
      'alert'
    end

    def alert_type_classes
      {
        success: 'alert-success',
        notice: 'alert-success',
        alert: 'alert-danger',
        error: 'alert-danger',
      }
    end

    def custom_alert_classes
      'alert-dismissible'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flash_rails_messages-2.0.0 lib/generators/flash_rails_messages/templates/config/initializers/flash_rails_messages_bootstrap.rb
flash_rails_messages-1.0.2 lib/generators/flash_rails_messages/templates/config/initializers/flash_rails_messages_bootstrap.rb