Sha256: 7c75cb4ceda23f8d3b9b3324c6b7d2e746904e61e91b94a04c9c698fbc4c5768

Contents?: true

Size: 844 Bytes

Versions: 6

Compression:

Stored size: 844 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-success',
        alert: 'alert-danger',
        error: 'alert-danger',
      }
    end

    def custom_alert_class
      'alert-dismissible'
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
flash_rails_messages-1.0.0 lib/generators/flash_rails_messages/templates/config/initializers/flash_rails_messages_bootstrap.rb
flash_rails_messages-0.1.4 lib/generators/flash_rails_messages/templates/config/initializers/flash_rails_messages_bootstrap.rb
flash_rails_messages-0.1.3 lib/generators/flash_rails_messages/templates/config/initializers/flash_rails_messages_bootstrap.rb
flash_rails_messages-0.1.2 lib/generators/flash_rails_messages/templates/config/initializers/flash_rails_messages_bootstrap.rb
flash_rails_messages-0.1.1 lib/generators/flash_rails_messages/templates/config/initializers/flash_rails_messages_bootstrap.rb
flash_rails_messages-0.1.0 lib/generators/flash_rails_messages/templates/config/initializers/flash_rails_messages_bootstrap.rb