Sha256: 893f007a3667646ea3d6f414a2b401fb04cf246cdfa9fa1b1e71057e3a42fcfb
Contents?: true
Size: 1.99 KB
Versions: 1
Compression:
Stored size: 1.99 KB
Contents
module FlexaLib module Helpers module ButtonHelpers #BUUTTON_HELPERS def flexa_cancel_button_to(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 #BUUTTON_HELPERS def flexa_edit_button_to(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 #BUUTTON_HELPERS def flexa_delete_button_to(model) content_tag :li do link_to content_tag("i", "",:class=>"icon-minus")<<' Excluir', model, :confirm => 'Deseja realmente excluir?', :method => :delete end end #BUUTTON_HELPERS def flexa_add_button_to(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 #BUUTTON_HELPERS # para criar botôes genéricos def flexa_generic_button_to(text,link,icon="",*args) options = args.extract_options! if !icon.nil? text = raw content_tag("i", "",:class=>"icon-"+icon.to_s)<<" "+text end content_tag :li do link_to text, link, options end end #BUUTTON_HELPERS def flexa_submit_button(text="Salvar") content_tag :li do flexa_link_to_submit content_tag("i", "",:class=>"icon-ok")<<" "<<text,:id=>"submit" end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
flexa_lib-0.5.2 | lib/flexa_lib/helpers/button_helpers.rb |