Module: Wice::JsAdaptor::Jquery::ClassMethods

Defined in:
lib/js_adaptors/jquery_adaptor.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#action_column_initialization(grid_name) ⇒ Object

:nodoc:



116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/js_adaptors/jquery_adaptor.rb', line 116

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

#auto_reloading_calendar_event_initialization(grid_name) ⇒ Object

:nodoc:



75
76
77
78
79
# File 'lib/js_adaptors/jquery_adaptor.rb', line 75

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

#auto_reloading_inputs_event_initialization(grid_name) ⇒ Object

:nodoc:



62
63
64
65
66
# File 'lib/js_adaptors/jquery_adaptor.rb', line 62

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').keyup(function(event, element){\n! +
  %!   #{grid_name}.process(this.id);\n! +
  %! });\n!
end

#auto_reloading_inputs_with_negation_checkboxes_event_initialization(grid_name) ⇒ Object

:nodoc:



68
69
70
71
72
# File 'lib/js_adaptors/jquery_adaptor.rb', line 68

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').click(function(event, element){\n! +
  %!   #{grid_name}.process(this.id);\n! +
  %! });\n!
end

#auto_reloading_selects_event_initialization(grid_name) ⇒ Object

:nodoc:



56
57
58
59
60
# File 'lib/js_adaptors/jquery_adaptor.rb', line 56

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').change(function(e){\n! +
  %!   #{grid_name}.process()\n! +
  %! });\n!
end

:nodoc:



87
88
89
90
91
# File 'lib/js_adaptors/jquery_adaptor.rb', line 87

def back_to_pagination_link_initialization(grid_name, parameters_json)  #:nodoc:
  %/ $('div##{grid_name}.wice_grid_container .show_all_link').click(function(e){\n/ +
  %/     #{grid_name}.reload_page_for_given_grid_state(#{parameters_json})\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



93
94
95
96
97
98
99
100
101
102
# File 'lib/js_adaptors/jquery_adaptor.rb', line 93

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}')[0].value, '#{base_path_to_query_controller}', #{parameters_json}, #{ids_json})\n! +
  %/}\n/ +
  %/ $('##{id_and_name}').keydown(function(event){\n/ +
  %/    if (event.keyCode == 13) #{grid_name}_save_query();\n/ +
  %/ })\n/
end

#csv_export_icon_initialization(grid_name) ⇒ Object

:nodoc:



50
51
52
53
54
# File 'lib/js_adaptors/jquery_adaptor.rb', line 50

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

#dom_loadedObject

:nodoc:



15
16
17
# File 'lib/js_adaptors/jquery_adaptor.rb', line 15

def dom_loaded  #:nodoc:
  %/$(document).ready(function(){\n/
end

#enter_key_event_registration(grid_name) ⇒ Object

:nodoc:



44
45
46
47
48
# File 'lib/js_adaptors/jquery_adaptor.rb', line 44

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

#fade_thisObject

:nodoc:



129
130
131
# File 'lib/js_adaptors/jquery_adaptor.rb', line 129

def fade_this  #:nodoc:
  'jQuery([]).pushStack(this).fadeOut()'
end

#focus_element(element_to_focus) ⇒ Object

:nodoc:



133
134
135
136
137
138
139
140
# File 'lib/js_adaptors/jquery_adaptor.rb', line 133

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

#initObject

:nodoc:



12
13
# File 'lib/js_adaptors/jquery_adaptor.rb', line 12

def init  #:nodoc:
end

#js_framework_specific_calendar_assets(view) ⇒ Object

:nodoc:



104
105
106
# File 'lib/js_adaptors/jquery_adaptor.rb', line 104

def js_framework_specific_calendar_assets(view)  #:nodoc:
  ''
end

#js_framework_specific_calendar_css_nameObject

:nodoc:



112
113
114
# File 'lib/js_adaptors/jquery_adaptor.rb', line 112

def js_framework_specific_calendar_css_name  #:nodoc:
  nil
end

#js_framework_specific_calendar_js_nameObject

:nodoc:



108
109
110
# File 'lib/js_adaptors/jquery_adaptor.rb', line 108

def js_framework_specific_calendar_js_name  #:nodoc:
  nil
end

#reset_button_initialization(grid_name, reset_grid_javascript) ⇒ Object

:nodoc:



19
20
21
22
23
# File 'lib/js_adaptors/jquery_adaptor.rb', line 19

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

:nodoc:



81
82
83
84
85
# File 'lib/js_adaptors/jquery_adaptor.rb', line 81

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

#show_hide_button_initialization(grid_name, filter_row_id) ⇒ Object

:nodoc:



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/js_adaptors/jquery_adaptor.rb', line 31

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

#submit_button_initialization(grid_name, submit_grid_javascript) ⇒ Object

:nodoc:



25
26
27
28
29
# File 'lib/js_adaptors/jquery_adaptor.rb', line 25

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