Module: BootstrapGridHelper

Defined in:
app/helpers/bootstrap_grid_helper.rb

Overview

RAILS BOOTSTRAP ENGINE

Bootstrap Grid System twitter.github.com/bootstrap/scaffolding.html#gridSystem

Copyright 2012-2013 Luiz Eduardo de Oliveira Fonseca, Agência Orangeweb

Licensed under The MIT License

opensource.org/licenses/MIT

Instance Method Summary collapse

Instance Method Details

#container(opts = {}, &block) ⇒ Object

Bootstrap Container Fixed

<div class=“container”> … rows … … span … … rows … </div>



32
33
34
35
36
# File 'app/helpers/bootstrap_grid_helper.rb', line 32

def container opts={}, &block
	opts[:class] = "" if opts[:class].nil?
	opts[:class].insert(-1, " container ") 
	(:div, capture(&block), opts)	
end

#container_fluid(opts = {}, &block) ⇒ Object

Bootstrap Container Fluid

<div class=“container-fluid”> … row-fluid … … span … … row-fluid … </div>



52
53
54
55
56
# File 'app/helpers/bootstrap_grid_helper.rb', line 52

def container_fluid opts={}, &block
	opts[:class] = "" if opts[:class].nil?
	opts[:class].insert(-1, " container-fluid ") 
	(:div, capture(&block), opts)	
end

#row(opts = {}, &block) ⇒ Object

Bootstrap Grid Row Fixed

<div class=“row”> … span items … </div>



70
71
72
73
74
# File 'app/helpers/bootstrap_grid_helper.rb', line 70

def row opts={}, &block
	opts[:class] = "" if opts[:class].nil?
	opts[:class].insert(-1, " row ") 
	(:div, capture(&block), opts)	
end

#row_fluid(opts = {}, &block) ⇒ Object

Bootstrap Grid Row Fluid

<div class=“row-fluid”> … span items … </div>



88
89
90
91
92
# File 'app/helpers/bootstrap_grid_helper.rb', line 88

def row_fluid opts={}, &block
	opts[:class] = "" if opts[:class].nil?	
	opts[:class].insert(-1, " row-fluid ") 
	(:div, capture(&block), opts)
end

#span(cols, opts = {}, &block) ⇒ Object

Bootstrap Grid Row

<div class=“span?”>…</div>



104
105
106
107
108
109
110
111
112
113
114
115
# File 'app/helpers/bootstrap_grid_helper.rb', line 104

def span cols, opts={}, &block
	opts[:class] = "" if opts[:class].nil?
	offset = ""
	
	unless opts[:offset].nil? then offset = " offset#{opts[:offset]} " end
	if opts[:class].nil? then opts[:class] = "" end
	
	opts.delete(:offset)
	opts[:class].insert(-1, " span#{cols}" + offset) 
   
	(:div, capture(&block), opts)
end