active_scaffold_vho 3.0.24 → 3.0.25
Sign up to get free protection for your applications and to get access to all the features.
- data/active_scaffold_vho.gemspec +2 -4
- data/frontends/default/javascripts/jquery/active_scaffold.js +64 -19
- data/frontends/default/javascripts/jquery/jquery.editinplace.js +1 -1
- data/frontends/default/javascripts/prototype/active_scaffold.js +54 -18
- data/frontends/default/views/_list_record.html.erb +2 -2
- data/frontends/default/views/_list_with_header.html.erb +1 -1
- data/lib/active_scaffold.rb +10 -8
- data/lib/active_scaffold/actions/list.rb +1 -3
- data/lib/active_scaffold/bridges/date_picker/lib/datepicker_bridge.rb +1 -1
- data/lib/active_scaffold/bridges/date_picker/public/javascripts/date_picker_bridge.js +27 -13
- data/lib/active_scaffold/bridges/tiny_mce/public/javascripts/jquery/tiny_mce_bridge.js +3 -3
- data/lib/active_scaffold/config/delete.rb +1 -1
- data/lib/active_scaffold/config/list.rb +18 -10
- data/lib/active_scaffold/data_structures/action_links.rb +1 -1
- data/lib/active_scaffold/data_structures/column.rb +1 -1
- data/lib/active_scaffold/helpers/list_column_helpers.rb +4 -4
- data/lib/active_scaffold/helpers/view_helpers.rb +2 -1
- data/lib/active_scaffold/locale/de.rb +1 -1
- data/lib/active_scaffold/version.rb +1 -1
- data/lib/active_scaffold_env.rb +2 -2
- metadata +4 -6
- data/frontends/default/views/_list_inline_adapter.html.erb +0 -10
- data/lib/active_scaffold/extensions/action_controller_rendering.rb +0 -22
data/active_scaffold_vho.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{active_scaffold_vho}
|
8
|
-
s.version = "3.0.
|
8
|
+
s.version = "3.0.25"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Many, see README"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2012-02-28}
|
13
13
|
s.description = %q{Save time and headaches, and create a more easily maintainable set of pages, with ActiveScaffold. ActiveScaffold handles all your CRUD (create, read, update, delete) user interface needs, leaving you more time to focus on more challenging (and interesting!) problems.}
|
14
14
|
s.email = %q{activescaffold@googlegroups.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -65,7 +65,6 @@ Gem::Specification.new do |s|
|
|
65
65
|
"frontends/default/views/_list_calculations.html.erb",
|
66
66
|
"frontends/default/views/_list_column_headings.html.erb",
|
67
67
|
"frontends/default/views/_list_header.html.erb",
|
68
|
-
"frontends/default/views/_list_inline_adapter.html.erb",
|
69
68
|
"frontends/default/views/_list_messages.html.erb",
|
70
69
|
"frontends/default/views/_list_pagination.html.erb",
|
71
70
|
"frontends/default/views/_list_pagination_links.html.erb",
|
@@ -183,7 +182,6 @@ Gem::Specification.new do |s|
|
|
183
182
|
"lib/active_scaffold/data_structures/nested_info.rb",
|
184
183
|
"lib/active_scaffold/data_structures/set.rb",
|
185
184
|
"lib/active_scaffold/data_structures/sorting.rb",
|
186
|
-
"lib/active_scaffold/extensions/action_controller_rendering.rb",
|
187
185
|
"lib/active_scaffold/extensions/action_view_rendering.rb",
|
188
186
|
"lib/active_scaffold/extensions/action_view_resolver.rb",
|
189
187
|
"lib/active_scaffold/extensions/active_association_reflection.rb",
|
@@ -239,6 +239,16 @@ $(document).ready(function() {
|
|
239
239
|
});
|
240
240
|
return true;
|
241
241
|
});
|
242
|
+
$('tr.inline-adapter-autoopen').live('as:list_row_loaded', function(event) {
|
243
|
+
var actionlink_id = $(event.target).attr('data-actionlinkid');
|
244
|
+
if(actionlink_id) {
|
245
|
+
var action_link = ActiveScaffold.ActionLink.get(actionlink_id);
|
246
|
+
if (action_link) {
|
247
|
+
action_link.set_opened();
|
248
|
+
}
|
249
|
+
}
|
250
|
+
return true;
|
251
|
+
});
|
242
252
|
$('form.as_form').live('ajax:before', function(event) {
|
243
253
|
var as_form = $(this).closest("form");
|
244
254
|
$(this).trigger('as:form_submit');
|
@@ -453,12 +463,17 @@ var ActiveScaffold = {
|
|
453
463
|
ActiveScaffold.highlight(replaced);
|
454
464
|
},
|
455
465
|
|
456
|
-
replace: function(element, html) {
|
466
|
+
replace: function(element, html, disable_event_trigger) {
|
457
467
|
if (typeof(element) == 'string') element = '#' + element;
|
458
468
|
element = $(element);
|
459
|
-
|
460
|
-
|
461
|
-
|
469
|
+
var new_element = null;
|
470
|
+
if((typeof(disable_event_trigger) == 'boolean') && disable_event_trigger == true) {
|
471
|
+
new_element = $(html).replaceAll(element);
|
472
|
+
} else {
|
473
|
+
ActiveScaffold.trigger_unload_events(element.find('[data-as_load]').andSelf());
|
474
|
+
new_element = $(html).replaceAll(element);
|
475
|
+
ActiveScaffold.trigger_load_events(new_element.find('[data-as_load]').andSelf());
|
476
|
+
}
|
462
477
|
return new_element;
|
463
478
|
},
|
464
479
|
|
@@ -731,7 +746,15 @@ var ActiveScaffold = {
|
|
731
746
|
hover_class: 'hover',
|
732
747
|
element_id: 'editor_id',
|
733
748
|
ajax_data_type: "script",
|
734
|
-
update_value: 'value'
|
749
|
+
update_value: 'value',
|
750
|
+
delegate: {didOpenEditInPlace: function(aDOMNode, aSettingsDict) {
|
751
|
+
ActiveScaffold.trigger_load_events(aDOMNode.find('[data-as_load]'));
|
752
|
+
return true;
|
753
|
+
},
|
754
|
+
shouldCloseEditInPlace: function(aDOMNode, aSettingsDict) {
|
755
|
+
ActiveScaffold.trigger_unload_events(aDOMNode.find('[data-as_load]'));
|
756
|
+
return true;
|
757
|
+
}}},
|
735
758
|
csrf_param = $('meta[name=csrf-param]').first(),
|
736
759
|
csrf_token = $('meta[name=csrf-token]').first(),
|
737
760
|
my_parent = span.parent(),
|
@@ -977,6 +1000,24 @@ ActiveScaffold.ActionLink.Abstract = Class.extend({
|
|
977
1000
|
this.adapter = element;
|
978
1001
|
this.adapter.addClass('as_adapter');
|
979
1002
|
this.adapter.data('action_link', this);
|
1003
|
+
},
|
1004
|
+
wrap_with_adapter_html: function(content) {
|
1005
|
+
// players_view class missing
|
1006
|
+
var id_string = null;
|
1007
|
+
var close_label = this.scaffold().attr('data-closelabel');
|
1008
|
+
var controller = this.scaffold().attr('data-controller');
|
1009
|
+
|
1010
|
+
if (this.tag.attr('data-controller')) {
|
1011
|
+
controller = this.tag.attr('data-controller');
|
1012
|
+
}
|
1013
|
+
|
1014
|
+
if(this.target.hasClass('before-header')) {
|
1015
|
+
id_string = this.target.attr('id').replace('search', 'nested');
|
1016
|
+
} else {
|
1017
|
+
id_string = this.target.attr('id').replace('list', 'nested');
|
1018
|
+
}
|
1019
|
+
|
1020
|
+
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="false" href="">' + close_label +'</a>' + content + '</div></td></tr>'
|
980
1021
|
}
|
981
1022
|
});
|
982
1023
|
|
@@ -987,12 +1028,15 @@ ActiveScaffold.Actions.Record = ActiveScaffold.Actions.Abstract.extend({
|
|
987
1028
|
instantiate_link: function(link) {
|
988
1029
|
var l = new ActiveScaffold.ActionLink.Record(link, this.target, this.loading_indicator);
|
989
1030
|
var refresh = this.target.attr('data-refresh');
|
990
|
-
if (refresh)
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
1031
|
+
if (refresh) {
|
1032
|
+
l.refresh_url = refresh;
|
1033
|
+
}
|
1034
|
+
|
1035
|
+
if (l.position && l.tag.attr('data-action') == 'index') {
|
1036
|
+
l.url = l.url.append_params({embedded: true});
|
1037
|
+
l.tag.attr('href', l.url);
|
995
1038
|
}
|
1039
|
+
|
996
1040
|
l.set = this;
|
997
1041
|
return l;
|
998
1042
|
}
|
@@ -1019,18 +1063,19 @@ ActiveScaffold.ActionLink.Record = ActiveScaffold.ActionLink.Abstract.extend({
|
|
1019
1063
|
}
|
1020
1064
|
|
1021
1065
|
if (this.position == 'after') {
|
1022
|
-
this.target.after(content);
|
1066
|
+
this.target.after(this.wrap_with_adapter_html(content));
|
1023
1067
|
ActiveScaffold.trigger_load_events(this.target.next().find('[data-as_load]'));
|
1024
1068
|
this.set_adapter(this.target.next());
|
1025
1069
|
}
|
1026
1070
|
else if (this.position == 'before') {
|
1027
|
-
this.target.before(content);
|
1071
|
+
this.target.before(this.wrap_with_adapter_html(content));
|
1028
1072
|
ActiveScaffold.trigger_load_events(this.target.prev().find('[data-as_load]'));
|
1029
1073
|
this.set_adapter(this.target.prev());
|
1030
1074
|
}
|
1031
1075
|
else {
|
1032
1076
|
return false;
|
1033
1077
|
}
|
1078
|
+
this.update_flash_messages('');
|
1034
1079
|
ActiveScaffold.highlight(this.adapter.find('td'));
|
1035
1080
|
},
|
1036
1081
|
|
@@ -1059,10 +1104,12 @@ ActiveScaffold.ActionLink.Record = ActiveScaffold.ActionLink.Abstract.extend({
|
|
1059
1104
|
|
1060
1105
|
set_opened: function() {
|
1061
1106
|
if (this.position == 'after') {
|
1062
|
-
this.
|
1107
|
+
var new_adapter = ActiveScaffold.replace(this.target.next(), this.wrap_with_adapter_html(this.target.next().children(':first-child').html()), true);
|
1108
|
+
this.set_adapter(new_adapter);
|
1063
1109
|
}
|
1064
1110
|
else if (this.position == 'before') {
|
1065
|
-
this.
|
1111
|
+
var new_adapter = ActiveScaffold.replace(this.target.prev(), this.wrap_with_adapter_html(this.target.prev().children(':first-child').html()), true);
|
1112
|
+
this.set_adapter(new_adapter);
|
1066
1113
|
}
|
1067
1114
|
this.disable();
|
1068
1115
|
}
|
@@ -1074,10 +1121,7 @@ ActiveScaffold.ActionLink.Record = ActiveScaffold.ActionLink.Abstract.extend({
|
|
1074
1121
|
ActiveScaffold.Actions.Table = ActiveScaffold.Actions.Abstract.extend({
|
1075
1122
|
instantiate_link: function(link) {
|
1076
1123
|
var l = new ActiveScaffold.ActionLink.Table(link, this.target, this.loading_indicator);
|
1077
|
-
|
1078
|
-
l.url = l.url.append_params({adapter: '_list_inline_adapter'});
|
1079
|
-
l.tag.attr('href', l.url);
|
1080
|
-
}
|
1124
|
+
|
1081
1125
|
return l;
|
1082
1126
|
}
|
1083
1127
|
});
|
@@ -1085,13 +1129,14 @@ ActiveScaffold.Actions.Table = ActiveScaffold.Actions.Abstract.extend({
|
|
1085
1129
|
ActiveScaffold.ActionLink.Table = ActiveScaffold.ActionLink.Abstract.extend({
|
1086
1130
|
insert: function(content) {
|
1087
1131
|
if (this.position == 'top') {
|
1088
|
-
this.target.prepend(content);
|
1132
|
+
this.target.prepend(this.wrap_with_adapter_html(content));
|
1089
1133
|
ActiveScaffold.trigger_load_events(this.target.children().first().find('[data-as_load]'));
|
1090
1134
|
this.set_adapter(this.target.children().first());
|
1091
1135
|
}
|
1092
1136
|
else {
|
1093
1137
|
throw 'Unknown position "' + this.position + '"'
|
1094
1138
|
}
|
1139
|
+
this.update_flash_messages('');
|
1095
1140
|
ActiveScaffold.highlight(this.adapter.find('td').first().children());
|
1096
1141
|
}
|
1097
1142
|
});
|
@@ -259,7 +259,7 @@ $.extend(InlineEditor.prototype, {
|
|
259
259
|
var buttons_html = (this.settings.show_buttons) ? this.settings.save_button + ' ' + this.settings.cancel_button : '';
|
260
260
|
var editorElement = this.createEditorElement(); // needs to happen before anything is replaced
|
261
261
|
/* insert the new in place form after the element they click, then empty out the original element */
|
262
|
-
this.dom.html('<form class="inplace_form" style="display: inline; margin: 0; padding: 0;"></form>')
|
262
|
+
this.dom.html('<form class="inplace_form" data-as_load="form" style="display: inline; margin: 0; padding: 0;"></form>')
|
263
263
|
.find('form')
|
264
264
|
.append(editorElement)
|
265
265
|
.append(buttons_html);
|
@@ -314,6 +314,16 @@ document.observe("dom:loaded", function() {
|
|
314
314
|
ActiveScaffold.focus_first_element_of_form(as_form);
|
315
315
|
return true;
|
316
316
|
});
|
317
|
+
document.on('as:list_row_loaded', 'tr.inline-adapter-autoopen', function(event, element) {
|
318
|
+
var actionlink_id = element.readAttribute('data-actionlinkid');
|
319
|
+
if(actionlink_id) {
|
320
|
+
var action_link = ActiveScaffold.ActionLink.get(actionlink_id);
|
321
|
+
if (action_link) {
|
322
|
+
action_link.set_opened();
|
323
|
+
}
|
324
|
+
}
|
325
|
+
return true;
|
326
|
+
});
|
317
327
|
document.on('ajax:before', 'form.as_form', function(event) {
|
318
328
|
var as_form = event.findElement('form');
|
319
329
|
element.fire('as:form_submit');
|
@@ -406,12 +416,14 @@ var ActiveScaffold = {
|
|
406
416
|
new_row.highlight();
|
407
417
|
},
|
408
418
|
|
409
|
-
replace: function(element, html) {
|
419
|
+
replace: function(element, html, disable_event_trigger) {
|
410
420
|
element = $(element);
|
411
421
|
var elements = element.select('[data-as_load]');
|
412
422
|
var new_element = null;
|
413
423
|
elements.unshift(element);
|
414
|
-
|
424
|
+
if((typeof(disable_event_trigger) != 'boolean') || disable_event_trigger === false) {
|
425
|
+
ActiveScaffold.trigger_unload_events(elements);
|
426
|
+
}
|
415
427
|
if (html.startsWith('<tr')) {
|
416
428
|
new_element = new Element('tbody').update(html);
|
417
429
|
} else {
|
@@ -421,7 +433,9 @@ var ActiveScaffold = {
|
|
421
433
|
Element.replace(element, new_element);
|
422
434
|
elements = new_element.select('[data-as_load]');
|
423
435
|
elements.unshift(new_element);
|
424
|
-
|
436
|
+
if((typeof(disable_event_trigger) != 'boolean') || disable_event_trigger === false) {
|
437
|
+
ActiveScaffold.trigger_load_events(elements);
|
438
|
+
}
|
425
439
|
return new_element;
|
426
440
|
},
|
427
441
|
|
@@ -774,9 +788,11 @@ ActiveScaffold.Actions.Abstract = Class.create({
|
|
774
788
|
this.target = $(target);
|
775
789
|
this.loading_indicator = $(loading_indicator);
|
776
790
|
this.options = options;
|
791
|
+
var _this = this;
|
777
792
|
this.links = links.collect(function(link) {
|
778
|
-
|
779
|
-
|
793
|
+
var my_link = _this.instantiate_link(link);
|
794
|
+
return my_link;
|
795
|
+
});
|
780
796
|
},
|
781
797
|
|
782
798
|
instantiate_link: function(link) {
|
@@ -879,6 +895,25 @@ ActiveScaffold.ActionLink.Abstract = Class.create({
|
|
879
895
|
this.adapter = element;
|
880
896
|
this.adapter.addClassName('as_adapter');
|
881
897
|
this.adapter.store('action_link', this);
|
898
|
+
},
|
899
|
+
|
900
|
+
wrap_with_adapter_html: function(content) {
|
901
|
+
// players_view class missing
|
902
|
+
var id_string = null;
|
903
|
+
var close_label = this.scaffold().readAttribute('data-closelabel');
|
904
|
+
var controller = this.scaffold().readAttribute('data-controller');
|
905
|
+
|
906
|
+
if (this.tag.readAttribute('data-controller')) {
|
907
|
+
controller = this.tag.readAttribute('data-controller');
|
908
|
+
}
|
909
|
+
|
910
|
+
if(this.target.hasClassName('before-header')) {
|
911
|
+
id_string = this.target.readAttribute('id').replace('search', 'nested');
|
912
|
+
} else {
|
913
|
+
id_string = this.target.readAttribute('id').replace('list', 'nested');
|
914
|
+
}
|
915
|
+
|
916
|
+
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="false" href="">' + close_label +'</a>' + content + '</div></td></tr>'
|
882
917
|
}
|
883
918
|
});
|
884
919
|
|
@@ -889,10 +924,10 @@ ActiveScaffold.Actions.Record = Class.create(ActiveScaffold.Actions.Abstract, {
|
|
889
924
|
instantiate_link: function(link) {
|
890
925
|
var l = new ActiveScaffold.ActionLink.Record(link, this.target, this.loading_indicator);
|
891
926
|
if (this.target.hasAttribute('data-refresh') && !this.target.readAttribute('data-refresh').blank()) l.refresh_url = this.target.readAttribute('data-refresh');
|
892
|
-
|
893
|
-
if (l.position) {
|
894
|
-
|
895
|
-
|
927
|
+
|
928
|
+
if (l.position && l.tag.hasAttribute('data-action') && l.tag.readAttribute('data-action') == "index") {
|
929
|
+
l.url = l.url.append_params({embedded: true});
|
930
|
+
l.tag.href = l.url;
|
896
931
|
}
|
897
932
|
l.set = this;
|
898
933
|
return l;
|
@@ -919,18 +954,19 @@ ActiveScaffold.ActionLink.Record = Class.create(ActiveScaffold.ActionLink.Abstra
|
|
919
954
|
}
|
920
955
|
|
921
956
|
if (this.position == 'after') {
|
922
|
-
this.target.insert({after:content});
|
957
|
+
this.target.insert({after:this.wrap_with_adapter_html(content)});
|
923
958
|
ActiveScaffold.trigger_load_events(this.target.next().select('[data-as_load]'));
|
924
959
|
this.set_adapter(this.target.next());
|
925
960
|
}
|
926
961
|
else if (this.position == 'before') {
|
927
|
-
this.target.insert({before:content});
|
962
|
+
this.target.insert({before:this.wrap_with_adapter_html(content)});
|
928
963
|
ActiveScaffold.trigger_load_events(this.target.previous().select('[data-as_load]'));
|
929
964
|
this.set_adapter(this.target.previous());
|
930
965
|
}
|
931
966
|
else {
|
932
967
|
return false;
|
933
968
|
}
|
969
|
+
this.update_flash_messages();
|
934
970
|
this.adapter.down('td').down().highlight();
|
935
971
|
},
|
936
972
|
|
@@ -957,10 +993,12 @@ ActiveScaffold.ActionLink.Record = Class.create(ActiveScaffold.ActionLink.Abstra
|
|
957
993
|
|
958
994
|
set_opened: function() {
|
959
995
|
if (this.position == 'after') {
|
960
|
-
this.
|
996
|
+
var new_adapter = ActiveScaffold.replace(this.target.next(), this.wrap_with_adapter_html(this.target.next().childElements().first().innerHTML), true);
|
997
|
+
this.set_adapter(new_adapter);
|
961
998
|
}
|
962
999
|
else if (this.position == 'before') {
|
963
|
-
this.
|
1000
|
+
var new_adapter = ActiveScaffold.replace(this.target.previous(), this.wrap_with_adapter_html(this.target.previous().childElements().first().innerHTML), true);
|
1001
|
+
this.set_adapter(new_adapter);
|
964
1002
|
}
|
965
1003
|
this.disable();
|
966
1004
|
}
|
@@ -972,10 +1010,7 @@ ActiveScaffold.ActionLink.Record = Class.create(ActiveScaffold.ActionLink.Abstra
|
|
972
1010
|
ActiveScaffold.Actions.Table = Class.create(ActiveScaffold.Actions.Abstract, {
|
973
1011
|
instantiate_link: function(link) {
|
974
1012
|
var l = new ActiveScaffold.ActionLink.Table(link, this.target, this.loading_indicator);
|
975
|
-
|
976
|
-
l.url = l.url.append_params({adapter: '_list_inline_adapter'});
|
977
|
-
l.tag.href = l.url;
|
978
|
-
}
|
1013
|
+
|
979
1014
|
return l;
|
980
1015
|
}
|
981
1016
|
});
|
@@ -983,13 +1018,14 @@ ActiveScaffold.Actions.Table = Class.create(ActiveScaffold.Actions.Abstract, {
|
|
983
1018
|
ActiveScaffold.ActionLink.Table = Class.create(ActiveScaffold.ActionLink.Abstract, {
|
984
1019
|
insert: function(content) {
|
985
1020
|
if (this.position == 'top') {
|
986
|
-
this.target.insert({top:content});
|
1021
|
+
this.target.insert({top:this.wrap_with_adapter_html(content)});
|
987
1022
|
ActiveScaffold.trigger_load_events(this.target.immediateDescendants().first().select('[data-as_load]'));
|
988
1023
|
this.set_adapter(this.target.immediateDescendants().first());
|
989
1024
|
}
|
990
1025
|
else {
|
991
1026
|
throw 'Unknown position "' + this.position + '"'
|
992
1027
|
}
|
1028
|
+
this.update_flash_messages();
|
993
1029
|
this.adapter.down('td').down().highlight();
|
994
1030
|
}
|
995
1031
|
});
|
@@ -9,5 +9,5 @@ action_links ||= active_scaffold_config.action_links.member
|
|
9
9
|
<tr class="record <%= tr_class %>" id="<%= element_row_id(:action => :list, :id => record.id) %>" data-refresh="<%= url_for(params_for(:action => :row, :id => record.id, :_method => :get, :escape => false)).html_safe %>" data-as_load="tr">
|
10
10
|
<%= render :partial => 'list_record_columns', :locals => {:record => record, :columns => columns} %>
|
11
11
|
<%= render :partial => 'list_actions', :locals => {:record => record, :url_options => url_options, :action_links => action_links} unless action_links.empty? %>
|
12
|
-
|
13
|
-
|
12
|
+
</tr>
|
13
|
+
<%= render_nested_view(action_links, url_options, record) unless @nested_auto_open.nil? %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div id="<%= active_scaffold_id -%>" class="<%= as_main_div_class %>" <%= "data-eid=#{id_from_controller(params[:eid])}" if params[:eid]%>>
|
1
|
+
<div id="<%= active_scaffold_id -%>" class="<%= as_main_div_class %>" <%= "data-eid=#{id_from_controller(params[:eid])}" if params[:eid]%> data-closelabel="<%=as_(:close).html_safe%>" data-controller=<%="#{params[:controller]}"%>>
|
2
2
|
<div class="active-scaffold-header">
|
3
3
|
<%= render :partial => 'list_header' %>
|
4
4
|
</div>
|
data/lib/active_scaffold.rb
CHANGED
@@ -104,14 +104,16 @@ module ActiveScaffold
|
|
104
104
|
end
|
105
105
|
|
106
106
|
def check_input_device
|
107
|
-
if
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
107
|
+
if self.class.uses_active_scaffold?
|
108
|
+
if request.env["HTTP_USER_AGENT"] && request.env["HTTP_USER_AGENT"][/(iPhone|iPod|iPad)/i]
|
109
|
+
session[:input_device_type] = 'TOUCH'
|
110
|
+
session[:hover_supported] = false
|
111
|
+
else
|
112
|
+
session[:input_device_type] = 'MOUSE'
|
113
|
+
session[:hover_supported] = true
|
114
|
+
end if session[:input_device_type].nil?
|
115
|
+
end
|
116
|
+
end
|
115
117
|
|
116
118
|
def touch_device?
|
117
119
|
session[:input_device_type] == 'TOUCH'
|
@@ -32,9 +32,7 @@ module ActiveScaffold::Actions
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
def list_respond_to_js
|
35
|
-
if params[:
|
36
|
-
render(:partial => 'list_with_header')
|
37
|
-
elsif params[:embedded]
|
35
|
+
if params[:embedded]
|
38
36
|
params.delete(:embedded)
|
39
37
|
render(:partial => 'list_with_header')
|
40
38
|
else
|
@@ -1,22 +1,36 @@
|
|
1
1
|
$(document).ready(function() {
|
2
|
-
$('
|
3
|
-
var
|
4
|
-
|
5
|
-
|
2
|
+
$('form.as_form, form.inplace_form').live('as:form_loaded', function(event) {
|
3
|
+
var as_form = $(this).closest("form");
|
4
|
+
as_form.find('input.datetime_picker').each(function(index) {
|
5
|
+
var date_picker = $(this);
|
6
|
+
if (typeof(date_picker.datetimepicker) == 'function') {
|
7
|
+
date_picker.datetimepicker();
|
8
|
+
}
|
9
|
+
});
|
10
|
+
|
11
|
+
as_form.find('input.date_picker').each(function(index) {
|
12
|
+
var date_picker = $(this);
|
13
|
+
if (typeof(date_picker.datepicker) == 'function') {
|
6
14
|
date_picker.datepicker();
|
7
|
-
date_picker.trigger('focus');
|
8
15
|
}
|
9
|
-
}
|
16
|
+
});
|
10
17
|
return true;
|
11
18
|
});
|
12
|
-
$('
|
13
|
-
var
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
date_picker.
|
19
|
+
$('form.as_form, form.inplace_form').live('as:form_unloaded', function(event) {
|
20
|
+
var as_form = $(this).closest("form");
|
21
|
+
as_form.find('input.datetime_picker').each(function(index) {
|
22
|
+
var date_picker = $(this);
|
23
|
+
if (typeof(date_picker.datetimepicker) == 'function') {
|
24
|
+
date_picker.datetimepicker('destroy');
|
25
|
+
}
|
26
|
+
});
|
27
|
+
|
28
|
+
as_form.find('input.date_picker').each(function(index) {
|
29
|
+
var date_picker = $(this);
|
30
|
+
if (typeof(date_picker.datepicker) == 'function') {
|
31
|
+
date_picker.datepicker('destroy');
|
18
32
|
}
|
19
|
-
}
|
33
|
+
});
|
20
34
|
return true;
|
21
35
|
});
|
22
36
|
});
|
@@ -1,11 +1,11 @@
|
|
1
|
-
$('form.as_form').live('as:form_loaded', function(event) {
|
1
|
+
$('form.as_form, form.inplace_form').live('as:form_loaded', function(event) {
|
2
2
|
var as_form = $(this).closest("form");
|
3
3
|
as_form.find('textarea.as_mceEditor').each(function(index, elem) {
|
4
4
|
tinyMCE.execCommand('mceAddControl', false, $(elem).attr('id'));
|
5
5
|
});
|
6
6
|
return true;
|
7
7
|
});
|
8
|
-
$('form.as_form').live('as:form_submit', function(event) {
|
8
|
+
$('form.as_form, form.inplace_form').live('as:form_submit', function(event) {
|
9
9
|
var as_form = $(this).closest("form");
|
10
10
|
if (as_form.has('textarea.as_mceEditor').length > 0) {
|
11
11
|
tinyMCE.triggerSave();
|
@@ -13,7 +13,7 @@ $('form.as_form').live('as:form_submit', function(event) {
|
|
13
13
|
return true;
|
14
14
|
});
|
15
15
|
|
16
|
-
$('form.as_form').live('as:form_unloaded', function(event) {
|
16
|
+
$('form.as_form, form.inplace_form').live('as:form_unloaded', function(event) {
|
17
17
|
var as_form = $(this).closest("form");
|
18
18
|
as_form.find('textarea.as_mceEditor').each(function(index, elem) {
|
19
19
|
tinyMCE.execCommand('mceRemoveControl', false, $(elem).attr('id'));
|
@@ -16,7 +16,7 @@ module ActiveScaffold::Config
|
|
16
16
|
|
17
17
|
# the ActionLink for this action
|
18
18
|
cattr_accessor :link
|
19
|
-
@@link = ActiveScaffold::DataStructures::ActionLink.new('destroy', :label => :delete, :type => :member, :confirm => :are_you_sure_to_delete, :method => :delete, :crud_type => :delete, :position => false, :parameters => {:destroy_action => true}, :security_method => :delete_authorized?)
|
19
|
+
@@link = ActiveScaffold::DataStructures::ActionLink.new('destroy', :label => :delete, :type => :member, :confirm => :are_you_sure_to_delete, :method => :delete, :crud_type => :delete, :position => false, :parameters => {:destroy_action => true}, :security_method => :delete_authorized?, :ignore_method => :delete_ignore?)
|
20
20
|
|
21
21
|
# whether we should refresh list after destroy or not
|
22
22
|
cattr_accessor :refresh_list
|
@@ -128,6 +128,11 @@ module ActiveScaffold::Config
|
|
128
128
|
attr_accessor :nested_auto_open
|
129
129
|
|
130
130
|
class UserSettings < UserSettings
|
131
|
+
def initialize(conf, storage, params)
|
132
|
+
super(conf,storage,params)
|
133
|
+
@sorting = nil
|
134
|
+
end
|
135
|
+
|
131
136
|
# This label has alread been localized.
|
132
137
|
def label
|
133
138
|
@session[:label] ? @session[:label] : @conf.label
|
@@ -159,17 +164,20 @@ module ActiveScaffold::Config
|
|
159
164
|
end
|
160
165
|
|
161
166
|
def sorting
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
167
|
+
if @sorting.nil?
|
168
|
+
# we want to store as little as possible in the session, but we want to return a Sorting data structure. so we recreate it each page load based on session data.
|
169
|
+
@session['sort'] = [@params['sort'], @params['sort_direction']] if @params['sort'] and @params['sort_direction']
|
170
|
+
@session['sort'] = nil if @params['sort_direction'] == 'reset'
|
171
|
+
|
172
|
+
if @session['sort']
|
173
|
+
sorting = @conf.sorting.clone
|
174
|
+
sorting.set(*@session['sort'])
|
175
|
+
@sorting = sorting
|
176
|
+
else
|
177
|
+
@sorting = default_sorting
|
178
|
+
end
|
172
179
|
end
|
180
|
+
@sorting
|
173
181
|
end
|
174
182
|
|
175
183
|
def count_includes
|
@@ -173,7 +173,7 @@ module ActiveScaffold::DataStructures
|
|
173
173
|
protected
|
174
174
|
|
175
175
|
def skip_action_link(controller, link, *args)
|
176
|
-
(!link.ignore_method.nil?
|
176
|
+
(!link.ignore_method.nil? && controller.respond_to?(link.ignore_method) && controller.send(link.ignore_method, *args)) || ((link.security_method_set? or controller.respond_to? link.security_method) and !controller.send(link.security_method, *args))
|
177
177
|
end
|
178
178
|
|
179
179
|
# called during clone or dup. makes the clone/dup deeper.
|
@@ -311,7 +311,7 @@ module ActiveScaffold::DataStructures
|
|
311
311
|
self.sort = false
|
312
312
|
else
|
313
313
|
if self.singular_association?
|
314
|
-
self.sort = {:method => "#{self.name}.
|
314
|
+
self.sort = {:method => "#{self.name}.to_label"}
|
315
315
|
elsif self.plural_association?
|
316
316
|
self.sort = {:method => "#{self.name}.join(',')"}
|
317
317
|
else
|
@@ -42,7 +42,6 @@ module ActiveScaffold
|
|
42
42
|
return text if link.crud_type.nil?
|
43
43
|
url_options[:link] = as_(:create_new) if link.crud_type == :create
|
44
44
|
end
|
45
|
-
|
46
45
|
if column_link_authorized?(link, column, record, associated)
|
47
46
|
render_action_link(link, url_options, record)
|
48
47
|
else
|
@@ -352,14 +351,15 @@ module ActiveScaffold
|
|
352
351
|
|
353
352
|
def render_nested_view(action_links, url_options, record)
|
354
353
|
rendered = []
|
354
|
+
link_id = nil
|
355
355
|
action_links.member.each do |link|
|
356
356
|
if link.nested_link? && link.column && @nested_auto_open[link.column.name] && @records.length <= @nested_auto_open[link.column.name] && controller.respond_to?(:render_component_into_view)
|
357
|
-
link_url_options = {:
|
357
|
+
link_url_options = {:embedded => true, :format => :js}.merge(action_link_url_options(link, url_options, record, options = {:reuse_eid => true}))
|
358
358
|
link_id = get_action_link_id(link_url_options, record, link.column)
|
359
|
-
rendered << (controller.send(:render_component_into_view, link_url_options)
|
359
|
+
rendered << (controller.send(:render_component_into_view, link_url_options))
|
360
360
|
end
|
361
361
|
end
|
362
|
-
rendered.join(' ').html_safe
|
362
|
+
content_tag(:tr, content_tag(:td, rendered.join(' ').html_safe), :class => "inline-adapter-autoopen", 'data-actionlinkid' => link_id, 'data-as_load'=>"tr");
|
363
363
|
end
|
364
364
|
|
365
365
|
end
|
@@ -127,7 +127,7 @@ module ActiveScaffold
|
|
127
127
|
end
|
128
128
|
|
129
129
|
def skip_action_link(link, *args)
|
130
|
-
(!link.ignore_method.nil?
|
130
|
+
(!link.ignore_method.nil? && controller.respond_to?(link.ignore_method) && controller.send(link.ignore_method, *args)) || ((link.security_method_set? or controller.respond_to? link.security_method) and !controller.send(link.security_method, *args))
|
131
131
|
end
|
132
132
|
|
133
133
|
def render_action_link(link, url_options, record = nil, html_options = {})
|
@@ -168,6 +168,7 @@ module ActiveScaffold
|
|
168
168
|
|
169
169
|
html_options['data-confirm'] = link.confirm(record.try(:to_label)) if link.confirm?
|
170
170
|
html_options['data-position'] = link.position if link.position and link.inline?
|
171
|
+
html_options['data-controller'] = link.controller.to_s if link.controller
|
171
172
|
html_options[:class] += ' as_action' if link.inline?
|
172
173
|
html_options['data-action'] = link.action if link.inline?
|
173
174
|
if link.popup?
|
data/lib/active_scaffold_env.rb
CHANGED
@@ -7,8 +7,8 @@ ActionController::Base.send(:include, ActiveScaffold::Helpers::ControllerHelpers
|
|
7
7
|
ActionView::Base.send(:include, ActiveScaffold::Helpers::ViewHelpers)
|
8
8
|
|
9
9
|
ActionController::Base.class_eval {include ActiveRecordPermissions::ModelUserAccess::Controller}
|
10
|
-
ActiveRecord::Base.class_eval
|
11
|
-
ActiveRecord::Base.class_eval
|
10
|
+
ActiveRecord::Base.class_eval {include ActiveRecordPermissions::ModelUserAccess::Model}
|
11
|
+
ActiveRecord::Base.class_eval {include ActiveRecordPermissions::Permissions}
|
12
12
|
|
13
13
|
I18n.load_path += Dir[File.join(File.dirname(__FILE__), 'active_scaffold', 'locale', '*.{rb,yml}')]
|
14
14
|
#ActiveScaffold.js_framework = :jquery
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_scaffold_vho
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 53
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 3.0.
|
9
|
+
- 25
|
10
|
+
version: 3.0.25
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Many, see README
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2012-02-28 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -178,7 +178,6 @@ files:
|
|
178
178
|
- frontends/default/views/_list_calculations.html.erb
|
179
179
|
- frontends/default/views/_list_column_headings.html.erb
|
180
180
|
- frontends/default/views/_list_header.html.erb
|
181
|
-
- frontends/default/views/_list_inline_adapter.html.erb
|
182
181
|
- frontends/default/views/_list_messages.html.erb
|
183
182
|
- frontends/default/views/_list_pagination.html.erb
|
184
183
|
- frontends/default/views/_list_pagination_links.html.erb
|
@@ -296,7 +295,6 @@ files:
|
|
296
295
|
- lib/active_scaffold/data_structures/nested_info.rb
|
297
296
|
- lib/active_scaffold/data_structures/set.rb
|
298
297
|
- lib/active_scaffold/data_structures/sorting.rb
|
299
|
-
- lib/active_scaffold/extensions/action_controller_rendering.rb
|
300
298
|
- lib/active_scaffold/extensions/action_view_rendering.rb
|
301
299
|
- lib/active_scaffold/extensions/action_view_resolver.rb
|
302
300
|
- lib/active_scaffold/extensions/active_association_reflection.rb
|
@@ -1,10 +0,0 @@
|
|
1
|
-
<%# nested_id, allows us to remove a nested scaffold programmatically %>
|
2
|
-
<tr class="inline-adapter" id="<%= element_row_id :action => :nested %>">
|
3
|
-
<td colspan="99" class="inline-adapter-cell">
|
4
|
-
<div class="<%= "#{params[:action]}-view" if params[:action] %> <%= "#{params[:associations] ? params[:associations] : params[:controller]}-view" %> view">
|
5
|
-
<%= link_to(as_(:close), '', :class => 'inline-adapter-close as_cancel', :remote => true, :title => as_(:close), 'data-refresh' => (action_name == 'index' ? true : false)) -%>
|
6
|
-
<%= payload -%>
|
7
|
-
</div>
|
8
|
-
</td>
|
9
|
-
</tr>
|
10
|
-
<%= javascript_tag("var action_link = ActiveScaffold.ActionLink.get('#{element_row_id(:action => :nested)}'); if (action_link) action_link.update_flash_messages('#{escape_javascript(render(:partial => 'messages').strip)}');") %>
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# wrap the action rendering for ActiveScaffold controllers
|
2
|
-
module ActionController #:nodoc:
|
3
|
-
class Base
|
4
|
-
def render_with_active_scaffold(*args, &block)
|
5
|
-
if self.class.uses_active_scaffold? and params[:adapter] and @rendering_adapter.nil?
|
6
|
-
@rendering_adapter = true # recursion control
|
7
|
-
# if we need an adapter, then we render the actual stuff to a string and insert it into the adapter template
|
8
|
-
opts = args.blank? ? Hash.new : args.first
|
9
|
-
render :partial => params[:adapter][1..-1],
|
10
|
-
:locals => {:payload => render_to_string(opts.merge(:layout => false), &block)},
|
11
|
-
:use_full_path => true, :layout => false
|
12
|
-
@rendering_adapter = nil # recursion control
|
13
|
-
else
|
14
|
-
render_without_active_scaffold(*args, &block)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
alias_method_chain :render, :active_scaffold
|
18
|
-
|
19
|
-
# Rails 2.x implementation is post-initialization on :active_scaffold method
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|