Module: BootstrapFormHelper

Defined in:
app/helpers/bootstrap_form_helpers.rb

Overview

RAILS BOOTSTRAP ENGINE

Form Helpers for Bootstrap & Simple_Form

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

#fieldset(title, &block) ⇒ Object

Generates a Fieldset



23
24
25
26
27
28
# File 'app/helpers/bootstrap_form_helpers.rb', line 23

def fieldset title, &block  
	#raw '<div class="form-inputs"><fieldset><legend>' + title + "</legend>" +
	#		capture(&block) +
	#	"</fieldset></div>"
	 :fieldset, (:legend, title) << capture(&block)
end

#form_actions(form, back_url, submit_title = "Gravar", cancel_title = "Cancelar") ⇒ Object

Generates a form actions block with submit and cancel buttons



47
48
49
50
51
# File 'app/helpers/bootstrap_form_helpers.rb', line 47

def form_actions form, back_url, submit_title = "Gravar", cancel_title = "Cancelar"
	form_actions_block do
		(form.button :submit, submit_title) + (link_to cancel_title, back_url)
	end
end

#form_actions_block(&block) ⇒ Object

Generates a form actions block



37
38
39
# File 'app/helpers/bootstrap_form_helpers.rb', line 37

def form_actions_block  &block  
	(:div, capture(&block), :class => "form-actions" )
end