Module: BootstrapAlertHelper
- Defined in:
- app/helpers/bootstrap_alert_helper.rb
Overview
RAILS BOOTSTRAP ENGINE
Bootstrap Alerts & Messages twitter.github.com/bootstrap/components.html#alerts
Copyright 2012-2013 Luiz Eduardo de Oliveira Fonseca, AgĂȘncia Orangeweb Licensed under The MIT License opensource.org/licenses/MIT
Instance Method Summary collapse
-
#alert_block(title, alert_context = :alert, &block) ⇒ Object
Alert Blocks.
-
#alert_inline(title, alert_context = :alert, &block) ⇒ Object
Alert Blocks.
-
#flash_messages ⇒ Object
Show Flash Messages with Bootstrap Alerts.
Instance Method Details
#alert_block(title, alert_context = :alert, &block) ⇒ Object
Alert Blocks
41 42 43 44 45 46 47 |
# File 'app/helpers/bootstrap_alert_helper.rb', line 41 def alert_block title, alert_context = :alert, &block raw '<div class="alert alert-block alert-' + alert_context.to_s + '" >' + ' <a class="close" data-dismiss="alert" href="#">×</a>' + ' <h4 class="alert-heading">' + title + '</h4>' + capture(&block) + '</div>' end |
#alert_inline(title, alert_context = :alert, &block) ⇒ Object
Alert Blocks
54 55 56 57 58 59 60 |
# File 'app/helpers/bootstrap_alert_helper.rb', line 54 def alert_inline title, alert_context = :alert, &block raw '<div class="alert alert-' + alert_context.to_s + '" >' + ' <a class="close" data-dismiss="alert" href="#">×</a>' + ' <strong class="alert-heading">' + title + '</strong>' + capture(&block) + '</div>' end |
#flash_messages ⇒ Object
Show Flash Messages with Bootstrap Alerts
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/helpers/bootstrap_alert_helper.rb', line 20 def = [] flash.each do |type, | next if type == :timeout next if type == :timedout type = :success if type == :notice type = :error if type == :alert text = content_tag(:div, content_tag(:button, raw("×"), :class => "close", "data-dismiss" => "alert") + , :class => "alert fade in alert-#{type}") << text if end .join("\n").html_safe end |