Module: FlexaLib::Helpers::ButtonHelpers
- Included in:
- FlexaLib::Helpers
- Defined in:
- lib/flexa_lib/helpers/button_helpers.rb
Instance Method Summary collapse
-
#flexa_add_button_to(class_ref, path = nil) ⇒ Object
BUUTTON_HELPERS.
-
#flexa_cancel_button_to(model) ⇒ Object
BUUTTON_HELPERS.
-
#flexa_delete_button_to(model) ⇒ Object
BUUTTON_HELPERS.
-
#flexa_edit_button_to(model, path = nil) ⇒ Object
BUUTTON_HELPERS.
-
#flexa_generic_button_to(text, link, icon = "", *args) ⇒ Object
BUUTTON_HELPERS para criar botôes genéricos.
-
#flexa_submit_button(text = "Salvar") ⇒ Object
BUUTTON_HELPERS.
Instance Method Details
#flexa_add_button_to(class_ref, path = nil) ⇒ Object
BUUTTON_HELPERS
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/flexa_lib/helpers/button_helpers.rb', line 37 def (class_ref,path=nil) class_name = class_ref.name.to_s.underscore if path.nil? path_link = "new_#{class_name}_path" else path_link = path end content_tag :li do link_to content_tag("i", "",:class=>"icon-plus")<<" Adicionar", send(path_link), :id=>"add" end end |
#flexa_cancel_button_to(model) ⇒ Object
BUUTTON_HELPERS
6 7 8 9 10 11 |
# File 'lib/flexa_lib/helpers/button_helpers.rb', line 6 def (model) model_name = model.class.to_s.underscore content_tag :li do link_to content_tag("i", "",:class=>"icon-backward")<<' Cancelar', send("#{model_name.pluralize}_path"),:id=>"cancel" end end |
#flexa_delete_button_to(model) ⇒ Object
BUUTTON_HELPERS
30 31 32 33 34 |
# File 'lib/flexa_lib/helpers/button_helpers.rb', line 30 def (model) content_tag :li do link_to content_tag("i", "",:class=>"icon-minus")<<' Excluir', model, :confirm => 'Deseja realmente excluir?', :method => :delete end end |
#flexa_edit_button_to(model, path = nil) ⇒ Object
BUUTTON_HELPERS
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/flexa_lib/helpers/button_helpers.rb', line 14 def (model, path=nil) model_name = model.class.to_s.underscore if path.nil? path_link = "edit_#{model_name}_path" else path_link = path end content_tag :li do link_to content_tag("i", "",:class=>"icon-pencil")<<' Editar', send(path_link, model) end end |
#flexa_generic_button_to(text, link, icon = "", *args) ⇒ Object
BUUTTON_HELPERS para criar botôes genéricos
51 52 53 54 55 56 57 58 59 |
# File 'lib/flexa_lib/helpers/button_helpers.rb', line 51 def (text,link,icon="",*args) = args. if !icon.nil? text = raw content_tag("i", "",:class=>"icon-"+icon.to_s)<<" "+text end content_tag :li do link_to text, link, end end |
#flexa_submit_button(text = "Salvar") ⇒ Object
BUUTTON_HELPERS
62 63 64 65 66 |
# File 'lib/flexa_lib/helpers/button_helpers.rb', line 62 def (text="Salvar") content_tag :li do flexa_link_to_submit content_tag("i", "",:class=>"icon-ok")<<" "<<text,:id=>"submit" end end |