active_scaffold_vho 3.0.20 → 3.0.21

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -8,6 +8,7 @@ source "http://rubygems.org"
8
8
  group :development do
9
9
  gem "shoulda", ">= 0"
10
10
  gem "bundler", "~> 1.0.0"
11
- gem "jeweler", "~> 1.5.2"
11
+ #gem "jeweler", "~> 1.5.2"
12
+ gem "jeweler", :git => 'git://github.com/vhochstein/jeweler.git'
12
13
  gem "rcov", ">= 0"
13
14
  end
data/Gemfile.lock CHANGED
@@ -1,12 +1,17 @@
1
+ GIT
2
+ remote: git://github.com/vhochstein/jeweler.git
3
+ revision: 5cdcbb9aff001309bf82e3df4060b8e2b485b8ea
4
+ specs:
5
+ jeweler (1.6.4)
6
+ bundler (~> 1.0)
7
+ git (>= 1.2.5)
8
+ rake
9
+
1
10
  GEM
2
11
  remote: http://rubygems.org/
3
12
  specs:
4
13
  git (1.2.5)
5
- jeweler (1.5.2)
6
- bundler (~> 1.0.0)
7
- git (>= 1.2.5)
8
- rake
9
- rake (0.8.7)
14
+ rake (0.9.2)
10
15
  rcov (0.9.9)
11
16
  shoulda (2.11.3)
12
17
 
@@ -15,6 +20,6 @@ PLATFORMS
15
20
 
16
21
  DEPENDENCIES
17
22
  bundler (~> 1.0.0)
18
- jeweler (~> 1.5.2)
23
+ jeweler!
19
24
  rcov
20
25
  shoulda
data/README CHANGED
@@ -20,7 +20,8 @@ http://code.google.com/p/recordselect/
20
20
 
21
21
  Please note the following list of Active Scaffold branches and Rails versions. Master will not work with Rails < 2.2
22
22
 
23
- Active Scaffold master currently supports rails-2.3.5, but incompatible changes can be introduced, if you want an stable version, use rails-2.3
23
+ Active Scaffold master currently supports rails-3.1, but incompatible changes can be introduced, if you want an stable version, use rails-2.3
24
+ Rails 3.0.*: Active Scaffold rails-3.0
24
25
  Rails 2.3.*: Active Scaffold rails-2.3
25
26
  Rails 2.2.*: Active Scaffold rails-2.2
26
27
  Rails 2.1.*: Active Scaffold rails-2.1
@@ -37,13 +38,13 @@ Since Rails 3.0, https://github.com/rails/verification.git is also needed.
37
38
  If you want to install as plugins under vendor/plugins, install these versions:
38
39
  rails plugin install git://github.com/vhochstein/render_component.git
39
40
  rails plugin install git://github.com/rails/verification.git
40
- rails plugin install git://github.com/vhochstein/active_scaffold.git
41
+ rails plugin install git://github.com/vhochstein/active_scaffold.git -r 'rails-3.0'
41
42
 
42
43
  If you want to use the gem, add to your Gemfile:
43
44
  gem "active_scaffold_vho"
44
45
 
45
46
  In case you would like to use most recent commit:
46
- gem 'active_scaffold_vho', :git => 'git://github.com/vhochstein/active_scaffold.git'
47
+ gem 'active_scaffold_vho', :git => 'git://github.com/vhochstein/active_scaffold.git', :branch => 'rails-3.0'
47
48
 
48
49
  == Pick your own javascript framework
49
50
 
@@ -66,4 +67,8 @@ To configure the javascript framework when installed as a gem:
66
67
  Add a config/initializers/active_scaffold.rb containing:
67
68
  ActiveScaffold.js_framework = :jquery # :prototype is the default
68
69
 
70
+ == Rails 3.1 compatible fork of activesaffold by Volker Hochstein:
71
+ under construction
72
+
73
+
69
74
  Released under the MIT license (included)
@@ -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.20"
8
+ s.version = "3.0.21"
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{2011-05-27}
12
+ s.date = %q{2011-09-23}
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 = [
@@ -131,6 +131,8 @@ Gem::Specification.new do |s|
131
131
  "lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge_helpers.rb",
132
132
  "lib/active_scaffold/bridges/carrierwave/lib/form_ui.rb",
133
133
  "lib/active_scaffold/bridges/carrierwave/lib/list_ui.rb",
134
+ "lib/active_scaffold/bridges/country_helper/bridge.rb",
135
+ "lib/active_scaffold/bridges/country_helper/lib/country_helper_bridge.rb",
134
136
  "lib/active_scaffold/bridges/date_picker/bridge.rb",
135
137
  "lib/active_scaffold/bridges/date_picker/lib/datepicker_bridge.rb",
136
138
  "lib/active_scaffold/bridges/date_picker/public/javascripts/date_picker_bridge.js",
@@ -198,7 +200,6 @@ Gem::Specification.new do |s|
198
200
  "lib/active_scaffold/finder.rb",
199
201
  "lib/active_scaffold/helpers/association_helpers.rb",
200
202
  "lib/active_scaffold/helpers/controller_helpers.rb",
201
- "lib/active_scaffold/helpers/country_helpers.rb",
202
203
  "lib/active_scaffold/helpers/form_column_helpers.rb",
203
204
  "lib/active_scaffold/helpers/human_condition_helpers.rb",
204
205
  "lib/active_scaffold/helpers/id_helpers.rb",
@@ -306,54 +307,6 @@ Gem::Specification.new do |s|
306
307
  s.require_paths = ["lib"]
307
308
  s.rubygems_version = %q{1.3.7}
308
309
  s.summary = %q{Rails 3 Version of activescaffold supporting prototype and jquery}
309
- s.test_files = [
310
- "test/bridges/bridge_test.rb",
311
- "test/config/base_test.rb",
312
- "test/config/create_test.rb",
313
- "test/config/list_test.rb",
314
- "test/config/show_test.rb",
315
- "test/config/update_test.rb",
316
- "test/const_mocker.rb",
317
- "test/data_structures/action_columns_test.rb",
318
- "test/data_structures/action_link_test.rb",
319
- "test/data_structures/action_links_test.rb",
320
- "test/data_structures/actions_test.rb",
321
- "test/data_structures/association_column_test.rb",
322
- "test/data_structures/column_test.rb",
323
- "test/data_structures/columns_test.rb",
324
- "test/data_structures/error_message_test.rb",
325
- "test/data_structures/set_test.rb",
326
- "test/data_structures/sorting_test.rb",
327
- "test/data_structures/standard_column_test.rb",
328
- "test/data_structures/virtual_column_test.rb",
329
- "test/extensions/active_record_test.rb",
330
- "test/extensions/array_test.rb",
331
- "test/helpers/form_column_helpers_test.rb",
332
- "test/helpers/list_column_helpers_test.rb",
333
- "test/helpers/pagination_helpers_test.rb",
334
- "test/misc/active_record_permissions_test.rb",
335
- "test/misc/attribute_params_test.rb",
336
- "test/misc/configurable_test.rb",
337
- "test/misc/constraints_test.rb",
338
- "test/misc/finder_test.rb",
339
- "test/misc/lang_test.rb",
340
- "test/mock_app/app/controllers/application_controller.rb",
341
- "test/mock_app/app/helpers/application_helper.rb",
342
- "test/mock_app/config/boot.rb",
343
- "test/mock_app/config/environment.rb",
344
- "test/mock_app/config/environments/development.rb",
345
- "test/mock_app/config/environments/production.rb",
346
- "test/mock_app/config/environments/test.rb",
347
- "test/mock_app/config/initializers/backtrace_silencers.rb",
348
- "test/mock_app/config/initializers/inflections.rb",
349
- "test/mock_app/config/initializers/mime_types.rb",
350
- "test/mock_app/config/initializers/new_rails_defaults.rb",
351
- "test/mock_app/config/initializers/session_store.rb",
352
- "test/mock_app/config/routes.rb",
353
- "test/model_stub.rb",
354
- "test/run_all.rb",
355
- "test/test_helper.rb"
356
- ]
357
310
 
358
311
  if s.respond_to? :specification_version then
359
312
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
@@ -362,7 +315,7 @@ Gem::Specification.new do |s|
362
315
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
363
316
  s.add_development_dependency(%q<shoulda>, [">= 0"])
364
317
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
365
- s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
318
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
366
319
  s.add_development_dependency(%q<rcov>, [">= 0"])
367
320
  s.add_runtime_dependency(%q<render_component_vho>, [">= 0"])
368
321
  s.add_runtime_dependency(%q<verification>, [">= 0"])
@@ -370,7 +323,7 @@ Gem::Specification.new do |s|
370
323
  else
371
324
  s.add_dependency(%q<shoulda>, [">= 0"])
372
325
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
373
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
326
+ s.add_dependency(%q<jeweler>, [">= 0"])
374
327
  s.add_dependency(%q<rcov>, [">= 0"])
375
328
  s.add_dependency(%q<render_component_vho>, [">= 0"])
376
329
  s.add_dependency(%q<verification>, [">= 0"])
@@ -379,7 +332,7 @@ Gem::Specification.new do |s|
379
332
  else
380
333
  s.add_dependency(%q<shoulda>, [">= 0"])
381
334
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
382
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
335
+ s.add_dependency(%q<jeweler>, [">= 0"])
383
336
  s.add_dependency(%q<rcov>, [">= 0"])
384
337
  s.add_dependency(%q<render_component_vho>, [">= 0"])
385
338
  s.add_dependency(%q<verification>, [">= 0"])
@@ -34,7 +34,14 @@ $(document).ready(function() {
34
34
  } else {
35
35
  // hack: jquery requires if you request for javascript that javascript
36
36
  // is coming back, however rails has a different mantra
37
- if (action_link.position) event.data_type = 'rails';
37
+ if (action_link.position) {
38
+ if (parseFloat($.fn.jquery) >= 1.5) {
39
+ event.data_type = 'text';
40
+ } else {
41
+ event.data_type = 'rails';
42
+ }
43
+ }
44
+
38
45
  if (action_link.loading_indicator) action_link.loading_indicator.css('visibility','visible');
39
46
  action_link.disable();
40
47
  }
@@ -50,7 +57,7 @@ $(document).ready(function() {
50
57
  } else {
51
58
  action_link.enable();
52
59
  }
53
- return true;
60
+ $(this).trigger('as:action_success', action_link);
54
61
  }
55
62
  return true;
56
63
  });
@@ -117,19 +124,6 @@ $(document).ready(function() {
117
124
  ActiveScaffold.report_500_response(as_scaffold);
118
125
  return true;
119
126
  });
120
- $('span.in_place_editor_field').live('hover', function(event) {
121
- $(this).data(); // jquery 1.4.2 workaround
122
- if (event.type == 'mouseenter') {
123
- if (typeof($(this).data('editInPlace')) === 'undefined') $(this).addClass("hover");
124
- }
125
- if (event.type == 'mouseleave') {
126
- if (typeof($(this).data('editInPlace')) === 'undefined') $(this).removeClass("hover");
127
- }
128
- return true;
129
- });
130
- $('span.in_place_editor_field').live('click', function(event) {
131
- ActiveScaffold.in_place_editor_field_clicked($(this));
132
- });
133
127
  $('a.as_paginate').live('ajax:before',function(event) {
134
128
  var as_paginate = $(this);
135
129
  var history_controller_id = as_paginate.attr('data-page-history');
@@ -230,6 +224,23 @@ $(document).ready(function() {
230
224
  }
231
225
  return true;
232
226
  });
227
+ $('form.as_form').live('as:form_loaded', function(event) {
228
+ var as_form = $(this).closest("form");
229
+ ActiveScaffold.focus_first_element_of_form(as_form);
230
+ return true;
231
+ });
232
+ $('span.mark_heading, span.in_place_editor_field[data-ie_mode="inline_checkbox"]').live('click', function(event) {
233
+ ActiveScaffold.process_checkbox_inplace_edit($(this).find('input:checkbox'), ActiveScaffold.inplace_edit_options($(this)));
234
+ return true;
235
+ });
236
+ $('tr.record').live('as:list_row_loaded', function(event) {
237
+ $(this).closest("tr").find('td > span.in_place_editor_field[data-ie_mode!="inline_checkbox"]').each(function(index) {
238
+ ActiveScaffold.create_inplace_editor($(this));
239
+ });
240
+ return true;
241
+ });
242
+ ActiveScaffold.trigger_load_events($('[data-as_load]'));
243
+
233
244
  });
234
245
 
235
246
  /* Simple Inheritance
@@ -439,6 +450,7 @@ var ActiveScaffold = {
439
450
  if (element.attr('id')) {
440
451
  element = $('#' + element.attr('id'));
441
452
  }
453
+ ActiveScaffold.trigger_load_events(element.find('[data-as_load]').andSelf());
442
454
  return element;
443
455
  },
444
456
 
@@ -446,6 +458,7 @@ var ActiveScaffold = {
446
458
  if (typeof(element) == 'string') element = '#' + element;
447
459
  element = $(element);
448
460
  element.html(html);
461
+ ActiveScaffold.trigger_load_events(element.find('[data-as_load]'));
449
462
  return element;
450
463
  },
451
464
 
@@ -498,15 +511,18 @@ var ActiveScaffold = {
498
511
 
499
512
  if (options.insert_at == 'top') {
500
513
  tbody.prepend(html);
514
+ ActiveScaffold.trigger_load_events(tbody.children().first().find('[data-as_load]'));
501
515
  var new_row = tbody.children('tr.record:first-child');
502
516
  } else if (options.insert_at == 'bottom') {
503
517
  var rows = tbody.children('tr.record, tr.inline-adapter');
504
518
  var new_row = null;
505
519
  if (rows.length > 0) {
506
520
  new_row = rows.last().after(html).next();
521
+
507
522
  } else {
508
523
  new_row = tbody.append(html).children().last();
509
524
  }
525
+ ActiveScaffold.trigger_load_events(new_row);
510
526
  }
511
527
  this.stripe(tbody);
512
528
  this.hide_empty_message(tbody);
@@ -590,10 +606,8 @@ var ActiveScaffold = {
590
606
  if (column_heading.attr('data-ie_size')) options.text_size = column_heading.attr('data-ie_size');
591
607
  },
592
608
 
593
- create_inplace_editor: function(span, options) {
594
- span.removeClass('hover');
595
- span.editInPlace(options);
596
- span.trigger('click.editInPlace');
609
+ create_inplace_editor: function(span) {
610
+ span.editInPlace(ActiveScaffold.inplace_edit_options(span));
597
611
  },
598
612
 
599
613
  highlight: function(element) {
@@ -646,6 +660,7 @@ var ActiveScaffold = {
646
660
  if (element) {
647
661
  if (options.is_subform == false) {
648
662
  this.replace(element.closest('dl'), content);
663
+ ActiveScaffold.trigger_load_events(element.closest('li.form-element'));
649
664
  } else {
650
665
  this.replace_html(element, content);
651
666
  }
@@ -701,9 +716,7 @@ var ActiveScaffold = {
701
716
  }
702
717
  },
703
718
 
704
- in_place_editor_field_clicked: function(span) {
705
- span.data(); // jquery 1.4.2 workaround
706
- if (typeof(span.data('editInPlace')) === 'undefined') {
719
+ inplace_edit_options: function(span){
707
720
  var options = {show_buttons: true,
708
721
  hover_class: 'hover',
709
722
  element_id: 'editor_id',
@@ -756,14 +769,29 @@ var ActiveScaffold = {
756
769
  var plural = false;
757
770
  if (column_heading.attr('data-ie_plural')) plural = true;
758
771
  options.field_type = 'remote';
759
- options.editor_url = render_url.replace(/__id__/, record_id)
772
+ options.editor_url = render_url.replace(/__id__/, record_id);
760
773
  }
761
- if (mode === 'inline_checkbox') {
762
- ActiveScaffold.process_checkbox_inplace_edit(span.find('input:checkbox'), options);
763
- } else {
764
- ActiveScaffold.create_inplace_editor(span, options);
774
+ return options;
775
+ },
776
+
777
+ in_place_checkbox_clicked: function(span) {
778
+ ActiveScaffold.process_checkbox_inplace_edit(span.find('input:checkbox'), options);
779
+ },
780
+
781
+ trigger_load_events: function(elements){
782
+ elements.each(function(index) {
783
+ switch ($(this).attr('data-as_load')) {
784
+ case 'tr':
785
+ $(this).trigger('as:list_row_loaded');
786
+ break;
787
+ case 'form':
788
+ $(this).trigger('as:form_loaded');
789
+ break;
790
+ case 'form-element':
791
+ $(this).trigger('as:form_element_loaded');
792
+ break;
765
793
  }
766
- }
794
+ });
767
795
  }
768
796
  }
769
797
 
@@ -863,6 +891,7 @@ ActiveScaffold.ActionLink.Abstract = Class.extend({
863
891
  this.loading_indicator = loading_indicator;
864
892
  this.hide_target = false;
865
893
  this.position = this.tag.attr('data-position');
894
+ this.action = this.tag.attr('data-action');
866
895
 
867
896
  this.tag.data('action_link', this);
868
897
  return this;
@@ -963,10 +992,12 @@ ActiveScaffold.ActionLink.Record = ActiveScaffold.ActionLink.Abstract.extend({
963
992
 
964
993
  if (this.position == 'after') {
965
994
  this.target.after(content);
995
+ ActiveScaffold.trigger_load_events(this.target.next().find('[data-as_load]'));
966
996
  this.set_adapter(this.target.next());
967
997
  }
968
998
  else if (this.position == 'before') {
969
999
  this.target.before(content);
1000
+ ActiveScaffold.trigger_load_events(this.target.prev().find('[data-as_load]'));
970
1001
  this.set_adapter(this.target.prev());
971
1002
  }
972
1003
  else {
@@ -1027,6 +1058,7 @@ ActiveScaffold.ActionLink.Table = ActiveScaffold.ActionLink.Abstract.extend({
1027
1058
  insert: function(content) {
1028
1059
  if (this.position == 'top') {
1029
1060
  this.target.prepend(content);
1061
+ ActiveScaffold.trigger_load_events(this.target.children().first().find('[data-as_load]'));
1030
1062
  this.set_adapter(this.target.children().first());
1031
1063
  }
1032
1064
  else {
@@ -309,6 +309,12 @@ document.observe("dom:loaded", function() {
309
309
  }
310
310
  return true;
311
311
  });
312
+ document.on('as:form_loaded', 'form.as_form', function(event) {
313
+ var as_form = event.findElement('form');
314
+ ActiveScaffold.focus_first_element_of_form(as_form);
315
+ return true;
316
+ });
317
+ ActiveScaffold.trigger_load_events($$('[data-as_load]'));
312
318
  });
313
319
 
314
320
 
@@ -394,12 +400,16 @@ var ActiveScaffold = {
394
400
  element = $(element)
395
401
  Element.replace(element, html);
396
402
  element = $(element.readAttribute('id'));
403
+ var elements = element.select('[data-as_load]');
404
+ elements.unshift(element);
405
+ ActiveScaffold.trigger_load_events(elements);
397
406
  return element;
398
407
  },
399
408
 
400
409
  replace_html: function(element, html) {
401
410
  element = $(element);
402
411
  element.update(html);
412
+ ActiveScaffold.trigger_load_events(element.select('[data-as_load]'));
403
413
  return element;
404
414
  },
405
415
 
@@ -454,7 +464,7 @@ var ActiveScaffold = {
454
464
  }
455
465
  new_row = Selector.findChildElements(tbody, ['tr.record']).last();
456
466
  }
457
-
467
+ ActiveScaffold.trigger_load_events(new Array(new_row));
458
468
  this.stripe(tbody);
459
469
  this.hide_empty_message(tbody);
460
470
  this.increment_record_count(tbody.up('div.active-scaffold'));
@@ -581,6 +591,7 @@ var ActiveScaffold = {
581
591
  if (element) {
582
592
  if (options.is_subform == false) {
583
593
  this.replace(element.up('dl'), content);
594
+ ActiveScaffold.trigger_load_events(new Array(element.up('li.form-element')));
584
595
  } else {
585
596
  this.replace_html(element, content);
586
597
  }
@@ -620,6 +631,22 @@ var ActiveScaffold = {
620
631
  }
621
632
  mark_all_checkbox.writeAttribute('value', ('' + !options.checked));
622
633
  }
634
+ },
635
+
636
+ trigger_load_events: function(elements){
637
+ elements.each(function(element) {
638
+ switch (element.readAttribute('data-as_load')) {
639
+ case 'tr':
640
+ element.fire('as:list_row_loaded');
641
+ break;
642
+ case 'form':
643
+ element.fire('as:form_loaded');
644
+ break;
645
+ case 'form-element':
646
+ element.fire('as:form_element_loaded');
647
+ break;
648
+ }
649
+ });
623
650
  }
624
651
 
625
652
  }
@@ -854,10 +881,12 @@ ActiveScaffold.ActionLink.Record = Class.create(ActiveScaffold.ActionLink.Abstra
854
881
 
855
882
  if (this.position == 'after') {
856
883
  this.target.insert({after:content});
884
+ ActiveScaffold.trigger_load_events(this.target.next().select('[data-as_load]'));
857
885
  this.set_adapter(this.target.next());
858
886
  }
859
887
  else if (this.position == 'before') {
860
888
  this.target.insert({before:content});
889
+ ActiveScaffold.trigger_load_events(this.target.previous().select('[data-as_load]'));
861
890
  this.set_adapter(this.target.previous());
862
891
  }
863
892
  else {
@@ -916,6 +945,7 @@ ActiveScaffold.ActionLink.Table = Class.create(ActiveScaffold.ActionLink.Abstrac
916
945
  insert: function(content) {
917
946
  if (this.position == 'top') {
918
947
  this.target.insert({top:content});
948
+ ActiveScaffold.trigger_load_events(this.target.immediateDescendants().first().select('[data-as_load]'));
919
949
  this.set_adapter(this.target.immediateDescendants().first());
920
950
  }
921
951
  else {
@@ -4,7 +4,10 @@
4
4
  options = {:id => element_form_id(:action => :add_existing),
5
5
  :class => "as_form create",
6
6
  :method => :post,
7
- 'data-loading' => true}
7
+ 'data-loading' => true,
8
+ 'data-as_load' => 'form',
9
+ 'data-as_action' => 'create'
10
+ }
8
11
  options[:remote] = true if xhr
9
12
  form_tag url_options, options -%>
10
13
 
@@ -25,6 +28,4 @@ options = {:id => element_form_id(:action => :add_existing),
25
28
  <%= loading_indicator_tag(:action => :add_existing, :id => params[:id]) %>
26
29
  </p>
27
30
 
28
- </form>
29
- <%= javascript_tag("ActiveScaffold.focus_first_element_of_form('#{element_form_id(:action => :add_existing)}');") %>
30
-
31
+ </form>
@@ -14,7 +14,10 @@ options = {:onsubmit => onsubmit,
14
14
  :multipart => multipart,
15
15
  :class => "as_form #{form_action.to_s}",
16
16
  :method => method,
17
- 'data-loading' => true}
17
+ 'data-loading' => true,
18
+ 'data-as_load' => 'form',
19
+ 'data-as_action' => form_action
20
+ }
18
21
  cancel_options = {:class => 'as_cancel', 'data-refresh' => false}
19
22
 
20
23
  cancel_options[:remote] = true if xhr #cancel link does nt have to care about multipart forms
@@ -48,4 +51,3 @@ end
48
51
  </p>
49
52
 
50
53
  </form>
51
- <%= javascript_tag("ActiveScaffold.focus_first_element_of_form('#{element_form_id(:action => form_action)}');") %>
@@ -4,7 +4,10 @@ options = {:id => element_form_id(:action => 'search'),
4
4
  :class => "as_form search",
5
5
  :remote => true,
6
6
  :method => :get,
7
- 'data-loading' => true}
7
+ 'data-loading' => true,
8
+ 'data-as_load' => 'form',
9
+ 'data-as_action' => 'search'
10
+ }
8
11
  form_tag url_options, options %>
9
12
  <ol class="form">
10
13
  <% visibles, hiddens = visibles_and_hiddens(active_scaffold_config.field_search) %>
@@ -28,5 +31,4 @@ form_tag url_options, options %>
28
31
  <%= link_to as_(:reset), url_for(url_options.merge(:search => '')), :class => 'as_cancel', :remote => true %>
29
32
  <%= loading_indicator_tag(:action => :search) %>
30
33
  </p>
31
- </form>
32
- <%= javascript_tag("ActiveScaffold.focus_first_element_of_form('#{element_form_id(:action => 'search')}');") %>
34
+ </form>
@@ -4,7 +4,7 @@
4
4
  <% renders_as = column_renders_as(column) %>
5
5
  <% if renders_as == :subsection -%>
6
6
  <% subsection_id = sub_section_id(:sub_section => column.label) %>
7
- <li class="sub-section">
7
+ <li class="sub-section" data-as_load="form-element">
8
8
  <h5><%= column.label %></h5>
9
9
  <%= render :partial => 'form', :locals => { :columns => column, :subsection_id => subsection_id} %>
10
10
  <%= link_to_visibility_toggle(subsection_id, {:default_visible => !column.collapsed}) -%>
@@ -12,11 +12,11 @@
12
12
  <% elsif column.readonly_association?
13
13
  next %>
14
14
  <% elsif renders_as == :subform and !override_form_field?(column) -%>
15
- <li class="sub-form <%= active_scaffold_config_for(column.association.klass).subform.layout %>-sub-form <%= column.css_class unless column.css_class.nil? || column.css_class.is_a?(Proc) %>" id="<%= sub_form_id(:association => column.name) %>">
15
+ <li class="sub-form <%= active_scaffold_config_for(column.association.klass).subform.layout %>-sub-form <%= column.css_class unless column.css_class.nil? || column.css_class.is_a?(Proc) %>" id="<%= sub_form_id(:association => column.name) %>" data-as_load="form-element">
16
16
  <%=raw render :partial => form_partial_for_column(column, renders_as), :locals => { :column => column } -%>
17
17
  </li>
18
18
  <% else -%>
19
- <li class="form-element <%= 'required' if column.required? %> <%= column.css_class unless column.css_class.nil? || column.css_class.is_a?(Proc) %>">
19
+ <li class="form-element <%= 'required' if column.required? %> <%= column.css_class unless column.css_class.nil? || column.css_class.is_a?(Proc) %>" data-as_load="form-element">
20
20
  <%=raw render :partial => form_partial_for_column(column, renders_as), :locals => { :column => column } -%>
21
21
  </li>
22
22
  <% end -%>
@@ -1,6 +1,6 @@
1
1
  <% display_class = ( @records.kind_of?(Array) ? @records.first : @records )
2
2
  columns ||= list_columns -%>
3
- <tr id="<%= active_scaffold_calculations_id %>" class="active-scaffold-calculations">
3
+ <tr id="<%= active_scaffold_calculations_id %>" class="active-scaffold-calculations" data-as_load="tr">
4
4
  <% columns.each do |column| -%>
5
5
  <td <%= "id=#{active_scaffold_calculations_id(column)}" if column.calculation? %>>
6
6
  <% if column.calculation? -%>
@@ -7,7 +7,7 @@ url_options = params_for(:action => :list, :id => record.id)
7
7
  action_links ||= active_scaffold_config.action_links.member
8
8
  -%>
9
9
 
10
- <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 %>">
10
+ <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">
11
11
  <%= render :partial => 'list_record_columns', :locals => {:record => record, :columns => columns} %>
12
12
  <%= render :partial => 'list_actions', :locals => {:record => record, :url_options => url_options, :action_links => action_links} unless action_links.empty? %>
13
13
  <%= render_nested_view(action_links, url_options, record) unless @nested_auto_open.nil? %>
@@ -4,7 +4,10 @@
4
4
  options = {:id => element_form_id(:action => 'search'),
5
5
  :class => "as_form search",
6
6
  :remote => true,
7
- :method => :get}
7
+ :method => :get,
8
+ 'data-as_load' => 'form',
9
+ 'data-as_action' => 'search'
10
+ }
8
11
  options['data-loading'] = true unless live_search
9
12
  form_tag url_options, options %>
10
13
  <%= text_field_tag :search, search_params, :class => 'text-input', :id => search_input_id, :size => 50, :autocomplete => :off %>
@@ -29,6 +32,5 @@ options['data-loading'] = true unless live_search
29
32
  $(<%= "##{search_input_id}".to_json.html_safe %>).delayedObserver(0.5, function() {
30
33
  $(<%= "##{search_input_id}".to_json.html_safe %>).parent().trigger("submit");});
31
34
  <% end -%>
32
- ActiveScaffold.focus_first_element_of_form('<%= element_form_id(:action => 'search') %>');
33
35
  //]]>
34
36
  </script>
@@ -1,6 +1,6 @@
1
1
  <div class="active-scaffold">
2
2
  <div class="delete-view view">
3
- <%= form_tag params_for(:action => link.action, :id => params[:id]), { :method => link.method } %>
3
+ <%= form_tag params_for(:action => link.action, :id => params[:id]), { :method => link.method, 'data-as_load' => 'form', 'data-as_action' => link.action} %>
4
4
  <h4><%= link.confirm(record.try(:to_label)) -%></h4>
5
5
 
6
6
  <p class="form-footer">
@@ -1,6 +1,6 @@
1
1
  <div class="active-scaffold">
2
2
  <div class="delete-view view">
3
- <%= form_tag params_for(:action => :destroy, :id => params[:id]), { :method => :delete } %>
3
+ <%= form_tag params_for(:action => :destroy, :id => params[:id]), { :method => :delete, 'data-as_load' => 'form', 'data-as_action' => :destroy} %>
4
4
  <h4><%= as_(:are_you_sure_to_delete, :label => @record.try(:to_label)) -%></h4>
5
5
 
6
6
  <p class="form-footer">
@@ -39,6 +39,7 @@ module ActiveScaffold
39
39
  crud_type = parent_record.new_record? ? :create : :update
40
40
  return parent_record unless parent_record.authorized_for?(:crud_type => crud_type)
41
41
 
42
+ attributes = {} unless attributes.is_a?(Hash)
42
43
  multi_parameter_attributes = {}
43
44
  attributes.each do |k, v|
44
45
  next unless k.include? '('
@@ -0,0 +1,9 @@
1
+ ActiveScaffold::Bridges.bridge "CountryHelper" do
2
+ install do
3
+ require File.join(File.dirname(__FILE__), "lib/country_helper_bridge.rb")
4
+ end
5
+
6
+ install? do
7
+ true
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  module ActiveScaffold
2
- module Helpers
2
+ module CountryHelperBridge
3
3
  module CountryHelpers
4
4
  # Return select and option tags for the given object and method, using country_options_for_select to generate the list of option tags.
5
5
  def country_select(object, method, priority_countries = nil, options = {}, html_options = {})
@@ -350,3 +350,9 @@ module ActiveScaffold
350
350
  end
351
351
  end
352
352
  end
353
+
354
+ ActionView::Base.class_eval do
355
+ include ActiveScaffold::CountryHelperBridge::CountryHelpers
356
+ include ActiveScaffold::CountryHelperBridge::FormColumnHelpers
357
+ include ActiveScaffold::CountryHelperBridge::SearchColumnHelpers
358
+ end
@@ -42,7 +42,7 @@ module ActiveScaffold::Config
42
42
  def columns
43
43
  # we want to delay initializing to the @core.columns set for as long as possible. Too soon and .search_sql will not be available to .searchable?
44
44
  unless @columns
45
- self.columns = @core.columns.collect{|c| c.name if c.searchable? and c.column and c.column.text?}.compact
45
+ self.columns = @core.columns.collect{|c| c.name if @core.columns._inheritable.include?(c.name) and c.searchable? and c.column and c.column.text?}.compact
46
46
  end
47
47
  @columns
48
48
  end
@@ -102,7 +102,7 @@ module ActiveScaffold::DataStructures
102
102
  model.reflect_on_all_associations.each do |current|
103
103
  if !current.belongs_to? && association.primary_key_name == current.association_foreign_key
104
104
  constrained_fields << current.name.to_sym
105
- @child_association = current
105
+ @child_association = current if current.klass == @parent_model
106
106
  end
107
107
  if association.primary_key_name == current.primary_key_name
108
108
  # show columns for has_many and has_one child associationes
@@ -128,7 +128,7 @@ module ActiveScaffold::DataStructures
128
128
 
129
129
  def set_sorting_from_order_clause(order_clause, model_table_name = nil)
130
130
  clear
131
- order_clause.split(',').each do |criterion|
131
+ order_clause.to_s.split(',').each do |criterion|
132
132
  unless criterion.blank?
133
133
  order_parts = extract_order_parts(criterion)
134
134
  add(order_parts[:column_name], order_parts[:direction]) unless different_table?(model_table_name, order_parts[:table_name])
@@ -93,7 +93,7 @@ module ActiveScaffold
93
93
  elsif value[:from].blank?
94
94
  nil
95
95
  elsif ActiveScaffold::Finder::StringComparators.values.include?(value[:opt])
96
- ["#{column.search_sql} LIKE ?", value[:opt].sub('?', value[:from])]
96
+ ["#{column.search_sql} #{ActiveScaffold::Finder.like_operator} ?", value[:opt].sub('?', value[:from])]
97
97
  elsif value[:opt] == 'BETWEEN'
98
98
  ["#{column.search_sql} BETWEEN ? AND ?", value[:from], value[:to]]
99
99
  elsif ActiveScaffold::Finder::NumericComparators.include?(value[:opt])
@@ -26,7 +26,7 @@ module ActiveScaffold
26
26
  when :select, :multi_select, :record_select
27
27
  associated = value
28
28
  associated = [associated].compact unless associated.is_a? Array
29
- associated = column.association.klass.find(associated.map(&:to_i)).collect(&:to_label) if column.association
29
+ associated = column.association.klass.where(["id in (?)", associated.map(&:to_i)]).collect(&:to_label) if column.association
30
30
  "#{column.active_record_class.human_attribute_name(column.name)} = #{associated.join(', ')}"
31
31
  when :boolean, :checkbox
32
32
  label = column.column.type_cast(value) ? as_(:true) : as_(:false)
@@ -269,7 +269,7 @@ module ActiveScaffold
269
269
  id_options = {:id => record.id.to_s, :action => 'update_column', :name => column.name.to_s}
270
270
  tag_options = {:id => element_cell_id(id_options), :class => "in_place_editor_field",
271
271
  :title => as_(:click_to_edit), 'data-ie_id' => record.id.to_s}
272
-
272
+ tag_options['data-ie_mode'] = :inline_checkbox if column.list_ui == :checkbox
273
273
  content_tag(:span, formatted_column, tag_options)
274
274
  end
275
275
 
@@ -10,7 +10,6 @@ module ActiveScaffold
10
10
  include ActiveScaffold::Helpers::ShowColumnHelpers
11
11
  include ActiveScaffold::Helpers::FormColumnHelpers
12
12
  include ActiveScaffold::Helpers::SearchColumnHelpers
13
- include ActiveScaffold::Helpers::CountryHelpers
14
13
  include ActiveScaffold::Helpers::HumanConditionHelpers
15
14
 
16
15
  ##
@@ -170,6 +169,7 @@ module ActiveScaffold
170
169
  html_options['data-confirm'] = link.confirm(record.try(:to_label)) if link.confirm?
171
170
  html_options['data-position'] = link.position if link.position and link.inline?
172
171
  html_options[:class] += ' as_action' if link.inline?
172
+ html_options['data-action'] = link.action if link.inline?
173
173
  if link.popup?
174
174
  html_options['data-popup'] = true
175
175
  html_options[:target] = '_blank'
@@ -209,7 +209,7 @@ module ActiveScaffold
209
209
  html = link_to(image_tag(link.image[:name] , :size => link.image[:size], :alt => label), url, html_options)
210
210
  end
211
211
  # if url is nil we would like to generate an anchor without href attribute
212
- url.nil? ? html.sub(/href=".*?"/, '') : html
212
+ url.nil? ? html.sub(/href=".*?"/, '').html_safe : html.html_safe
213
213
  end
214
214
 
215
215
  def url_options_for_nested_link(column, record, link, url_options, options = {})
@@ -302,7 +302,7 @@ module ActiveScaffold
302
302
  end
303
303
 
304
304
  def column_show_add_new(column, associated, record)
305
- value = column.plural_association? || (column.singular_association? and not associated.empty?)
305
+ value = (column.plural_association? && !column.readonly_association?) || (column.singular_association? and not associated.empty?)
306
306
  value = false unless record.class.authorized_for?(:crud_type => :create)
307
307
  value
308
308
  end
@@ -2,7 +2,7 @@ module ActiveScaffold
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 0
5
- PATCH = 20
5
+ PATCH = 21
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
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: 47
4
+ hash: 45
5
5
  prerelease: false
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
- - 20
10
- version: 3.0.20
9
+ - 21
10
+ version: 3.0.21
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: 2011-05-27 00:00:00 +02:00
18
+ date: 2011-09-23 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -54,14 +54,12 @@ dependencies:
54
54
  version_requirements: &id003 !ruby/object:Gem::Requirement
55
55
  none: false
56
56
  requirements:
57
- - - ~>
57
+ - - ">="
58
58
  - !ruby/object:Gem::Version
59
- hash: 7
59
+ hash: 3
60
60
  segments:
61
- - 1
62
- - 5
63
- - 2
64
- version: 1.5.2
61
+ - 0
62
+ version: "0"
65
63
  requirement: *id003
66
64
  type: :development
67
65
  - !ruby/object:Gem::Dependency
@@ -246,6 +244,8 @@ files:
246
244
  - lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge_helpers.rb
247
245
  - lib/active_scaffold/bridges/carrierwave/lib/form_ui.rb
248
246
  - lib/active_scaffold/bridges/carrierwave/lib/list_ui.rb
247
+ - lib/active_scaffold/bridges/country_helper/bridge.rb
248
+ - lib/active_scaffold/bridges/country_helper/lib/country_helper_bridge.rb
249
249
  - lib/active_scaffold/bridges/date_picker/bridge.rb
250
250
  - lib/active_scaffold/bridges/date_picker/lib/datepicker_bridge.rb
251
251
  - lib/active_scaffold/bridges/date_picker/public/javascripts/date_picker_bridge.js
@@ -313,7 +313,6 @@ files:
313
313
  - lib/active_scaffold/finder.rb
314
314
  - lib/active_scaffold/helpers/association_helpers.rb
315
315
  - lib/active_scaffold/helpers/controller_helpers.rb
316
- - lib/active_scaffold/helpers/country_helpers.rb
317
316
  - lib/active_scaffold/helpers/form_column_helpers.rb
318
317
  - lib/active_scaffold/helpers/human_condition_helpers.rb
319
318
  - lib/active_scaffold/helpers/id_helpers.rb
@@ -449,50 +448,5 @@ rubygems_version: 1.3.7
449
448
  signing_key:
450
449
  specification_version: 3
451
450
  summary: Rails 3 Version of activescaffold supporting prototype and jquery
452
- test_files:
453
- - test/bridges/bridge_test.rb
454
- - test/config/base_test.rb
455
- - test/config/create_test.rb
456
- - test/config/list_test.rb
457
- - test/config/show_test.rb
458
- - test/config/update_test.rb
459
- - test/const_mocker.rb
460
- - test/data_structures/action_columns_test.rb
461
- - test/data_structures/action_link_test.rb
462
- - test/data_structures/action_links_test.rb
463
- - test/data_structures/actions_test.rb
464
- - test/data_structures/association_column_test.rb
465
- - test/data_structures/column_test.rb
466
- - test/data_structures/columns_test.rb
467
- - test/data_structures/error_message_test.rb
468
- - test/data_structures/set_test.rb
469
- - test/data_structures/sorting_test.rb
470
- - test/data_structures/standard_column_test.rb
471
- - test/data_structures/virtual_column_test.rb
472
- - test/extensions/active_record_test.rb
473
- - test/extensions/array_test.rb
474
- - test/helpers/form_column_helpers_test.rb
475
- - test/helpers/list_column_helpers_test.rb
476
- - test/helpers/pagination_helpers_test.rb
477
- - test/misc/active_record_permissions_test.rb
478
- - test/misc/attribute_params_test.rb
479
- - test/misc/configurable_test.rb
480
- - test/misc/constraints_test.rb
481
- - test/misc/finder_test.rb
482
- - test/misc/lang_test.rb
483
- - test/mock_app/app/controllers/application_controller.rb
484
- - test/mock_app/app/helpers/application_helper.rb
485
- - test/mock_app/config/boot.rb
486
- - test/mock_app/config/environment.rb
487
- - test/mock_app/config/environments/development.rb
488
- - test/mock_app/config/environments/production.rb
489
- - test/mock_app/config/environments/test.rb
490
- - test/mock_app/config/initializers/backtrace_silencers.rb
491
- - test/mock_app/config/initializers/inflections.rb
492
- - test/mock_app/config/initializers/mime_types.rb
493
- - test/mock_app/config/initializers/new_rails_defaults.rb
494
- - test/mock_app/config/initializers/session_store.rb
495
- - test/mock_app/config/routes.rb
496
- - test/model_stub.rb
497
- - test/run_all.rb
498
- - test/test_helper.rb
451
+ test_files: []
452
+