active_scaffold_vho 3.1.5 → 3.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -15,6 +15,7 @@ doc
15
15
  pkg
16
16
 
17
17
  nbproject
18
+ .idea
18
19
 
19
20
  # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
20
21
  #
data/Gemfile.lock CHANGED
@@ -1,38 +1,38 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- active_scaffold_vho (3.1.5)
4
+ active_scaffold_vho (3.1.6)
5
5
  kaminari
6
6
  rails (>= 3.1.0)
7
7
 
8
8
  GEM
9
9
  remote: http://rubygems.org/
10
10
  specs:
11
- actionmailer (3.2.8)
12
- actionpack (= 3.2.8)
11
+ actionmailer (3.2.11)
12
+ actionpack (= 3.2.11)
13
13
  mail (~> 2.4.4)
14
- actionpack (3.2.8)
15
- activemodel (= 3.2.8)
16
- activesupport (= 3.2.8)
14
+ actionpack (3.2.11)
15
+ activemodel (= 3.2.11)
16
+ activesupport (= 3.2.11)
17
17
  builder (~> 3.0.0)
18
18
  erubis (~> 2.7.0)
19
19
  journey (~> 1.0.4)
20
20
  rack (~> 1.4.0)
21
21
  rack-cache (~> 1.2)
22
22
  rack-test (~> 0.6.1)
23
- sprockets (~> 2.1.3)
24
- activemodel (3.2.8)
25
- activesupport (= 3.2.8)
23
+ sprockets (~> 2.2.1)
24
+ activemodel (3.2.11)
25
+ activesupport (= 3.2.11)
26
26
  builder (~> 3.0.0)
27
- activerecord (3.2.8)
28
- activemodel (= 3.2.8)
29
- activesupport (= 3.2.8)
27
+ activerecord (3.2.11)
28
+ activemodel (= 3.2.11)
29
+ activesupport (= 3.2.11)
30
30
  arel (~> 3.0.2)
31
31
  tzinfo (~> 0.3.29)
32
- activeresource (3.2.8)
33
- activemodel (= 3.2.8)
34
- activesupport (= 3.2.8)
35
- activesupport (3.2.8)
32
+ activeresource (3.2.11)
33
+ activemodel (= 3.2.11)
34
+ activesupport (= 3.2.11)
35
+ activesupport (3.2.11)
36
36
  i18n (~> 0.6)
37
37
  multi_json (~> 1.0)
38
38
  arel (3.0.2)
@@ -41,7 +41,7 @@ GEM
41
41
  hike (1.2.1)
42
42
  i18n (0.6.1)
43
43
  journey (1.0.4)
44
- json (1.7.5)
44
+ json (1.7.6)
45
45
  kaminari (0.14.1)
46
46
  actionpack (>= 3.0.0)
47
47
  activesupport (>= 3.0.0)
@@ -50,45 +50,46 @@ GEM
50
50
  mime-types (~> 1.16)
51
51
  treetop (~> 1.4.8)
52
52
  mime-types (1.19)
53
- multi_json (1.3.7)
53
+ multi_json (1.5.0)
54
54
  polyglot (0.3.3)
55
- rack (1.4.1)
55
+ rack (1.4.4)
56
56
  rack-cache (1.2)
57
57
  rack (>= 0.4)
58
58
  rack-ssl (1.3.2)
59
59
  rack
60
60
  rack-test (0.6.2)
61
61
  rack (>= 1.0)
62
- rails (3.2.8)
63
- actionmailer (= 3.2.8)
64
- actionpack (= 3.2.8)
65
- activerecord (= 3.2.8)
66
- activeresource (= 3.2.8)
67
- activesupport (= 3.2.8)
62
+ rails (3.2.11)
63
+ actionmailer (= 3.2.11)
64
+ actionpack (= 3.2.11)
65
+ activerecord (= 3.2.11)
66
+ activeresource (= 3.2.11)
67
+ activesupport (= 3.2.11)
68
68
  bundler (~> 1.0)
69
- railties (= 3.2.8)
70
- railties (3.2.8)
71
- actionpack (= 3.2.8)
72
- activesupport (= 3.2.8)
69
+ railties (= 3.2.11)
70
+ railties (3.2.11)
71
+ actionpack (= 3.2.11)
72
+ activesupport (= 3.2.11)
73
73
  rack-ssl (~> 1.3.2)
74
74
  rake (>= 0.8.7)
75
75
  rdoc (~> 3.4)
76
76
  thor (>= 0.14.6, < 2.0)
77
- rake (0.9.2.2)
77
+ rake (10.0.3)
78
78
  rcov (0.9.9)
79
79
  rdoc (3.12)
80
80
  json (~> 1.4)
81
81
  shoulda (2.11.3)
82
- sprockets (2.1.3)
82
+ sprockets (2.2.2)
83
83
  hike (~> 1.2)
84
+ multi_json (~> 1.0)
84
85
  rack (~> 1.0)
85
86
  tilt (~> 1.1, != 1.3.0)
86
- thor (0.16.0)
87
+ thor (0.17.0)
87
88
  tilt (1.3.3)
88
89
  treetop (1.4.12)
89
90
  polyglot
90
91
  polyglot (>= 0.3.1)
91
- tzinfo (0.3.34)
92
+ tzinfo (0.3.35)
92
93
 
93
94
  PLATFORMS
94
95
  ruby
@@ -1,5 +1,5 @@
1
1
  $(document).ready(function() {
2
- $('form.as_form').live('ajax:before', function(event) {
2
+ $(document).on('ajax:before', 'form.as_form', function(event) {
3
3
  var as_form = $(this).closest("form");
4
4
  $(this).find('.association-record-new').each(function(index) {
5
5
  var record_action = 'empty';
@@ -11,7 +11,7 @@ $(document).ready(function() {
11
11
  });
12
12
  return true;
13
13
  });
14
- $('form.as_form').live('ajax:loading', function(event) {
14
+ $(document).on('ajax:beforeSend', 'form.as_form', function(event) {
15
15
  var as_form = $(this).closest("form");
16
16
  if (as_form && as_form.attr('data-loading') == 'true') {
17
17
  ActiveScaffold.disable_form(as_form);
@@ -19,26 +19,26 @@ $(document).ready(function() {
19
19
  return true;
20
20
  });
21
21
 
22
- $('form.as_form').live('ajax:complete', function(event) {
22
+ $(document).on('ajax:complete', 'form.as_form', function(event) {
23
23
  var as_form = $(this).closest("form");
24
24
  if (as_form && as_form.attr('data-loading') == 'true') {
25
25
  ActiveScaffold.enable_form(as_form);
26
26
  }
27
27
  });
28
- $('form.as_form').live('ajax:error', function(event, xhr, status, error) {
28
+ $(document).on('ajax:error', 'form.as_form', function(event, xhr, status, error) {
29
29
  var as_div = $(this).closest("div.active-scaffold");
30
30
  if (as_div) {
31
31
  ActiveScaffold.report_500_response(as_div)
32
32
  }
33
33
  });
34
- $('form.as_form.as_remote_upload').live('submit', function(event) {
34
+ $(document).on('submit', 'form.as_form.as_remote_upload', function(event) {
35
35
  var as_form = $(this).closest("form");
36
36
  if (as_form && as_form.attr('data-loading') == 'true') {
37
37
  setTimeout("ActiveScaffold.disable_form('" + as_form.attr('id') + "')", 10);
38
38
  }
39
39
  return true;
40
40
  });
41
- $('a.as_action').live('ajax:before', function(event) {
41
+ $(document).on('ajax:before', 'a.as_action', function(event) {
42
42
  var action_link = ActiveScaffold.ActionLink.get($(this));
43
43
  if (action_link) {
44
44
  if (action_link.is_disabled()) {
@@ -61,7 +61,7 @@ $(document).ready(function() {
61
61
  }
62
62
  return true;
63
63
  });
64
- $('a.as_action').live('ajax:beforeSend', function(event, xhr, settings) {
64
+ $(document).on('ajax:beforeSend', 'a.as_action', function(event, xhr, settings) {
65
65
  xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script);
66
66
  var action_link = ActiveScaffold.ActionLink.get($(this));
67
67
  if (action_link && action_link.position) {
@@ -70,7 +70,7 @@ $(document).ready(function() {
70
70
  }
71
71
  return true;
72
72
  });
73
- $('a.as_action').live('ajax:success', function(event, response) {
73
+ $(document).on('ajax:success', 'a.as_action', function(event, response) {
74
74
  var action_link = ActiveScaffold.ActionLink.get($(this));
75
75
  if (action_link) {
76
76
  if (action_link.position) {
@@ -83,14 +83,14 @@ $(document).ready(function() {
83
83
  }
84
84
  return true;
85
85
  });
86
- $('a.as_action').live('ajax:complete', function(event) {
86
+ $(document).on('ajax:complete', 'a.as_action', function(event) {
87
87
  var action_link = ActiveScaffold.ActionLink.get($(this));
88
88
  if (action_link) {
89
89
  if (action_link.loading_indicator) action_link.loading_indicator.css('visibility','hidden');
90
90
  }
91
91
  return true;
92
92
  });
93
- $('a.as_action').live('ajax:error', function(event, xhr, status, error) {
93
+ $(document).on('ajax:error', 'a.as_action', function(event, xhr, status, error) {
94
94
  var action_link = ActiveScaffold.ActionLink.get($(this));
95
95
  if (action_link) {
96
96
  ActiveScaffold.report_500_response(action_link.scaffold_id());
@@ -98,7 +98,7 @@ $(document).ready(function() {
98
98
  }
99
99
  return true;
100
100
  });
101
- $('a.as_cancel').live('ajax:before', function(event) {
101
+ $(document).on('ajax:before', 'a.as_cancel', function(event) {
102
102
  var as_cancel = $(this);
103
103
  var action_link = ActiveScaffold.find_action_link(as_cancel);
104
104
 
@@ -108,7 +108,7 @@ $(document).ready(function() {
108
108
  if (refresh_data === 'true' && action_link.refresh_url) {
109
109
  event.data_url = action_link.refresh_url;
110
110
  as_cancel.attr('href', action_link.refresh_url);
111
- if (action_link.position) event.data_type = 'html'
111
+ if (action_link.position) event.data_type = 'rails';
112
112
  } else if (refresh_data === 'false' || typeof(cancel_url) == 'undefined' || cancel_url.length == 0) {
113
113
  action_link.close();
114
114
  return false;
@@ -116,18 +116,18 @@ $(document).ready(function() {
116
116
  }
117
117
  return true;
118
118
  });
119
- $('a.as_cancel').live('ajax:beforeSend', function(event, xhr, settings) {
119
+ $(document).on('ajax:beforeSend', 'a.as_cancel', function(event, xhr, settings) {
120
120
  var as_cancel = $(this);
121
121
  var action_link = ActiveScaffold.find_action_link($(this));
122
122
  var refresh_data = as_cancel.attr('data-refresh');
123
123
 
124
124
  if (action_link && action_link.position && refresh_data === 'true' && action_link.refresh_url) {
125
- settings.dataType = 'html';
126
- settings.dataTypes = ['html'];
125
+ settings.dataType = 'text';
126
+ settings.dataTypes = ['text'];
127
127
  }
128
128
  return true;
129
129
  });
130
- $('a.as_cancel').live('ajax:success', function(event, response) {
130
+ $(document).on('ajax:success', 'a.as_cancel', function(event, response) {
131
131
  var action_link = ActiveScaffold.find_action_link($(this));
132
132
 
133
133
  if (action_link) {
@@ -139,26 +139,26 @@ $(document).ready(function() {
139
139
  }
140
140
  return true;
141
141
  });
142
- $('a.as_cancel').live('ajax:error', function(event, xhr, status, error) {
142
+ $(document).on('ajax:error', 'a.as_cancel', function(event, xhr, status, error) {
143
143
  var action_link = ActiveScaffold.find_action_link($(this));
144
144
  if (action_link) {
145
145
  ActiveScaffold.report_500_response(action_link.scaffold_id());
146
146
  }
147
147
  return true;
148
148
  });
149
- $('a.as_sort').live('ajax:before', function(event) {
149
+ $(document).on('ajax:before', 'a.as_sort', function(event) {
150
150
  var as_sort = $(this);
151
151
  var history_controller_id = as_sort.attr('data-page-history');
152
152
  if (history_controller_id) addActiveScaffoldPageToHistory(as_sort.attr('href'), history_controller_id);
153
153
  as_sort.closest('th').addClass('loading');
154
154
  return true;
155
155
  });
156
- $('a.as_sort').live('ajax:error', function(event, xhr, status, error) {
156
+ $(document).on('ajax:error', 'a.as_sort', function(event, xhr, status, error) {
157
157
  var as_scaffold = $(this).closest('.active-scaffold');
158
158
  ActiveScaffold.report_500_response(as_scaffold);
159
159
  return true;
160
160
  });
161
- $('div.active-scaffold-footer .pagination a').live('ajax:before',function(event) {
161
+ $(document).on('ajax:before', 'div.active-scaffold-footer .pagination a', function(event) {
162
162
  var as_paginate = $(this);
163
163
  var loading_indicator = as_paginate.closest('.pagination').find('img.loading-indicator').first();
164
164
  var history_controller_id = as_paginate.attr('data-page-history');
@@ -173,16 +173,16 @@ $(document).ready(function() {
173
173
  loading_indicator.css('visibility','visible');
174
174
  return true;
175
175
  });
176
- $('div.active-scaffold-footer .pagination a').live('ajax:error', function(event, xhr, status, error) {
176
+ $(document).on('ajax:error', 'div.active-scaffold-footer .pagination a', function(event, xhr, status, error) {
177
177
  var as_scaffold = $(this).closest('.active-scaffold');
178
178
  ActiveScaffold.report_500_response(as_scaffold);
179
179
  return true;
180
180
  });
181
- $('div.active-scaffold-footer .pagination a').live('ajax:complete', function(event) {
181
+ $(document).on('ajax:complete', 'div.active-scaffold-footer .pagination a', function(event) {
182
182
  $(this).prevAll('img.loading-indicator').css('visibility','hidden');
183
183
  return true;
184
184
  });
185
- $('a.as_add_existing').live('ajax:before', function(event) {
185
+ $(document).on('ajax:before', 'a.as_add_existing', function(event) {
186
186
  var selected_id = $(this).prev().val();
187
187
  if (selected_id) {
188
188
  var url = $(this).attr('href').replace('--ID--', $(this).prev().val());
@@ -194,14 +194,14 @@ $(document).ready(function() {
194
194
  }
195
195
 
196
196
  });
197
- $('a.as_destroy_existing').live('click', function(event) {
197
+ $(document).on('click', 'a.as_destroy_existing', function(event) {
198
198
  var associated_record = $(this).closest('tr.association-record');
199
199
  ActiveScaffold.delete_subform_record(associated_record);
200
200
  event.stopPropagation();
201
201
  return false;
202
202
  });
203
203
 
204
- $('input.update_form, textarea.update_form, select.update_form').live('change', function(event) {
204
+ $(document).on('change', 'input.update_form, textarea.update_form, select.update_form', function(event) {
205
205
  var element = $(this);
206
206
  var as_form = element.closest('form.as_form');
207
207
  var params = null;
@@ -242,12 +242,12 @@ $(document).ready(function() {
242
242
  return true;
243
243
  });
244
244
 
245
- $('select.as_search_range_option').live('change', function(event) {
245
+ $(document).on('change', 'select.as_search_range_option', function(event) {
246
246
  ActiveScaffold[$(this).val() == 'BETWEEN' ? 'show' : 'hide']($(this).parent().find('.as_search_range_between'));
247
247
  return true;
248
248
  });
249
249
 
250
- $('select.as_search_range_option').live('change', function(event) {
250
+ $(document).on('change', 'select.as_search_range_option', function(event) {
251
251
  var element = $(this);
252
252
  ActiveScaffold[!(element.val() == 'PAST' || element.val() == 'FUTURE' || element.val() == 'RANGE') ? 'show' : 'hide'](element.attr('id').replace(/_opt/, '_numeric'));
253
253
  ActiveScaffold[(element.val() == 'PAST' || element.val() == 'FUTURE') ? 'show' : 'hide'](element.attr('id').replace(/_opt/, '_trend'));
@@ -255,18 +255,18 @@ $(document).ready(function() {
255
255
  return true;
256
256
  });
257
257
 
258
- $('select.as_update_date_operator').live('change', function(event) {
258
+ $(document).on('change', 'select.as_update_date_operator', function(event) {
259
259
  ActiveScaffold[$(this).val() == 'REPLACE' ? 'show' : 'hide']($(this).next());
260
260
  ActiveScaffold[$(this).val() == 'REPLACE' ? 'hide' : 'show']($(this).next().next());
261
261
  return true;
262
262
  });
263
263
 
264
- $('a[data-popup]').live('click', function(e) {
264
+ $(document).on('click', 'a[data-popup]', function(e) {
265
265
  window.open($(this).attr('href'));
266
266
  e.preventDefault();
267
267
  });
268
268
 
269
- $('.hover_click').live("click", function(event) {
269
+ $(document).on("click", '.hover_click', function(event) {
270
270
  var element = $(this);
271
271
  var ul_element = element.children('ul').first();
272
272
  if (ul_element.is(':visible')) {
@@ -276,19 +276,19 @@ $(document).ready(function() {
276
276
  }
277
277
  return false;
278
278
  });
279
- $('.hover_click a.as_action').live('click', function(event) {
279
+ $(document).on('click', '.hover_click a.as_action', function(event) {
280
280
  var element = $(this).closest('.hover_click');
281
281
  if (element) {
282
282
  element.find('ul').hide();
283
283
  }
284
284
  return true;
285
285
  });
286
- $('form.as_form').live('as:form_loaded', function(event) {
286
+ $(document).on('as:form_loaded', 'form.as_form', function(event) {
287
287
  var as_form = $(this).closest("form");
288
288
  ActiveScaffold.focus_first_element_of_form(as_form);
289
289
  return true;
290
290
  });
291
- $('li.horizontal-sub-form').live('as:form_element_loaded', function(event) {
291
+ $(document).on('as:form_element_loaded', 'li.horizontal-sub-form', function(event) {
292
292
  $(this).find('a.as_associated_form_link').each(function(index) {
293
293
  ActiveScaffold.show($(this));
294
294
  //Show select Box for add_existing as well
@@ -298,7 +298,7 @@ $(document).ready(function() {
298
298
  })
299
299
  return true;
300
300
  });
301
- $('li.sub-form').live('as:form_element_loaded', function(event) {
301
+ $(document).on('as:form_element_loaded', 'li.sub-form', function(event) {
302
302
  $(this).find('.association-record-new').each(function(index) {
303
303
  $(this).find('input, textarea, select').each(function(index) {
304
304
  $(this).data('value_was', $(this).val());
@@ -306,17 +306,17 @@ $(document).ready(function() {
306
306
  })
307
307
  return true;
308
308
  });
309
- $('span.mark_heading, span.in_place_editor_field[data-ie_mode="inline_checkbox"]').live('click', function(event) {
309
+ $(document).on('click', 'span.mark_heading, span.in_place_editor_field[data-ie_mode="inline_checkbox"]', function(event) {
310
310
  ActiveScaffold.process_checkbox_inplace_edit($(this).find('input:checkbox'), ActiveScaffold.inplace_edit_options($(this)));
311
311
  return true;
312
312
  });
313
- $('tr.record').live('as:list_row_loaded', function(event) {
313
+ $(document).on('as:list_row_loaded', 'tr.record', function(event) {
314
314
  $(this).closest("tr").find('td > span.in_place_editor_field[data-ie_mode!="inline_checkbox"]').each(function(index) {
315
315
  ActiveScaffold.create_inplace_editor($(this));
316
316
  });
317
317
  return true;
318
318
  });
319
- $('tr.inline-adapter-autoopen').live('as:list_row_loaded', function(event) {
319
+ $(document).on('as:list_row_loaded', 'tr.inline-adapter-autoopen', function(event) {
320
320
  var actionlink_controllers = $(event.target).attr('data-actionlink-controllers');
321
321
  if(actionlink_controllers) {
322
322
  actionlink_controllers = actionlink_controllers.split('::');
@@ -334,12 +334,12 @@ $(document).ready(function() {
334
334
  }
335
335
  return true;
336
336
  });
337
- $('form.as_form').live('ajax:before', function(event) {
337
+ $(document).on('ajax:before', 'form.as_form', function(event) {
338
338
  var as_form = $(this).closest("form");
339
339
  $(this).trigger('as:form_submit');
340
340
  return true;
341
341
  });
342
- $('form.as_form[data-remote!="true"]').live('submit', function(event) {
342
+ $(document).on('submit', 'form.as_form[data-remote!="true"]', function(event) {
343
343
  var as_form = $(this).closest("form");
344
344
  $(this).trigger('as:form_submit');
345
345
  return true;
@@ -553,11 +553,12 @@ var ActiveScaffold = {
553
553
  if (typeof(element) == 'string') element = '#' + element;
554
554
  element = $(element);
555
555
  var new_element = null;
556
+ var new_fragment = $(html);
556
557
  if((typeof(disable_event_trigger) == 'boolean') && disable_event_trigger == true) {
557
- new_element = $(html).replaceAll(element);
558
+ new_element = new_fragment.replaceAll(element).first();
558
559
  } else {
559
560
  ActiveScaffold.trigger_unload_events(element.find('[data-as_load]').andSelf());
560
- new_element = $(html).replaceAll(element);
561
+ new_element = new_fragment.replaceAll(element).first();
561
562
  ActiveScaffold.trigger_load_events(new_element.find('[data-as_load]').andSelf());
562
563
  }
563
564
  return new_element;
@@ -597,8 +598,8 @@ var ActiveScaffold = {
597
598
  as_form = $(as_form)
598
599
  var loading_indicator = $('#' + as_form.attr('id').replace(/-form$/, '-loading-indicator'));
599
600
  if (loading_indicator) loading_indicator.css('visibility','visible');
600
- $('input[type=submit]', as_form).attr('disabled', 'disabled');
601
- $("input:enabled,select:enabled,textarea:enabled", as_form).attr('disabled', 'disabled');
601
+ $('input[type=submit]', as_form).prop('disabled', true);
602
+ $("input:enabled,select:enabled,textarea:enabled", as_form).prop('disabled', true);
602
603
  },
603
604
 
604
605
  enable_form: function(as_form) {
@@ -606,13 +607,16 @@ var ActiveScaffold = {
606
607
  as_form = $(as_form)
607
608
  var loading_indicator = $('#' + as_form.attr('id').replace(/-form$/, '-loading-indicator'));
608
609
  if (loading_indicator) loading_indicator.css('visibility','hidden');
609
- $('input[type=submit]', as_form).removeAttr('disabled');
610
- $("input:disabled,select:disabled,textarea:disabled", as_form).removeAttr('disabled');
610
+ $('input[type=submit]', as_form).prop('disabled', false);
611
+ $("input:disabled,select:disabled,textarea:disabled", as_form).prop('disabled', false);
611
612
  },
612
613
 
613
614
  focus_first_element_of_form: function(form_element) {
614
- if (typeof(form_element) == 'string') form_element = '#' + form_element;
615
- $(form_element + ":first *:input[type!=hidden]:first").focus();
615
+ if (typeof(form_element) == 'string') {
616
+ form_element = '#' + form_element;
617
+ form_element = $(form_element);
618
+ }
619
+ form_element.find("input[type!=hidden]:first").focus();
616
620
  },
617
621
 
618
622
  create_record_row: function(active_scaffold_id, html, options) {
@@ -699,10 +703,10 @@ var ActiveScaffold = {
699
703
  data: options['params'],
700
704
  dataType: options.ajax_data_type,
701
705
  after: function(request){
702
- checkbox.attr('disabled', 'disabled');
706
+ checkbox.prop('disabled', true);
703
707
  },
704
708
  complete: function(request){
705
- checkbox.removeAttr('disabled');
709
+ checkbox.prop('disabled', false);
706
710
  }
707
711
  });
708
712
  },
@@ -724,7 +728,7 @@ var ActiveScaffold = {
724
728
  highlight: function(element) {
725
729
  if (typeof(element) == 'string') element = $('#' + element);
726
730
  if (typeof(element.effect) == 'function') {
727
- element.effect("highlight", {}, 3000);
731
+ element.effect("highlight", {}, 1000);
728
732
  }
729
733
  },
730
734
 
@@ -1172,12 +1176,12 @@ ActiveScaffold.ActionLink.Record = ActiveScaffold.ActionLink.Abstract.extend({
1172
1176
 
1173
1177
  if (this.position == 'after') {
1174
1178
  this.target.after(this.wrap_with_adapter_html(content, should_refresh_data));
1175
- ActiveScaffold.trigger_load_events(this.target.next().find('[data-as_load]'));
1179
+ ActiveScaffold.trigger_load_events(this.target.next().find('.records').first().find('> [data-as_load]'));
1176
1180
  this.set_adapter(this.target.next());
1177
1181
  }
1178
1182
  else if (this.position == 'before') {
1179
1183
  this.target.before(this.wrap_with_adapter_html(content, should_refresh_data));
1180
- ActiveScaffold.trigger_load_events(this.target.prev().find('[data-as_load]'));
1184
+ ActiveScaffold.trigger_load_events(this.target.prev().find('.records').first().find('> [data-as_load]'));
1181
1185
  this.set_adapter(this.target.prev());
1182
1186
  }
1183
1187
  else {
@@ -1212,14 +1216,17 @@ ActiveScaffold.ActionLink.Record = ActiveScaffold.ActionLink.Abstract.extend({
1212
1216
 
1213
1217
  set_opened: function() {
1214
1218
  var should_refresh_data = (typeof(this.refresh_ur)== 'undefined');
1219
+ var new_adapter = null;
1215
1220
  if (this.position == 'after') {
1216
- var new_adapter = ActiveScaffold.replace(this.target.next(), this.wrap_with_adapter_html(this.target.next().children(':first-child').html(), should_refresh_data), true);
1217
- this.set_adapter(new_adapter);
1221
+ new_adapter = this.target.next();
1222
+ } else if (this.position == 'before') {
1223
+ new_adapter = this.target.prev();
1218
1224
  }
1219
- else if (this.position == 'before') {
1220
- var new_adapter = ActiveScaffold.replace(this.target.prev(), this.wrap_with_adapter_html(this.target.prev().children(':first-child').html(), should_refresh_data), true);
1221
- this.set_adapter(new_adapter);
1225
+ if (!new_adapter.hasClass('as_adapter')) {
1226
+ new_adapter = ActiveScaffold.replace(new_adapter, this.wrap_with_adapter_html(new_adapter.children(':first-child').html(), should_refresh_data), true);
1227
+ ActiveScaffold.trigger_load_events(new_adapter.find('.records').first().find('> [data-as_load]'));
1222
1228
  }
1229
+ this.set_adapter(new_adapter);
1223
1230
  this.disable();
1224
1231
  }
1225
1232
  });
@@ -2,7 +2,7 @@
2
2
  <%= ActiveScaffold::Bridges::DatePickerBridge.localization %>
3
3
 
4
4
  $(document).ready(function() {
5
- $('form.as_form, form.inplace_form').live('as:form_loaded', function(event) {
5
+ $(document).on('as:form_loaded', 'form.as_form, form.inplace_form', function(event) {
6
6
  var as_form = $(this).closest("form");
7
7
  as_form.find('input.datetime_picker').each(function(index) {
8
8
  var date_picker = $(this);
@@ -19,7 +19,7 @@ $(document).ready(function() {
19
19
  });
20
20
  return true;
21
21
  });
22
- $('form.as_form, form.inplace_form').live('as:form_unloaded', function(event) {
22
+ $(document).on('as:form_unloaded', 'form.as_form, form.inplace_form', function(event) {
23
23
  var as_form = $(this).closest("form");
24
24
  as_form.find('input.datetime_picker').each(function(index) {
25
25
  var date_picker = $(this);