active_scaffold 3.1.17 → 3.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/assets/images/{add.gif → active_scaffold/add.gif} +0 -0
- data/app/assets/images/{arrow_down.gif → active_scaffold/arrow_down.gif} +0 -0
- data/app/assets/images/{arrow_up.gif → active_scaffold/arrow_up.gif} +0 -0
- data/app/assets/images/{close.gif → active_scaffold/close.gif} +0 -0
- data/app/assets/images/{close_touch.png → active_scaffold/close_touch.png} +0 -0
- data/app/assets/images/{config.png → active_scaffold/config.png} +0 -0
- data/app/assets/images/{cross.png → active_scaffold/cross.png} +0 -0
- data/app/assets/images/{gears.png → active_scaffold/gears.png} +0 -0
- data/app/assets/images/{indicator-small.gif → active_scaffold/indicator-small.gif} +0 -0
- data/app/assets/images/{indicator.gif → active_scaffold/indicator.gif} +0 -0
- data/app/assets/images/{magnifier.png → active_scaffold/magnifier.png} +0 -0
- data/app/assets/javascripts/jquery/active_scaffold.js +125 -125
- data/app/assets/javascripts/jquery/date_picker_bridge.js.erb +5 -5
- data/app/assets/javascripts/jquery/draggable_lists.js +9 -9
- data/app/assets/javascripts/jquery/tiny_mce_bridge.js +2 -2
- data/app/assets/stylesheets/active_scaffold.css.erb +166 -147
- data/app/assets/stylesheets/active_scaffold.css.erb~ +182 -147
- data/app/assets/stylesheets/blue-theme.css +74 -0
- data/app/assets/stylesheets/blue-theme.css~ +1150 -0
- data/frontends/default/views/_search.html.erb +3 -3
- data/lib/active_scaffold/actions/nested.rb +2 -2
- data/lib/active_scaffold/actions/nested.rb~ +3 -3
- data/lib/active_scaffold/data_structures/nested_info.rb +6 -2
- data/lib/active_scaffold/data_structures/nested_info.rb~ +7 -3
- data/lib/active_scaffold/helpers/search_column_helpers.rb +3 -1
- data/lib/active_scaffold/helpers/view_helpers.rb +1 -1
- data/lib/active_scaffold/version.rb +1 -1
- data/lib/active_scaffold.rb +2 -1
- data/lib/active_scaffold.rb~ +14 -4
- metadata +21 -19
@@ -1,33 +1,33 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
var as_form =
|
1
|
+
jQuery(document).ready(function() {
|
2
|
+
jQuery('form.as_form').live('ajax:beforeSend', function(event) {
|
3
|
+
var as_form = jQuery(this).closest("form");
|
4
4
|
if (as_form && as_form.attr('data-loading') == 'true') {
|
5
5
|
ActiveScaffold.disable_form(as_form);
|
6
6
|
}
|
7
7
|
return true;
|
8
8
|
});
|
9
9
|
|
10
|
-
|
11
|
-
var as_form =
|
10
|
+
jQuery('form.as_form').live('ajax:complete', function(event) {
|
11
|
+
var as_form = jQuery(this).closest("form");
|
12
12
|
if (as_form && as_form.attr('data-loading') == 'true') {
|
13
13
|
ActiveScaffold.enable_form(as_form);
|
14
14
|
}
|
15
15
|
});
|
16
|
-
|
17
|
-
var as_div =
|
16
|
+
jQuery('form.as_form').live('ajax:error', function(event, xhr, status, error) {
|
17
|
+
var as_div = jQuery(this).closest("div.active-scaffold");
|
18
18
|
if (as_div) {
|
19
19
|
ActiveScaffold.report_500_response(as_div)
|
20
20
|
}
|
21
21
|
});
|
22
|
-
|
23
|
-
var as_form =
|
22
|
+
jQuery('form.as_form.as_remote_upload').live('submit', function(event) {
|
23
|
+
var as_form = jQuery(this).closest("form");
|
24
24
|
if (as_form && as_form.attr('data-loading') == 'true') {
|
25
25
|
setTimeout("ActiveScaffold.disable_form('" + as_form.attr('id') + "')", 10);
|
26
26
|
}
|
27
27
|
return true;
|
28
28
|
});
|
29
|
-
|
30
|
-
var action_link = ActiveScaffold.ActionLink.get(
|
29
|
+
jQuery('a.as_action').live('ajax:before', function(event) {
|
30
|
+
var action_link = ActiveScaffold.ActionLink.get(jQuery(this));
|
31
31
|
if (action_link) {
|
32
32
|
if (action_link.is_disabled()) {
|
33
33
|
return false;
|
@@ -38,8 +38,8 @@ $(document).ready(function() {
|
|
38
38
|
}
|
39
39
|
return true;
|
40
40
|
});
|
41
|
-
|
42
|
-
var action_link = ActiveScaffold.ActionLink.get(
|
41
|
+
jQuery('a.as_action').live('ajax:success', function(event, response) {
|
42
|
+
var action_link = ActiveScaffold.ActionLink.get(jQuery(this));
|
43
43
|
if (action_link) {
|
44
44
|
if (action_link.position) {
|
45
45
|
action_link.insert(response);
|
@@ -47,27 +47,27 @@ $(document).ready(function() {
|
|
47
47
|
} else {
|
48
48
|
action_link.enable();
|
49
49
|
}
|
50
|
-
|
50
|
+
jQuery(this).trigger('as:action_success', action_link);
|
51
51
|
}
|
52
52
|
return true;
|
53
53
|
});
|
54
|
-
|
55
|
-
var action_link = ActiveScaffold.ActionLink.get(
|
54
|
+
jQuery('a.as_action').live('ajax:complete', function(event) {
|
55
|
+
var action_link = ActiveScaffold.ActionLink.get(jQuery(this));
|
56
56
|
if (action_link) {
|
57
57
|
if (action_link.loading_indicator) action_link.loading_indicator.css('visibility','hidden');
|
58
58
|
}
|
59
59
|
return true;
|
60
60
|
});
|
61
|
-
|
62
|
-
var action_link = ActiveScaffold.ActionLink.get(
|
61
|
+
jQuery('a.as_action').live('ajax:error', function(event, xhr, status, error) {
|
62
|
+
var action_link = ActiveScaffold.ActionLink.get(jQuery(this));
|
63
63
|
if (action_link) {
|
64
64
|
ActiveScaffold.report_500_response(action_link.scaffold_id());
|
65
65
|
action_link.enable();
|
66
66
|
}
|
67
67
|
return true;
|
68
68
|
});
|
69
|
-
|
70
|
-
var as_cancel =
|
69
|
+
jQuery('a.as_cancel').live('ajax:before', function(event) {
|
70
|
+
var as_cancel = jQuery(this);
|
71
71
|
var action_link = ActiveScaffold.find_action_link(as_cancel);
|
72
72
|
|
73
73
|
if (action_link) {
|
@@ -80,8 +80,8 @@ $(document).ready(function() {
|
|
80
80
|
}
|
81
81
|
return true;
|
82
82
|
});
|
83
|
-
|
84
|
-
var action_link = ActiveScaffold.find_action_link(
|
83
|
+
jQuery('a.as_cancel').live('ajax:success', function(event, response) {
|
84
|
+
var action_link = ActiveScaffold.find_action_link(jQuery(this));
|
85
85
|
|
86
86
|
if (action_link) {
|
87
87
|
if (action_link.position) {
|
@@ -92,100 +92,100 @@ $(document).ready(function() {
|
|
92
92
|
}
|
93
93
|
return true;
|
94
94
|
});
|
95
|
-
|
96
|
-
var action_link = ActiveScaffold.find_action_link(
|
95
|
+
jQuery('a.as_cancel').live('ajax:error', function(event, xhr, status, error) {
|
96
|
+
var action_link = ActiveScaffold.find_action_link(jQuery(this));
|
97
97
|
if (action_link) {
|
98
98
|
ActiveScaffold.report_500_response(action_link.scaffold_id());
|
99
99
|
}
|
100
100
|
return true;
|
101
101
|
});
|
102
|
-
|
103
|
-
var as_sort =
|
102
|
+
jQuery('a.as_sort').live('ajax:before', function(event) {
|
103
|
+
var as_sort = jQuery(this);
|
104
104
|
var history_controller_id = as_sort.attr('data-page-history');
|
105
105
|
if (history_controller_id) addActiveScaffoldPageToHistory(as_sort.attr('href'), history_controller_id);
|
106
106
|
as_sort.closest('th').addClass('loading');
|
107
107
|
return true;
|
108
108
|
});
|
109
|
-
|
110
|
-
var as_scaffold =
|
109
|
+
jQuery('a.as_sort').live('ajax:error', function(event, xhr, status, error) {
|
110
|
+
var as_scaffold = jQuery(this).closest('.active-scaffold');
|
111
111
|
ActiveScaffold.report_500_response(as_scaffold);
|
112
112
|
return true;
|
113
113
|
});
|
114
|
-
|
115
|
-
|
114
|
+
jQuery('span.in_place_editor_field').live('hover', function(event) {
|
115
|
+
jQuery(this).data(); // $ 1.4.2 workaround
|
116
116
|
if (event.type == 'mouseenter') {
|
117
|
-
if (typeof(
|
117
|
+
if (typeof(jQuery(this).data('editInPlace')) === 'undefined') jQuery(this).addClass("hover");
|
118
118
|
}
|
119
119
|
if (event.type == 'mouseleave') {
|
120
|
-
if (typeof(
|
120
|
+
if (typeof(jQuery(this).data('editInPlace')) === 'undefined') jQuery(this).removeClass("hover");
|
121
121
|
}
|
122
122
|
return true;
|
123
123
|
});
|
124
|
-
|
125
|
-
ActiveScaffold.in_place_editor_field_clicked(
|
124
|
+
jQuery('span.in_place_editor_field').live('click', function(event) {
|
125
|
+
ActiveScaffold.in_place_editor_field_clicked(jQuery(this));
|
126
126
|
});
|
127
|
-
|
128
|
-
var as_paginate =
|
127
|
+
jQuery('a.as_paginate').live('ajax:before',function(event) {
|
128
|
+
var as_paginate = jQuery(this);
|
129
129
|
var history_controller_id = as_paginate.attr('data-page-history');
|
130
130
|
if (history_controller_id) addActiveScaffoldPageToHistory(as_paginate.attr('href'), history_controller_id);
|
131
131
|
as_paginate.prevAll('img.loading-indicator').css('visibility','visible');
|
132
132
|
return true;
|
133
133
|
});
|
134
|
-
|
135
|
-
var as_scaffold =
|
134
|
+
jQuery('a.as_paginate').live('ajax:error', function(event, xhr, status, error) {
|
135
|
+
var as_scaffold = jQuery(this).closest('.active-scaffold');
|
136
136
|
ActiveScaffold.report_500_response(as_scaffold);
|
137
137
|
return true;
|
138
138
|
});
|
139
|
-
|
140
|
-
|
139
|
+
jQuery('a.as_paginate').live('ajax:complete', function(event) {
|
140
|
+
jQuery(this).prevAll('img.loading-indicator').css('visibility','hidden');
|
141
141
|
return true;
|
142
142
|
});
|
143
|
-
|
144
|
-
var id =
|
143
|
+
jQuery('a.as_add_existing, a.as_replace_existing').live('ajax:before', function(event) {
|
144
|
+
var id = jQuery(this).prev().val();
|
145
145
|
if (id) {
|
146
|
-
if (
|
147
|
-
|
146
|
+
if (!jQuery(this).data('href')) jQuery(this).data('href', jQuery(this).attr('href'));
|
147
|
+
jQuery(this).attr('href', jQuery(this).data('href').replace('--ID--', id));
|
148
148
|
return true;
|
149
149
|
} else return false;
|
150
150
|
});
|
151
|
-
|
152
|
-
var element =
|
151
|
+
jQuery('input.update_form:not(.recordselect), textarea.update_form, select.update_form').live('change', function(event) {
|
152
|
+
var element = jQuery(this);
|
153
153
|
var value = element.is("input:checkbox:not(:checked)") ? null : element.val();
|
154
154
|
ActiveScaffold.update_column(element, element.attr('data-update_url'), element.attr('data-update_send_form'), element.attr('id'), value);
|
155
155
|
return true;
|
156
156
|
});
|
157
|
-
|
158
|
-
var element =
|
157
|
+
jQuery('input.recordselect.update_form').live('recordselect:change', function(event, id, label) {
|
158
|
+
var element = jQuery(this);
|
159
159
|
ActiveScaffold.update_column(element, element.attr('data-update_url'), element.attr('data-update_send_form'), element.attr('id'), id);
|
160
160
|
return true;
|
161
161
|
});
|
162
162
|
|
163
|
-
|
164
|
-
ActiveScaffold[
|
163
|
+
jQuery('select.as_search_range_option').live('change', function(event) {
|
164
|
+
ActiveScaffold[jQuery(this).val() == 'BETWEEN' ? 'show' : 'hide'](jQuery(this).parent().find('.as_search_range_between'));
|
165
165
|
return true;
|
166
166
|
});
|
167
167
|
|
168
|
-
|
169
|
-
var element =
|
168
|
+
jQuery('select.as_search_range_option').live('change', function(event) {
|
169
|
+
var element = jQuery(this);
|
170
170
|
ActiveScaffold[!(element.val() == 'PAST' || element.val() == 'FUTURE' || element.val() == 'RANGE') ? 'show' : 'hide'](element.attr('id').replace(/_opt/, '_numeric'));
|
171
171
|
ActiveScaffold[(element.val() == 'PAST' || element.val() == 'FUTURE') ? 'show' : 'hide'](element.attr('id').replace(/_opt/, '_trend'));
|
172
172
|
ActiveScaffold[(element.val() == 'RANGE') ? 'show' : 'hide'](element.attr('id').replace(/_opt/, '_range'));
|
173
173
|
return true;
|
174
174
|
});
|
175
175
|
|
176
|
-
|
177
|
-
ActiveScaffold[
|
178
|
-
ActiveScaffold[
|
176
|
+
jQuery('select.as_update_date_operator').live('change', function(event) {
|
177
|
+
ActiveScaffold[jQuery(this).val() == 'REPLACE' ? 'show' : 'hide'](jQuery(this).next());
|
178
|
+
ActiveScaffold[jQuery(this).val() == 'REPLACE' ? 'hide' : 'show'](jQuery(this).next().next());
|
179
179
|
return true;
|
180
180
|
});
|
181
181
|
|
182
|
-
|
183
|
-
window.open(
|
182
|
+
jQuery('a[data-popup]').live('click', function(e) {
|
183
|
+
window.open(jQuery(this).attr('href'));
|
184
184
|
e.preventDefault();
|
185
185
|
});
|
186
186
|
|
187
|
-
|
188
|
-
var element =
|
187
|
+
jQuery('.hover_click').live("click", function(event) {
|
188
|
+
var element = jQuery(this);
|
189
189
|
var ul_element = element.children('ul').first();
|
190
190
|
if (ul_element.is(':visible')) {
|
191
191
|
element.find('ul').hide();
|
@@ -194,8 +194,8 @@ $(document).ready(function() {
|
|
194
194
|
}
|
195
195
|
return false;
|
196
196
|
});
|
197
|
-
|
198
|
-
var element =
|
197
|
+
jQuery('.hover_click a.as_action').live('click', function(event) {
|
198
|
+
var element = jQuery(this).closest('.hover_click');
|
199
199
|
if (element) {
|
200
200
|
element.find('ul').hide();
|
201
201
|
}
|
@@ -267,7 +267,7 @@ $(document).ready(function() {
|
|
267
267
|
})();
|
268
268
|
|
269
269
|
/*
|
270
|
-
|
270
|
+
$ delayed observer
|
271
271
|
(c) 2007 - Maxime Haineault (max@centdessin.com)
|
272
272
|
|
273
273
|
Special thanks to Stephen Goguen & Tane Piper.
|
@@ -275,7 +275,7 @@ $(document).ready(function() {
|
|
275
275
|
Slight modifications by Elliot Winkler
|
276
276
|
*/
|
277
277
|
|
278
|
-
if (typeof(
|
278
|
+
if (typeof($.fn.delayedObserver) === 'undefined') {
|
279
279
|
(function() {
|
280
280
|
var delayedObserverStack = [];
|
281
281
|
var observed;
|
@@ -303,9 +303,9 @@ if (typeof(jQuery.fn.delayedObserver) === 'undefined') {
|
|
303
303
|
);
|
304
304
|
}
|
305
305
|
|
306
|
-
|
306
|
+
$.fn.extend({
|
307
307
|
delayedObserver:function(delay, callback){
|
308
|
-
$this =
|
308
|
+
$this = jQuery(this);
|
309
309
|
|
310
310
|
delayedObserverStack.push({
|
311
311
|
obj: $this, timer: null, delay: delay,
|
@@ -333,14 +333,14 @@ if (typeof(jQuery.fn.delayedObserver) === 'undefined') {
|
|
333
333
|
var ActiveScaffold = {
|
334
334
|
records_for: function(tbody_id) {
|
335
335
|
if (typeof(tbody_id) == 'string') tbody_id = '#' + tbody_id;
|
336
|
-
return
|
336
|
+
return jQuery(tbody_id).children('.record');
|
337
337
|
},
|
338
338
|
stripe: function(tbody_id) {
|
339
339
|
var even = false;
|
340
340
|
var rows = this.records_for(tbody_id);
|
341
341
|
|
342
342
|
rows.each(function (index, row_node) {
|
343
|
-
row =
|
343
|
+
row = jQuery(row_node);
|
344
344
|
if (row_node.tagName != 'SCRIPT'
|
345
345
|
&& !row.hasClass("create")
|
346
346
|
&& !row.hasClass("update")
|
@@ -356,7 +356,7 @@ var ActiveScaffold = {
|
|
356
356
|
},
|
357
357
|
hide_empty_message: function(tbody) {
|
358
358
|
if (this.records_for(tbody).length != 0) {
|
359
|
-
var empty_message_node =
|
359
|
+
var empty_message_node = jQuery(tbody).parent().find('tbody.messages p.empty-message')
|
360
360
|
if (empty_message_node) empty_message_node.hide();
|
361
361
|
}
|
362
362
|
},
|
@@ -367,7 +367,7 @@ var ActiveScaffold = {
|
|
367
367
|
},
|
368
368
|
removeSortClasses: function(scaffold) {
|
369
369
|
if (typeof(scaffold) == 'string') scaffold = '#' + scaffold;
|
370
|
-
scaffold =
|
370
|
+
scaffold = jQuery(scaffold)
|
371
371
|
scaffold.find('td.sorted').each(function(element) {
|
372
372
|
element.removeClass("sorted");
|
373
373
|
});
|
@@ -380,14 +380,14 @@ var ActiveScaffold = {
|
|
380
380
|
decrement_record_count: function(scaffold) {
|
381
381
|
// decrement the last record count, firsts record count are in nested lists
|
382
382
|
if (typeof(scaffold) == 'string') scaffold = '#' + scaffold;
|
383
|
-
scaffold =
|
383
|
+
scaffold = jQuery(scaffold)
|
384
384
|
count = scaffold.find('span.active-scaffold-records').last();
|
385
385
|
if (count) count.html(parseInt(count.html(), 10) - 1);
|
386
386
|
},
|
387
387
|
increment_record_count: function(scaffold) {
|
388
388
|
// increment the last record count, firsts record count are in nested lists
|
389
389
|
if (typeof(scaffold) == 'string') scaffold = '#' + scaffold;
|
390
|
-
scaffold =
|
390
|
+
scaffold = jQuery(scaffold)
|
391
391
|
count = scaffold.find('span.active-scaffold-records').last();
|
392
392
|
if (count) count.html(parseInt(count.html(), 10) + 1);
|
393
393
|
},
|
@@ -395,7 +395,7 @@ var ActiveScaffold = {
|
|
395
395
|
var even_row = false;
|
396
396
|
var replaced = null;
|
397
397
|
if (typeof(row) == 'string') row = '#' + row;
|
398
|
-
row =
|
398
|
+
row = jQuery(row);
|
399
399
|
if (row.hasClass('even-record')) even_row = true;
|
400
400
|
|
401
401
|
replaced = this.replace(row, html);
|
@@ -405,67 +405,67 @@ var ActiveScaffold = {
|
|
405
405
|
|
406
406
|
replace: function(element, html) {
|
407
407
|
if (typeof(element) == 'string') element = '#' + element;
|
408
|
-
element =
|
408
|
+
element = jQuery(element);
|
409
409
|
element.replaceWith(html);
|
410
410
|
if (element.attr('id')) {
|
411
|
-
element =
|
411
|
+
element = jQuery('#' + element.attr('id'));
|
412
412
|
}
|
413
413
|
return element;
|
414
414
|
},
|
415
415
|
|
416
416
|
replace_html: function(element, html) {
|
417
417
|
if (typeof(element) == 'string') element = '#' + element;
|
418
|
-
element =
|
418
|
+
element = jQuery(element);
|
419
419
|
element.html(html);
|
420
420
|
return element;
|
421
421
|
},
|
422
422
|
|
423
423
|
remove: function(element) {
|
424
424
|
if (typeof(element) == 'string') element = '#' + element;
|
425
|
-
|
425
|
+
jQuery(element).remove();
|
426
426
|
},
|
427
427
|
|
428
428
|
hide: function(element) {
|
429
429
|
if (typeof(element) == 'string') element = '#' + element;
|
430
|
-
|
430
|
+
jQuery(element).hide();
|
431
431
|
},
|
432
432
|
|
433
433
|
show: function(element) {
|
434
434
|
if (typeof(element) == 'string') element = '#' + element;
|
435
|
-
|
435
|
+
jQuery(element).show();
|
436
436
|
},
|
437
437
|
|
438
438
|
reset_form: function(element) {
|
439
439
|
if (typeof(element) == 'string') element = '#' + element;
|
440
|
-
|
440
|
+
jQuery(element).get(0).reset();
|
441
441
|
},
|
442
442
|
|
443
443
|
disable_form: function(as_form) {
|
444
444
|
if (typeof(as_form) == 'string') as_form = '#' + as_form;
|
445
|
-
as_form =
|
446
|
-
var loading_indicator =
|
445
|
+
as_form = jQuery(as_form)
|
446
|
+
var loading_indicator = jQuery('#' + as_form.attr('id').replace(/-form$/, '-loading-indicator'));
|
447
447
|
if (loading_indicator) loading_indicator.css('visibility','visible');
|
448
|
-
|
449
|
-
as_form[0].disabled_fields =
|
448
|
+
jQuery('input[type=submit]', as_form).attr('disabled', 'disabled');
|
449
|
+
as_form[0].disabled_fields = jQuery("input:enabled,select:enabled,textarea:enabled", as_form).attr('disabled', 'disabled');
|
450
450
|
},
|
451
451
|
|
452
452
|
enable_form: function(as_form) {
|
453
453
|
if (typeof(as_form) == 'string') as_form = '#' + as_form;
|
454
|
-
as_form =
|
455
|
-
var loading_indicator =
|
454
|
+
as_form = jQuery(as_form)
|
455
|
+
var loading_indicator = jQuery('#' + as_form.attr('id').replace(/-form$/, '-loading-indicator'));
|
456
456
|
if (loading_indicator) loading_indicator.css('visibility','hidden');
|
457
|
-
|
457
|
+
jQuery('input[type=submit]', as_form).removeAttr('disabled');
|
458
458
|
as_form[0].disabled_fields.removeAttr('disabled');
|
459
459
|
},
|
460
460
|
|
461
461
|
focus_first_element_of_form: function(form_element) {
|
462
462
|
if (typeof(form_element) == 'string') form_element = '#' + form_element;
|
463
|
-
|
463
|
+
jQuery(form_element + ":first *:input[type!=hidden]:first").focus();
|
464
464
|
},
|
465
465
|
|
466
466
|
create_record_row: function(active_scaffold_id, html, options) {
|
467
467
|
if (typeof(active_scaffold_id) == 'string') active_scaffold_id = '#' + active_scaffold_id;
|
468
|
-
tbody =
|
468
|
+
tbody = jQuery(active_scaffold_id).find('tbody.records');
|
469
469
|
|
470
470
|
if (options.insert_at == 'top') {
|
471
471
|
tbody.prepend(html);
|
@@ -487,7 +487,7 @@ var ActiveScaffold = {
|
|
487
487
|
|
488
488
|
delete_record_row: function(row, page_reload_url) {
|
489
489
|
if (typeof(row) == 'string') row = '#' + row;
|
490
|
-
row =
|
490
|
+
row = jQuery(row);
|
491
491
|
var tbody = row.closest('tbody.records');
|
492
492
|
|
493
493
|
var current_action_node = row.find('td.actions a.disabled').first();
|
@@ -506,38 +506,38 @@ var ActiveScaffold = {
|
|
506
506
|
|
507
507
|
delete_subform_record: function(record) {
|
508
508
|
if (typeof(record) == 'string') record = '#' + record;
|
509
|
-
record =
|
509
|
+
record = jQuery(record);
|
510
510
|
var errors = record.prev();
|
511
511
|
if (errors.hasClass('association-record-errors')) {
|
512
512
|
this.remove(errors);
|
513
513
|
}
|
514
|
-
var associated =
|
514
|
+
var associated = jQuery(record).next();
|
515
515
|
this.remove(record);
|
516
516
|
while (associated.hasClass('associated-record')) {
|
517
517
|
record = associated;
|
518
|
-
associated =
|
518
|
+
associated = jQuery(record).next();
|
519
519
|
this.remove(record);
|
520
520
|
}
|
521
521
|
},
|
522
522
|
|
523
523
|
report_500_response: function(active_scaffold_id) {
|
524
|
-
server_error =
|
525
|
-
if (
|
524
|
+
server_error = jQuery(active_scaffold_id).find('td.messages-container p.server-error');
|
525
|
+
if (!jQuery(server_error).is(':visible')) {
|
526
526
|
server_error.show();
|
527
527
|
}
|
528
528
|
},
|
529
529
|
|
530
530
|
find_action_link: function(element) {
|
531
531
|
if (typeof(element) == 'string') element = '#' + element;
|
532
|
-
var as_adapter =
|
532
|
+
var as_adapter = jQuery(element).closest('.as_adapter');
|
533
533
|
return ActiveScaffold.ActionLink.get(as_adapter);
|
534
534
|
},
|
535
535
|
|
536
536
|
scroll_to: function(element) {
|
537
537
|
if (typeof(element) == 'string') element = '#' + element;
|
538
|
-
var form_offset =
|
538
|
+
var form_offset = jQuery(element).offset(),
|
539
539
|
destination = form_offset.top;
|
540
|
-
|
540
|
+
jQuery(document).scrollTop(destination);
|
541
541
|
},
|
542
542
|
|
543
543
|
process_checkbox_inplace_edit: function(checkbox, options) {
|
@@ -574,7 +574,7 @@ var ActiveScaffold = {
|
|
574
574
|
},
|
575
575
|
|
576
576
|
highlight: function(element) {
|
577
|
-
if (typeof(element) == 'string') element =
|
577
|
+
if (typeof(element) == 'string') element = jQuery('#' + element);
|
578
578
|
if (typeof(element.effect) == 'function') {
|
579
579
|
element.effect("highlight", {}, 3000);
|
580
580
|
}
|
@@ -582,27 +582,27 @@ var ActiveScaffold = {
|
|
582
582
|
|
583
583
|
create_visibility_toggle: function(element, options) {
|
584
584
|
if (typeof(element) == 'string') element = '#' + element;
|
585
|
-
var toggable =
|
585
|
+
var toggable = jQuery(element);
|
586
586
|
var toggler = toggable.prev();
|
587
587
|
var initial_label = (options.default_visible === true) ? options.hide_label : options.show_label;
|
588
588
|
|
589
589
|
toggler.append(' (<a class="visibility-toggle" href="#">' + initial_label + '</a>)');
|
590
590
|
toggler.children('a').click(function() {
|
591
591
|
toggable.toggle();
|
592
|
-
|
592
|
+
jQuery(this).html((toggable.is(':hidden')) ? options.show_label : options.hide_label);
|
593
593
|
return false;
|
594
594
|
});
|
595
595
|
},
|
596
596
|
|
597
597
|
create_associated_record_form: function(element, content, options) {
|
598
598
|
if (typeof(element) == 'string') element = '#' + element;
|
599
|
-
var element =
|
599
|
+
var element = jQuery(element);
|
600
600
|
if (options.singular == false) {
|
601
|
-
if (!(options.id &&
|
601
|
+
if (!(options.id && jQuery('#' + options.id).size() > 0)) {
|
602
602
|
element.append(content);
|
603
603
|
}
|
604
604
|
} else {
|
605
|
-
var current =
|
605
|
+
var current = jQuery('#' + element.attr('id') + ' .association-record')
|
606
606
|
if (current[0]) {
|
607
607
|
this.replace(current[0], content);
|
608
608
|
} else {
|
@@ -613,7 +613,7 @@ var ActiveScaffold = {
|
|
613
613
|
|
614
614
|
render_form_field: function(source, content, options) {
|
615
615
|
if (typeof(source) == 'string') source = '#' + source;
|
616
|
-
var source =
|
616
|
+
var source = jQuery(source);
|
617
617
|
var element = source.closest('.association-record');
|
618
618
|
if (element.length == 0) {
|
619
619
|
element = source.closest('form > ol.form');
|
@@ -631,13 +631,13 @@ var ActiveScaffold = {
|
|
631
631
|
|
632
632
|
sortable: function(element, controller, options, url_params) {
|
633
633
|
if (typeof(element) == 'string') element = '#' + element;
|
634
|
-
var element =
|
634
|
+
var element = jQuery(element);
|
635
635
|
var sortable_options = {};
|
636
636
|
if (options.update === true) {
|
637
|
-
url_params.authenticity_token =
|
637
|
+
url_params.authenticity_token = jQuery('meta[name=csrf-param]').attr('content');
|
638
638
|
sortable_options.update = function(event, ui) {
|
639
639
|
var url = controller + '/' + options.action + '?'
|
640
|
-
url +=
|
640
|
+
url += jQuery(this).sortable('serialize',{key: encodeURIComponent(jQuery(this).attr('id') + '[]'), expression:/^[^_-](?:[A-Za-z0-9_-]*)-(.*)-row$/});
|
641
641
|
$.post(url.append_params(url_params));
|
642
642
|
}
|
643
643
|
}
|
@@ -656,10 +656,10 @@ var ActiveScaffold = {
|
|
656
656
|
// element is tbody id
|
657
657
|
mark_records: function(element, options) {
|
658
658
|
if (typeof(element) == 'string') element = '#' + element;
|
659
|
-
var element =
|
660
|
-
var mark_checkboxes =
|
659
|
+
var element = jQuery(element);
|
660
|
+
var mark_checkboxes = jQuery('#' + element.attr('id') + ' > tr.record td.marked-column input[type="checkbox"]');
|
661
661
|
mark_checkboxes.each(function (index) {
|
662
|
-
var item =
|
662
|
+
var item = jQuery(this);
|
663
663
|
if(options.checked === true) {
|
664
664
|
item.attr('checked', 'checked');
|
665
665
|
} else {
|
@@ -679,15 +679,15 @@ var ActiveScaffold = {
|
|
679
679
|
},
|
680
680
|
|
681
681
|
in_place_editor_field_clicked: function(span) {
|
682
|
-
span.data(); //
|
682
|
+
span.data(); // $ 1.4.2 workaround
|
683
683
|
if (typeof(span.data('editInPlace')) === 'undefined') {
|
684
684
|
var options = {show_buttons: true,
|
685
685
|
hover_class: 'hover',
|
686
686
|
element_id: 'editor_id',
|
687
687
|
ajax_data_type: "script",
|
688
688
|
update_value: 'value'},
|
689
|
-
csrf_param =
|
690
|
-
csrf_token =
|
689
|
+
csrf_param = jQuery('meta[name=csrf-param]').first(),
|
690
|
+
csrf_token = jQuery('meta[name=csrf-token]').first(),
|
691
691
|
my_parent = span.parent(),
|
692
692
|
column_heading = null;
|
693
693
|
|
@@ -744,7 +744,7 @@ var ActiveScaffold = {
|
|
744
744
|
},
|
745
745
|
|
746
746
|
update_column: function(element, url, send_form, source_id, val) {
|
747
|
-
if (!element) element =
|
747
|
+
if (!element) element = jQuery('#' + source_id);
|
748
748
|
var as_form = element.closest('form.as_form');
|
749
749
|
var params = null;
|
750
750
|
|
@@ -777,7 +777,7 @@ var ActiveScaffold = {
|
|
777
777
|
},
|
778
778
|
|
779
779
|
draggable_lists: function(element) {
|
780
|
-
|
780
|
+
jQuery('#' + element).draggable_lists();
|
781
781
|
}
|
782
782
|
}
|
783
783
|
|
@@ -819,11 +819,11 @@ String.prototype.append_params = function(params) {
|
|
819
819
|
ActiveScaffold.Actions = new Object();
|
820
820
|
ActiveScaffold.Actions.Abstract = Class.extend({
|
821
821
|
init: function(links, target, loading_indicator, options) {
|
822
|
-
this.target =
|
823
|
-
this.loading_indicator =
|
822
|
+
this.target = jQuery(target);
|
823
|
+
this.loading_indicator = jQuery(loading_indicator);
|
824
824
|
this.options = options;
|
825
825
|
var _this = this;
|
826
|
-
this.links =
|
826
|
+
this.links = jQuery.map(links, function(link) {
|
827
827
|
var my_link = _this.instantiate_link(link);
|
828
828
|
return my_link;
|
829
829
|
});
|
@@ -841,9 +841,9 @@ ActiveScaffold.Actions.Abstract = Class.extend({
|
|
841
841
|
ActiveScaffold.ActionLink = {
|
842
842
|
get: function(element) {
|
843
843
|
if (typeof(element) == 'string') element = '#' + element;
|
844
|
-
var element =
|
844
|
+
var element = jQuery(element);
|
845
845
|
if (element.length > 0) {
|
846
|
-
element.data(); //
|
846
|
+
element.data(); // $ 1.4.2 workaround
|
847
847
|
if (typeof(element.data('action_link')) === 'undefined' && !element.hasClass('as_adapter')) {
|
848
848
|
var parent = element.closest('.actions');
|
849
849
|
if (parent.length === 0) {
|
@@ -860,7 +860,7 @@ ActiveScaffold.ActionLink = {
|
|
860
860
|
//table action
|
861
861
|
new ActiveScaffold.Actions.Table(parent.find('a.as_action'), parent.closest('div.active-scaffold').find('tbody.before-header'), parent.find('.loading-indicator'));
|
862
862
|
}
|
863
|
-
element =
|
863
|
+
element = jQuery(element);
|
864
864
|
}
|
865
865
|
return element.data('action_link');
|
866
866
|
} else {
|
@@ -870,7 +870,7 @@ ActiveScaffold.ActionLink = {
|
|
870
870
|
};
|
871
871
|
ActiveScaffold.ActionLink.Abstract = Class.extend({
|
872
872
|
init: function(a, target, loading_indicator) {
|
873
|
-
this.tag =
|
873
|
+
this.tag = jQuery(a);
|
874
874
|
this.url = this.tag.attr('href');
|
875
875
|
this.method = this.tag.attr('data-method') || 'get';
|
876
876
|
this.target = target;
|
@@ -905,7 +905,7 @@ ActiveScaffold.ActionLink.Abstract = Class.extend({
|
|
905
905
|
get_new_adapter_id: function() {
|
906
906
|
var id = 'adapter_';
|
907
907
|
var i = 0;
|
908
|
-
while (
|
908
|
+
while (jQuery(id + i)) i++;
|
909
909
|
return id + i;
|
910
910
|
},
|
911
911
|
|
@@ -930,14 +930,14 @@ ActiveScaffold.ActionLink.Abstract = Class.extend({
|
|
930
930
|
},
|
931
931
|
|
932
932
|
update_flash_messages: function(messages) {
|
933
|
-
message_node =
|
933
|
+
message_node = jQuery(this.scaffold_id().replace(/-active-scaffold/, '-messages'));
|
934
934
|
if (message_node) message_node.html(messages);
|
935
935
|
},
|
936
936
|
set_adapter: function(element) {
|
937
937
|
this.adapter = element;
|
938
938
|
this.adapter.addClass('as_adapter');
|
939
939
|
this.adapter.data('action_link', this);
|
940
|
-
if (this.refresh_url)
|
940
|
+
if (this.refresh_url) jQuery('.as_cancel[data-refresh=true]', this.adapter).attr('href', this.refresh_url);
|
941
941
|
}
|
942
942
|
});
|
943
943
|
|