Sha256: fafc6dc8e4daebb2a75095bddc94befcf26f543274bc02fa64dc50ff8f8e14e2

Contents?: true

Size: 839 Bytes

Versions: 1

Compression:

Stored size: 839 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_class
      'alert'
    end

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

    def custom_alert_class
      'alert-dismissible'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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