Module: FlexaLib::Helpers::ButtonHelpers

Included in:
FlexaLib::Helpers
Defined in:
lib/flexa_lib/helpers/button_helpers.rb

Instance Method Summary collapse

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 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
   :li do
    link_to ("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 flexa_cancel_button_to(model)
  model_name = model.class.to_s.underscore
   :li do
    link_to ("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 flexa_delete_button_to(model)
   :li do
    link_to ("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 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
  
   :li do
    link_to ("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 flexa_generic_button_to(text,link,icon="",*args)
  options = args.extract_options!
  if !icon.nil?
    text = raw ("i", "",:class=>"icon-"+icon.to_s)<<" "+text
  end
   :li do
    link_to text, link, options
  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 flexa_submit_button(text="Salvar")
   :li do
    flexa_link_to_submit ("i", "",:class=>"icon-ok")<<" "<<text,:id=>"submit"      
  end
end