Module: Wice::JsAdaptor::Prototype::ClassMethods

Defined in:
lib/js_adaptors/prototype_adaptor.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#action_column_initialization(grid_name) ⇒ Object

:nodoc:


137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/js_adaptors/prototype_adaptor.rb', line 137

def action_column_initialization(grid_name)  #:nodoc:
  %! $$('div##{grid_name}.wice_grid_container .select_all').each(function(e){\n! +
  %!   e.observe('click', function(){\n! +
  %!     $$('div##{grid_name}.wice_grid_container .sel input').each(function(checkbox){\n! +
  %!       checkbox.checked = true;\n! +
  %!     })\n! +
  %!   })\n! +
  %! })\n! +
  %! $$('div##{grid_name}.wice_grid_container .deselect_all').each(function(e){\n! +
  %!   e.observe('click', function(){\n! +
  %!     $$('div##{grid_name}.wice_grid_container .sel input').each(function(checkbox){\n! +
  %!       checkbox.checked = false;\n! +
  %!     })\n! +
  %!   })\n! +
  %! })\n!
end

#auto_reloading_calendar_event_initialization(grid_name) ⇒ Object

:nodoc:


88
89
90
91
92
# File 'lib/js_adaptors/prototype_adaptor.rb', line 88

def auto_reloading_calendar_event_initialization(grid_name)  #:nodoc:
  %! document.observe('wg:calendarChanged_#{grid_name}', function(event){\n! +
  %!   #{grid_name}.process()\n! +
  %! });\n!
end

#auto_reloading_inputs_event_initialization(grid_name) ⇒ Object

:nodoc:


71
72
73
74
75
76
77
# File 'lib/js_adaptors/prototype_adaptor.rb', line 71

def auto_reloading_inputs_event_initialization(grid_name)  #:nodoc:
  %! $$('div##{grid_name}.wice_grid_container input.auto_reload', '.#{grid_name}_detached_filter input.auto_reload').each(function(e){\n! +
  %!   e.observe('keyup', function(event){\n! +
  %!     #{grid_name}.set_process_timer(event.element().id)\n! +
  %!   })\n! +
  %! });\n!
end

#auto_reloading_inputs_with_negation_checkboxes_event_initialization(grid_name) ⇒ Object

:nodoc:


79
80
81
82
83
84
85
# File 'lib/js_adaptors/prototype_adaptor.rb', line 79

def auto_reloading_inputs_with_negation_checkboxes_event_initialization(grid_name)  #:nodoc:
  %! $$('div##{grid_name}.wice_grid_container input.negation_checkbox', '.#{grid_name}_detached_filter input.negation_checkbox').each(function(e){\n! +
  %!   e.observe('click', function(event){\n! +
  %!     #{grid_name}.process(event.element().id)\n! +
  %!   })\n! +
  %! });\n!
end

#auto_reloading_selects_event_initialization(grid_name) ⇒ Object

:nodoc:


63
64
65
66
67
68
69
# File 'lib/js_adaptors/prototype_adaptor.rb', line 63

def auto_reloading_selects_event_initialization(grid_name)  #:nodoc:
  %! $$('div##{grid_name}.wice_grid_container select.auto_reload', '.#{grid_name}_detached_filter select.auto_reload').each(function(e){\n! +
  %!   e.observe('change', function(event){\n! +
  %!     #{grid_name}.process()\n! +
  %!   })\n! +
  %! });\n!
end

:nodoc:


104
105
106
107
108
109
110
# File 'lib/js_adaptors/prototype_adaptor.rb', line 104

def back_to_pagination_link_initialization(grid_name, parameters_json)  #:nodoc:
  %/ $$('div##{grid_name}.wice_grid_container .show_all_link').each(function(e){\n/ +
  %/   e.observe('click', function(){\n/ +
  %/     #{grid_name}.reload_page_for_given_grid_state(#{parameters_json})\n/ +
  %/   })\n/ +
  %/ })\n/
end

#call_to_save_query_and_key_event_initialization_for_saving_queries(id_and_name, grid_name, base_path_to_query_controller, parameters_json, ids_json) ⇒ Object


112
113
114
115
116
117
118
119
120
121
# File 'lib/js_adaptors/prototype_adaptor.rb', line 112

def call_to_save_query_and_key_event_initialization_for_saving_queries(
                                  id_and_name, grid_name, base_path_to_query_controller, parameters_json, ids_json)  #:nodoc:
  %/ function #{grid_name}_save_query(){\n/ +
  %`   if ( typeof(#{grid_name}) != "undefined")\n` +
  %/     #{grid_name}.save_query('#{id_and_name}', $F('#{id_and_name}'), '#{base_path_to_query_controller}', #{parameters_json}, #{ids_json})\n/ +
  %/   }\n/ +
  %/ $('#{id_and_name}').observe('keydown', function(event){\n/ +
  %/   if (event.keyCode == 13) #{grid_name}_save_query();\n/ +
  %/ })\n/
end

#csv_export_icon_initialization(grid_name) ⇒ Object

:nodoc:


55
56
57
58
59
60
61
# File 'lib/js_adaptors/prototype_adaptor.rb', line 55

def csv_export_icon_initialization(grid_name)  #:nodoc:
  %! $$('div##{grid_name}.wice_grid_container .export_to_csv_button').each(function(e){\n! +
  %!   e.observe('click', function(event){\n! +
  %!     #{grid_name}.export_to_csv()\n! +
  %!   })\n! +
  %! });\n!
end

#dom_loadedObject

:nodoc:


14
15
16
# File 'lib/js_adaptors/prototype_adaptor.rb', line 14

def dom_loaded  #:nodoc:
  %/ document.observe("dom:loaded", function() {\n/
end

#enter_key_event_registration(grid_name) ⇒ Object

:nodoc:


47
48
49
50
51
52
53
# File 'lib/js_adaptors/prototype_adaptor.rb', line 47

def enter_key_event_registration(grid_name)  #:nodoc:
  %! $$('div##{grid_name}.wice_grid_container .wice_grid_filter_row input[type=text], .#{grid_name}_detached_filter input[type=text]').each(function(e){\n! +
  %!   e.observe('keydown', function(event){\n! +
  %!     if (event.keyCode == 13) {#{grid_name}.process()}\n! +
  %!   })\n! +
  %! });\n!
end

#fade_thisObject

:nodoc:


154
155
156
# File 'lib/js_adaptors/prototype_adaptor.rb', line 154

def fade_this  #:nodoc:
  'new Effect.Fade(this)'
end

#focus_element(element_to_focus) ⇒ Object

:nodoc:


158
159
160
161
162
# File 'lib/js_adaptors/prototype_adaptor.rb', line 158

def focus_element(element_to_focus)  #:nodoc:
  %! var elToFocus = $('#{element_to_focus}');\n! +
  %! elToFocus.focus();\n! +
  %! elToFocus.value = elToFocus.value;\n! # this will just place the cursor at the end of the text input
end

#initObject

:nodoc:


11
12
# File 'lib/js_adaptors/prototype_adaptor.rb', line 11

def init  #:nodoc:
end

#js_framework_specific_calendar_assets(view) ⇒ Object

:nodoc:


124
125
126
# File 'lib/js_adaptors/prototype_adaptor.rb', line 124

def js_framework_specific_calendar_assets(view)  #:nodoc:
  view.stylesheet_link_tag("calendarview.css") + view.javascript_include_tag("calendarview.js")
end

#js_framework_specific_calendar_css_nameObject

:nodoc:


132
133
134
# File 'lib/js_adaptors/prototype_adaptor.rb', line 132

def js_framework_specific_calendar_css_name  #:nodoc:
  'calendarview.css'
end

#js_framework_specific_calendar_js_nameObject

:nodoc:


128
129
130
# File 'lib/js_adaptors/prototype_adaptor.rb', line 128

def js_framework_specific_calendar_js_name  #:nodoc:
  'calendarview.js'
end

#reset_button_initialization(grid_name, reset_grid_javascript) ⇒ Object

:nodoc:


18
19
20
21
22
23
24
# File 'lib/js_adaptors/prototype_adaptor.rb', line 18

def reset_button_initialization(grid_name, reset_grid_javascript)  #:nodoc:
  %/ $$('div##{grid_name}.wice_grid_container .reset').each(function(e){\n/+
  %/   e.observe('click', function(){\n/+
  %/     #{reset_grid_javascript};\n/+
  %/   })\n/+
  %/ });\n/
end

:nodoc:


95
96
97
98
99
100
101
# File 'lib/js_adaptors/prototype_adaptor.rb', line 95

def show_all_link_initialization(grid_name, confirmation, parameters_json)  #:nodoc:
  %/ $$('div##{grid_name}.wice_grid_container .show_all_link').each(function(e){\n/ +
  %/   e.observe('click', function(){\n/ +
  %/     #{confirmation} #{grid_name}.reload_page_for_given_grid_state(#{parameters_json})\n/ +
  %/   })\n/ +
  %/ })\n/
end

#show_hide_button_initialization(grid_name, filter_row_id) ⇒ Object

:nodoc:


34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/js_adaptors/prototype_adaptor.rb', line 34

def show_hide_button_initialization(grid_name, filter_row_id)  #:nodoc:
  %/ $('#{grid_name}_show_icon').observe('click', function(){\n/+
  %/   Element.toggle('#{grid_name}_show_icon');\n/+
  %/   Element.toggle('#{grid_name}_hide_icon');\n/+
  %/   $('#{filter_row_id}').show();\n/+
  %/ })\n/+
  %/ $('#{grid_name}_hide_icon').observe('click', function(){\n/+
  %/   Element.toggle('#{grid_name}_show_icon');\n/+
  %/   Element.toggle('#{grid_name}_hide_icon');\n/+
  %/   $('#{filter_row_id}').hide();\n/+
  %/ });\n/
end

#submit_button_initialization(grid_name, submit_grid_javascript) ⇒ Object

:nodoc:


26
27
28
29
30
31
32
# File 'lib/js_adaptors/prototype_adaptor.rb', line 26

def submit_button_initialization(grid_name, submit_grid_javascript)  #:nodoc:
  %/ $$('div##{grid_name}.wice_grid_container .submit').each(function(e){\n/+
  %/   e.observe('click', function(){\n/+
  %/     #{submit_grid_javascript};\n/+
  %/   })\n/+
  %/ });\n/
end

#update_ranges(grid_name) ⇒ Object


164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/js_adaptors/prototype_adaptor.rb', line 164

def update_ranges(grid_name)
  %/ $$('div##{grid_name}.wice_grid_container .range-start, .#{grid_name}_detached_filter .range-start').each(function(e){\n/+
  %/   e.observe('keyup', function(){\n/+
  %!     var endRange = e.next();\n! +
  %!     if (e.value){\n! +
  %/       endRange.value = #{Wice::ConfigurationProvider.value_for(:SECOND_RANGE_VALUE_FOLLOWING_THE_FIRST)} + parseInt(e.value);\n/ +
  %/     }else{\n/ +
    %/       endRange.value = '';\n/ +
  %/     }\n/ +
  %/   })\n/+
  %/ });\n/
end