Module: FlexaLib::Helpers::ButtonGridHelpers

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

Instance Method Summary collapse

Instance Method Details

#flexa_grid_button_delete_to(obj) ⇒ Object

BUTTON_GRID_HELPERS



18
19
20
# File 'lib/flexa_lib/helpers/button_grid_helpers.rb', line 18

def flexa_grid_button_delete_to(obj)
  link_to ("i", "",:class=>"icon-minus icon-white"), obj, :confirm => 'Are you sure?', :method => :delete, :class=>"btn btn-smallest btn-danger"
end

#flexa_grid_button_edit_to(obj) ⇒ Object

BUTTON_GRID_HELPERS



12
13
14
15
# File 'lib/flexa_lib/helpers/button_grid_helpers.rb', line 12

def flexa_grid_button_edit_to(obj)
  model_name = obj.class.to_s.underscore
  link_to ("i", "",:class=>"icon-pencil icon-white"), send("edit_#{model_name}_path",obj), :class=>"btn btn-smallest btn-warning"
end

#flexa_grid_button_generic(button, icon, path, *args) ⇒ Object

BUTTON_GRID_HELPERS



34
35
36
37
38
# File 'lib/flexa_lib/helpers/button_grid_helpers.rb', line 34

def flexa_grid_button_generic(button,icon,path,*args)
  options = args.extract_options!
  options[:class]= "btn btn-smallest btn-"+button
  concat(link_to ("i", "",:class=>"icon-"+icon+" icon-white"), path, options)
end

#flexa_grid_button_select_to(obj, fill) ⇒ Object

BUTTON_GRID_HELPERS



23
24
25
26
27
28
29
30
31
# File 'lib/flexa_lib/helpers/button_grid_helpers.rb', line 23

def flexa_grid_button_select_to(obj,fill)
  afill=fill.split(",")
  fill = ""
  afill.each do |f|
    fill << "window.parent.$('##{f}').attr('value','"+obj.send(f).to_s+"');"
  end
  link_to ("i", "",:class=>"icon-ok icon-white"), "#", :class=>"btn btn-smallest btn-success",:onclick=>fill+"window.parent.$('#div_"+afill.first.to_s+"').modal('hide');"
  #flexa_grid_button_generic("success","ok","#",:onclick=>fill+"window.parent.$('#lookup').modal('hide');")
end

#flexa_grid_button_show_to(obj) ⇒ Object

BUTTON_GRID_HELPERS



7
8
9
# File 'lib/flexa_lib/helpers/button_grid_helpers.rb', line 7

def flexa_grid_button_show_to(obj)
  link_to ("i", "",:class=>"icon-search icon-white"), obj, :class=>"btn btn-smallest btn-info"
end