active_scaffold 3.3.0 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. data/CHANGELOG +18 -0
  2. data/app/assets/javascripts/active_scaffold.js.erb +8 -0
  3. data/app/assets/javascripts/jquery/active_scaffold.js +11 -7
  4. data/app/assets/javascripts/jquery/date_picker_bridge.js.erb +19 -0
  5. data/app/assets/javascripts/prototype/active_scaffold.js +2 -0
  6. data/app/assets/stylesheets/active_scaffold_layout.css +5 -1
  7. data/app/views/active_scaffold_overrides/_field_search.html.erb +2 -2
  8. data/app/views/active_scaffold_overrides/_form_association.html.erb +5 -5
  9. data/app/views/active_scaffold_overrides/_form_association_record.html.erb +21 -16
  10. data/app/views/active_scaffold_overrides/_horizontal_subform.html.erb +8 -8
  11. data/app/views/active_scaffold_overrides/_horizontal_subform_header.html.erb +1 -1
  12. data/app/views/active_scaffold_overrides/_list.html.erb +1 -1
  13. data/app/views/active_scaffold_overrides/_list_calculations.html.erb +5 -7
  14. data/app/views/active_scaffold_overrides/_list_inline_adapter.html.erb +1 -12
  15. data/app/views/active_scaffold_overrides/_list_pagination.html.erb +1 -1
  16. data/app/views/active_scaffold_overrides/_list_record.html.erb +2 -2
  17. data/app/views/active_scaffold_overrides/_list_with_header.html.erb +1 -1
  18. data/app/views/active_scaffold_overrides/_render_field.js.erb +1 -1
  19. data/app/views/active_scaffold_overrides/_update_calculations.js.erb +1 -0
  20. data/app/views/active_scaffold_overrides/_vertical_subform.html.erb +2 -4
  21. data/app/views/active_scaffold_overrides/destroy.js.erb +1 -1
  22. data/app/views/active_scaffold_overrides/edit_associated.js.erb +2 -2
  23. data/config/locales/de.yml +109 -109
  24. data/config/locales/en.yml +109 -111
  25. data/config/locales/es.yml +112 -113
  26. data/config/locales/fr.yml +119 -125
  27. data/config/locales/hu.yml +109 -110
  28. data/config/locales/ja.yml +109 -110
  29. data/config/locales/ru.yml +119 -121
  30. data/lib/active_scaffold.rb +2 -2
  31. data/lib/active_scaffold/actions/common_search.rb +7 -3
  32. data/lib/active_scaffold/actions/core.rb +1 -0
  33. data/lib/active_scaffold/actions/field_search.rb +2 -1
  34. data/lib/active_scaffold/actions/list.rb +7 -1
  35. data/lib/active_scaffold/actions/subform.rb +2 -4
  36. data/lib/active_scaffold/attribute_params.rb +2 -4
  37. data/lib/active_scaffold/bridges/calendar_date_select.rb +1 -1
  38. data/lib/active_scaffold/bridges/date_picker.rb +4 -1
  39. data/lib/active_scaffold/bridges/date_picker/helper.rb +6 -6
  40. data/lib/active_scaffold/bridges/file_column.rb +1 -1
  41. data/lib/active_scaffold/bridges/file_column/as_file_column_bridge.rb +1 -1
  42. data/lib/active_scaffold/bridges/file_column/file_column_helpers.rb +1 -1
  43. data/lib/active_scaffold/bridges/paperclip.rb +1 -1
  44. data/lib/active_scaffold/bridges/paperclip/paperclip_bridge_helpers.rb +1 -1
  45. data/lib/active_scaffold/bridges/shared/date_bridge.rb +1 -1
  46. data/lib/active_scaffold/config/base.rb +6 -1
  47. data/lib/active_scaffold/config/core.rb +16 -0
  48. data/lib/active_scaffold/config/list.rb +4 -0
  49. data/lib/active_scaffold/data_structures/column.rb +10 -3
  50. data/lib/active_scaffold/extensions/action_view_rendering.rb +10 -5
  51. data/lib/active_scaffold/helpers/association_helpers.rb +20 -5
  52. data/lib/active_scaffold/helpers/form_column_helpers.rb +31 -21
  53. data/lib/active_scaffold/helpers/list_column_helpers.rb +8 -5
  54. data/lib/active_scaffold/helpers/pagination_helpers.rb +8 -0
  55. data/lib/active_scaffold/helpers/search_column_helpers.rb +20 -6
  56. data/lib/active_scaffold/helpers/view_helpers.rb +6 -6
  57. data/lib/active_scaffold/version.rb +1 -1
  58. data/test/bridges/paperclip_test.rb +2 -2
  59. data/vendor/assets/javascripts/getprototypeof.js +12 -0
  60. data/vendor/assets/javascripts/jquery-ui-timepicker-addon.js +1 -1
  61. metadata +5 -5
  62. data/app/views/active_scaffold_overrides/_search_attribute.html.erb +0 -10
data/CHANGELOG CHANGED
@@ -1,3 +1,21 @@
1
+ = 3.3.1
2
+ - Set adapter colspan (nested lists and forms) using javascript, fixed issue when active_scaffold_config_list is used
3
+ - Fix bug saving default values when get method is overrided on model to return default value
4
+ - Fix close action_link without adapter
5
+ - Fix update calculations after destroy a row
6
+ - Fix count and calculate searching with count_includes
7
+ - Fix action_after_create
8
+ - Cache associations options (for :select form_ui on associations), it can be disabled with config.cache_association_options = false
9
+ - Clean some code so we can stop changing @record in partials and using @record in helpers
10
+ - Support jquery-rails 3 gem and jquery-ui-rails gem
11
+ - Clean some invalid HTML
12
+ - Add store_user_settings option to enable storing sort, page and search params into session (enabled by default for backwards compatibility)
13
+ - Fix each_record_in_scope when conditions_for_collection needs some includes
14
+ - Add method to override label in search fields (field_search)
15
+ - Add method to override attributes for column headings on list
16
+ - Support security_method and ignore_method in column's link
17
+ - render :super should work for every render call (with partial and locals or with only one hash)
18
+
1
19
  = 3.3.0
2
20
  - Unify field overrides and list_ui method signatures
3
21
  - Improve performance removing some partials and adding some caching for helper overrides and UIs, and caching url generation for lists (caching url is optional)
@@ -1,7 +1,15 @@
1
1
  <% case ActiveScaffold.js_framework %>
2
2
  <% when :jquery %>
3
+ <% require_asset "getprototypeof" %>
4
+ <% if Jquery::Rails.const_defined? 'JQUERY_UI_VERSION' %>
3
5
  <% require_asset "jquery-ui" %>
4
6
  <% require_asset "jquery-ui-timepicker-addon" %>
7
+ <% elsif Jquery.const_defined? 'Ui' %>
8
+ <% require_asset "jquery.ui.core" %>
9
+ <% require_asset "jquery.ui.sortable" %>
10
+ <% require_asset "jquery.ui.datepicker" %>
11
+ <% require_asset "jquery-ui-timepicker-addon" %>
12
+ <% end %>
5
13
  <% require_asset "jquery/active_scaffold" %>
6
14
  <% require_asset "jquery/jquery.editinplace" %>
7
15
  <% require_asset "jquery/date_picker_bridge" %>
@@ -1,5 +1,5 @@
1
1
  jQuery(document).ready(function($) {
2
- if (jQuery().jquery < '1.8.0') {
2
+ if (/1\.[2-7]\..*/.test(jQuery().jquery)) {
3
3
  var error = 'ActiveScaffold requires jquery 1.8.0 or greater, please use jquery-rails 2.1.x gem or greater';
4
4
  if (typeof console != 'undefined') console.error(error);
5
5
  else alert(error);
@@ -986,12 +986,14 @@ ActiveScaffold.ActionLink.Abstract = Class.extend({
986
986
  },
987
987
 
988
988
  close: function() {
989
- var link = this;
990
- ActiveScaffold.remove(this.adapter, function() {
991
- link.enable();
992
- if (link.hide_target) link.target.show();
993
- if (ActiveScaffold.config.scroll_on_close) ActiveScaffold.scroll_to(link.target.attr('id'), ActiveScaffold.config.scroll_on_close == 'checkInViewport');
994
- });
989
+ if (this.adapter) {
990
+ var link = this;
991
+ ActiveScaffold.remove(this.adapter, function() {
992
+ link.enable();
993
+ if (link.hide_target) link.target.show();
994
+ if (ActiveScaffold.config.scroll_on_close) ActiveScaffold.scroll_to(link.target.attr('id'), ActiveScaffold.config.scroll_on_close == 'checkInViewport');
995
+ });
996
+ }
995
997
  },
996
998
 
997
999
  reload: function() {
@@ -1077,6 +1079,7 @@ ActiveScaffold.ActionLink.Record = ActiveScaffold.ActionLink.Abstract.extend({
1077
1079
  this.hide_target = true;
1078
1080
  }
1079
1081
 
1082
+ var colspan = this.target.children().length;
1080
1083
  if (this.position == 'after') {
1081
1084
  this.target.after(content);
1082
1085
  this.set_adapter(this.target.next());
@@ -1088,6 +1091,7 @@ ActiveScaffold.ActionLink.Record = ActiveScaffold.ActionLink.Abstract.extend({
1088
1091
  else {
1089
1092
  return false;
1090
1093
  }
1094
+ this.adapter.find('.inline-adapter-cell:first').attr('colspan', colspan);
1091
1095
  ActiveScaffold.highlight(this.adapter.find('td'));
1092
1096
  },
1093
1097
 
@@ -1,5 +1,24 @@
1
1
  <%# encoding: utf-8 %>
2
2
  <%= ActiveScaffold::Bridges[:date_picker].localization %>
3
+ Object.getPrototypeOf($.datepicker)._attachDatepicker_without_inlineSettings = Object.getPrototypeOf($.datepicker)._attachDatepicker;
4
+ $.extend(Object.getPrototypeOf($.datepicker), {
5
+ _attachDatepicker: function(target, settings) {
6
+ var inlineSettings = {}, $target = $(target);
7
+ for (var attrName in this._defaults) {
8
+ if(this._defaults.hasOwnProperty(attrName)){
9
+ var attrValue = $target.data(attrName.toLowerCase());
10
+ if (attrValue) {
11
+ try {
12
+ inlineSettings[attrName] = eval(attrValue);
13
+ } catch (err) {
14
+ inlineSettings[attrName] = attrValue;
15
+ }
16
+ }
17
+ }
18
+ }
19
+ this._attachDatepicker_without_inlineSettings(target, $.extend({}, settings || {}, inlineSettings));
20
+ }
21
+ });
3
22
  jQuery(document).on("focus", "input.date_picker", function(){
4
23
  var date_picker = jQuery(this);
5
24
  if (typeof(date_picker.datepicker) == 'function') {
@@ -969,6 +969,7 @@ ActiveScaffold.ActionLink.Record = Class.create(ActiveScaffold.ActionLink.Abstra
969
969
  this.hide_target = true;
970
970
  }
971
971
 
972
+ var colspan = this.target.childElements().length;
972
973
  if (this.position == 'after') {
973
974
  this.target.insert({after:content});
974
975
  this.set_adapter(this.target.next());
@@ -980,6 +981,7 @@ ActiveScaffold.ActionLink.Record = Class.create(ActiveScaffold.ActionLink.Abstra
980
981
  else {
981
982
  return false;
982
983
  }
984
+ this.adapter.down('.inline-adapter-cell').writeAttribute('colspan', colspan);
983
985
  ActiveScaffold.highlight(this.adapter.down('td').down());
984
986
  },
985
987
 
@@ -13,8 +13,9 @@ margin: 5px 0;
13
13
 
14
14
  .active-scaffold table {
15
15
  width: 100%;
16
- border-collapse: separate;
16
+ border-collapse: collapse;
17
17
  }
18
+ .active-scaffold td, .active-scaffold th { padding: 0; }
18
19
 
19
20
  .active-scaffold a,
20
21
  .active-scaffold a:visited {
@@ -400,6 +401,9 @@ padding: 3px 0px 2px 0px;
400
401
  border-bottom: none;
401
402
  font: bold 12px arial, sans-serif;
402
403
  }
404
+ .active-scaffold .active-scaffold-footer > br {
405
+ clear: both;
406
+ }
403
407
 
404
408
  .active-scaffold-footer .active-scaffold-pagination {
405
409
  float: right;
@@ -9,14 +9,14 @@ form_tag url_options, options %>
9
9
  <ol class="form">
10
10
  <% visibles, hiddens = visibles_and_hiddens(active_scaffold_config.field_search) %>
11
11
  <% visibles.each do |column| -%>
12
- <%= render :partial => 'search_attribute', :locals => {:column => column} %>
12
+ <li class="form-element"><%= search_attribute(column, @record) %></li>
13
13
  <% end -%>
14
14
  <% unless hiddens.empty? -%>
15
15
  <li class="sub-section">
16
16
  <h5><%= as_(:optional_attributes) %></h5>
17
17
  <ol id ="<%= sub_section_id(:sub_section => 'further_options') %>" class="form" style="display:none;">
18
18
  <% hiddens.each do |column| -%>
19
- <%= render :partial => 'search_attribute', :locals => {:column => column} %>
19
+ <li class="form-element"><%= search_attribute(column, @record) %></li>
20
20
  <% end -%>
21
21
  </ol>
22
22
  <%= link_to_visibility_toggle(sub_section_id(:sub_section => 'further_options'), {:default_visible => false}) %>
@@ -1,12 +1,12 @@
1
1
  <%
2
- parent_record = @record
2
+ parent_record ||= @record # save @record, some partial can change @record TODO remove when changing @record is removed
3
3
  associated = column.singular_association? ? [parent_record.send(column.name)].compact : parent_record.send(column.name).to_a
4
4
  associated = associated.sort_by {|r| r.new_record? ? 99999999999 : r.id} unless column.association.options.has_key?(:order)
5
- if show_blank_record = column.show_blank_record?(associated)
6
- associated << build_associated(column, parent_record)
5
+ if column.show_blank_record?(associated)
6
+ show_blank_record = build_associated(column, parent_record)
7
7
  end
8
8
  disable_required_for_new = @disable_required_for_new
9
- @disable_required_for_new = show_blank_record unless (column.singular_association? && column.required?)
9
+ @disable_required_for_new = !!show_blank_record unless (column.singular_association? && column.required?)
10
10
  subform_div_id = "#{sub_form_id(:association => column.name, :id => parent_record.id || generated_id(parent_record) || 99999999999)}-div"
11
11
  -%>
12
12
  <h5><%= column.label -%></h5>
@@ -18,6 +18,6 @@ subform_div_id = "#{sub_form_id(:association => column.name, :id => parent_recor
18
18
  </div>
19
19
  <%= link_to_visibility_toggle(subform_div_id, {:default_visible => !column.collapsed}) -%>
20
20
  <%
21
- @record = parent_record
21
+ @record = parent_record # restore @record, some partials can change it TODO remove when changing @record is removed
22
22
  @disable_required_for_new = disable_required_for_new
23
23
  -%>
@@ -1,10 +1,15 @@
1
1
  <%
2
2
  record_column = column
3
- readonly = (@record.readonly? or not @record.authorized_for?(:crud_type => :update))
4
- crud_type = @record.new_record? ? :create : (readonly ? :read : :update)
3
+ Rails.logger.warn "Relying on @record to render form_asssociation_record partial with no :object is deprecated, called from #{caller(1).detect {|l| l =~ /\.erb:/ }.gsub(/(.*:\d+):.*/, '\1')}" unless local_assigns[:form_association_record]
4
+ record = form_association_record ||= @record # TODO remove me, backwards compatibility, no :collection neither object in render
5
+ @record = record # TODO remove me, backward compatibility, helpers using @record
6
+ readonly = (record.readonly? or not record.authorized_for?(:crud_type => :update))
7
+ crud_type = record.new_record? ? :create : (readonly ? :read : :update)
5
8
  show_actions = false
6
- config = active_scaffold_config_for(@record.class)
7
- options = active_scaffold_input_options(config.columns[@record.class.primary_key], scope)
9
+ locked ||= false
10
+ config = active_scaffold_config_for(record.class)
11
+ scope = column_scope(record_column, scope, record)
12
+ options = active_scaffold_input_options(config.columns[record.class.primary_key], scope)
8
13
  tr_id = "association-#{options[:id]}"
9
14
 
10
15
  if config.subform.layout == :vertical
@@ -24,20 +29,20 @@
24
29
  default_col_class = []
25
30
  flatten ||= false
26
31
  end
27
- index ||= nil
32
+ index ||= form_association_record_counter ||= nil
28
33
 
29
34
  columns_length = 0
30
35
  columns_groups = []
31
36
  -%>
32
37
  <<%= record_tag %> class="sub-form-record">
33
- <% unless @record.errors.empty? -%>
34
- <%= content_tag error_tag, :class => "association-record-errors", :id => element_messages_id(:action => @record.class.name.underscore, :id => "#{parent_record.id}-#{index}") do %>
35
- <% errors = active_scaffold_error_messages_for(:record, :object_name => @record.class.model_name.human.downcase) %>
36
- <%= error_inner_tag ? content_tag(error_inner_tag, errors, :colspan => (active_scaffold_config_for(@record.class).subform.columns.length + 1 if error_inner_tag == :td)) : errors %>
38
+ <% unless record.errors.empty? -%>
39
+ <%= content_tag error_tag, :class => "association-record-errors", :id => element_messages_id(:action => record.class.name.underscore, :id => "#{parent_record.id}-#{index}") do %>
40
+ <% errors = active_scaffold_error_messages_for(:record, :object_name => record.class.model_name.human.downcase) %>
41
+ <%= error_inner_tag ? content_tag(error_inner_tag, errors, :colspan => (active_scaffold_config_for(record.class).subform.columns.length + 1 if error_inner_tag == :td)) : errors %>
37
42
  <% end %>
38
43
  <% end %>
39
- <%= content_tag row_tag, :id => tr_id, :class => "association-record#{' association-record-new' if @record.new_record?}#{' locked' if locked}" do %>
40
- <% config.subform.columns.each :for => @record.class, :crud_type => :read, :flatten => flatten do |column| %>
44
+ <%= content_tag row_tag, :id => tr_id, :class => "association-record#{' association-record-new' if record.new_record?}#{' locked' if locked}" do %>
45
+ <% config.subform.columns.each :for => record.class, :crud_type => :read, :flatten => flatten do |column| %>
41
46
  <%
42
47
  if column.is_a? ActiveScaffold::DataStructures::ActionColumns
43
48
  columns_groups << column
@@ -56,16 +61,16 @@
56
61
  col_class << 'hidden' if column_renders_as(column) == :hidden
57
62
  -%>
58
63
  <%= content_tag column_tag, :class => col_class.join(' ') do %>
59
- <%= active_scaffold_render_subform_column(column, scope, crud_type, readonly) %>
64
+ <%= active_scaffold_render_subform_column(column, scope, crud_type, readonly, false, record) %>
60
65
  <% end %>
61
66
  <% end -%>
62
67
  <% if show_actions -%>
63
68
  <%= content_tag column_tag, :class => "actions" do %>
64
- <% if record_column.plural_association? and (@record.authorized_for?(:crud_type => :delete) or not [:destroy, :delete_all].include?(record_column.association.options[:dependent])) %>
69
+ <% if record_column.plural_association? and (record.authorized_for?(:crud_type => :delete) or not [:destroy, :delete_all].include?(record_column.association.options[:dependent])) %>
65
70
  <%= link_to as_(:remove), '#', :class => 'destroy', :id => "#{options[:id]}-destroy" , :data => {:delete_id => tr_id} unless locked %>
66
71
  <% end %>
67
- <% unless @record.new_record? %>
68
- <input type="hidden" name="<%= options[:name] -%>" id="<%= options[:id] -%>" value="<%= @record.id -%>" />
72
+ <% unless record.new_record? %>
73
+ <input type="hidden" name="<%= options[:name] -%>" id="<%= options[:id] -%>" value="<%= record.id -%>" />
69
74
  <% end -%>
70
75
  <% end %>
71
76
  <% end -%>
@@ -75,7 +80,7 @@
75
80
  <%= content_tag row_tag, :class => 'associated-record' do %>
76
81
  <%= content_tag column_tag, :colspan => (columns_length if column_tag == :td) do %>
77
82
  <% column.each :for => @record.class, :crud_type => :read, :flatten => true do |col| %>
78
- <%= active_scaffold_render_subform_column(col, scope, crud_type, readonly, true) %>
83
+ <%= active_scaffold_render_subform_column(col, scope, crud_type, readonly, true, record) %>
79
84
  <% end %>
80
85
  <% end %>
81
86
  <% end %>
@@ -1,12 +1,12 @@
1
- <table cellpadding="0" cellspacing="0" id="<%= sub_form_list_id(:association => column.name, :id => parent_record.try(:id) || generated_id(parent_record) || 99999999999) %>">
2
- <% @record = associated.empty? ? build_associated(column, parent_record) : associated.last -%>
3
- <%= render :partial => 'horizontal_subform_header', :locals => {:parent_record => parent_record, :record => @record} %>
1
+ <table id="<%= sub_form_list_id(:association => column.name, :id => parent_record.try(:id) || generated_id(parent_record) || 99999999999) %>">
2
+ <%
3
+ header_record_class = (show_blank_record && show_blank_record.class) || column.association.klass
4
+ -%>
5
+ <%= render :partial => 'horizontal_subform_header', :locals => {:parent_record => parent_record, :record_class => header_record_class} %>
4
6
 
5
- <% associated.each_index do |index| %>
6
- <% @record = associated[index] -%>
7
- <%= render :partial => 'form_association_record', :locals => {:scope => column_scope(column, scope), :parent_record => parent_record, :column => column, :locked => show_blank_record && @record.new_record? && @record == associated.last, :index => index} %>
8
- <% end -%>
7
+ <%= render :partial => 'form_association_record', :collection => associated, :locals => {:scope => scope, :parent_record => parent_record, :column => column} %>
8
+ <%= render :partial => 'form_association_record', :object => show_blank_record, :locals => {:scope => scope, :parent_record => parent_record, :column => column, :locked => true, :index => associated.size} if show_blank_record %>
9
9
  <tfoot>
10
- <%= render :partial => 'horizontal_subform_footer', :locals => {:scope => column_scope(column, scope), :parent_record => parent_record, :column => column} %>
10
+ <%= render :partial => 'horizontal_subform_footer', :locals => {:scope => scope, :parent_record => parent_record, :column => column} %>
11
11
  </tfoot>
12
12
  </table>
@@ -1,7 +1,7 @@
1
1
  <thead>
2
2
  <tr>
3
3
  <%
4
- active_scaffold_config_for(record.class).subform.columns.each :for => record.class, :crud_type => :read do |column|
4
+ active_scaffold_config_for(record_class).subform.columns.each :for => record_class, :crud_type => :read do |column|
5
5
  next if column.is_a? ActiveScaffold::DataStructures::ActionColumns
6
6
  next unless in_subform?(column, parent_record)
7
7
  hidden = column_renders_as(column) == :hidden
@@ -15,7 +15,7 @@
15
15
  </tbody>
16
16
  </table>
17
17
  <% end %>
18
- <table cellpadding="0" cellspacing="0">
18
+ <table>
19
19
  <thead>
20
20
  <tr>
21
21
  <% columns = list_columns %>
@@ -2,13 +2,11 @@
2
2
  columns ||= list_columns -%>
3
3
  <tr id="<%= active_scaffold_calculations_id %>" class="active-scaffold-calculations">
4
4
  <% columns.each do |column| -%>
5
- <td <%= "id=#{active_scaffold_calculations_id(:column => column)}" if column.calculation? %>>
6
- <% if column.calculation? -%>
7
- <%= render_column_calculation(column) %>
8
- <% else -%>
9
- &nbsp;
10
- <% end -%>
11
- </td>
5
+ <% if column.calculation? %>
6
+ <td id="<%= active_scaffold_calculations_id(:column => column) %>"><%= render_column_calculation(column) %></td>
7
+ <% else %>
8
+ <td>&nbsp;</td>
9
+ <% end -%>
12
10
  <% end -%>
13
11
  <% unless active_scaffold_config.action_links.empty? -%>
14
12
  <td class="actions">&nbsp;</td>
@@ -1,17 +1,6 @@
1
- <%
2
- column_count ||= begin
3
- config = if nested? and (nested.singular_association? || action_name == 'index')
4
- active_scaffold_config_for(nested.parent_model)
5
- else
6
- active_scaffold_config
7
- end
8
- # increment in 1 for self-associations, parent_model config will have constraints too
9
- config.list.columns.count + 1 + (config == active_scaffold_config && action_name == 'index' ? 1 : 0)
10
- end
11
- %>
12
1
  <%# nested_id, allows us to remove a nested scaffold programmatically %>
13
2
  <tr class="inline-adapter" id="<%= element_row_id :action => :nested %>">
14
- <td colspan="<%= column_count %>" class="inline-adapter-cell">
3
+ <td class="inline-adapter-cell">
15
4
  <% if controller.send(:successful?) %>
16
5
  <div class="<%= "#{params[:action]}-view" if params[:action] %> <%= "#{nested? ? nested.name : id_from_controller(params[:controller])}-view" %> view">
17
6
  <%= link_to(as_(:close), '', :class => 'inline-adapter-close as_cancel', :remote => true, :title => as_(:close)) -%>
@@ -6,6 +6,6 @@
6
6
  <div class="active-scaffold-pagination">
7
7
  <%= render :partial => 'list_pagination_links', :locals => { :current_page => @page } if @page.pager.infinite? || @page.pager.number_of_pages > 1 %>
8
8
  </div>
9
- <br clear="both" /><%# a hack for the Rico Corner problem %>
9
+ <br /><!-- to clear this block -->
10
10
  </div>
11
11
  <% end -%>
@@ -5,7 +5,7 @@ tr_class = cycle("", "even-record") + ' ' + list_row_class(record)
5
5
  action_links ||= active_scaffold_config.action_links.member
6
6
  data_refresh ||= url_for(params_for(:action => :row, :id => '--ID--', :_method => :get))
7
7
  -%>
8
- <tr class="record <%= tr_class %>" id="<%= element_row_id(:action => :list, :id => record.id) %>" data-refresh="<%= data_refresh.sub('--ID--', record.id.to_s).html_safe %>">
8
+ <tr class="record <%= tr_class %>" id="<%= element_row_id(:action => :list, :id => record.id) %>" data-refresh="<%= data_refresh.sub('--ID--', record.id.to_s) %>">
9
9
  <% columns.each do |column| %>
10
10
  <% authorized = record.authorized_for?(:crud_type => :read, :column => column.name) -%>
11
11
  <% column_value = authorized ? get_column_value(record, column) : active_scaffold_config.list.empty_field_text -%>
@@ -15,7 +15,7 @@ data_refresh ||= url_for(params_for(:action => :row, :id => '--ID--', :_method =
15
15
  <% end %>
16
16
  <% end -%>
17
17
 
18
- <td class="actions"><table cellpadding="0" cellspacing="0">
18
+ <td class="actions"><table>
19
19
  <tr>
20
20
  <td class="indicator-container">
21
21
  <%= loading_indicator_tag(:action => :record, :id => record.id) %>
@@ -2,7 +2,7 @@
2
2
  <div class="active-scaffold-header">
3
3
  <%= render :partial => 'list_header' %>
4
4
  </div>
5
- <table cellpadding="0" cellspacing="0">
5
+ <table>
6
6
  <tbody class="before-header" id="<%= before_header_id -%>">
7
7
  <% if active_scaffold_config.list.always_show_search %>
8
8
  <% old_record, @record = @record, new_model %>
@@ -17,7 +17,7 @@
17
17
  html = if scope
18
18
  readonly = (@record.readonly? or not @record.authorized_for?(:crud_type => :update))
19
19
  crud_type = @record.new_record? ? :create : (readonly ? :read : :update)
20
- active_scaffold_render_subform_column(column, scope, crud_type, readonly, !active_scaffold_config.subform.columns.names_without_auth_check.include?(column.name))
20
+ active_scaffold_render_subform_column(column, scope, crud_type, readonly, !active_scaffold_config.subform.columns.names_without_auth_check.include?(column.name), @record)
21
21
  else
22
22
  render_column(column, @record, renders_as, scope)
23
23
  end
@@ -1,4 +1,5 @@
1
1
  <% calculations_id ||= active_scaffold_calculations_id -%>
2
2
  <% if active_scaffold_config.list.columns.any? {|c| c.calculation?} %>
3
+ <% params.delete(:id) %>
3
4
  ActiveScaffold.replace('<%= calculations_id %>', '<%= escape_javascript(render(:partial => 'list_calculations')) %>');
4
5
  <% end %>
@@ -1,6 +1,4 @@
1
1
  <div id="<%= sub_form_list_id(:association => column.name, :id => parent_record.id || generated_id(parent_record) || 99999999999) %>">
2
- <% associated.each_index do |index| %>
3
- <% @record = associated[index] -%>
4
- <%= render :partial => 'form_association_record', :locals => {:scope => column_scope(column, scope), :parent_record => parent_record, :column => column, :locked => show_blank_record && @record.new_record? && @record == associated.last, :index => index} %>
5
- <% end -%>
2
+ <%= render :partial => 'form_association_record', :collection => associated, :locals => {:scope => scope, :parent_record => parent_record, :column => column} %>
3
+ <%= render :partial => 'form_association_record', :object => show_blank_record, :locals => {:scope => scope, :parent_record => parent_record, :column => column, :locked => true, :index => associated.size} if show_blank_record %>
6
4
  </div>
@@ -8,7 +8,7 @@
8
8
  <% messages_id = active_scaffold_messages_id(:controller_id => current_id) %>
9
9
  <%= render :partial => 'update_calculations', :locals => {:calculations_id => active_scaffold_calculations_id(:controller_id => current_id)}, :formats => [:js] %>
10
10
  <% elsif render_parent_action == :index %>
11
- <% if controller.respond_to?(:render_component_into_view) %>
11
+ <% if controller.respond_to?(:render_component_into_view, true) %>
12
12
  <%= escape_javascript(controller.send(:render_component_into_view, render_parent_options)) %>
13
13
  <% else %>
14
14
  ActiveScaffold.reload('<%= url_for render_parent_options %>');
@@ -1,12 +1,12 @@
1
1
  <%
2
- associated_form = render :partial => "form_association_record", :locals => {:scope => @scope, :parent_record => @parent_record, :column => @column, :locked => @record.new_record? && @column.singular_association?}
2
+ associated_form = render :partial => "form_association_record", :object => @record, :locals => {:scope => @scope, :parent_record => @parent_record, :column => @column, :locked => @record.new_record? && @column.singular_association?}
3
3
  options = {:singular => false}
4
4
  if @column.singular_association?
5
5
  options[:singular] = true
6
6
  else
7
7
  unless @record.new_record?
8
8
  column = active_scaffold_config_for(@record.class).columns[@record.class.primary_key]
9
- options[:id] = active_scaffold_input_options(column, @scope)[:id]
9
+ options[:id] = active_scaffold_input_options(column, column_scope(@column, @scope, @record))[:id]
10
10
  end
11
11
  end %>
12
12
  ActiveScaffold.create_associated_record_form('<%=sub_form_list_id(:association => @column.name, :id => @parent_record.id || generated_id(@parent_record) || 99999999999)%>','<%=escape_javascript(associated_form)%>', <%= options.to_json.html_safe %>);
@@ -1,126 +1,126 @@
1
1
  de:
2
2
  time:
3
3
  formats:
4
- picker: "%d.%m.%Y %H:%M"
4
+ picker: ! '%d.%m.%Y %H:%M'
5
5
  active_scaffold:
6
- add: 'Hinzufügen'
7
- add_existing: 'Existierenden Eintrag hinzufügen'
8
- add_existing_model: 'Existierende %{model} hinzufügen'
9
- apply: 'Apply'
10
- are_you_sure_to_delete: 'Sind Sie sicher?'
11
- cancel: 'Abbrechen'
12
- click_to_edit: 'Zum Editieren anklicken'
13
- click_to_reset: 'Reset'
14
- close: 'Schließen'
15
- config_list: 'Konfigurieren'
16
- config_list_model: 'Konfiguriere Spalten für %{model}'
17
- create: 'Anlegen'
18
- create_model: 'Lege %{model} an'
19
- create_another: 'Weitere anlegen'
20
- created_model: '%{model} angelegt'
21
- create_new: 'Neu anlegen'
22
- customize: 'Anpassen'
23
- delete: 'Löschen'
24
- deleted_model: '%{model} gelöscht'
25
- delimiter: 'Trennzeichen'
26
- download: 'Download'
27
- edit: 'Bearbeiten'
28
- export: 'Exportieren'
29
- nested_for_model: '%{nested_model} für %{parent_model}'
30
- nested_of_model: '%{nested_model} von %{parent_model}'
6
+ add: Hinzufügen
7
+ add_existing: Existierenden Eintrag hinzufügen
8
+ add_existing_model: Existierende %{model} hinzufügen
9
+ apply: Apply
10
+ are_you_sure_to_delete: Sind Sie sicher?
11
+ cancel: Abbrechen
12
+ click_to_edit: Zum Editieren anklicken
13
+ click_to_reset: Reset
14
+ close: Schließen
15
+ config_list: Konfigurieren
16
+ config_list_model: Konfiguriere Spalten für %{model}
17
+ create: Anlegen
18
+ create_model: Lege %{model} an
19
+ create_another: Weitere anlegen
20
+ created_model: ! '%{model} angelegt'
21
+ create_new: Neu anlegen
22
+ customize: Anpassen
23
+ delete: Löschen
24
+ deleted_model: ! '%{model} gelöscht'
25
+ delimiter: Trennzeichen
26
+ download: Download
27
+ edit: Bearbeiten
28
+ export: Exportieren
29
+ nested_for_model: ! '%{nested_model} für %{parent_model}'
30
+ nested_of_model: ! '%{nested_model} von %{parent_model}'
31
31
  'false': 'False'
32
- filtered: '(Gefiltert)'
33
- found: 'Gefunden'
34
- hide: 'Verstecken'
35
- inplace_edit_handle: '--'
36
- live_search: 'Live-Suche'
37
- loading: 'Lade…'
38
- mark_all_records: "Mark all"
39
- next: 'Vor'
40
- no_entries: 'Keine Einträge'
41
- no_options: 'Keine Optionen'
42
- omit_header: 'Lasse Header weg'
43
- options: 'Optionen'
44
- pdf: 'PDF'
45
- previous: 'Zurück'
46
- print: 'Drucken'
32
+ filtered: (Gefiltert)
33
+ found: Gefunden
34
+ hide: Verstecken
35
+ inplace_edit_handle: --
36
+ live_search: Live-Suche
37
+ loading: Lade…
38
+ mark_all_records: Mark all
39
+ next: Vor
40
+ no_entries: Keine Einträge
41
+ no_options: Keine Optionen
42
+ omit_header: Lasse Header weg
43
+ options: Optionen
44
+ pdf: PDF
45
+ previous: Zurück
46
+ print: Drucken
47
47
  records_marked:
48
- one: "1 marked %{model}"
49
- other: "%{count} marked %{model}"
50
- refresh: 'Neu laden'
51
- remove: 'Entfernen'
52
- remove_file: 'Entferne oder Ersetze Datei'
53
- replace_existing: 'Existierenden ersetzen'
54
- replace_with_new: 'Mit Neuer ersetzen'
55
- revisions_for_model: 'Revisionen für %{model}'
56
- reset: 'Zurücksetzen'
57
- saving: 'Speichern…'
58
- search: 'Suche'
59
- search_terms: 'Suchbegriffe'
60
- _select_: '- Auswählen -'
61
- show: 'Anzeigen'
62
- show_model: 'Zeige %{model} an'
63
- _to_ : ' zu '
48
+ one: 1 marked %{model}
49
+ other: ! '%{count} marked %{model}'
50
+ refresh: Neu laden
51
+ remove: Entfernen
52
+ remove_file: Entferne oder Ersetze Datei
53
+ replace_existing: Existierenden ersetzen
54
+ replace_with_new: Mit Neuer ersetzen
55
+ revisions_for_model: Revisionen für %{model}
56
+ reset: Zurücksetzen
57
+ saving: Speichern…
58
+ search: Suche
59
+ search_terms: Suchbegriffe
60
+ _select_: ! '- Auswählen -'
61
+ show: Anzeigen
62
+ show_model: Zeige %{model} an
63
+ _to_: ! ' zu '
64
64
  'true': 'True'
65
- update: 'Speichern'
66
- update_model: 'Editiere %{model}'
67
- updated_model: '%{model} aktualisiert'
68
- '=': '='
69
- '>=': '>='
70
- '<=': '<='
71
- '>': '>'
72
- '<': '<'
73
- '!=': '!='
74
- between: 'Zwischen'
75
- contains: 'Enthält'
76
- begins_with: 'Beginnt'
77
- ends_with: 'Endet'
78
- today: 'Heute'
79
- yesterday: 'Gestern'
80
- tomorrow: 'Morgen'
81
- this_week: 'Diese Woche'
82
- prev_week: 'Letzte Woche'
83
- next_week: 'Nächste Woche'
84
- this_month: 'Diesen Monat'
85
- prev_month: 'Letzten Monat'
86
- next_month: 'Nächsten Monat'
87
- this_year: 'Dieses Jahr'
88
- prev_year: 'Letztes Jahr'
89
- next_year: 'Nächstes Jahr'
90
- past: 'Letzten'
91
- future: 'Nächsten'
92
- range: 'Zeitraum'
93
- seconds: 'Sekunden'
94
- minutes: 'Minuten'
95
- hours: 'Stunden'
96
- days: 'Tage'
97
- weeks: 'Wochen'
98
- months: 'Monate'
99
- years: 'Jahre'
100
- optional_attributes: 'Weitere'
65
+ update: Speichern
66
+ update_model: Editiere %{model}
67
+ updated_model: ! '%{model} aktualisiert'
68
+ =: =
69
+ ! '>=': ! '>='
70
+ <=: <=
71
+ ! '>': ! '>'
72
+ <: <
73
+ ! '!=': ! '!='
74
+ between: Zwischen
75
+ contains: Enthält
76
+ begins_with: Beginnt
77
+ ends_with: Endet
78
+ today: Heute
79
+ yesterday: Gestern
80
+ tomorrow: Morgen
81
+ this_week: Diese Woche
82
+ prev_week: Letzte Woche
83
+ next_week: Nächste Woche
84
+ this_month: Diesen Monat
85
+ prev_month: Letzten Monat
86
+ next_month: Nächsten Monat
87
+ this_year: Dieses Jahr
88
+ prev_year: Letztes Jahr
89
+ next_year: Nächstes Jahr
90
+ past: Letzten
91
+ future: Nächsten
92
+ range: Zeitraum
93
+ seconds: Sekunden
94
+ minutes: Minuten
95
+ hours: Stunden
96
+ days: Tage
97
+ weeks: Wochen
98
+ months: Monate
99
+ years: Jahre
100
+ optional_attributes: Weitere
101
101
  :null: 'Null'
102
- not_null: 'Nicht Null'
102
+ not_null: Nicht Null
103
103
  date_picker_options:
104
- weekHeader: 'Wo'
104
+ weekHeader: Wo
105
105
  firstDay: 1
106
106
  isRTL: false
107
107
  showMonthAfterYear: false
108
108
  datetime_picker_options:
109
- timeText: 'Uhrzeit'
110
- currentText: 'Jetzt'
111
- closeText: 'Schließen'
109
+ timeText: Uhrzeit
110
+ currentText: Jetzt
111
+ closeText: Schließen
112
112
  human_conditions:
113
- boolean: "%{column} = %{value}"
114
- association: "%{column} = %{value}"
113
+ boolean: ! '%{column} = %{value}'
114
+ association: ! '%{column} = %{value}'
115
115
  errors:
116
116
  template:
117
117
  header:
118
- one: "Konnte %{model} nicht speichern: ein Fehler."
119
- other: "Konnte %{model} nicht speichern: %{count} Fehler."
120
- body: "Bitte überprüfen Sie die folgenden Felder:"
121
- # error_messages
122
- cant_destroy_record: "%{record} kann nicht gelöscht werden"
123
- internal_error: 'Fehler bei der Verarbeitung (code 500, Interner Fehler)'
124
- version_inconsistency: 'Inkonsistente Versionen - dieser Eintrag wurde verändert nachdem Sie mit der Bearbeitung begonnen haben.'
125
- record_not_saved: 'Eintrag kann nicht gespeichert werden. Ursache unbekannt.'
126
- no_authorization_for_action: "Keine Berechtigung für Aktion %{action}"
118
+ one: ! 'Konnte %{model} nicht speichern: ein Fehler.'
119
+ other: ! 'Konnte %{model} nicht speichern: %{count} Fehler.'
120
+ body: ! 'Bitte überprüfen Sie die folgenden Felder:'
121
+ cant_destroy_record: ! '%{record} kann nicht gelöscht werden'
122
+ internal_error: Fehler bei der Verarbeitung (code 500, Interner Fehler)
123
+ version_inconsistency: Inkonsistente Versionen - dieser Eintrag wurde verändert nachdem Sie mit der Bearbeitung begonnen haben.
124
+ record_not_saved: Eintrag kann nicht gespeichert werden. Ursache unbekannt.
125
+ no_authorization_for_action: Keine Berechtigung für Aktion %{action}
126
+ 'null': 'Null'