active_scaffold 3.5.4 → 3.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. checksums.yaml +4 -4
  2. data/{CHANGELOG → CHANGELOG.rdoc} +72 -0
  3. data/README.md +20 -8
  4. data/app/assets/javascripts/active_scaffold.js.erb +0 -1
  5. data/app/assets/javascripts/jquery/active_scaffold.js +98 -7
  6. data/app/assets/stylesheets/active_scaffold_colors.scss +1 -1
  7. data/app/assets/stylesheets/active_scaffold_layout.css +52 -29
  8. data/app/views/active_scaffold_overrides/_base_form.html.erb +2 -2
  9. data/app/views/active_scaffold_overrides/_form.html.erb +1 -1
  10. data/app/views/active_scaffold_overrides/_form_association.html.erb +2 -1
  11. data/app/views/active_scaffold_overrides/_form_association_footer.html.erb +3 -2
  12. data/app/views/active_scaffold_overrides/_form_association_record.html.erb +9 -7
  13. data/app/views/active_scaffold_overrides/_horizontal_subform.html.erb +4 -4
  14. data/app/views/active_scaffold_overrides/_horizontal_subform_header.html.erb +2 -1
  15. data/app/views/active_scaffold_overrides/_list.html.erb +2 -1
  16. data/app/views/active_scaffold_overrides/_list_header.html.erb +5 -7
  17. data/app/views/active_scaffold_overrides/_list_messages.html.erb +1 -0
  18. data/app/views/active_scaffold_overrides/_list_record.html.erb +4 -5
  19. data/app/views/active_scaffold_overrides/_list_with_header.html.erb +1 -1
  20. data/app/views/active_scaffold_overrides/_messages.html.erb +1 -0
  21. data/app/views/active_scaffold_overrides/_refresh_list.js.erb +4 -0
  22. data/app/views/active_scaffold_overrides/_render_field.js.erb +2 -1
  23. data/app/views/active_scaffold_overrides/_show_association_horizontal.html.erb +2 -1
  24. data/app/views/active_scaffold_overrides/_show_columns.html.erb +2 -2
  25. data/app/views/active_scaffold_overrides/_show_horizontal_record.html.erb +4 -4
  26. data/app/views/active_scaffold_overrides/_update_calculations.js.erb +1 -1
  27. data/app/views/active_scaffold_overrides/_update_column.js.erb +2 -2
  28. data/app/views/active_scaffold_overrides/_vertical_subform.html.erb +2 -2
  29. data/app/views/active_scaffold_overrides/action_confirmation.html.erb +2 -2
  30. data/app/views/active_scaffold_overrides/delete.html.erb +2 -2
  31. data/app/views/active_scaffold_overrides/on_action_update.js.erb +16 -6
  32. data/app/views/active_scaffold_overrides/on_update.js.erb +1 -1
  33. data/app/views/active_scaffold_overrides/row.js.erb +1 -1
  34. data/app/views/active_scaffold_overrides/update_column.js.erb +2 -2
  35. data/config/locales/de.yml +2 -1
  36. data/config/locales/en.yml +1 -0
  37. data/config/locales/es.yml +1 -0
  38. data/config/locales/fr.yml +2 -1
  39. data/config/locales/hu.yml +1 -0
  40. data/config/locales/ja.yml +1 -0
  41. data/config/locales/ru.yml +1 -0
  42. data/lib/active_scaffold.rb +19 -16
  43. data/lib/active_scaffold/actions/common_search.rb +11 -8
  44. data/lib/active_scaffold/actions/core.rb +91 -70
  45. data/lib/active_scaffold/actions/create.rb +28 -28
  46. data/lib/active_scaffold/actions/delete.rb +3 -3
  47. data/lib/active_scaffold/actions/field_search.rb +53 -43
  48. data/lib/active_scaffold/actions/list.rb +111 -27
  49. data/lib/active_scaffold/actions/nested.rb +65 -48
  50. data/lib/active_scaffold/actions/search.rb +1 -1
  51. data/lib/active_scaffold/actions/show.rb +4 -4
  52. data/lib/active_scaffold/actions/subform.rb +23 -22
  53. data/lib/active_scaffold/actions/update.rb +96 -77
  54. data/lib/active_scaffold/active_record_permissions.rb +2 -11
  55. data/lib/active_scaffold/attribute_params.rb +102 -94
  56. data/lib/active_scaffold/bridges.rb +8 -8
  57. data/lib/active_scaffold/bridges/active_storage.rb +6 -0
  58. data/lib/active_scaffold/bridges/active_storage/active_storage_bridge.rb +34 -0
  59. data/lib/active_scaffold/bridges/active_storage/active_storage_helpers.rb +54 -0
  60. data/lib/active_scaffold/bridges/active_storage/form_ui.rb +22 -0
  61. data/lib/active_scaffold/bridges/active_storage/list_ui.rb +36 -0
  62. data/lib/active_scaffold/bridges/bitfields.rb +2 -1
  63. data/lib/active_scaffold/bridges/bitfields/bitfields_bridge.rb +12 -15
  64. data/lib/active_scaffold/bridges/bitfields/list_ui.rb +19 -0
  65. data/lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb +1 -1
  66. data/lib/active_scaffold/bridges/cancan/cancan_bridge.rb +9 -12
  67. data/lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb +1 -1
  68. data/lib/active_scaffold/bridges/carrierwave/list_ui.rb +2 -2
  69. data/lib/active_scaffold/bridges/chosen/helpers.rb +7 -6
  70. data/lib/active_scaffold/bridges/date_picker/ext.rb +0 -13
  71. data/lib/active_scaffold/bridges/date_picker/helper.rb +49 -44
  72. data/lib/active_scaffold/bridges/dragonfly/list_ui.rb +1 -1
  73. data/lib/active_scaffold/bridges/file_column/as_file_column_bridge.rb +1 -1
  74. data/lib/active_scaffold/bridges/file_column/file_column_helpers.rb +3 -3
  75. data/lib/active_scaffold/bridges/file_column/form_ui.rb +3 -3
  76. data/lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb +10 -7
  77. data/lib/active_scaffold/bridges/paper_trail.rb +1 -1
  78. data/lib/active_scaffold/bridges/paper_trail/actions.rb +3 -1
  79. data/lib/active_scaffold/bridges/paperclip/list_ui.rb +1 -1
  80. data/lib/active_scaffold/bridges/paperclip/paperclip_bridge.rb +1 -1
  81. data/lib/active_scaffold/bridges/paperclip/paperclip_bridge_helpers.rb +2 -2
  82. data/lib/active_scaffold/bridges/record_select/helpers.rb +15 -17
  83. data/lib/active_scaffold/bridges/shared/date_bridge.rb +20 -19
  84. data/lib/active_scaffold/bridges/tiny_mce/helpers.rb +3 -1
  85. data/lib/active_scaffold/bridges/usa_state_select/usa_state_select_helper.rb +21 -4
  86. data/lib/active_scaffold/config/base.rb +133 -41
  87. data/lib/active_scaffold/config/core.rb +146 -18
  88. data/lib/active_scaffold/config/delete.rb +14 -1
  89. data/lib/active_scaffold/config/field_search.rb +7 -1
  90. data/lib/active_scaffold/config/form.rb +10 -1
  91. data/lib/active_scaffold/config/list.rb +39 -13
  92. data/lib/active_scaffold/config/mark.rb +4 -2
  93. data/lib/active_scaffold/config/nested.rb +16 -17
  94. data/lib/active_scaffold/config/search.rb +9 -0
  95. data/lib/active_scaffold/config/show.rb +4 -0
  96. data/lib/active_scaffold/config/update.rb +4 -0
  97. data/lib/active_scaffold/configurable.rb +14 -7
  98. data/lib/active_scaffold/constraints.rb +22 -20
  99. data/lib/active_scaffold/core.rb +67 -28
  100. data/lib/active_scaffold/data_structures/action_columns.rb +50 -59
  101. data/lib/active_scaffold/data_structures/action_link.rb +50 -20
  102. data/lib/active_scaffold/data_structures/action_links.rb +15 -13
  103. data/lib/active_scaffold/data_structures/association/abstract.rb +38 -15
  104. data/lib/active_scaffold/data_structures/association/active_mongoid.rb +2 -6
  105. data/lib/active_scaffold/data_structures/association/active_record.rb +6 -2
  106. data/lib/active_scaffold/data_structures/association/mongoid.rb +0 -3
  107. data/lib/active_scaffold/data_structures/column.rb +75 -66
  108. data/lib/active_scaffold/data_structures/columns.rb +3 -2
  109. data/lib/active_scaffold/data_structures/nested_info.rb +33 -19
  110. data/lib/active_scaffold/data_structures/set.rb +8 -0
  111. data/lib/active_scaffold/data_structures/sorting.rb +10 -2
  112. data/lib/active_scaffold/delayed_setup.rb +16 -5
  113. data/lib/active_scaffold/extensions/action_controller_rendering.rb +3 -2
  114. data/lib/active_scaffold/extensions/action_view_rendering.rb +93 -32
  115. data/lib/active_scaffold/extensions/cow_proxy.rb +95 -0
  116. data/lib/active_scaffold/extensions/ice_nine.rb +36 -0
  117. data/lib/active_scaffold/extensions/left_outer_joins.rb +8 -33
  118. data/lib/active_scaffold/extensions/localize.rb +3 -1
  119. data/lib/active_scaffold/extensions/routing_mapper.rb +6 -45
  120. data/lib/active_scaffold/extensions/to_label.rb +3 -2
  121. data/lib/active_scaffold/extensions/unsaved_record.rb +2 -4
  122. data/lib/active_scaffold/finder.rb +110 -77
  123. data/lib/active_scaffold/helpers/action_link_helpers.rb +62 -36
  124. data/lib/active_scaffold/helpers/association_helpers.rb +18 -16
  125. data/lib/active_scaffold/helpers/controller_helpers.rb +34 -10
  126. data/lib/active_scaffold/helpers/form_column_helpers.rb +196 -124
  127. data/lib/active_scaffold/helpers/human_condition_helpers.rb +1 -1
  128. data/lib/active_scaffold/helpers/id_helpers.rb +6 -2
  129. data/lib/active_scaffold/helpers/list_column_helpers.rb +90 -57
  130. data/lib/active_scaffold/helpers/pagination_helpers.rb +2 -2
  131. data/lib/active_scaffold/helpers/search_column_helpers.rb +29 -34
  132. data/lib/active_scaffold/helpers/show_column_helpers.rb +3 -5
  133. data/lib/active_scaffold/helpers/view_helpers.rb +39 -36
  134. data/lib/active_scaffold/marked_model.rb +2 -2
  135. data/lib/active_scaffold/orm_checks.rb +3 -7
  136. data/lib/active_scaffold/paginator.rb +7 -7
  137. data/lib/active_scaffold/registry.rb +33 -0
  138. data/lib/active_scaffold/responds_to_parent.rb +8 -11
  139. data/lib/active_scaffold/tableless.rb +82 -66
  140. data/lib/active_scaffold/version.rb +2 -2
  141. data/lib/generators/active_scaffold/controller_generator.rb +2 -2
  142. data/lib/generators/active_scaffold/install_generator.rb +52 -4
  143. data/lib/generators/active_scaffold/resource_generator.rb +2 -2
  144. data/shoulda_macros/macros.rb +3 -1
  145. data/test/bridges/date_picker_test.rb +1 -2
  146. data/test/bridges/paperclip_test.rb +6 -6
  147. data/test/class_with_finder.rb +2 -2
  148. data/test/company.rb +4 -4
  149. data/test/config/create_test.rb +4 -2
  150. data/test/config/nested_test.rb +1 -1
  151. data/test/config/show_test.rb +1 -1
  152. data/test/config/update_test.rb +7 -6
  153. data/test/data_structures/action_columns_test.rb +2 -2
  154. data/test/data_structures/action_links_test.rb +1 -1
  155. data/test/data_structures/column_test.rb +3 -6
  156. data/test/data_structures/columns_test.rb +2 -2
  157. data/test/data_structures/sorting_test.rb +7 -0
  158. data/test/extensions/action_view_rendering_test.rb +20 -0
  159. data/test/extensions/active_record_test.rb +4 -4
  160. data/test/extensions/routing_mapper_test.rb +2 -2
  161. data/test/helpers/list_column_helpers_test.rb +3 -1
  162. data/test/misc/active_record_permissions_test.rb +3 -11
  163. data/test/misc/attribute_params_test.rb +12 -8
  164. data/test/misc/calculation_test.rb +1 -1
  165. data/test/misc/configurable_test.rb +10 -10
  166. data/test/misc/constraints_test.rb +2 -2
  167. data/test/misc/convert_numbers_format_test.rb +7 -3
  168. data/test/misc/lang_test.rb +1 -1
  169. data/test/misc/parse_datetime_test.rb +3 -4
  170. data/test/misc/tableless_test.rb +14 -0
  171. data/test/mock_app/Rakefile +1 -1
  172. data/test/mock_app/app/assets/config/manifest.js +0 -0
  173. data/test/mock_app/app/controllers/cars_controller.rb +1 -0
  174. data/test/mock_app/app/controllers/people_controller.rb +5 -1
  175. data/test/mock_app/app/controllers/roles_controller.rb +4 -0
  176. data/test/mock_app/app/views/active_scaffold_overrides/_form.html.erb +2 -0
  177. data/test/mock_app/app/views/active_scaffold_overrides/list.html.erb +2 -0
  178. data/test/mock_app/app/views/people/_first_name_form_column.html.erb +2 -0
  179. data/test/mock_app/app/views/people/_form.html.erb +2 -0
  180. data/test/mock_app/app/views/people/list.html.erb +2 -0
  181. data/test/mock_app/config/application.rb +2 -1
  182. data/test/mock_app/config/boot.rb +1 -1
  183. data/test/mock_app/config/environment.rb +2 -2
  184. data/test/mock_app/config/routes.rb +4 -1
  185. data/test/mock_app/db/schema.rb +2 -0
  186. data/test/performance/list_cars_performance_test.rb +34 -0
  187. data/test/performance/list_people_performance_test.rb +31 -0
  188. data/test/performance_test_help.rb +3 -0
  189. data/test/test_helper.rb +12 -4
  190. metadata +69 -18
  191. data/app/assets/javascripts/prototype/rico_corner.js +0 -370
  192. data/lib/active_scaffold/bridges/file_column/test/test_helper.rb +0 -7
@@ -17,7 +17,7 @@
17
17
  submit_text ||= form_action
18
18
  apply_text ||= :"#{form_action}_apply"
19
19
  body_partial ||= 'form'
20
- form_id = element_form_id(:action => form_action, :id => @record.try(:id))
20
+ form_id = element_form_id(action: form_action, id: @record&.id)
21
21
  %>
22
22
  <%=
23
23
  options = {:id => form_id,
@@ -54,7 +54,7 @@ end
54
54
  <%= submit_tag as_(submit_text), :class => "submit" if !persistent || persistent == :optional %>
55
55
  <%= submit_tag as_(apply_text), :class => "submit", :name => 'dont_close' if persistent %>
56
56
  <%= link_to(as_(:cancel), main_path_to_return, cancel_options) if cancel_link %>
57
- <%= loading_indicator_tag(:action => form_action, :id => @record.try(:id)) %>
57
+ <%= loading_indicator_tag(action: form_action, id: @record&.id) %>
58
58
  <%= render :partial => footer_extension, :locals => { :form_action => form_action } if footer_extension %>
59
59
  </p>
60
60
 
@@ -4,7 +4,7 @@
4
4
  show_unauthorized_columns = active_scaffold_config.send(form_action).show_unauthorized_columns if active_scaffold_config.actions.include? form_action
5
5
  %>
6
6
  <ol class="form" <%= "id=#{subsection_id}" unless subsection_id.nil? %> <%= "style=\"display: none;\"".html_safe if columns.collapsed %>>
7
- <% columns.each :for => @record, :crud_type => (:read if show_unauthorized_columns) do |column| %>
7
+ <% columns.each_column(for: @record, crud_type: (:read if show_unauthorized_columns)) do |column| %>
8
8
  <% column_css_class = column.css_class unless column.css_class.nil? || column.css_class.is_a?(Proc) %>
9
9
  <% renders_as = column_renders_as(column) %>
10
10
  <% authorized = show_unauthorized_columns || renders_as == :subsection ? @record.authorized_for?(:crud_type => form_action, :column => column.name) : true %>
@@ -13,8 +13,9 @@ footer = render(:partial => 'form_association_footer', :locals => {:parent_recor
13
13
  -%>
14
14
  <h5>
15
15
  <%= column.label -%>
16
- <%= link_to_visibility_toggle(subform_div_id, {:default_visible => !column.collapsed}) -%>
16
+ <%= link_to_visibility_toggle(subform_div_id, default_visible: !column.collapsed) -%>
17
17
  </h5>
18
+ <%= content_tag :span, column.description, class: 'description' if column.description.present? %>
18
19
  <div id ="<%= subform_div_id %>" <%= 'style="display: none;"'.html_safe if column.collapsed -%>>
19
20
  <%# HACK: to be able to delete all associated records %>
20
21
  <%= hidden_field_tag "#{(opts = active_scaffold_input_options(column, scope, :object => parent_record))[:name]}[0]", '', :id => "#{opts[:id]}_0" if column.association.collection? %>
@@ -13,8 +13,9 @@ return unless show_add_new or show_add_existing
13
13
  temporary_id = generated_id(parent_record) if parent_record.new_record?
14
14
  controller_path = active_scaffold_controller_for(parent_record.class).controller_path
15
15
  parent_controller = (main_form_controller || controller).controller_path
16
- edit_associated_url = params_for(:controller => controller_path, :action => 'edit_associated', :child_association => column.name, :associated_id => '--ID--', :scope => scope, :id => parent_record.to_param, :generated_id => temporary_id, :parent_controller => parent_controller) if show_add_existing
17
- add_new_url = params_for(:controller => controller_path, :action => 'edit_associated', :child_association => column.name, :scope => scope, :id => parent_record.to_param, :generated_id => temporary_id, :parent_controller => parent_controller) if show_add_new
16
+ url_options = {:controller => controller_path, :action => 'edit_associated', :child_association => column.name, :scope => scope, :id => parent_record.to_param, :generated_id => temporary_id, :parent_controller => parent_controller}
17
+ edit_associated_url = params_for(url_options.merge(:associated_id => '--ID--')) if show_add_existing
18
+ add_new_url = params_for(url_options) if show_add_new
18
19
 
19
20
  -%>
20
21
  <div class="footer-wrapper">
@@ -6,11 +6,13 @@
6
6
  show_actions = false
7
7
  locked ||= false
8
8
  config = active_scaffold_config_for(record.class)
9
+ columns ||= config.subform.columns
9
10
  scope = column_scope(record_column, scope, record)
10
11
  options = active_scaffold_input_options(config.columns[record.class.primary_key], scope, :object => record)
11
12
  tr_id = "association-#{options[:id]}"
13
+ layout ||= config.subform.layout
12
14
 
13
- if config.subform.layout == :vertical
15
+ if layout == :vertical
14
16
  record_tag ||= :div
15
17
  row_tag ||= :ol
16
18
  column_tag ||= :li
@@ -40,9 +42,9 @@
40
42
  <% end %>
41
43
  <% end %>
42
44
  <%= content_tag row_tag, :id => tr_id, :class => "association-record#{' association-record-new' if record.new_record?}#{' locked' if locked}" do %>
43
- <% config.subform.columns.each :for => record.class, :crud_type => :read, :flatten => flatten do |column| %>
45
+ <% columns.each_column(for: record.class, crud_type: :read, flatten: flatten) do |column| %>
44
46
  <%
45
- if column.respond_to? :each
47
+ if column.respond_to? :each_column
46
48
  columns_groups << column
47
49
  next
48
50
  end
@@ -51,8 +53,8 @@
51
53
  columns_length += 1
52
54
  show_actions = true
53
55
  if column.association && column.form_ui.nil?
54
- column = column.clone
55
- column.form_ui ||= :select
56
+ column = column.dup unless ActiveScaffold.threadsafe
57
+ column.form_ui = :select
56
58
  end
57
59
 
58
60
  col_class = default_col_class.clone
@@ -80,10 +82,10 @@
80
82
  <% end -%>
81
83
  <% end %>
82
84
 
83
- <% columns_groups.each do |column| %>
85
+ <% columns_groups.each do |columns_group| %>
84
86
  <%= content_tag row_tag, :class => 'associated-record' do %>
85
87
  <%= content_tag column_tag, :colspan => (columns_length if column_tag == :td) do %>
86
- <% column.each :for => record.class, :crud_type => :read, :flatten => true do |col| %>
88
+ <% columns_group.each_column(for: record.class, crud_type: :read, flatten: true) do |col| %>
87
89
  <%= active_scaffold_render_subform_column(col, scope, crud_type, readonly, true, record) %>
88
90
  <% end %>
89
91
  <% end %>
@@ -1,11 +1,11 @@
1
- <table id="<%= sub_form_list_id(:association => column.name, :id => parent_record.try(:id) || generated_id(parent_record) || 99999999999) %>">
1
+ <table id="<%= sub_form_list_id(association: column.name, id: parent_record&.id || generated_id(parent_record) || 99999999999) %>">
2
2
  <%
3
3
  header_record_class = (show_blank_record && show_blank_record.class) || column.association.klass
4
4
  -%>
5
- <%= render :partial => 'horizontal_subform_header', :locals => {:parent_record => parent_record, :record_class => header_record_class, :parent_column => column} %>
5
+ <%= render partial: 'horizontal_subform_header', :locals => {parent_record: parent_record, record_class: header_record_class, parent_column: column, columns: local_assigns[:columns]} %>
6
6
 
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 %>
7
+ <%= render partial: 'form_association_record', collection: associated, locals: {scope: scope, parent_record: parent_record, column: column, columns: local_assigns[:columns], layout: :horizontal} %>
8
+ <%= render partial: 'form_association_record', object: show_blank_record, locals: {scope: scope, parent_record: parent_record, column: column, columns: local_assigns[:columns], layout: :horizontal, locked: true, index: associated.size} if show_blank_record %>
9
9
  <tfoot>
10
10
  <%= render :partial => 'horizontal_subform_footer', :locals => {:scope => scope, :parent_record => parent_record, :column => column} %>
11
11
  </tfoot>
@@ -1,7 +1,8 @@
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
+ columns ||= active_scaffold_config_for(record_class).subform.columns
5
+ columns.each_column(for: record_class, crud_type: :read) do |column|
5
6
  next unless column.is_a? ActiveScaffold::DataStructures::Column
6
7
  next unless in_subform?(column, parent_record, parent_column)
7
8
  hidden = column_renders_as(column) == :hidden
@@ -4,7 +4,8 @@
4
4
  <tr>
5
5
  <td class="messages-container">
6
6
  <p class="error-message message server-error" style="display:none;">
7
- <%= as_(:internal_error).html_safe %><span class="error-500"><%= as_(:error_500).html_safe %></span>
7
+ <%= as_(:internal_error).html_safe %>
8
+ <span class="error-500"><%= as_(:error_500).html_safe %></span>
8
9
  <a href="#" class="close" title="<%= as_(:close).html_safe %>"><%= as_(:close).html_safe %></a>
9
10
  </p>
10
11
  <div id="<%= active_scaffold_messages_id -%>" class="action-messages">
@@ -1,8 +1,6 @@
1
- <% action_links = active_scaffold_config.action_links.collection
2
- unless action_links.empty? -%>
3
- <div class="actions">
4
- <%= display_action_links(action_links, nil, :skip_unauthorized => true) %>
5
- <%= loading_indicator_tag(:action => :table) %>
6
- </div>
7
- <% end %>
1
+ <% action_links = active_scaffold_config.action_links.collection -%>
2
+ <div class="actions">
3
+ <%= display_action_links(action_links, nil, :skip_unauthorized => true) unless action_links.empty? %>
4
+ <%= loading_indicator_tag(:action => :table) %>
5
+ </div>
8
6
  <h2><%= active_scaffold_config.list.user.label %></h2>
@@ -5,6 +5,7 @@
5
5
  <% unless active_scaffold_config.list.messages_above_header %>
6
6
  <p class="error-message message server-error" style="display:none;">
7
7
  <%= as_(:internal_error).html_safe %>
8
+ <span class="error-500"><%= as_(:error_500).html_safe %></span>
8
9
  <a href="#" class="close" title="<%= as_(:close).html_safe %>"><%= as_(:close).html_safe %></a>
9
10
  </p>
10
11
  <div id="<%= active_scaffold_messages_id -%>" class="action-messages">
@@ -6,14 +6,13 @@ tr_class = "#{cycle("", "even-record")} #{list_row_class(record)}"
6
6
  action_links ||= active_scaffold_config.action_links.member
7
7
  data_refresh ||= record.to_param
8
8
  -%>
9
- <tr class="record <%= tr_class %>" id="<%= row_id %>" data-refresh="<%= data_refresh %>">
9
+ <%= content_tag :tr, list_row_attributes(tr_class, row_id, data_refresh) do %>
10
10
  <% columns.each do |column| %>
11
11
  <% authorized = record.authorized_for?(:crud_type => :read, :column => column.name) -%>
12
12
  <% column_value = authorized ? get_column_value(record, column) : empty_field_text -%>
13
+ <% attrs = column_attributes(column, record).merge(:class => column_class(column, column_value, record)) %>
13
14
 
14
- <%= content_tag :td, column_attributes(column, record).merge(:class => column_class(column, column_value, record)) do %>
15
- <%= authorized ? render_list_column(column_value, column, record) : column_value %>
16
- <% end %>
15
+ <%= content_tag :td, authorized ? render_list_column(column_value, column, record) : column_value, attrs %>
17
16
  <% end -%>
18
17
 
19
18
  <% unless grouped_search? -%>
@@ -26,4 +25,4 @@ data_refresh ||= record.to_param
26
25
  </tr>
27
26
  </table></td>
28
27
  <% end -%>
29
- </tr>
28
+ <% end %>
@@ -1,4 +1,4 @@
1
- <%= content_tag(:div, id: active_scaffold_id, class: as_main_div_class, data: params[:eid] ? {eid: id_from_controller(params[:eid])} : {}) do %>
1
+ <%= content_tag(:div, id: active_scaffold_id, class: as_main_div_class, data: as_main_div_data) do %>
2
2
  <div class="active-scaffold-header">
3
3
  <%= render :partial => 'list_header' %>
4
4
  </div>
@@ -2,6 +2,7 @@
2
2
  <% if flash[name].present? %>
3
3
  <div class="<%= "#{name}-message message" %>">
4
4
  <%= display_message flash[name] %>
5
+ <% flash.delete name %>
5
6
  <% if request.xhr? %>
6
7
  <a href="#" class="close" title="<%= as_(:close) %>"><%= as_(:close) %></a>
7
8
  <% end %>
@@ -4,7 +4,11 @@
4
4
 
5
5
  <% if @page.pager.infinite? || @page.number < @page.pager.number_of_pages -%>
6
6
  ActiveScaffold.auto_load_page('<%= url_for main_path_to_return %>', {auto_pagination: true, page: <%= @page.number + 1 %>});
7
+ <% else %>
8
+ ActiveScaffold.hide('<%= loading_indicator_id(action: :pagination) %>');
7
9
  <% end # @page.pager.infinite?... %>
10
+ <% else %>
11
+ ActiveScaffold.hide('<%= loading_indicator_id(action: :pagination) %>');
8
12
  <% end # @page.items.present? %>
9
13
 
10
14
  <% elsif active_scaffold_config.list.refresh_with_header -%>
@@ -17,7 +17,8 @@
17
17
  html = if scope
18
18
  readonly = @record.readonly? || !@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), @record)
20
+ # subform.columns.to_a.include? so it doesn't check inside subgroups
21
+ active_scaffold_render_subform_column(column, scope, crud_type, readonly, !active_scaffold_config.subform.columns.to_a.include?(column.name), @record)
21
22
  else
22
23
  render_column(column, @record, renders_as, scope)
23
24
  end
@@ -1,10 +1,11 @@
1
1
  <%
2
2
  columns_hash = {}
3
+ heading_columns = show_columns_for(associated.first, column, columns_hash)
3
4
  %>
4
5
  <table>
5
6
  <thead>
6
7
  <tr>
7
- <% show_columns_for(associated.first, column, columns_hash).each(:skip_groups => true) do |column| -%>
8
+ <% heading_columns.each_column(skip_groups: true) do |column| -%>
8
9
  <th><%= show_label(column) %></th>
9
10
  <% end -%>
10
11
  </tr>
@@ -1,7 +1,7 @@
1
1
  <dl>
2
- <% columns.each :for => record do |column| %>
2
+ <% columns.each_column(for: record) do |column| %>
3
3
  <dt><%= show_label(column) -%></dt>
4
- <% if column.respond_to? :each -%>
4
+ <% if column.respond_to? :each_column -%>
5
5
  <dd>
6
6
  <%= render :partial => 'show_columns', :locals => {:columns => column, :record => record} %>
7
7
  <% else -%>
@@ -3,9 +3,9 @@
3
3
  columns_groups = []
4
4
  %>
5
5
  <tr>
6
- <% columns.each :for => record do |column| -%>
6
+ <% columns.each_column(for: record) do |column| -%>
7
7
  <%
8
- if column.respond_to? :each
8
+ if column.respond_to? :each_column
9
9
  columns_groups << column
10
10
  next
11
11
  end
@@ -14,10 +14,10 @@
14
14
  <%= content_tag :td, content_tag(:span, show_column_value(record, column)), :class => "#{column.name}-column #{:numeric if column.number?}" %>
15
15
  <% end -%>
16
16
  </tr>
17
- <% columns_groups.each do |columns| %>
17
+ <% columns_groups.each do |columns_group| %>
18
18
  <tr>
19
19
  <td colspan="<%= columns_length %>">
20
- <% columns.each do |column| %>
20
+ <% columns_group.each_column do |column| %>
21
21
  <%= show_column_value(record, column) %>
22
22
  <% end %>
23
23
  </td>
@@ -1,5 +1,5 @@
1
1
  <% calculations_id ||= active_scaffold_calculations_id -%>
2
- <% if active_scaffold_config.actions.include?(:list) && active_scaffold_config.list.columns.any? {|c| c.calculation?} %>
2
+ <% if active_scaffold_config.actions.include?(:list) && list_columns.any? {|c| c.calculation?} %>
3
3
  <% params.delete(:id) %>
4
4
  ActiveScaffold.replace('<%= calculations_id %>', '<%= escape_javascript(render(:partial => 'list_calculations')) %>');
5
5
  <% end %>
@@ -11,6 +11,6 @@
11
11
  <% if @record.authorized_for?(:crud_type => :read, :column => column.name) -%>
12
12
  ActiveScaffold.replace_html('<%= row_id %> .<%= column.name %>-column','<%= escape_javascript(render_list_column(get_column_value(@record, column), column, @record)) %>');
13
13
  <% end -%>
14
- <% if column.update_columns && !column.update_columns.empty? %>
15
- <%= render(:partial => 'update_column', :collection => column.update_columns & active_scaffold_config.list.columns.names, :locals => {:row_id => row_id})%>
14
+ <% if column.update_columns&.present? %>
15
+ <%= render(:partial => 'update_column', :collection => column.update_columns & active_scaffold_config.list.columns.visible_columns_names, :locals => {:row_id => row_id})%>
16
16
  <% end %>
@@ -1,4 +1,4 @@
1
1
  <div id="<%= sub_form_list_id(:association => column.name, :id => parent_record.id || generated_id(parent_record) || 99999999999) %>">
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 %>
2
+ <%= render partial: 'form_association_record', collection: associated, locals: {scope: scope, parent_record: parent_record, column: column, columns: local_assigns[:columns], layout: :vertical} %>
3
+ <%= render partial: 'form_association_record', object: show_blank_record, locals: {scope: scope, parent_record: parent_record, column: column, columns: local_assigns[:columns], layout: :vertical, locked: true, index: associated.size} if show_blank_record %>
4
4
  </div>
@@ -1,7 +1,7 @@
1
1
  <div class="active-scaffold">
2
2
  <div class="delete-view view">
3
3
  <%= form_tag params_for(:action => link.action, :id => params[:id]), { :method => link.method } %>
4
- <h4><%= link.confirm(h(record.try(:to_label))) -%></h4>
4
+ <h4><%= link.confirm(h(record&.to_label)) -%></h4>
5
5
 
6
6
  <p class="form-footer">
7
7
  <%= submit_tag as_(link.label), :class => 'submit' %>
@@ -10,4 +10,4 @@
10
10
 
11
11
  </form>
12
12
  </div>
13
- </div>
13
+ </div>
@@ -1,7 +1,7 @@
1
1
  <div class="active-scaffold">
2
2
  <div class="delete-view view">
3
3
  <%= form_tag params_for(:action => :destroy, :id => params[:id]), { :method => :delete } %>
4
- <h4><%= as_(:are_you_sure_to_delete, :label => h(@record.try(:to_label))) -%></h4>
4
+ <h4><%= as_(:are_you_sure_to_delete, :label => h(@record&.to_label)) -%></h4>
5
5
 
6
6
  <p class="form-footer">
7
7
  <%= submit_tag as_(:delete), :class => 'submit' %>
@@ -10,4 +10,4 @@
10
10
 
11
11
  </form>
12
12
  </div>
13
- </div>
13
+ </div>
@@ -1,9 +1,12 @@
1
+ var link;
2
+ <% if @action_link&.position %>
3
+ link = ActiveScaffold.find_action_link('<%= element_form_id(:action => action_name) %>');
4
+ <% end %>
1
5
  <% if successful? %>
2
6
  <% if @record %>
3
7
  <%= render :partial => 'update_messages' %>
4
8
  <% row = escape_javascript(render(:partial => 'list_record', :locals => {:record => @record})) -%>
5
- <% if @action_link.try(:position) %>
6
- var link = ActiveScaffold.find_action_link('<%= element_form_id(:action => action_name) %>');
9
+ <% if @action_link&.position %>
7
10
  if (link) link.close('<%= row %>');
8
11
  <% else %>
9
12
  ActiveScaffold.update_row('<%= element_row_id(:action => :list, :id => @record.id) %>', '<%= row %>');
@@ -11,14 +14,21 @@ if (link) link.close('<%= row %>');
11
14
  <% end %>
12
15
  <%= render :partial => 'update_calculations', :formats => [:js] %>
13
16
  <% else %>
14
- <% if @action_link.try(:position) %>
15
- var link = ActiveScaffold.find_action_link('<%= element_form_id(:action => action_name) %>');
17
+ <% if @action_link&.position %>
16
18
  if (link) link.close();
17
19
  <% end %>
18
20
  <%= render 'refresh_list', no_history: true %>
19
21
  <% end %>
20
22
  <% else %>
21
- <% flash[:error] = active_scaffold_error_messages_for(@record, :object_name => "#{@record.class.model_name.human.downcase}#{@record.new_record? ? '' : ": #{@record.to_label}"}", :header_message => '', :message => "#{@record.class.model_name.human.downcase}#{@record.new_record? ? '' : ": #{@record.to_label}"}", :container_tag => nil, :list_type => :br) if @record.try(:errors).present? %>
22
- ActiveScaffold.replace_html('<%= active_scaffold_messages_id %>','<%= escape_javascript(render(:partial => 'messages')) %>');
23
+ <% flash[:error] = active_scaffold_error_messages_for(@record, :object_name => "#{@record.class.model_name.human.downcase}#{@record.new_record? ? '' : ": #{@record.to_label}"}", :header_message => '', :message => "#{@record.class.model_name.human.downcase}#{@record.new_record? ? '' : ": #{@record.to_label}"}", :container_tag => nil, :list_type => :br) if @record&.errors.present? %>
24
+ <% messages = escape_javascript(render(:partial => 'messages')) %>
25
+ <% if @action_link&.position %>
26
+ if (link) {
27
+ link.update_flash_messages('<%= messages %>');
28
+ ActiveScaffold.enable_form(link.adapter.find('form'));
29
+ }
30
+ <% else %>
31
+ ActiveScaffold.replace_html('<%= active_scaffold_messages_id %>', '<%= messages %>');
23
32
  ActiveScaffold.scroll_to('<%= active_scaffold_messages_id %>', true);
33
+ <% end %>
24
34
  <% end %>
@@ -1,5 +1,5 @@
1
1
  try {
2
- <% form_selector ||= "#{element_form_id(:action => :update, :id => @record.try(:id) || params[:id])}" %>
2
+ <% form_selector ||= "#{element_form_id(:action => :update, :id => @record&.id || params[:id])}" %>
3
3
  var action_link = ActiveScaffold.find_action_link('<%= form_selector %>');
4
4
  if (action_link) action_link.update_flash_messages('<%= escape_javascript(render(:partial => 'messages')) %>');
5
5
  <% if successful? %>
@@ -1,2 +1,2 @@
1
- ActiveScaffold.update_row('<%= element_row_id(:action => :list, :id => @record.try(:id)) %>', '<%= escape_javascript render('list_record', :record => @record) %>');
1
+ ActiveScaffold.update_row('<%= element_row_id(action: :list, id: @record&.id) %>', '<%= escape_javascript render('list_record', record: @record) %>');
2
2
  <%= render :partial => 'update_calculations', :formats => [:js] %>
@@ -15,12 +15,12 @@
15
15
  ActiveScaffold.update_inplace_edit('<%= @column_span_id %>','<%= escape_javascript(formatted_value) %>', <%= column_empty?(formatted_value).to_json %>);
16
16
  <% if ipe_update == :columns && @column.update_columns && !@column.update_columns.empty?
17
17
  @rendered = Set.new([@column.name]) -%>
18
- <%= render :partial => 'update_column', :collection => @column.update_columns & active_scaffold_config.list.columns.names, :locals => {:row_id => element_row_id(:action => :list, :id => @record.id)} %>
18
+ <%= render :partial => 'update_column', :collection => @column.update_columns & active_scaffold_config.list.columns.visible_columns_names, :locals => {:row_id => element_row_id(:action => :list, :id => @record.id)} %>
19
19
  <% end %>
20
20
  <% end -%>
21
21
  <% else -%>
22
22
  ActiveScaffold.replace_html('<%= @column_span_id %>','<%= escape_javascript(get_column_value(@record, @column)) %>');
23
23
  <% end -%>
24
24
  <% if @column.calculation? -%>
25
- ActiveScaffold.replace_html('<%= active_scaffold_calculations_id(:column => @column) %>', '<%= escape_javascript(render_column_calculation(@column)) %>');
25
+ ActiveScaffold.replace_html('<%= active_scaffold_calculations_id(:column => @column) %>', '<%= escape_javascript(render_column_calculation(@column, id_condition: false)) %>');
26
26
  <% end -%>
@@ -107,7 +107,8 @@ de:
107
107
  other: "%{count} %{model} makriert"
108
108
  refresh: Neu laden
109
109
  remove: Entfernen
110
- remove_file: Entferne oder Ersetze Datei
110
+ remove_file: Entferne oder Ersetzte Datei
111
+ remove_files: Entfernen oder Hinzufügen Dateien
111
112
  replace_existing: Existierenden ersetzen
112
113
  replace_with_new: Mit Neuer ersetzen
113
114
  reset: Zurücksetzen
@@ -108,6 +108,7 @@ en:
108
108
  refresh: Refresh
109
109
  remove: Remove
110
110
  remove_file: Remove or Replace file
111
+ remove_files: Remove or Add files
111
112
  replace_existing: Replace Existing
112
113
  replace_with_new: Replace With New
113
114
  reset: Reset
@@ -110,6 +110,7 @@ es:
110
110
  refresh: Recargar
111
111
  remove: Eliminar
112
112
  remove_file: Eliminar o Reemplazar archivo
113
+ remove_files: Eliminar o Añadir archivos
113
114
  replace_existing: Reemplazar existente
114
115
  replace_with_new: Reemplazar con Nuevo
115
116
  reset: Restaurar
@@ -107,7 +107,8 @@ fr:
107
107
  other: "%{count} %{model} marqués"
108
108
  refresh: Rafraîchir
109
109
  remove: Supprimer
110
- remove_file: Supprimer et remplacer le fichier
110
+ remove_file: Supprimer ou remplacer le fichier
111
+ remove_files: Supprimer ou Ajouter des fichiers
111
112
  replace_existing: Remplacer existant(e)
112
113
  replace_with_new: Remplacer avec le nouveau
113
114
  reset: Annuler