Module: RulesEngineView::Buttons

Defined in:
lib/rules_engine_view/buttons.rb

Instance Method Summary collapse

Instance Method Details

nested buttons



68
69
70
# File 'lib/rules_engine_view/buttons.rb', line 68

def re_add_link(title, id) 
  link_to(title, "#", :class => 're-add-link', :id => "#{id}")
end

#re_button_add(url, options = {}) ⇒ Object

ADD and REMOVE BUTTONS



88
89
90
91
# File 'lib/rules_engine_view/buttons.rb', line 88

def re_button_add url, options = {}
  klass = "re-button-add #{options[:class]}"
  link_to("", url, options.merge(:class => klass))
end

#re_button_checked(url, options = {}) ⇒ Object



103
104
105
106
# File 'lib/rules_engine_view/buttons.rb', line 103

def re_button_checked url, options = {}
  klass = "re-button-checked #{options[:class]}"
  link_to("", url, options.merge(:class => klass))
end


35
36
37
38
39
40
41
42
43
# File 'lib/rules_engine_view/buttons.rb', line 35

def re_button_link(title, url, color, options = {})
  klass = "re-form-button-#{color} #{options[:class]}"
  result = "<div class='re-form-button".html_safe
  result << " span-#{options[:span]}" unless options[:span].blank?
  result << "'>".html_safe
  result << link_to("<span>".html_safe + title + "</span>".html_safe, url, options.merge(:class=> klass).except(:span))      
  result << "</div>".html_safe
  result
end


49
50
51
# File 'lib/rules_engine_view/buttons.rb', line 49

def re_button_link_blue(title, url, options = {})
  return re_button_link(title, url, "blue", options)
end


45
46
47
# File 'lib/rules_engine_view/buttons.rb', line 45

def re_button_link_gray(title, url, options = {})
  return re_button_link(title, url, "gray", options)
end


53
54
55
# File 'lib/rules_engine_view/buttons.rb', line 53

def re_button_link_green(title, url, options = {})
  return re_button_link(title, url, "green", options)
end


57
58
59
# File 'lib/rules_engine_view/buttons.rb', line 57

def re_button_link_orange(title, url, options = {})
  return re_button_link(title, url, "orange", options)
end


61
62
63
# File 'lib/rules_engine_view/buttons.rb', line 61

def re_button_link_red(title, url, options = {})
  return re_button_link(title, url, "red", options)
end

#re_button_remove(url, options = {}) ⇒ Object



93
94
95
96
# File 'lib/rules_engine_view/buttons.rb', line 93

def re_button_remove url, options = {}
  klass = "re-button-remove #{options[:class]}"
  link_to("", url, options.merge(:class => klass))
end

#re_button_select(url, options = {}) ⇒ Object



98
99
100
101
# File 'lib/rules_engine_view/buttons.rb', line 98

def re_button_select url, options = {}
  klass = "re-button-select #{options[:class]}"
  link_to("", url, options.merge(:class => klass))
end

#re_button_submit(title, color, options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/rules_engine_view/buttons.rb', line 4

def re_button_submit(title, color, options ={})
  klass = "re-form-button-#{color} #{options[:class]}"
  result = "<div class='re-form-button".html_safe
  result << " span-#{options[:span]}" unless options[:span].blank?
  result << "'>".html_safe
  result << submit_tag(title, options.merge(:class=> klass).except(:span))      
  result << "</div>".html_safe
  result
end

#re_button_submit_blue(title, options = {}) ⇒ Object



18
19
20
# File 'lib/rules_engine_view/buttons.rb', line 18

def re_button_submit_blue(title, options = {})
  return re_button_submit(title, "blue", options)
end

#re_button_submit_gray(title, options = {}) ⇒ Object



14
15
16
# File 'lib/rules_engine_view/buttons.rb', line 14

def re_button_submit_gray(title, options = {})
  return re_button_submit(title, "gray", options)
end

#re_button_submit_green(title, options = {}) ⇒ Object



22
23
24
# File 'lib/rules_engine_view/buttons.rb', line 22

def re_button_submit_green(title, options = {})
  return re_button_submit(title, "green", options)
end

#re_button_submit_orange(title, options = {}) ⇒ Object



26
27
28
# File 'lib/rules_engine_view/buttons.rb', line 26

def re_button_submit_orange(title, options = {})
  return re_button_submit(title, "orange", options)
end

#re_button_submit_red(title, options = {}) ⇒ Object



30
31
32
# File 'lib/rules_engine_view/buttons.rb', line 30

def re_button_submit_red(title, options = {})
  return re_button_submit(title, "red", options)
end

#re_button_unchecked(url, options = {}) ⇒ Object



108
109
110
111
# File 'lib/rules_engine_view/buttons.rb', line 108

def re_button_unchecked url, options = {}
  klass = "re-button-unchecked #{options[:class]}"
  link_to("", url, options.merge(:class => klass))
end

#re_remove_field(object_name, id) ⇒ Object



79
80
81
82
83
84
# File 'lib/rules_engine_view/buttons.rb', line 79

def re_remove_field(object_name, id)
  return "" if id == 0
  
  builder_id = object_name.gsub('[', '_').gsub(']', '')
  hidden_field_tag("#{object_name}[_delete]", "", :id => "#{builder_id}__delete")
end


72
73
74
75
76
77
# File 'lib/rules_engine_view/buttons.rb', line 72

def re_remove_link(title, object_name, id)
  return "" if id == 0
  
  builder_id = object_name.gsub('[', '_').gsub(']', '')    
  link_to(title, "#", :class => 're-remove-link', :id => "#{builder_id}_remove")
end