active_scaffold_vho 3.0.31 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. data/Gemfile +9 -1
  2. data/Gemfile.lock +8 -79
  3. data/Rakefile +17 -20
  4. data/active_scaffold_vho.gemspec +374 -15
  5. data/{frontends/default → app/assets}/images/add.gif +0 -0
  6. data/{frontends/default → app/assets}/images/arrow_down.gif +0 -0
  7. data/{frontends/default → app/assets}/images/arrow_up.gif +0 -0
  8. data/{frontends/default → app/assets}/images/close.gif +0 -0
  9. data/{frontends/default → app/assets}/images/close_touch.png +0 -0
  10. data/{frontends/default → app/assets}/images/config.png +0 -0
  11. data/{frontends/default → app/assets}/images/cross.png +0 -0
  12. data/{frontends/default → app/assets}/images/gears.png +0 -0
  13. data/{frontends/default → app/assets}/images/indicator-small.gif +0 -0
  14. data/{frontends/default → app/assets}/images/indicator.gif +0 -0
  15. data/{frontends/default → app/assets}/images/magnifier.png +0 -0
  16. data/app/assets/javascripts/active_scaffold.js.erb +12 -0
  17. data/{frontends/default → app/assets}/javascripts/jquery/active_scaffold.js +73 -245
  18. data/app/assets/javascripts/jquery/date_picker_bridge.js.erb +24 -0
  19. data/app/assets/javascripts/jquery/jquery-ui-timepicker-addon.js +1060 -0
  20. data/{frontends/default → app/assets}/javascripts/jquery/jquery.editinplace.js +1 -1
  21. data/{lib/active_scaffold/bridges/tiny_mce/public → app/assets}/javascripts/jquery/tiny_mce_bridge.js +4 -3
  22. data/{frontends/default → app/assets}/javascripts/prototype/active_scaffold.js +36 -122
  23. data/{frontends/default → app/assets}/javascripts/prototype/dhtml_history.js +0 -0
  24. data/{frontends/default → app/assets}/javascripts/prototype/form_enhancements.js +0 -0
  25. data/{frontends/default → app/assets}/javascripts/prototype/rico_corner.js +0 -0
  26. data/{frontends/default/stylesheets/stylesheet-ie.css → app/assets/stylesheets/active_scaffold-ie.css} +0 -0
  27. data/{frontends/default/stylesheets/stylesheet.css → app/assets/stylesheets/active_scaffold.css.erb} +24 -22
  28. data/app/assets/stylesheets/jquery-ui-timepicker-addon.css +6 -0
  29. data/frontends/default/views/_action_group.html.erb +1 -1
  30. data/frontends/default/views/_base_form.html.erb +1 -1
  31. data/frontends/default/views/_form_association_footer.html.erb +11 -7
  32. data/frontends/default/views/_horizontal_subform_record.html.erb +5 -9
  33. data/frontends/default/views/_list.html.erb +1 -2
  34. data/frontends/default/views/_list_inline_adapter.html.erb +10 -0
  35. data/frontends/default/views/_list_messages.html.erb +2 -2
  36. data/frontends/default/views/_list_pagination.html.erb +6 -3
  37. data/frontends/default/views/_list_pagination_links.html.erb +9 -0
  38. data/frontends/default/views/_list_record.html.erb +2 -1
  39. data/frontends/default/views/_list_record_columns.html.erb +2 -1
  40. data/frontends/default/views/_list_with_header.html.erb +1 -1
  41. data/frontends/default/views/_messages.html.erb +0 -1
  42. data/frontends/default/views/_render_field.js.erb +13 -0
  43. data/frontends/default/views/_vertical_subform_record.html.erb +5 -9
  44. data/frontends/default/views/add_existing.js.erb +20 -0
  45. data/frontends/default/views/destroy.js.erb +24 -0
  46. data/frontends/default/views/{edit_associated.js.rjs → edit_associated.js.erb} +3 -2
  47. data/frontends/default/views/form_messages.js.erb +1 -0
  48. data/frontends/default/views/list.js.erb +1 -0
  49. data/frontends/default/views/on_action_update.js.erb +13 -0
  50. data/frontends/default/views/on_create.js.erb +45 -0
  51. data/frontends/default/views/on_mark_all.js.erb +12 -0
  52. data/frontends/default/views/on_update.js.erb +31 -0
  53. data/frontends/default/views/update_column.js.erb +16 -0
  54. data/frontends/default/views/update_row.js.erb +1 -0
  55. data/init.rb +1 -7
  56. data/lib/active_scaffold/actions/delete.rb +3 -5
  57. data/lib/active_scaffold/actions/field_search.rb +2 -6
  58. data/lib/active_scaffold/actions/list.rb +16 -14
  59. data/lib/active_scaffold/actions/search.rb +3 -3
  60. data/lib/active_scaffold/active_record_permissions.rb +2 -25
  61. data/lib/active_scaffold/attribute_params.rb +21 -44
  62. data/lib/active_scaffold/bridges/calendar_date_select/bridge.rb +1 -1
  63. data/lib/active_scaffold/bridges/date_picker/bridge.rb +2 -16
  64. data/lib/active_scaffold/bridges/date_picker/lib/datepicker_bridge.rb +86 -56
  65. data/lib/active_scaffold/bridges/file_column/bridge.rb +1 -1
  66. data/lib/active_scaffold/bridges/file_column/lib/as_file_column_bridge.rb +1 -1
  67. data/lib/active_scaffold/bridges/file_column/lib/file_column_helpers.rb +1 -1
  68. data/lib/active_scaffold/bridges/paperclip/bridge.rb +1 -1
  69. data/lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge_helpers.rb +2 -2
  70. data/lib/active_scaffold/bridges/shared/date_bridge.rb +3 -3
  71. data/lib/active_scaffold/bridges/tiny_mce/bridge.rb +0 -12
  72. data/lib/active_scaffold/bridges/validation_reflection/lib/validation_reflection_bridge.rb +1 -1
  73. data/lib/active_scaffold/config/base.rb +1 -1
  74. data/lib/active_scaffold/config/core.rb +1 -8
  75. data/lib/active_scaffold/config/delete.rb +1 -1
  76. data/lib/active_scaffold/config/field_search.rb +1 -22
  77. data/lib/active_scaffold/config/list.rb +10 -18
  78. data/lib/active_scaffold/data_structures/action_link.rb +9 -0
  79. data/lib/active_scaffold/data_structures/action_links.rb +1 -1
  80. data/lib/active_scaffold/data_structures/column.rb +4 -30
  81. data/lib/active_scaffold/data_structures/nested_info.rb +3 -3
  82. data/lib/active_scaffold/data_structures/sorting.rb +1 -1
  83. data/lib/active_scaffold/engine.rb +8 -0
  84. data/lib/active_scaffold/extensions/action_controller_rendering.rb +22 -0
  85. data/lib/active_scaffold/extensions/action_view_rendering.rb +79 -59
  86. data/lib/active_scaffold/extensions/action_view_resolver.rb +4 -2
  87. data/lib/active_scaffold/extensions/active_association_reflection.rb +3 -3
  88. data/lib/active_scaffold/extensions/reverse_associations.rb +3 -3
  89. data/lib/active_scaffold/finder.rb +27 -39
  90. data/lib/active_scaffold/helpers/association_helpers.rb +3 -3
  91. data/lib/active_scaffold/helpers/form_column_helpers.rb +3 -3
  92. data/lib/active_scaffold/helpers/human_condition_helpers.rb +2 -4
  93. data/lib/active_scaffold/helpers/list_column_helpers.rb +16 -22
  94. data/lib/active_scaffold/helpers/search_column_helpers.rb +1 -1
  95. data/lib/active_scaffold/helpers/view_helpers.rb +35 -13
  96. data/lib/active_scaffold/locale/de.rb +120 -0
  97. data/lib/active_scaffold/locale/en.rb +119 -0
  98. data/lib/active_scaffold/version.rb +2 -2
  99. data/lib/active_scaffold.rb +12 -27
  100. data/lib/active_scaffold_env.rb +3 -3
  101. data/test/mock_app/public/stylesheets/active_scaffold/default/stylesheet.css +1 -1
  102. metadata +84 -86
  103. data/.gitignore +0 -42
  104. data/frontends/default/views/_render_field.js.rjs +0 -10
  105. data/frontends/default/views/add_existing.js.rjs +0 -17
  106. data/frontends/default/views/destroy.js.rjs +0 -23
  107. data/frontends/default/views/form_messages.js.rjs +0 -1
  108. data/frontends/default/views/list.js.rjs +0 -1
  109. data/frontends/default/views/on_action_update.js.rjs +0 -10
  110. data/frontends/default/views/on_create.js.rjs +0 -41
  111. data/frontends/default/views/on_mark_all.js.rjs +0 -12
  112. data/frontends/default/views/on_update.js.rjs +0 -28
  113. data/frontends/default/views/update_column.js.rjs +0 -13
  114. data/frontends/default/views/update_row.js.rjs +0 -1
  115. data/lib/active_scaffold/bridges/date_picker/public/javascripts/date_picker_bridge.js +0 -36
  116. data/lib/active_scaffold/bridges/tiny_mce/public/javascripts/prototype/tiny_mce_bridge.js +0 -21
  117. data/lib/active_scaffold/locale/de.yml +0 -120
  118. data/lib/active_scaffold/locale/en.yml +0 -115
  119. data/lib/active_scaffold_assets.rb +0 -45
@@ -1,18 +1,5 @@
1
1
  $(document).ready(function() {
2
- $(document).on('ajax:before', 'form.as_form', function(event) {
3
- var as_form = $(this).closest("form");
4
- $(this).find('.association-record-new').each(function(index) {
5
- var record_action = 'empty';
6
-
7
- if(ActiveScaffold.form_elements_changed($(this).find('input, textarea, select'))) {
8
- record_action = 'create';
9
- }
10
- $(this).find('input.associated_action').val(record_action);
11
- });
12
- return true;
13
- });
14
-
15
- $(document).on('ajax:beforeSend', 'form.as_form', function(event) {
2
+ $('form.as_form').live('ajax:loading', function(event) {
16
3
  var as_form = $(this).closest("form");
17
4
  if (as_form && as_form.attr('data-loading') == 'true') {
18
5
  ActiveScaffold.disable_form(as_form);
@@ -20,26 +7,26 @@ $(document).ready(function() {
20
7
  return true;
21
8
  });
22
9
 
23
- $(document).on('ajax:complete', 'form.as_form', function(event) {
10
+ $('form.as_form').live('ajax:complete', function(event) {
24
11
  var as_form = $(this).closest("form");
25
12
  if (as_form && as_form.attr('data-loading') == 'true') {
26
13
  ActiveScaffold.enable_form(as_form);
27
14
  }
28
15
  });
29
- $(document).on('ajax:error', 'form.as_form', function(event) {
16
+ $('form.as_form').live('ajax:error', function(event, xhr, status, error) {
30
17
  var as_div = $(this).closest("div.active-scaffold");
31
18
  if (as_div) {
32
19
  ActiveScaffold.report_500_response(as_div)
33
20
  }
34
21
  });
35
- $(document).on('submit', 'form.as_form.as_remote_upload', function(event) {
22
+ $('form.as_form.as_remote_upload').live('submit', function(event) {
36
23
  var as_form = $(this).closest("form");
37
24
  if (as_form && as_form.attr('data-loading') == 'true') {
38
25
  setTimeout("ActiveScaffold.disable_form('" + as_form.attr('id') + "')", 10);
39
26
  }
40
27
  return true;
41
28
  });
42
- $(document).on('ajax:before', 'a.as_action', function(event) {
29
+ $('a.as_action').live('ajax:before', function(event) {
43
30
  var action_link = ActiveScaffold.ActionLink.get($(this));
44
31
  if (action_link) {
45
32
  if (action_link.is_disabled()) {
@@ -47,7 +34,6 @@ $(document).ready(function() {
47
34
  } else {
48
35
  // hack: jquery requires if you request for javascript that javascript
49
36
  // is coming back, however rails has a different mantra
50
- // Not needed anymore just included for backwards compatibility with jquery_vho
51
37
  if (action_link.position) {
52
38
  if (parseFloat($.fn.jquery) >= 1.5) {
53
39
  event.data_type = 'text';
@@ -55,23 +41,13 @@ $(document).ready(function() {
55
41
  event.data_type = 'rails';
56
42
  }
57
43
  }
58
-
59
44
  if (action_link.loading_indicator) action_link.loading_indicator.css('visibility','visible');
60
45
  action_link.disable();
61
46
  }
62
47
  }
63
48
  return true;
64
49
  });
65
- $(document).on('ajax:beforeSend', 'a.as_action', function(event, xhr, settings) {
66
- xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script);
67
- var action_link = ActiveScaffold.ActionLink.get($(this));
68
- if (action_link && action_link.position) {
69
- settings.dataType = 'text';
70
- settings.dataTypes = ['text'];
71
- }
72
- return true;
73
- });
74
- $(document).on('ajax:success', 'a.as_action', function(event, response) {
50
+ $('a.as_action').live('ajax:success', function(event, response) {
75
51
  var action_link = ActiveScaffold.ActionLink.get($(this));
76
52
  if (action_link) {
77
53
  if (action_link.position) {
@@ -84,14 +60,14 @@ $(document).ready(function() {
84
60
  }
85
61
  return true;
86
62
  });
87
- $(document).on('ajax:complete', 'a.as_action', function(event) {
63
+ $('a.as_action').live('ajax:complete', function(event) {
88
64
  var action_link = ActiveScaffold.ActionLink.get($(this));
89
65
  if (action_link) {
90
66
  if (action_link.loading_indicator) action_link.loading_indicator.css('visibility','hidden');
91
67
  }
92
68
  return true;
93
69
  });
94
- $(document).on('ajax:error', 'a.as_action', function(event) {
70
+ $('a.as_action').live('ajax:error', function(event, xhr, status, error) {
95
71
  var action_link = ActiveScaffold.ActionLink.get($(this));
96
72
  if (action_link) {
97
73
  ActiveScaffold.report_500_response(action_link.scaffold_id());
@@ -99,7 +75,7 @@ $(document).ready(function() {
99
75
  }
100
76
  return true;
101
77
  });
102
- $(document).on('ajax:before', 'a.as_cancel', function(event) {
78
+ $('a.as_cancel').live('ajax:before', function(event) {
103
79
  var as_cancel = $(this);
104
80
  var action_link = ActiveScaffold.find_action_link(as_cancel);
105
81
 
@@ -108,7 +84,6 @@ $(document).ready(function() {
108
84
  var refresh_data = as_cancel.attr('data-refresh');
109
85
  if (refresh_data === 'true' && action_link.refresh_url) {
110
86
  event.data_url = action_link.refresh_url;
111
- as_cancel.attr('href', action_link.refresh_url);
112
87
  if (action_link.position) event.data_type = 'html'
113
88
  } else if (refresh_data === 'false' || typeof(cancel_url) == 'undefined' || cancel_url.length == 0) {
114
89
  action_link.close();
@@ -117,18 +92,7 @@ $(document).ready(function() {
117
92
  }
118
93
  return true;
119
94
  });
120
- $(document).on('ajax:beforeSend', 'a.as_cancel', function(event, xhr, settings) {
121
- var as_cancel = $(this);
122
- var action_link = ActiveScaffold.find_action_link(as_cancel);
123
- var refresh_data = as_cancel.attr('data-refresh');
124
-
125
- if (action_link && action_link.position && refresh_data === 'true' && action_link.refresh_url) {
126
- settings.dataType = 'html';
127
- settings.dataTypes = ['html'];
128
- }
129
- return true;
130
- });
131
- $(document).on('ajax:success', 'a.as_cancel', function(event, response) {
95
+ $('a.as_cancel').live('ajax:success', function(event, response) {
132
96
  var action_link = ActiveScaffold.find_action_link($(this));
133
97
 
134
98
  if (action_link) {
@@ -140,69 +104,47 @@ $(document).ready(function() {
140
104
  }
141
105
  return true;
142
106
  });
143
- $(document).on('ajax:error', 'a.as_cancel', function(event) {
107
+ $('a.as_cancel').live('ajax:error', function(event, xhr, status, error) {
144
108
  var action_link = ActiveScaffold.find_action_link($(this));
145
109
  if (action_link) {
146
110
  ActiveScaffold.report_500_response(action_link.scaffold_id());
147
111
  }
148
112
  return true;
149
113
  });
150
- $(document).on('ajax:before', 'a.as_sort', function(event) {
114
+ $('a.as_sort').live('ajax:before', function(event) {
151
115
  var as_sort = $(this);
152
116
  var history_controller_id = as_sort.attr('data-page-history');
153
117
  if (history_controller_id) addActiveScaffoldPageToHistory(as_sort.attr('href'), history_controller_id);
154
118
  as_sort.closest('th').addClass('loading');
155
119
  return true;
156
120
  });
157
- $(document).on('ajax:error', 'a.as_sort', function(event) {
121
+ $('a.as_sort').live('ajax:error', function(event, xhr, status, error) {
158
122
  var as_scaffold = $(this).closest('.active-scaffold');
159
123
  ActiveScaffold.report_500_response(as_scaffold);
160
124
  return true;
161
125
  });
162
- $(document).on('ajax:before','div.active-scaffold-footer .pagination a', function(event) {
126
+ $('a.as_paginate').live('ajax:before',function(event) {
163
127
  var as_paginate = $(this);
164
- var loading_indicator = as_paginate.closest('.pagination').find('img.loading-indicator').first();
165
128
  var history_controller_id = as_paginate.attr('data-page-history');
166
129
  if (history_controller_id) addActiveScaffoldPageToHistory(as_paginate.attr('href'), history_controller_id);
167
-
168
- if (loading_indicator == null || loading_indicator.length == 0) {
169
- var table_loading_indicator = as_paginate.closest('div.active-scaffold').find('div.actions img.loading-indicator').first();
170
- loading_indicator = table_loading_indicator.clone();
171
- loading_indicator.attr('id', null);
172
- as_paginate.closest('.pagination').prepend(loading_indicator);
173
- }
174
- loading_indicator.css('visibility','visible');
130
+ as_paginate.prevAll('img.loading-indicator').css('visibility','visible');
175
131
  return true;
176
132
  });
177
- $(document).on('ajax:error', 'div.active-scaffold-footer .pagination a', function(event) {
133
+ $('a.as_paginate').live('ajax:error', function(event, xhr, status, error) {
178
134
  var as_scaffold = $(this).closest('.active-scaffold');
179
135
  ActiveScaffold.report_500_response(as_scaffold);
180
136
  return true;
181
137
  });
182
- $(document).on('ajax:complete', 'div.active-scaffold-footer .pagination a', function(event) {
138
+ $('a.as_paginate').live('ajax:complete', function(event) {
183
139
  $(this).prevAll('img.loading-indicator').css('visibility','hidden');
184
140
  return true;
185
141
  });
186
- $(document).on('ajax:before', 'a.as_add_existing', function(event) {
187
- var selected_id = $(this).prev().val();
188
- if (selected_id) {
189
- var url = $(this).attr('href').replace('--ID--', $(this).prev().val());
190
- $(this).attr('href', url);
191
- event.data_url = url;
192
- return true;
193
- } else {
194
- return false;
195
- }
196
-
197
- });
198
- $(document).on('click', 'a.as_destroy_existing', function(event) {
199
- var associated_record = $(this).closest('tr.association-record');
200
- ActiveScaffold.delete_subform_record(associated_record);
201
- event.stopPropagation();
202
- return false;
142
+ $('input[type=button].as_add_existing').live('ajax:before', function(event) {
143
+ var url = $(this).attr('href').replace('--ID--', $(this).prev().val());
144
+ event.data_url = url;
145
+ return true;
203
146
  });
204
-
205
- $(document).on('change', 'input.update_form, textarea.update_form, select.update_form', function(event) {
147
+ $('input.update_form, select.update_form').live('change', function(event) {
206
148
  var element = $(this);
207
149
  var as_form = element.closest('form.as_form');
208
150
  var params = null;
@@ -222,11 +164,14 @@ $(document).ready(function() {
222
164
  $.ajax({
223
165
  url: element.attr('data-update_url'),
224
166
  data: params,
225
- beforeSend: function(event) {
167
+ beforeSend: function(xhr, settings) {
226
168
  element.nextAll('img.loading-indicator').css('visibility','visible');
227
- ActiveScaffold.disable_form(as_form)
169
+ ActiveScaffold.disable_form(as_form);
170
+ if (settings.dataType === undefined || settings.dataType === 'text') {
171
+ xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script);
172
+ }
228
173
  },
229
- complete: function(event) {
174
+ complete: function(xhr, status) {
230
175
  element.nextAll('img.loading-indicator').css('visibility','hidden');
231
176
  ActiveScaffold.enable_form(as_form)
232
177
  },
@@ -240,12 +185,12 @@ $(document).ready(function() {
240
185
  return true;
241
186
  });
242
187
 
243
- $(document).on('change', 'select.as_search_range_option', function(event) {
188
+ $('select.as_search_range_option').live('change', function(event) {
244
189
  ActiveScaffold[$(this).val() == 'BETWEEN' ? 'show' : 'hide']($(this).parent().find('.as_search_range_between'));
245
190
  return true;
246
191
  });
247
192
 
248
- $(document).on('change', 'select.as_search_range_option', function(event) {
193
+ $('select.as_search_range_option').live('change', function(event) {
249
194
  var element = $(this);
250
195
  ActiveScaffold[!(element.val() == 'PAST' || element.val() == 'FUTURE' || element.val() == 'RANGE') ? 'show' : 'hide'](element.attr('id').replace(/_opt/, '_numeric'));
251
196
  ActiveScaffold[(element.val() == 'PAST' || element.val() == 'FUTURE') ? 'show' : 'hide'](element.attr('id').replace(/_opt/, '_trend'));
@@ -253,18 +198,18 @@ $(document).ready(function() {
253
198
  return true;
254
199
  });
255
200
 
256
- $(document).on('change', 'select.as_update_date_operator', function(event) {
201
+ $('select.as_update_date_operator').live('change', function(event) {
257
202
  ActiveScaffold[$(this).val() == 'REPLACE' ? 'show' : 'hide']($(this).next());
258
203
  ActiveScaffold[$(this).val() == 'REPLACE' ? 'hide' : 'show']($(this).next().next());
259
204
  return true;
260
205
  });
261
206
 
262
- $(document).on('click', 'a[data-popup]', function(e) {
207
+ $('a[data-popup]').live('click', function(e) {
263
208
  window.open($(this).attr('href'));
264
209
  e.preventDefault();
265
210
  });
266
211
 
267
- $(document).on("click", '.hover_click', function(event) {
212
+ $('.hover_click').live("click", function(event) {
268
213
  var element = $(this);
269
214
  var ul_element = element.children('ul').first();
270
215
  if (ul_element.is(':visible')) {
@@ -274,76 +219,39 @@ $(document).ready(function() {
274
219
  }
275
220
  return false;
276
221
  });
277
- $(document).on('click', '.hover_click a.as_action', function(event) {
222
+ $('.hover_click a.as_action').live('click', function(event) {
278
223
  var element = $(this).closest('.hover_click');
279
224
  if (element) {
280
225
  element.find('ul').hide();
281
226
  }
282
227
  return true;
283
228
  });
284
- $(document).on('as:form_loaded', 'form.as_form', function(event) {
229
+ $('form.as_form').live('as:form_loaded', function(event) {
285
230
  var as_form = $(this).closest("form");
286
231
  ActiveScaffold.focus_first_element_of_form(as_form);
287
232
  return true;
288
233
  });
289
- $(document).on('as:form_element_loaded', 'li.horizontal-sub-form', function(event) {
290
- $(this).find('a.as_associated_form_link').each(function(index) {
291
- ActiveScaffold.show($(this));
292
- //Show select Box for add_existing as well
293
- if($(this).has('as_add_existing')) {
294
- ActiveScaffold.show($(this).prev());
295
- }
296
- })
297
- return true;
298
- });
299
- $(document).on('as:form_element_loaded', 'li.sub-form', function(event) {
300
- $(this).find('.association-record-new').each(function(index) {
301
- $(this).find('input, textarea, select').each(function(index) {
302
- $(this).data('value_was', $(this).val());
303
- })
304
- })
305
- return true;
306
- });
307
- $(document).on('click', 'span.mark_heading, span.in_place_editor_field[data-ie_mode="inline_checkbox"]', function(event) {
234
+ $('span.mark_heading, span.in_place_editor_field[data-ie_mode="inline_checkbox"]').live('click', function(event) {
308
235
  ActiveScaffold.process_checkbox_inplace_edit($(this).find('input:checkbox'), ActiveScaffold.inplace_edit_options($(this)));
309
236
  return true;
310
237
  });
311
- $(document).on('as:list_row_loaded', 'tr.record', function(event) {
238
+ $('tr.record').live('as:list_row_loaded', function(event) {
312
239
  $(this).closest("tr").find('td > span.in_place_editor_field[data-ie_mode!="inline_checkbox"]').each(function(index) {
313
240
  ActiveScaffold.create_inplace_editor($(this));
314
241
  });
315
242
  return true;
316
243
  });
317
- $(document).on('as:list_row_loaded', 'tr.inline-adapter-autoopen', function(event) {
318
- var actionlink_controllers = $(event.target).attr('data-actionlink-controllers');
319
- if(actionlink_controllers) {
320
- actionlink_controllers = actionlink_controllers.split('::');
321
- $(this).prev('tr').find('a.index').each(function(index) {
322
- var action_link = $(this);
323
- for (var i = 0; i < actionlink_controllers.length; i++) {
324
- if (actionlink_controllers[i] === action_link.attr('data-controller')) {
325
- var as_action_link = ActiveScaffold.ActionLink.get(action_link);
326
- if (as_action_link) {
327
- as_action_link.set_opened();
328
- }
329
- }
330
- }
331
- });
332
- }
333
- return true;
334
- });
335
- $(document).on('ajax:before', 'form.as_form', function(event) {
244
+ $('form.as_form').live('ajax:before', function(event) {
336
245
  var as_form = $(this).closest("form");
337
246
  $(this).trigger('as:form_submit');
338
247
  return true;
339
248
  });
340
- $(document).on('submit', 'form.as_form[data-remote!="true"]', function(event) {
249
+ $('form.as_form[data-remote!="true"]').live('submit', function(event) {
341
250
  var as_form = $(this).closest("form");
342
251
  $(this).trigger('as:form_submit');
343
252
  return true;
344
253
  });
345
254
  ActiveScaffold.trigger_load_events($('[data-as_load]'));
346
- ActiveScaffold.load_embedded_conrollers();
347
255
 
348
256
  });
349
257
 
@@ -547,18 +455,12 @@ var ActiveScaffold = {
547
455
  ActiveScaffold.highlight(replaced);
548
456
  },
549
457
 
550
- replace: function(element, html, disable_event_trigger) {
458
+ replace: function(element, html) {
551
459
  if (typeof(element) == 'string') element = '#' + element;
552
460
  element = $(element);
553
- var new_element = null;
554
- var new_fragment = $(html);
555
- if((typeof(disable_event_trigger) == 'boolean') && disable_event_trigger == true) {
556
- new_element = new_fragment.replaceAll(element).first();
557
- } else {
558
- ActiveScaffold.trigger_unload_events(element.find('[data-as_load]').andSelf());
559
- new_element = new_fragment.replaceAll(element).first();
560
- ActiveScaffold.trigger_load_events(new_element.find('[data-as_load]').andSelf());
561
- }
461
+ ActiveScaffold.trigger_unload_events(element.find('[data-as_load]').andSelf());
462
+ var new_element = $(html).replaceAll(element);
463
+ ActiveScaffold.trigger_load_events(new_element.find('[data-as_load]').andSelf());
562
464
  return new_element;
563
465
  },
564
466
 
@@ -596,8 +498,8 @@ var ActiveScaffold = {
596
498
  as_form = $(as_form)
597
499
  var loading_indicator = $('#' + as_form.attr('id').replace(/-form$/, '-loading-indicator'));
598
500
  if (loading_indicator) loading_indicator.css('visibility','visible');
599
- $('input[type=submit]', as_form).prop('disabled', true);
600
- $("input:enabled,select:enabled,textarea:enabled", as_form).prop('disabled', true);
501
+ $('input[type=submit]', as_form).attr('disabled', 'disabled');
502
+ $("input:enabled,select:enabled,textarea:enabled", as_form).attr('disabled', 'disabled');
601
503
  },
602
504
 
603
505
  enable_form: function(as_form) {
@@ -605,16 +507,13 @@ var ActiveScaffold = {
605
507
  as_form = $(as_form)
606
508
  var loading_indicator = $('#' + as_form.attr('id').replace(/-form$/, '-loading-indicator'));
607
509
  if (loading_indicator) loading_indicator.css('visibility','hidden');
608
- $('input[type=submit]', as_form).prop('disabled', false);
609
- $("input:disabled,select:disabled,textarea:disabled", as_form).prop('disabled', false);
510
+ $('input[type=submit]', as_form).removeAttr('disabled');
511
+ $("input:disabled,select:disabled,textarea:disabled", as_form).removeAttr('disabled');
610
512
  },
611
513
 
612
514
  focus_first_element_of_form: function(form_element) {
613
- if (typeof(form_element) == 'string') {
614
- form_element = '#' + form_element;
615
- form_element = $(form_element);
616
- }
617
- form_element.find("input[type!=hidden]:first").focus();
515
+ if (typeof(form_element) == 'string') form_element = '#' + form_element;
516
+ $(form_element + ":first *:input[type!=hidden]:first").focus();
618
517
  },
619
518
 
620
519
  create_record_row: function(active_scaffold_id, html, options) {
@@ -668,12 +567,11 @@ var ActiveScaffold = {
668
567
  if (errors.hasClass('association-record-errors')) {
669
568
  this.replace_html(errors, '');
670
569
  }
671
- record.find('input.associated_action').val('delete');
672
- this.hide(record);
570
+ this.remove(record);
673
571
  },
674
572
 
675
573
  report_500_response: function(active_scaffold_id) {
676
- server_error = $(active_scaffold_id).find('td.messages-container p.server-error').filter(":first");
574
+ server_error = $(active_scaffold_id).find('td.messages-container p.server-error');
677
575
  if (!$(server_error).is(':visible')) {
678
576
  server_error.show();
679
577
  }
@@ -701,10 +599,10 @@ var ActiveScaffold = {
701
599
  data: options['params'],
702
600
  dataType: options.ajax_data_type,
703
601
  after: function(request){
704
- checkbox.prop('disabled', true);
602
+ checkbox.attr('disabled', 'disabled');
705
603
  },
706
604
  complete: function(request){
707
- checkbox.prop('disabled', false);
605
+ checkbox.removeAttr('disabled');
708
606
  }
709
607
  });
710
608
  },
@@ -726,7 +624,7 @@ var ActiveScaffold = {
726
624
  highlight: function(element) {
727
625
  if (typeof(element) == 'string') element = $('#' + element);
728
626
  if (typeof(element.effect) == 'function') {
729
- element.effect("highlight", {}, 1000);
627
+ element.effect("highlight", {}, 3000);
730
628
  }
731
629
  },
732
630
 
@@ -835,15 +733,7 @@ var ActiveScaffold = {
835
733
  hover_class: 'hover',
836
734
  element_id: 'editor_id',
837
735
  ajax_data_type: "script",
838
- update_value: 'value',
839
- delegate: {didOpenEditInPlace: function(aDOMNode, aSettingsDict) {
840
- ActiveScaffold.trigger_load_events(aDOMNode.find('[data-as_load]'));
841
- return true;
842
- },
843
- shouldCloseEditInPlace: function(aDOMNode, aSettingsDict) {
844
- ActiveScaffold.trigger_unload_events(aDOMNode.find('[data-as_load]'));
845
- return true;
846
- }}},
736
+ update_value: 'value'},
847
737
  csrf_param = $('meta[name=csrf-param]').first(),
848
738
  csrf_token = $('meta[name=csrf-token]').first(),
849
739
  my_parent = span.parent(),
@@ -930,29 +820,6 @@ var ActiveScaffold = {
930
820
  break;
931
821
  }
932
822
  });
933
- },
934
-
935
- load_embedded_conrollers: function(){
936
- $.each($('a.as_link_to_component'), function(index) {
937
- var div_element = $(this).closest('div.active-scaffold-component');
938
- div_element.load($(this).attr('href').append_params({embedded: true}), function() {
939
- ActiveScaffold.trigger_load_events($(this).find('[data-as_load]'));
940
- });
941
- });
942
- },
943
-
944
- form_elements_changed: function(form_elements){
945
- var form_elements_count = form_elements.length;
946
- var i = 0;
947
- var changed = false;
948
-
949
- while(changed === false && i < form_elements_count) {
950
- if($(form_elements[i]).val() != $(form_elements[i]).data('value_was')) {
951
- changed = true;
952
- }
953
- i++;
954
- }
955
- return changed;
956
823
  }
957
824
  }
958
825
 
@@ -1053,7 +920,7 @@ ActiveScaffold.ActionLink.Abstract = Class.extend({
1053
920
  this.hide_target = false;
1054
921
  this.position = this.tag.attr('data-position');
1055
922
  this.action = this.tag.attr('data-action');
1056
-
923
+
1057
924
  this.tag.data('action_link', this);
1058
925
  return this;
1059
926
  },
@@ -1112,24 +979,6 @@ ActiveScaffold.ActionLink.Abstract = Class.extend({
1112
979
  this.adapter = element;
1113
980
  this.adapter.addClass('as_adapter');
1114
981
  this.adapter.data('action_link', this);
1115
- },
1116
- wrap_with_adapter_html: function(content, should_refresh_data) {
1117
- // players_view class missing
1118
- var id_string = null;
1119
- var close_label = this.scaffold().attr('data-closelabel');
1120
- var controller = this.scaffold().attr('data-controller');
1121
-
1122
- if (this.tag.attr('data-controller')) {
1123
- controller = this.tag.attr('data-controller');
1124
- }
1125
-
1126
- if(this.target.hasClass('before-header')) {
1127
- id_string = this.target.attr('id').replace('search', 'nested');
1128
- } else {
1129
- id_string = this.target.attr('id').replace('list', 'nested');
1130
- }
1131
-
1132
- return '<tr class="inline-adapter" id="' + id_string + '"><td colspan="99" class="inline-adapter-cell"><div class="' + this.action + '-view ' + controller + '-view view"><a class="inline-adapter-close as_cancel" title="' + close_label + '" data-remote="true" data-refresh="' + should_refresh_data + '" href="">' + close_label +'</a>' + content + '</div></td></tr>'
1133
982
  }
1134
983
  });
1135
984
 
@@ -1140,15 +989,12 @@ ActiveScaffold.Actions.Record = ActiveScaffold.Actions.Abstract.extend({
1140
989
  instantiate_link: function(link) {
1141
990
  var l = new ActiveScaffold.ActionLink.Record(link, this.target, this.loading_indicator);
1142
991
  var refresh = this.target.attr('data-refresh');
1143
- if (refresh) {
1144
- l.refresh_url = refresh;
1145
- }
1146
-
1147
- if (l.position && l.tag.attr('data-action') == 'index') {
1148
- l.url = l.url.append_params({embedded: true});
1149
- l.tag.attr('href', l.url);
1150
- }
992
+ if (refresh) l.refresh_url = refresh;
1151
993
 
994
+ if (l.position) {
995
+ l.url = l.url.append_params({adapter: '_list_inline_adapter'});
996
+ l.tag.attr('href', l.url);
997
+ }
1152
998
  l.set = this;
1153
999
  return l;
1154
1000
  }
@@ -1167,7 +1013,6 @@ ActiveScaffold.ActionLink.Record = ActiveScaffold.ActionLink.Abstract.extend({
1167
1013
  },
1168
1014
 
1169
1015
  insert: function(content) {
1170
- var should_refresh_data = (typeof(this.refresh_ur)== 'undefined');
1171
1016
  this.close_previous_adapter();
1172
1017
 
1173
1018
  if (this.position == 'replace') {
@@ -1176,27 +1021,18 @@ ActiveScaffold.ActionLink.Record = ActiveScaffold.ActionLink.Abstract.extend({
1176
1021
  }
1177
1022
 
1178
1023
  if (this.position == 'after') {
1179
- this.target.after(this.wrap_with_adapter_html(content, should_refresh_data));
1180
- if(this.action == 'index') {
1181
- ActiveScaffold.trigger_load_events(this.target.next().find('.records').first().find('> [data-as_load]'));
1182
- } else {
1183
- ActiveScaffold.trigger_load_events(this.target.next().find('[data-as_load]'));
1184
- }
1024
+ this.target.after(content);
1025
+ ActiveScaffold.trigger_load_events(this.target.next().find('[data-as_load]'));
1185
1026
  this.set_adapter(this.target.next());
1186
1027
  }
1187
1028
  else if (this.position == 'before') {
1188
- this.target.before(this.wrap_with_adapter_html(content, should_refresh_data));
1189
- if (this.action == 'index') {
1190
- ActiveScaffold.trigger_load_events(this.target.prev().find('.records').first().find('> [data-as_load]'));
1191
- } else {
1192
- ActiveScaffold.trigger_load_events(this.target.prev().find('[data-as_load]'));
1193
- }
1029
+ this.target.before(content);
1030
+ ActiveScaffold.trigger_load_events(this.target.prev().find('[data-as_load]'));
1194
1031
  this.set_adapter(this.target.prev());
1195
1032
  }
1196
1033
  else {
1197
1034
  return false;
1198
1035
  }
1199
- this.update_flash_messages('');
1200
1036
  ActiveScaffold.highlight(this.adapter.find('td'));
1201
1037
  },
1202
1038
 
@@ -1224,22 +1060,12 @@ ActiveScaffold.ActionLink.Record = ActiveScaffold.ActionLink.Abstract.extend({
1224
1060
  },
1225
1061
 
1226
1062
  set_opened: function() {
1227
- var should_refresh_data = (typeof(this.refresh_ur)== 'undefined');
1228
- var new_adapter = null;
1229
1063
  if (this.position == 'after') {
1230
- new_adapter = this.target.next();
1231
- } else if (this.position == 'before') {
1232
- new_adapter = this.target.prev();
1064
+ this.set_adapter(this.target.next());
1233
1065
  }
1234
- if (!new_adapter.hasClass('as_adapter')) {
1235
- new_adapter = ActiveScaffold.replace(new_adapter, this.wrap_with_adapter_html(new_adapter.children(':first-child').html(), should_refresh_data), true);
1236
- if (this.action == 'index') {
1237
- ActiveScaffold.trigger_load_events(new_adapter.find('.records').first().find('> [data-as_load]'));
1238
- } else {
1239
- ActiveScaffold.trigger_load_events(new_adapter.find('[data-as_load]'));
1240
- }
1066
+ else if (this.position == 'before') {
1067
+ this.set_adapter(this.target.prev());
1241
1068
  }
1242
- this.set_adapter(new_adapter);
1243
1069
  this.disable();
1244
1070
  }
1245
1071
  });
@@ -1250,7 +1076,10 @@ ActiveScaffold.ActionLink.Record = ActiveScaffold.ActionLink.Abstract.extend({
1250
1076
  ActiveScaffold.Actions.Table = ActiveScaffold.Actions.Abstract.extend({
1251
1077
  instantiate_link: function(link) {
1252
1078
  var l = new ActiveScaffold.ActionLink.Table(link, this.target, this.loading_indicator);
1253
-
1079
+ if (l.position) {
1080
+ l.url = l.url.append_params({adapter: '_list_inline_adapter'});
1081
+ l.tag.attr('href', l.url);
1082
+ }
1254
1083
  return l;
1255
1084
  }
1256
1085
  });
@@ -1258,14 +1087,13 @@ ActiveScaffold.Actions.Table = ActiveScaffold.Actions.Abstract.extend({
1258
1087
  ActiveScaffold.ActionLink.Table = ActiveScaffold.ActionLink.Abstract.extend({
1259
1088
  insert: function(content) {
1260
1089
  if (this.position == 'top') {
1261
- this.target.prepend(this.wrap_with_adapter_html(content, false));
1090
+ this.target.prepend(content);
1262
1091
  ActiveScaffold.trigger_load_events(this.target.children().first().find('[data-as_load]'));
1263
1092
  this.set_adapter(this.target.children().first());
1264
1093
  }
1265
1094
  else {
1266
1095
  throw 'Unknown position "' + this.position + '"'
1267
1096
  }
1268
- this.update_flash_messages('');
1269
1097
  ActiveScaffold.highlight(this.adapter.find('td').first().children());
1270
1098
  }
1271
1099
  });
@@ -0,0 +1,24 @@
1
+ <%= ActiveScaffold::Bridges::DatePickerBridge.localization %>
2
+
3
+ $(document).ready(function() {
4
+ $('input.date_picker').live('focus', function(event) {
5
+ var date_picker = $(this);
6
+ if (typeof(date_picker.datepicker) == 'function') {
7
+ if (!date_picker.hasClass('hasDatepicker')) {
8
+ date_picker.datepicker();
9
+ date_picker.trigger('focus');
10
+ }
11
+ }
12
+ return true;
13
+ });
14
+ $('input.datetime_picker').live('focus', function(event) {
15
+ var date_picker = $(this);
16
+ if (typeof(date_picker.datetimepicker) == 'function') {
17
+ if (!date_picker.hasClass('hasDatepicker')) {
18
+ date_picker.datetimepicker();
19
+ date_picker.trigger('focus');
20
+ }
21
+ }
22
+ return true;
23
+ });
24
+ });