Sha256: de5f7d02f28f79b73780f2b46f06069cff6fba50a3dbf4d3d60b11e56a3a1ebf

Contents?: true

Size: 1.6 KB

Versions: 6

Compression:

Stored size: 1.6 KB

Contents

# -*- encoding : utf-8 -*-
# ============================================================================
#
#	RAILS BOOTSTRAP ENGINE
#
#	Bootstrap Alerts & Messages
#	http://twitter.github.com/bootstrap/components.html#alerts
#
#
#	Copyright 2012-2013 Luiz Eduardo de Oliveira Fonseca, AgĂȘncia Orangeweb
#	Licensed under The MIT License
#	http://opensource.org/licenses/MIT
#
module BootstrapAlertHelper




	# Show Flash Messages with Bootstrap Alerts
	def flash_messages
		messages = []
		
		flash.each do |type, message|
			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") +
				message, :class => "alert fade in alert-#{type}")
				messages << text if message
		end
		messages.join("\n").html_safe
	end
	
	
	
	
	
  	#	Alert Blocks
  	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="#">&times;</a>' +
        	'   <h4 class="alert-heading">' + title + '</h4>' +
            	capture(&block) +
            '</div>'
    end
    
    
    
    
    
  	#	Alert Blocks
  	def alert_inline title, alert_context = :alert, &block  
	  	raw '<div class="alert alert-' + alert_context.to_s + '" >' +
        	'   <a class="close" data-dismiss="alert" href="#">&times;</a>' +
        	'   <strong class="alert-heading">' + title + '</strong>' +
            	capture(&block) +
            '</div>'
    end	



end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rails-bootstrap-engine-0.0.9 app/helpers/bootstrap_alert_helper.rb
rails-bootstrap-engine-0.0.8 app/helpers/bootstrap_alert_helper.rb
rails-bootstrap-engine-0.0.5 app/helpers/bootstrap_alert_helper.rb
rails-bootstrap-engine-0.0.4 app/helpers/bootstrap_alert_helper.rb
rails-bootstrap-engine-0.0.3 app/helpers/bootstrap_alert_helper.rb
rails-bootstrap-engine-0.0.2 app/helpers/bootstrap_alert_helper.rb