active_scaffold_vho 3.0.31 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. data/Gemfile +9 -1
  2. data/Gemfile.lock +8 -79
  3. data/Rakefile +17 -20
  4. data/active_scaffold_vho.gemspec +374 -15
  5. data/{frontends/default → app/assets}/images/add.gif +0 -0
  6. data/{frontends/default → app/assets}/images/arrow_down.gif +0 -0
  7. data/{frontends/default → app/assets}/images/arrow_up.gif +0 -0
  8. data/{frontends/default → app/assets}/images/close.gif +0 -0
  9. data/{frontends/default → app/assets}/images/close_touch.png +0 -0
  10. data/{frontends/default → app/assets}/images/config.png +0 -0
  11. data/{frontends/default → app/assets}/images/cross.png +0 -0
  12. data/{frontends/default → app/assets}/images/gears.png +0 -0
  13. data/{frontends/default → app/assets}/images/indicator-small.gif +0 -0
  14. data/{frontends/default → app/assets}/images/indicator.gif +0 -0
  15. data/{frontends/default → app/assets}/images/magnifier.png +0 -0
  16. data/app/assets/javascripts/active_scaffold.js.erb +12 -0
  17. data/{frontends/default → app/assets}/javascripts/jquery/active_scaffold.js +73 -245
  18. data/app/assets/javascripts/jquery/date_picker_bridge.js.erb +24 -0
  19. data/app/assets/javascripts/jquery/jquery-ui-timepicker-addon.js +1060 -0
  20. data/{frontends/default → app/assets}/javascripts/jquery/jquery.editinplace.js +1 -1
  21. data/{lib/active_scaffold/bridges/tiny_mce/public → app/assets}/javascripts/jquery/tiny_mce_bridge.js +4 -3
  22. data/{frontends/default → app/assets}/javascripts/prototype/active_scaffold.js +36 -122
  23. data/{frontends/default → app/assets}/javascripts/prototype/dhtml_history.js +0 -0
  24. data/{frontends/default → app/assets}/javascripts/prototype/form_enhancements.js +0 -0
  25. data/{frontends/default → app/assets}/javascripts/prototype/rico_corner.js +0 -0
  26. data/{frontends/default/stylesheets/stylesheet-ie.css → app/assets/stylesheets/active_scaffold-ie.css} +0 -0
  27. data/{frontends/default/stylesheets/stylesheet.css → app/assets/stylesheets/active_scaffold.css.erb} +24 -22
  28. data/app/assets/stylesheets/jquery-ui-timepicker-addon.css +6 -0
  29. data/frontends/default/views/_action_group.html.erb +1 -1
  30. data/frontends/default/views/_base_form.html.erb +1 -1
  31. data/frontends/default/views/_form_association_footer.html.erb +11 -7
  32. data/frontends/default/views/_horizontal_subform_record.html.erb +5 -9
  33. data/frontends/default/views/_list.html.erb +1 -2
  34. data/frontends/default/views/_list_inline_adapter.html.erb +10 -0
  35. data/frontends/default/views/_list_messages.html.erb +2 -2
  36. data/frontends/default/views/_list_pagination.html.erb +6 -3
  37. data/frontends/default/views/_list_pagination_links.html.erb +9 -0
  38. data/frontends/default/views/_list_record.html.erb +2 -1
  39. data/frontends/default/views/_list_record_columns.html.erb +2 -1
  40. data/frontends/default/views/_list_with_header.html.erb +1 -1
  41. data/frontends/default/views/_messages.html.erb +0 -1
  42. data/frontends/default/views/_render_field.js.erb +13 -0
  43. data/frontends/default/views/_vertical_subform_record.html.erb +5 -9
  44. data/frontends/default/views/add_existing.js.erb +20 -0
  45. data/frontends/default/views/destroy.js.erb +24 -0
  46. data/frontends/default/views/{edit_associated.js.rjs → edit_associated.js.erb} +3 -2
  47. data/frontends/default/views/form_messages.js.erb +1 -0
  48. data/frontends/default/views/list.js.erb +1 -0
  49. data/frontends/default/views/on_action_update.js.erb +13 -0
  50. data/frontends/default/views/on_create.js.erb +45 -0
  51. data/frontends/default/views/on_mark_all.js.erb +12 -0
  52. data/frontends/default/views/on_update.js.erb +31 -0
  53. data/frontends/default/views/update_column.js.erb +16 -0
  54. data/frontends/default/views/update_row.js.erb +1 -0
  55. data/init.rb +1 -7
  56. data/lib/active_scaffold/actions/delete.rb +3 -5
  57. data/lib/active_scaffold/actions/field_search.rb +2 -6
  58. data/lib/active_scaffold/actions/list.rb +16 -14
  59. data/lib/active_scaffold/actions/search.rb +3 -3
  60. data/lib/active_scaffold/active_record_permissions.rb +2 -25
  61. data/lib/active_scaffold/attribute_params.rb +21 -44
  62. data/lib/active_scaffold/bridges/calendar_date_select/bridge.rb +1 -1
  63. data/lib/active_scaffold/bridges/date_picker/bridge.rb +2 -16
  64. data/lib/active_scaffold/bridges/date_picker/lib/datepicker_bridge.rb +86 -56
  65. data/lib/active_scaffold/bridges/file_column/bridge.rb +1 -1
  66. data/lib/active_scaffold/bridges/file_column/lib/as_file_column_bridge.rb +1 -1
  67. data/lib/active_scaffold/bridges/file_column/lib/file_column_helpers.rb +1 -1
  68. data/lib/active_scaffold/bridges/paperclip/bridge.rb +1 -1
  69. data/lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge_helpers.rb +2 -2
  70. data/lib/active_scaffold/bridges/shared/date_bridge.rb +3 -3
  71. data/lib/active_scaffold/bridges/tiny_mce/bridge.rb +0 -12
  72. data/lib/active_scaffold/bridges/validation_reflection/lib/validation_reflection_bridge.rb +1 -1
  73. data/lib/active_scaffold/config/base.rb +1 -1
  74. data/lib/active_scaffold/config/core.rb +1 -8
  75. data/lib/active_scaffold/config/delete.rb +1 -1
  76. data/lib/active_scaffold/config/field_search.rb +1 -22
  77. data/lib/active_scaffold/config/list.rb +10 -18
  78. data/lib/active_scaffold/data_structures/action_link.rb +9 -0
  79. data/lib/active_scaffold/data_structures/action_links.rb +1 -1
  80. data/lib/active_scaffold/data_structures/column.rb +4 -30
  81. data/lib/active_scaffold/data_structures/nested_info.rb +3 -3
  82. data/lib/active_scaffold/data_structures/sorting.rb +1 -1
  83. data/lib/active_scaffold/engine.rb +8 -0
  84. data/lib/active_scaffold/extensions/action_controller_rendering.rb +22 -0
  85. data/lib/active_scaffold/extensions/action_view_rendering.rb +79 -59
  86. data/lib/active_scaffold/extensions/action_view_resolver.rb +4 -2
  87. data/lib/active_scaffold/extensions/active_association_reflection.rb +3 -3
  88. data/lib/active_scaffold/extensions/reverse_associations.rb +3 -3
  89. data/lib/active_scaffold/finder.rb +27 -39
  90. data/lib/active_scaffold/helpers/association_helpers.rb +3 -3
  91. data/lib/active_scaffold/helpers/form_column_helpers.rb +3 -3
  92. data/lib/active_scaffold/helpers/human_condition_helpers.rb +2 -4
  93. data/lib/active_scaffold/helpers/list_column_helpers.rb +16 -22
  94. data/lib/active_scaffold/helpers/search_column_helpers.rb +1 -1
  95. data/lib/active_scaffold/helpers/view_helpers.rb +35 -13
  96. data/lib/active_scaffold/locale/de.rb +120 -0
  97. data/lib/active_scaffold/locale/en.rb +119 -0
  98. data/lib/active_scaffold/version.rb +2 -2
  99. data/lib/active_scaffold.rb +12 -27
  100. data/lib/active_scaffold_env.rb +3 -3
  101. data/test/mock_app/public/stylesheets/active_scaffold/default/stylesheet.css +1 -1
  102. metadata +84 -86
  103. data/.gitignore +0 -42
  104. data/frontends/default/views/_render_field.js.rjs +0 -10
  105. data/frontends/default/views/add_existing.js.rjs +0 -17
  106. data/frontends/default/views/destroy.js.rjs +0 -23
  107. data/frontends/default/views/form_messages.js.rjs +0 -1
  108. data/frontends/default/views/list.js.rjs +0 -1
  109. data/frontends/default/views/on_action_update.js.rjs +0 -10
  110. data/frontends/default/views/on_create.js.rjs +0 -41
  111. data/frontends/default/views/on_mark_all.js.rjs +0 -12
  112. data/frontends/default/views/on_update.js.rjs +0 -28
  113. data/frontends/default/views/update_column.js.rjs +0 -13
  114. data/frontends/default/views/update_row.js.rjs +0 -1
  115. data/lib/active_scaffold/bridges/date_picker/public/javascripts/date_picker_bridge.js +0 -36
  116. data/lib/active_scaffold/bridges/tiny_mce/public/javascripts/prototype/tiny_mce_bridge.js +0 -21
  117. data/lib/active_scaffold/locale/de.yml +0 -120
  118. data/lib/active_scaffold/locale/en.yml +0 -115
  119. data/lib/active_scaffold_assets.rb +0 -45
@@ -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" data-as_load="form" style="display: inline; margin: 0; padding: 0;"></form>')
262
+ this.dom.html('<form class="inplace_form" style="display: inline; margin: 0; padding: 0;"></form>')
263
263
  .find('form')
264
264
  .append(editorElement)
265
265
  .append(buttons_html);
@@ -1,18 +1,19 @@
1
- $(document).on('as:form_loaded', 'form.as_form, form.inplace_form', function(event) {
1
+ $('form.as_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
- $(document).on('as:form_submit', 'form.as_form, form.inplace_form', function(event) {
8
+ $('form.as_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();
12
12
  }
13
13
  return true;
14
14
  });
15
- $(document).on('as:form_unloaded', 'form.as_form, form.inplace_form', function(event) {
15
+
16
+ $('form.as_form').live('as:form_unloaded', function(event) {
16
17
  var as_form = $(this).closest("form");
17
18
  as_form.find('textarea.as_mceEditor').each(function(index, elem) {
18
19
  tinyMCE.execCommand('mceRemoveControl', false, $(elem).attr('id'));
@@ -209,51 +209,34 @@ document.observe("dom:loaded", function() {
209
209
  }
210
210
  return true;
211
211
  });
212
- document.on('ajax:before', 'div.active-scaffold-footer .pagination a', function(event) {
212
+ document.on('ajax:before', 'a.as_paginate', function(event) {
213
213
  var as_paginate = event.findElement();
214
- var loading_indicator = as_paginate.up(1).down('img.loading-indicator');
214
+ var loading_indicator = as_paginate.up().down('img.loading-indicator');
215
215
  var history_controller_id = as_paginate.readAttribute('data-page-history');
216
216
 
217
217
  if (history_controller_id) addActiveScaffoldPageToHistory(as_paginate.readAttribute('href'), history_controller_id);
218
- if (loading_indicator == null) {
219
- var table_loading_indicator = as_paginate.up('div.active-scaffold').down('div.actions').down('img.loading-indicator');
220
- loading_indicator = table_loading_indicator.cloneNode(true);
221
- loading_indicator.id = null;
222
- as_paginate.up(1).insert({top: loading_indicator});
223
- }
224
- loading_indicator.style.visibility = 'visible';
218
+ if (loading_indicator) loading_indicator.style.visibility = 'visible';
225
219
  return true;
226
220
  });
227
- document.on('ajax:failure', 'div.active-scaffold-footer .pagination a', function(event) {
221
+ document.on('ajax:failure', 'a.as_paginate', function(event) {
228
222
  var as_scaffold = event.findElement('.active-scaffold');
229
223
  ActiveScaffold.report_500_response(as_scaffold);
230
224
  return true;
231
225
  });
232
- document.on('ajax:complete', 'div.active-scaffold-footer .pagination a', function(event) {
226
+ document.on('ajax:complete', 'a.as_paginate', function(event) {
233
227
  var as_paginate = event.findElement();
234
228
  var loading_indicator = as_paginate.up().down('img.loading-indicator');
235
229
 
236
230
  if(loading_indicator) loading_indicator.style.visibility = 'hidden';
237
231
  return true;
238
232
  });
239
- document.on('ajax:before', 'a.as_add_existing', function(event) {
233
+ document.on('ajax:before', 'input[type=button].as_add_existing', function(event) {
240
234
  var button = event.findElement();
241
- var selected_id = button.previous().getValue();
242
- if (selected_id) {
243
- var url = button.readAttribute('href').sub('--ID--', selected_id);
244
- event.memo.url = url;
245
- return true;
246
- } else {
247
- return false;
248
- }
249
- });
250
- document.on('click', 'a.as_destroy_existing', function(event) {
251
- var associated_record = event.findElement('tr.association-record');
252
- ActiveScaffold.delete_subform_record(associated_record);
253
- event.stop();
254
- return false;
235
+ var url = button.readAttribute('href').sub('--ID--', button.previous().getValue());
236
+ event.memo.url = url;
237
+ return true;
255
238
  });
256
- document.on('change', 'input.update_form, textarea.update_form, select.update_form', function(event) {
239
+ document.on('change', 'input.update_form, select.update_form', function(event) {
257
240
  var element = event.findElement();
258
241
  var as_form = element.up('form.as_form');
259
242
  var params = null;
@@ -331,45 +314,17 @@ document.observe("dom:loaded", function() {
331
314
  ActiveScaffold.focus_first_element_of_form(as_form);
332
315
  return true;
333
316
  });
334
- document.on('as:form_element_loaded', 'li.horizontal-sub-form', function(event, element) {
335
- element.select('a.as_associated_form_link').each(function(element) {
336
- ActiveScaffold.show(element);
337
- //Show select Box for add_existing as well
338
- if(element.hasClassName('as_add_existing')) {
339
- ActiveScaffold.show(element.previous());
340
- }
341
- });
342
- return true;
343
- });
344
- document.on('as:list_row_loaded', 'tr.inline-adapter-autoopen', function(event, element) {
345
- var actionlink_controllers = event.element().readAttribute('data-actionlink-controllers');
346
- if(actionlink_controllers) {
347
- actionlink_controllers = actionlink_controllers.split('::');
348
- element.previous('tr').select('a.index').each(function(action_link) {
349
- for (var i = 0; i < actionlink_controllers.length; i++) {
350
- if (actionlink_controllers[i] === action_link.readAttribute('data-controller')) {
351
- var as_action_link = ActiveScaffold.ActionLink.get(action_link);
352
- if (as_action_link) {
353
- as_action_link.set_opened();
354
- }
355
- }
356
- }
357
- });
358
- }
359
- return true;
360
- });
361
317
  document.on('ajax:before', 'form.as_form', function(event) {
362
318
  var as_form = event.findElement('form');
363
- as_form.fire('as:form_submit');
319
+ element.fire('as:form_submit');
364
320
  return true;
365
321
  });
366
322
  document.on('submit', 'form.as_form[data-remote!="true"]', function(event) {
367
323
  var as_form = event.findElement('form');
368
- as_form.fire('as:form_submit');
324
+ element.fire('as:form_submit');
369
325
  return true;
370
326
  });
371
327
  ActiveScaffold.trigger_load_events($$('[data-as_load]'));
372
- ActiveScaffold.load_embedded_conrollers();
373
328
  });
374
329
 
375
330
 
@@ -451,26 +406,17 @@ var ActiveScaffold = {
451
406
  new_row.highlight();
452
407
  },
453
408
 
454
- replace: function(element, html, disable_event_trigger) {
409
+ replace: function(element, html) {
455
410
  element = $(element);
456
411
  var elements = element.select('[data-as_load]');
457
- var new_element = null;
458
412
  elements.unshift(element);
459
- if((typeof(disable_event_trigger) != 'boolean') || disable_event_trigger === false) {
460
- ActiveScaffold.trigger_unload_events(elements);
461
- }
462
- if (html.startsWith('<tr')) {
463
- new_element = new Element('tbody').update(html);
464
- } else {
465
- new_element = new Element('div').update(html);
466
- }
413
+ ActiveScaffold.trigger_unload_events(elements);
414
+ var new_element = new Element('div').update(html);
467
415
  new_element = new_element.firstDescendant();
468
416
  Element.replace(element, new_element);
469
417
  elements = new_element.select('[data-as_load]');
470
418
  elements.unshift(new_element);
471
- if((typeof(disable_event_trigger) != 'boolean') || disable_event_trigger === false) {
472
- ActiveScaffold.trigger_load_events(elements);
473
- }
419
+ ActiveScaffold.trigger_load_events(elements);
474
420
  return new_element;
475
421
  },
476
422
 
@@ -525,7 +471,7 @@ var ActiveScaffold = {
525
471
  tbody.insert({top: html});
526
472
  new_row = tbody.firstDescendant();
527
473
  } else if (options.insert_at == 'bottom') {
528
- var last_row = tbody.childElements().reverse().detect(function(node) {return node.hasClassName('record') || node.hasClassName('inline-adapter')});
474
+ var last_row = tbody.childElements().reverse().detect(function(node) { return node.hasClassName('record') || node.hasClassName('inline-adapter')});
529
475
  if (last_row) {
530
476
  last_row.insert({after: html});
531
477
  } else {
@@ -564,8 +510,7 @@ var ActiveScaffold = {
564
510
  if (errors.hasClassName('association-record-errors')) {
565
511
  this.replace_html(errors, '');
566
512
  }
567
- record.down('input.associated_action').value('delete');
568
- this.hide(record);
513
+ this.remove(record);
569
514
  },
570
515
 
571
516
  report_500_response: function(active_scaffold_id) {
@@ -661,7 +606,7 @@ var ActiveScaffold = {
661
606
  if (element) {
662
607
  if (options.is_subform == false) {
663
608
  ActiveScaffold.trigger_unload_events(new Array(element.up('li.form-element')));
664
- element = this.replace(element.up('dl'), content);
609
+ this.replace(element.up('dl'), content);
665
610
  ActiveScaffold.trigger_load_events(new Array(element.up('li.form-element')));
666
611
  } else {
667
612
  this.replace_html(element, content);
@@ -687,7 +632,7 @@ var ActiveScaffold = {
687
632
  var mark_checkboxes = $$('#' + element.readAttribute('id') + ' > tr.record td.marked-column input[type="checkbox"]');
688
633
  mark_checkboxes.each(function(item) {
689
634
  if(options.checked === true) {
690
- item.writeAttribute({checked: 'checked'});
635
+ item.writeAttribute({ checked: 'checked' });
691
636
  } else {
692
637
  item.removeAttribute('checked');
693
638
  }
@@ -696,7 +641,7 @@ var ActiveScaffold = {
696
641
  if(options.include_mark_all === true) {
697
642
  var mark_all_checkbox = element.previous('thead').down('th.marked-column_heading span input[type="checkbox"]');
698
643
  if(options.checked === true) {
699
- mark_all_checkbox.writeAttribute({checked: 'checked'});
644
+ mark_all_checkbox.writeAttribute({ checked: 'checked' });
700
645
  } else {
701
646
  mark_all_checkbox.removeAttribute('checked');
702
647
  }
@@ -734,13 +679,6 @@ var ActiveScaffold = {
734
679
  break;
735
680
  }
736
681
  });
737
- },
738
-
739
- load_embedded_conrollers: function(){
740
- $$('a.as_link_to_component').each(function(element) {
741
- var div_element = element.up('div.active-scaffold-component');
742
- new Ajax.Updater(div_element, element.readAttribute('href').append_params({embedded: true}), {method: 'get', evalScripts: true});
743
- });
744
682
  }
745
683
 
746
684
  }
@@ -831,11 +769,9 @@ ActiveScaffold.Actions.Abstract = Class.create({
831
769
  this.target = $(target);
832
770
  this.loading_indicator = $(loading_indicator);
833
771
  this.options = options;
834
- var _this = this;
835
772
  this.links = links.collect(function(link) {
836
- var my_link = _this.instantiate_link(link);
837
- return my_link;
838
- });
773
+ return this.instantiate_link(link);
774
+ }.bind(this));
839
775
  },
840
776
 
841
777
  instantiate_link: function(link) {
@@ -938,25 +874,6 @@ ActiveScaffold.ActionLink.Abstract = Class.create({
938
874
  this.adapter = element;
939
875
  this.adapter.addClassName('as_adapter');
940
876
  this.adapter.store('action_link', this);
941
- },
942
-
943
- wrap_with_adapter_html: function(content, should_refresh_data) {
944
- // players_view class missing
945
- var id_string = null;
946
- var close_label = this.scaffold().readAttribute('data-closelabel');
947
- var controller = this.scaffold().readAttribute('data-controller');
948
-
949
- if (this.tag.readAttribute('data-controller')) {
950
- controller = this.tag.readAttribute('data-controller');
951
- }
952
-
953
- if(this.target.hasClassName('before-header')) {
954
- id_string = this.target.readAttribute('id').replace('search', 'nested');
955
- } else {
956
- id_string = this.target.readAttribute('id').replace('list', 'nested');
957
- }
958
-
959
- return '<tr class="inline-adapter" id="' + id_string + '"><td colspan="99" class="inline-adapter-cell"><div class="' + this.action + '-view ' + controller + '-view view"><a class="inline-adapter-close as_cancel" title="' + close_label + '" data-remote="true" data-refresh="' + should_refresh_data + '" href="">' + close_label +'</a>' + content + '</div></td></tr>'
960
877
  }
961
878
  });
962
879
 
@@ -967,10 +884,10 @@ ActiveScaffold.Actions.Record = Class.create(ActiveScaffold.Actions.Abstract, {
967
884
  instantiate_link: function(link) {
968
885
  var l = new ActiveScaffold.ActionLink.Record(link, this.target, this.loading_indicator);
969
886
  if (this.target.hasAttribute('data-refresh') && !this.target.readAttribute('data-refresh').blank()) l.refresh_url = this.target.readAttribute('data-refresh');
970
-
971
- if (l.position && l.tag.hasAttribute('data-action') && l.tag.readAttribute('data-action') == "index") {
972
- l.url = l.url.append_params({embedded: true});
973
- l.tag.href = l.url;
887
+
888
+ if (l.position) {
889
+ l.url = l.url.append_params({adapter: '_list_inline_adapter'});
890
+ l.tag.href = l.url;
974
891
  }
975
892
  l.set = this;
976
893
  return l;
@@ -989,7 +906,6 @@ ActiveScaffold.ActionLink.Record = Class.create(ActiveScaffold.ActionLink.Abstra
989
906
  },
990
907
 
991
908
  insert: function(content) {
992
- var should_refresh_data = (typeof(this.refresh_ur)== 'undefined');
993
909
  this.close_previous_adapter();
994
910
 
995
911
  if (this.position == 'replace') {
@@ -998,19 +914,18 @@ ActiveScaffold.ActionLink.Record = Class.create(ActiveScaffold.ActionLink.Abstra
998
914
  }
999
915
 
1000
916
  if (this.position == 'after') {
1001
- this.target.insert({after:this.wrap_with_adapter_html(content, should_refresh_data)});
917
+ this.target.insert({after:content});
1002
918
  ActiveScaffold.trigger_load_events(this.target.next().select('[data-as_load]'));
1003
919
  this.set_adapter(this.target.next());
1004
920
  }
1005
921
  else if (this.position == 'before') {
1006
- this.target.insert({before:this.wrap_with_adapter_html(content, should_refresh_data)});
922
+ this.target.insert({before:content});
1007
923
  ActiveScaffold.trigger_load_events(this.target.previous().select('[data-as_load]'));
1008
924
  this.set_adapter(this.target.previous());
1009
925
  }
1010
926
  else {
1011
927
  return false;
1012
928
  }
1013
- this.update_flash_messages();
1014
929
  this.adapter.down('td').down().highlight();
1015
930
  },
1016
931
 
@@ -1036,14 +951,11 @@ ActiveScaffold.ActionLink.Record = Class.create(ActiveScaffold.ActionLink.Abstra
1036
951
  },
1037
952
 
1038
953
  set_opened: function() {
1039
- var should_refresh_data = (typeof(this.refresh_ur)== 'undefined');
1040
954
  if (this.position == 'after') {
1041
- var new_adapter = ActiveScaffold.replace(this.target.next(), this.wrap_with_adapter_html(this.target.next().childElements().first().innerHTML, should_refresh_data), true);
1042
- this.set_adapter(new_adapter);
955
+ this.set_adapter(this.target.next());
1043
956
  }
1044
957
  else if (this.position == 'before') {
1045
- var new_adapter = ActiveScaffold.replace(this.target.previous(), this.wrap_with_adapter_html(this.target.previous().childElements().first().innerHTML, should_refresh_data), true);
1046
- this.set_adapter(new_adapter);
958
+ this.set_adapter(this.target.previous());
1047
959
  }
1048
960
  this.disable();
1049
961
  }
@@ -1055,7 +967,10 @@ ActiveScaffold.ActionLink.Record = Class.create(ActiveScaffold.ActionLink.Abstra
1055
967
  ActiveScaffold.Actions.Table = Class.create(ActiveScaffold.Actions.Abstract, {
1056
968
  instantiate_link: function(link) {
1057
969
  var l = new ActiveScaffold.ActionLink.Table(link, this.target, this.loading_indicator);
1058
-
970
+ if (l.position) {
971
+ l.url = l.url.append_params({adapter: '_list_inline_adapter'});
972
+ l.tag.href = l.url;
973
+ }
1059
974
  return l;
1060
975
  }
1061
976
  });
@@ -1063,14 +978,13 @@ ActiveScaffold.Actions.Table = Class.create(ActiveScaffold.Actions.Abstract, {
1063
978
  ActiveScaffold.ActionLink.Table = Class.create(ActiveScaffold.ActionLink.Abstract, {
1064
979
  insert: function(content) {
1065
980
  if (this.position == 'top') {
1066
- this.target.insert({top:this.wrap_with_adapter_html(content, false)});
981
+ this.target.insert({top:content});
1067
982
  ActiveScaffold.trigger_load_events(this.target.immediateDescendants().first().select('[data-as_load]'));
1068
983
  this.set_adapter(this.target.immediateDescendants().first());
1069
984
  }
1070
985
  else {
1071
986
  throw 'Unknown position "' + this.position + '"'
1072
987
  }
1073
- this.update_flash_messages();
1074
988
  this.adapter.down('td').down().highlight();
1075
989
  }
1076
990
  });
@@ -171,20 +171,21 @@ background-repeat: no-repeat;
171
171
  }
172
172
 
173
173
  .active-scaffold-header div.actions div.action_group div {
174
- background-image: url(../../../images/active_scaffold/default/gears.png); /* default icon for actions or override with css */
174
+ background-image: url(<%= asset_path 'gears.png' %>); /* default icon for actions or override with css */
175
175
  }
176
176
 
177
177
  .active-scaffold-header div.actions a.show_config_list {
178
- background-image: url(../../../images/active_scaffold/default/config.png);
178
+ background-image: url(<%= asset_path 'config.png' %>);
179
179
  }
180
180
 
181
181
  .active-scaffold-header div.actions a.new,
182
182
  .active-scaffold-header div.actions a.new_existing {
183
- background-image: url(../../../images/active_scaffold/default/add.gif);
183
+ background-image: url(<%= asset_path 'add.gif' %>);
184
184
  }
185
185
 
186
186
  .active-scaffold-header div.actions a.show_search {
187
- background-image: url(../../../images/active_scaffold/default/magnifier.png);
187
+
188
+ background-image: url(<%= asset_path 'magnifier.png' %>);
188
189
  }
189
190
 
190
191
  .blue-theme .active-scaffold-header div.actions a:hover {
@@ -243,17 +244,17 @@ padding-right: 18px;
243
244
 
244
245
  .active-scaffold th.asc a,
245
246
  .active-scaffold th.asc a:hover {
246
- background: #333 url(../../../images/active_scaffold/default/arrow_up.gif) right 50% no-repeat;
247
+ background: #333 url(<%= asset_path 'arrow_up.gif' %>) right 50% no-repeat;
247
248
  }
248
249
 
249
250
  .active-scaffold th.desc a,
250
251
  .active-scaffold th.desc a:hover {
251
- background: #333 url(../../../images/active_scaffold/default/arrow_down.gif) right 50% no-repeat;
252
+ background: #333 url(<%= asset_path 'arrow_down.gif' %>) right 50% no-repeat;
252
253
  }
253
254
 
254
255
  .active-scaffold th.loading a,
255
256
  .active-scaffold th.loading a:hover {
256
- background: #333 url(../../../images/active_scaffold/default/indicator-small.gif) right 50% no-repeat;
257
+ background: #333 url(<%= asset_path 'indicator-small.gif' %>) right 50% no-repeat;
257
258
  }
258
259
 
259
260
  .active-scaffold th .mark_heading {
@@ -432,7 +433,7 @@ float: right;
432
433
  text-indent: -4000px;
433
434
  width: 16px;
434
435
  height: 17px;
435
- background: url(../../../images/active_scaffold/default/close.gif) 0 0 no-repeat;
436
+ background: url(<%= asset_path 'close.gif' %>) 0 0 no-repeat;
436
437
  }
437
438
 
438
439
  /* Nested
@@ -528,11 +529,10 @@ background-color: #005CB8;
528
529
  color: #ccc;
529
530
  }
530
531
 
531
- .active-scaffold-footer .pagination {
532
- text-align: right;
532
+ .active-scaffold-footer .active-scaffold-pagination {
533
+ float: right;
533
534
  white-space: nowrap;
534
535
  margin-right: 5px;
535
- font: bold 12px arial, sans-serif;
536
536
  }
537
537
 
538
538
  .blue-theme .active-scaffold-footer .active-scaffold-records {
@@ -543,7 +543,8 @@ margin-left: 5px;
543
543
  text-decoration: none;
544
544
  letter-spacing: 0;
545
545
  padding: 0 2px;
546
- margin: 0;
546
+ margin: 0 -2px;
547
+ font: bold 12px arial, sans-serif;
547
548
  }
548
549
 
549
550
  .blue-theme .active-scaffold-footer a,
@@ -561,9 +562,9 @@ padding-left: 5px;
561
562
  border-left: solid 1px #ccc;
562
563
  }
563
564
 
564
- .active-scaffold-footer .prev {
565
- margin-right: 3px;
566
- padding-right: 3px;
565
+ .active-scaffold-footer .previous {
566
+ margin-right: 0;
567
+ padding-right: 5px;
567
568
  border-right: solid 1px #ccc;
568
569
  }
569
570
 
@@ -776,7 +777,7 @@ padding: 6px 0;
776
777
  }
777
778
 
778
779
  .active-scaffold li.form-element dd {
779
- float: none;
780
+ float: left;
780
781
  }
781
782
 
782
783
  .active-scaffold li.form-element dd input[type="checkbox"] {
@@ -954,7 +955,7 @@ height: 16px;
954
955
  padding: 0;
955
956
  width: 16px;
956
957
  text-indent: -4000px;
957
- background: url(../../../images/active_scaffold/default/cross.png) 0 0 no-repeat;
958
+ background: url(<%= asset_path 'cross.png' %>) 0 0 no-repeat;
958
959
  }
959
960
 
960
961
  .active-scaffold .sub-form .locked a.destroy {
@@ -993,17 +994,18 @@ font-size: 100%;
993
994
  }
994
995
 
995
996
  .active-scaffold-found {
997
+ float:left;
996
998
  }
997
999
 
998
1000
  .as_touch a.inline-adapter-close {
999
1001
  width: 25px;
1000
1002
  height: 27px;
1001
- background: url(../../../images/active_scaffold/default/close_touch.png) 0 0 no-repeat;
1003
+ background: url(<%= asset_path 'close_touch.png' %>) 0 0 no-repeat;
1002
1004
  }
1003
1005
 
1004
- .as_touch .active-scaffold-footer .pagination, .as_touch .active-scaffold-footer .pagination a {
1005
- font-size: 20px;
1006
- padding: 3px 10px;
1006
+ .as_touch .as_paginate {
1007
+ font-size: 20px;
1008
+ padding: 3px 10px;
1007
1009
  }
1008
1010
 
1009
1011
  .as_touch .active-scaffold-header div.actions a {
@@ -1072,4 +1074,4 @@ padding: 5px 2px 5px 5px;
1072
1074
 
1073
1075
  .as_touch tr.record td {
1074
1076
  padding: 5px 10px;
1075
- }
1077
+ }
@@ -0,0 +1,6 @@
1
+ .ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
2
+ .ui-timepicker-div dl { text-align: left; }
3
+ .ui-timepicker-div dl dt { height: 25px; }
4
+ .ui-timepicker-div dl dd { margin: -25px 10px 10px 65px; }
5
+ .ui-timepicker-div td { font-size: 90%; }
6
+ .ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
@@ -16,7 +16,7 @@
16
16
  <% end %>
17
17
  <% else -%>
18
18
  <% if options[:level] == 0 %>
19
- <%= "#{start_level_0_tag}#{h(render_group_action_link(link, url_options, options, record))}#{end_level_0_tag}".html_safe %>
19
+ <%= "#{start_level_0_tag}#{render_group_action_link(link, url_options, options, record)}#{end_level_0_tag}".html_safe %>
20
20
  <% else %>
21
21
  <%= content_tag('li', render_group_action_link(link, url_options, options, record), options[:first_action] ? {:class => 'top'}: {}) %>
22
22
  <% end %>
@@ -54,4 +54,4 @@ end
54
54
  <%= loading_indicator_tag(:action => form_action, :id => params[:id]) %>
55
55
  </p>
56
56
 
57
- </form>
57
+ </form>
@@ -10,15 +10,17 @@ show_add_new = column_show_add_new(column, associated, @record)
10
10
 
11
11
  return unless show_add_new or show_add_existing
12
12
 
13
- edit_associated_url = url_for(:action => 'edit_associated', :id => parent_record.id, :association => column.name, :associated_id => '--ID--', :escape => false, :eid => params[:eid], :parent_controller => params[:parent_controller], :parent_id => params[:parent_id]).html_safe if show_add_existing
14
- add_new_url = url_for(:action => 'edit_associated', :id => parent_record.id, :association => column.name, :escape => false, :eid => params[:eid], :parent_controller => params[:parent_controller], :parent_id => params[:parent_id]).html_safe if show_add_new
13
+ edit_associated_url = url_for(:action => 'edit_associated', :id => parent_record.id, :association => column.name, :associated_id => '--ID--', :escape => false, :eid => params[:eid], :parent_controller => params[:parent_controller], :parent_id => params[:parent_id]) if show_add_existing
14
+ add_new_url = url_for(:action => 'edit_associated', :id => parent_record.id, :association => column.name, :escape => false, :eid => params[:eid], :parent_controller => params[:parent_controller], :parent_id => params[:parent_id]) if show_add_new
15
15
 
16
16
  -%>
17
17
  <div class="footer-wrapper">
18
18
  <div class="footer">
19
19
  <% if show_add_new -%>
20
- <% add_label = column.plural_association? ? as_(:create_another, :model => column.association.klass.model_name.human) : as_(:replace_with_new) %>
21
- <%= link_to add_label, add_new_url, :class => 'as_associated_form_link', :remote => true, :style=> "display: none;" %>
20
+ <% add_label = column.plural_association? ? as_(:create_another, :model => column.association.klass.model_name.human) : as_(:replace_with_new)
21
+ create_another_id = "#{sub_form_id(:association => column.name)}-create-another" %>
22
+ <%= tag(:input, {:id => create_another_id, :type => 'button', :value => add_label, :href => add_new_url.html_safe, 'data-remote' => true, :style=> "display: none;"}) %>
23
+ <%= javascript_tag("ActiveScaffold.show('#{create_another_id}');") %>
22
24
  <% end -%>
23
25
 
24
26
  <%= '|' if show_add_new and show_add_existing %>
@@ -27,9 +29,11 @@ add_new_url = url_for(:action => 'edit_associated', :id => parent_record.id, :as
27
29
  <% if remote_controller and remote_controller.respond_to? :uses_record_select? and remote_controller.uses_record_select? -%>
28
30
  <%= link_to_record_select as_(:add_existing), remote_controller.controller_path, :onselect => "ActiveScaffold.record_select_onselect(#{edit_associated_url.to_json}, #{active_scaffold_id.to_json}, id);" -%>
29
31
  <% else -%>
30
- <% select_options = options_for_select(options_for_association(column.association))%>
31
- <%= select_tag 'associated_id', '<option value="">'.html_safe + as_(:_select_) + '</option>'.html_safe + select_options, :id => nil, :style => "display: none;" %>
32
- <%= link_to as_(:add_existing), edit_associated_url, :remote => true, :class => 'as_associated_form_link as_add_existing', :style => "display: none;" %>
32
+ <% select_options = options_for_select(options_for_association(column.association))
33
+ add_existing_id = "#{sub_form_id(:association => column.name)}-add-existing" %>
34
+ <%= select_tag 'associated_id', '<option value="">'.html_safe + as_(:_select_) + '</option>'.html_safe + select_options %>
35
+ <%= tag(:input, {:id => add_existing_id, :type => 'button', :value => as_(:add_existing), :href => edit_associated_url.html_safe, 'data-remote' => true, :class=> 'as_add_existing', :style => "display: none;"}) %>
36
+ <%= javascript_tag("ActiveScaffold.show('#{add_existing_id}');") %>
33
37
  <% end -%>
34
38
  <% end -%>
35
39
  </div>
@@ -5,7 +5,6 @@
5
5
  config = active_scaffold_config_for(@record.class)
6
6
  options = active_scaffold_input_options(config.columns[@record.class.primary_key], scope)
7
7
  tr_id = "association-#{options[:id]}"
8
- associated_action = @record.new_record? ? :create_or_empty : :update
9
8
  %>
10
9
  <tr id="<%= tr_id %>" class="association-record <%= 'association-record-new' if @record.new_record? -%> <%= 'locked' if locked -%>">
11
10
  <% config.subform.columns.each :for => @record.class, :crud_type => crud_type, :flatten => true do |column| %>
@@ -26,16 +25,13 @@
26
25
  <% if show_actions -%>
27
26
  <td class="actions">
28
27
  <% if record_column.plural_association? and (@record.authorized_for?(:crud_type => :delete) or not [:destroy, :delete_all].include?(record_column.association.options[:dependent])) %>
29
- <% link_classes = ['destroy', 'as_destroy_existing']
30
- link_classes << 'as_associated_form_link' if !locked %>
31
- <%= link_to as_(:remove), '#', :class => link_classes.join(' '), :style=> "display: none;" %>
28
+ <% destroy_id = "#{options[:id]}-destroy" %>
29
+ <%= link_to as_(:remove), '#', :class => 'destroy', :id => destroy_id , :onclick => "ActiveScaffold.delete_subform_record(\"#{tr_id}\"); return false;", :style=> "display: none;" %>
30
+ <%= javascript_tag("ActiveScaffold.show('#{destroy_id}');") if !locked %>
32
31
  <% end %>
33
- </td>
34
- <% end -%>
35
- <td>
36
32
  <% unless @record.new_record? %>
37
- <input type="hidden" name="<%= options[:name] -%>" id="<%= options[:id] -%>" value="<%= @record.id -%>" />
33
+ <input type="hidden" name="<%= options[:name] -%>" id="<%= options[:id] -%>" value="<%= @record.id -%>" />
38
34
  <% end -%>
39
- <input type="hidden" name="<%= scope ? "record#{scope}[associated_action]" : "record[associated_action]" -%>" class="associated_action" value="<%= associated_action -%>" />
40
35
  </td>
36
+ <% end -%>
41
37
  </tr>
@@ -8,7 +8,7 @@
8
8
  <%= render :partial => 'list_messages', :locals => {:columns => columns} %>
9
9
  <tbody class="records" id="<%= active_scaffold_tbody_id %>">
10
10
  <% if !@records.empty? -%>
11
- <%= render :partial => 'list_record', :collection => @records, :locals => { :hidden => false, :columns => columns, :action_links => active_scaffold_config.action_links.member} %>
11
+ <%= render :partial => 'list_record', :collection => @page.items, :locals => { :hidden => false, :columns => columns, :action_links => active_scaffold_config.action_links.member} %>
12
12
  <% end -%>
13
13
  <% if columns.any? {|c| c.calculation?} -%>
14
14
  <%= render :partial => 'list_calculations', :locals => {:columns => columns} %>
@@ -16,4 +16,3 @@
16
16
  </tbody>
17
17
  </table>
18
18
  <%= render :partial => 'list_pagination' %>
19
- <% save_current_page_num %>
@@ -0,0 +1,10 @@
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)}');") %>
@@ -11,7 +11,7 @@
11
11
  <p class="filtered-message" <%= ' style="display:none;" '.html_safe unless @filtered %>>
12
12
  <%= @filtered.is_a?(Array) ? render(:partial => 'human_conditions', :locals => {:columns => @filtered}) : as_(active_scaffold_config.list.filtered_message) %>
13
13
  </p>
14
- <p id="<%= empty_message_id %>" class="empty-message" <%= ' style="display:none;" '.html_safe unless @records.empty? %>>
14
+ <p id="<%= empty_message_id %>" class="empty-message" <%= ' style="display:none;" '.html_safe unless @page.items.empty? %>>
15
15
  <%= as_(active_scaffold_config.list.no_entries_message) %>
16
16
  </p>
17
17
  </td>
@@ -23,7 +23,7 @@
23
23
  action_links.add(search_link) -%>
24
24
  <%= render :partial => 'list_actions', :locals => {:record => record, :url_options => params_for(:escape => false, :search => ''), :action_links => action_links.member} %>
25
25
  <% else %>
26
- <td class='actions'><%= '<p class="empty-message">&nbsp;</p>'.html_safe if @records.empty? %></td>
26
+ <td class='actions'><%= '<p class="empty-message">&nbsp;</p>'.html_safe if @page.items.empty? %></td>
27
27
  <% end -%>
28
28
 
29
29
  </tr>