active_scaffold 3.5.2 → 3.6.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{CHANGELOG → CHANGELOG.rdoc} +66 -0
- data/README.md +17 -7
- data/app/assets/javascripts/active_scaffold.js.erb +0 -1
- data/app/assets/javascripts/jquery/active_scaffold.js +63 -6
- data/app/assets/stylesheets/active_scaffold_colors.scss +1 -1
- data/app/assets/stylesheets/active_scaffold_layout.css +52 -29
- data/app/views/active_scaffold_overrides/_base_form.html.erb +2 -2
- data/app/views/active_scaffold_overrides/_form.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_form_association_footer.html.erb +3 -2
- data/app/views/active_scaffold_overrides/_form_association_record.html.erb +6 -6
- data/app/views/active_scaffold_overrides/_horizontal_subform.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_horizontal_subform_header.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_list.html.erb +2 -1
- data/app/views/active_scaffold_overrides/_list_header.html.erb +5 -7
- data/app/views/active_scaffold_overrides/_list_messages.html.erb +1 -0
- data/app/views/active_scaffold_overrides/_list_record.html.erb +4 -5
- data/app/views/active_scaffold_overrides/_list_with_header.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_messages.html.erb +1 -0
- data/app/views/active_scaffold_overrides/_refresh_list.js.erb +4 -0
- data/app/views/active_scaffold_overrides/_render_field.js.erb +2 -1
- data/app/views/active_scaffold_overrides/_show_association_horizontal.html.erb +2 -1
- data/app/views/active_scaffold_overrides/_show_columns.html.erb +2 -2
- data/app/views/active_scaffold_overrides/_show_horizontal_record.html.erb +4 -4
- data/app/views/active_scaffold_overrides/_update_calculations.js.erb +1 -1
- data/app/views/active_scaffold_overrides/_update_column.js.erb +2 -2
- data/app/views/active_scaffold_overrides/action_confirmation.html.erb +2 -2
- data/app/views/active_scaffold_overrides/delete.html.erb +2 -2
- data/app/views/active_scaffold_overrides/on_action_update.js.erb +16 -6
- data/app/views/active_scaffold_overrides/on_update.js.erb +1 -1
- data/app/views/active_scaffold_overrides/row.js.erb +1 -1
- data/app/views/active_scaffold_overrides/update_column.js.erb +1 -1
- data/config/locales/de.yml +2 -1
- data/config/locales/en.yml +1 -0
- data/config/locales/es.yml +1 -0
- data/config/locales/fr.yml +2 -1
- data/config/locales/hu.yml +1 -0
- data/config/locales/ja.yml +1 -0
- data/config/locales/ru.yml +1 -0
- data/lib/active_scaffold.rb +19 -16
- data/lib/active_scaffold/actions/common_search.rb +11 -8
- data/lib/active_scaffold/actions/core.rb +89 -71
- data/lib/active_scaffold/actions/create.rb +28 -28
- data/lib/active_scaffold/actions/delete.rb +3 -3
- data/lib/active_scaffold/actions/field_search.rb +53 -43
- data/lib/active_scaffold/actions/list.rb +111 -27
- data/lib/active_scaffold/actions/nested.rb +65 -48
- data/lib/active_scaffold/actions/search.rb +1 -1
- data/lib/active_scaffold/actions/show.rb +4 -4
- data/lib/active_scaffold/actions/subform.rb +12 -17
- data/lib/active_scaffold/actions/update.rb +96 -77
- data/lib/active_scaffold/active_record_permissions.rb +2 -11
- data/lib/active_scaffold/attribute_params.rb +104 -86
- data/lib/active_scaffold/bridges.rb +8 -8
- data/lib/active_scaffold/bridges/active_storage.rb +6 -0
- data/lib/active_scaffold/bridges/active_storage/active_storage_bridge.rb +33 -0
- data/lib/active_scaffold/bridges/active_storage/active_storage_helpers.rb +54 -0
- data/lib/active_scaffold/bridges/active_storage/form_ui.rb +22 -0
- data/lib/active_scaffold/bridges/active_storage/list_ui.rb +36 -0
- data/lib/active_scaffold/bridges/bitfields.rb +1 -0
- data/lib/active_scaffold/bridges/bitfields/bitfields_bridge.rb +12 -15
- data/lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb +1 -1
- data/lib/active_scaffold/bridges/cancan/cancan_bridge.rb +9 -12
- data/lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb +1 -1
- data/lib/active_scaffold/bridges/carrierwave/list_ui.rb +2 -2
- data/lib/active_scaffold/bridges/chosen/helpers.rb +11 -9
- data/lib/active_scaffold/bridges/date_picker/ext.rb +0 -13
- data/lib/active_scaffold/bridges/date_picker/helper.rb +49 -44
- data/lib/active_scaffold/bridges/dragonfly/list_ui.rb +1 -1
- data/lib/active_scaffold/bridges/file_column/as_file_column_bridge.rb +1 -1
- data/lib/active_scaffold/bridges/file_column/file_column_helpers.rb +3 -3
- data/lib/active_scaffold/bridges/file_column/form_ui.rb +3 -3
- data/lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb +10 -7
- data/lib/active_scaffold/bridges/paper_trail.rb +1 -1
- data/lib/active_scaffold/bridges/paperclip/list_ui.rb +1 -1
- data/lib/active_scaffold/bridges/paperclip/paperclip_bridge.rb +1 -1
- data/lib/active_scaffold/bridges/paperclip/paperclip_bridge_helpers.rb +2 -2
- data/lib/active_scaffold/bridges/record_select/helpers.rb +12 -16
- data/lib/active_scaffold/bridges/shared/date_bridge.rb +20 -19
- data/lib/active_scaffold/bridges/tiny_mce/helpers.rb +3 -1
- data/lib/active_scaffold/bridges/usa_state_select/usa_state_select_helper.rb +21 -4
- data/lib/active_scaffold/config/base.rb +133 -41
- data/lib/active_scaffold/config/core.rb +146 -18
- data/lib/active_scaffold/config/delete.rb +14 -1
- data/lib/active_scaffold/config/field_search.rb +7 -1
- data/lib/active_scaffold/config/form.rb +10 -1
- data/lib/active_scaffold/config/list.rb +39 -13
- data/lib/active_scaffold/config/mark.rb +4 -2
- data/lib/active_scaffold/config/nested.rb +16 -17
- data/lib/active_scaffold/config/search.rb +9 -0
- data/lib/active_scaffold/config/show.rb +4 -0
- data/lib/active_scaffold/config/update.rb +4 -0
- data/lib/active_scaffold/configurable.rb +14 -7
- data/lib/active_scaffold/constraints.rb +22 -20
- data/lib/active_scaffold/core.rb +68 -29
- data/lib/active_scaffold/data_structures/action_columns.rb +50 -59
- data/lib/active_scaffold/data_structures/action_link.rb +50 -20
- data/lib/active_scaffold/data_structures/action_links.rb +15 -13
- data/lib/active_scaffold/data_structures/association/abstract.rb +41 -15
- data/lib/active_scaffold/data_structures/association/active_mongoid.rb +2 -6
- data/lib/active_scaffold/data_structures/association/active_record.rb +6 -2
- data/lib/active_scaffold/data_structures/association/mongoid.rb +0 -3
- data/lib/active_scaffold/data_structures/column.rb +75 -66
- data/lib/active_scaffold/data_structures/columns.rb +3 -2
- data/lib/active_scaffold/data_structures/nested_info.rb +21 -19
- data/lib/active_scaffold/data_structures/set.rb +8 -0
- data/lib/active_scaffold/data_structures/sorting.rb +10 -2
- data/lib/active_scaffold/delayed_setup.rb +16 -5
- data/lib/active_scaffold/extensions/action_controller_rendering.rb +3 -2
- data/lib/active_scaffold/extensions/action_view_rendering.rb +34 -14
- data/lib/active_scaffold/extensions/cow_proxy.rb +91 -0
- data/lib/active_scaffold/extensions/ice_nine.rb +36 -0
- data/lib/active_scaffold/extensions/left_outer_joins.rb +8 -33
- data/lib/active_scaffold/extensions/localize.rb +3 -1
- data/lib/active_scaffold/extensions/routing_mapper.rb +6 -45
- data/lib/active_scaffold/extensions/to_label.rb +3 -2
- data/lib/active_scaffold/extensions/unsaved_record.rb +2 -4
- data/lib/active_scaffold/finder.rb +104 -73
- data/lib/active_scaffold/helpers/action_link_helpers.rb +62 -36
- data/lib/active_scaffold/helpers/association_helpers.rb +21 -19
- data/lib/active_scaffold/helpers/controller_helpers.rb +23 -10
- data/lib/active_scaffold/helpers/form_column_helpers.rb +157 -121
- data/lib/active_scaffold/helpers/human_condition_helpers.rb +1 -1
- data/lib/active_scaffold/helpers/id_helpers.rb +6 -2
- data/lib/active_scaffold/helpers/list_column_helpers.rb +82 -53
- data/lib/active_scaffold/helpers/pagination_helpers.rb +2 -2
- data/lib/active_scaffold/helpers/search_column_helpers.rb +29 -34
- data/lib/active_scaffold/helpers/show_column_helpers.rb +3 -5
- data/lib/active_scaffold/helpers/view_helpers.rb +38 -35
- data/lib/active_scaffold/marked_model.rb +2 -2
- data/lib/active_scaffold/orm_checks.rb +3 -7
- data/lib/active_scaffold/paginator.rb +7 -7
- data/lib/active_scaffold/registry.rb +33 -0
- data/lib/active_scaffold/responds_to_parent.rb +8 -11
- data/lib/active_scaffold/tableless.rb +67 -65
- data/lib/active_scaffold/version.rb +2 -2
- data/lib/generators/active_scaffold/controller_generator.rb +2 -2
- data/lib/generators/active_scaffold/install_generator.rb +1 -1
- data/lib/generators/active_scaffold/resource_generator.rb +2 -2
- data/shoulda_macros/macros.rb +3 -1
- data/test/bridges/date_picker_test.rb +1 -2
- data/test/bridges/paperclip_test.rb +6 -6
- data/test/class_with_finder.rb +2 -2
- data/test/company.rb +4 -4
- data/test/config/create_test.rb +4 -2
- data/test/config/nested_test.rb +1 -1
- data/test/config/show_test.rb +1 -1
- data/test/config/update_test.rb +7 -6
- data/test/data_structures/action_columns_test.rb +2 -2
- data/test/data_structures/action_links_test.rb +1 -1
- data/test/data_structures/column_test.rb +3 -6
- data/test/data_structures/columns_test.rb +2 -2
- data/test/data_structures/sorting_test.rb +7 -0
- data/test/extensions/active_record_test.rb +4 -4
- data/test/extensions/routing_mapper_test.rb +2 -2
- data/test/helpers/list_column_helpers_test.rb +3 -1
- data/test/misc/active_record_permissions_test.rb +3 -11
- data/test/misc/attribute_params_test.rb +12 -8
- data/test/misc/calculation_test.rb +1 -1
- data/test/misc/configurable_test.rb +10 -10
- data/test/misc/constraints_test.rb +2 -2
- data/test/misc/convert_numbers_format_test.rb +7 -3
- data/test/misc/lang_test.rb +1 -1
- data/test/misc/parse_datetime_test.rb +3 -4
- data/test/misc/tableless_test.rb +6 -0
- data/test/mock_app/Rakefile +1 -1
- data/test/mock_app/app/assets/config/manifest.js +0 -0
- data/test/mock_app/app/controllers/cars_controller.rb +1 -0
- data/test/mock_app/app/controllers/people_controller.rb +3 -1
- data/test/mock_app/config/application.rb +2 -1
- data/test/mock_app/config/boot.rb +1 -1
- data/test/mock_app/config/environment.rb +2 -2
- data/test/mock_app/config/routes.rb +4 -1
- data/test/mock_app/db/schema.rb +2 -0
- data/test/performance/list_cars_performance_test.rb +34 -0
- data/test/performance/list_people_performance_test.rb +31 -0
- data/test/performance_test_help.rb +3 -0
- data/test/test_helper.rb +10 -2
- metadata +56 -15
- data/app/assets/javascripts/prototype/rico_corner.js +0 -370
- 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(:
|
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(:
|
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.
|
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 @@ 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
|
-
|
17
|
-
|
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">
|
@@ -40,9 +40,9 @@
|
|
40
40
|
<% end %>
|
41
41
|
<% end %>
|
42
42
|
<%= 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.
|
43
|
+
<% config.subform.columns.each_column(for: record.class, crud_type: :read, flatten: flatten) do |column| %>
|
44
44
|
<%
|
45
|
-
if column.respond_to? :
|
45
|
+
if column.respond_to? :each_column
|
46
46
|
columns_groups << column
|
47
47
|
next
|
48
48
|
end
|
@@ -51,8 +51,8 @@
|
|
51
51
|
columns_length += 1
|
52
52
|
show_actions = true
|
53
53
|
if column.association && column.form_ui.nil?
|
54
|
-
column = column.
|
55
|
-
column.form_ui
|
54
|
+
column = column.dup unless ActiveScaffold.threadsafe
|
55
|
+
column.form_ui = :select
|
56
56
|
end
|
57
57
|
|
58
58
|
col_class = default_col_class.clone
|
@@ -80,10 +80,10 @@
|
|
80
80
|
<% end -%>
|
81
81
|
<% end %>
|
82
82
|
|
83
|
-
<% columns_groups.each do |
|
83
|
+
<% columns_groups.each do |columns_group| %>
|
84
84
|
<%= content_tag row_tag, :class => 'associated-record' do %>
|
85
85
|
<%= content_tag column_tag, :colspan => (columns_length if column_tag == :td) do %>
|
86
|
-
<%
|
86
|
+
<% columns_group.each_column(for: record.class, crud_type: :read, flatten: true) do |col| %>
|
87
87
|
<%= active_scaffold_render_subform_column(col, scope, crud_type, readonly, true, record) %>
|
88
88
|
<% end %>
|
89
89
|
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<table id="<%= sub_form_list_id(:
|
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
|
-%>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<thead>
|
2
2
|
<tr>
|
3
3
|
<%
|
4
|
-
active_scaffold_config_for(record_class).subform.columns.
|
4
|
+
active_scaffold_config_for(record_class).subform.columns.each_column(for: record_class, crud_type: :read) do |column|
|
5
5
|
next unless column.is_a? ActiveScaffold::DataStructures::Column
|
6
6
|
next unless in_subform?(column, parent_record, parent_column)
|
7
7
|
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
|
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
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
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
|
-
|
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,
|
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
|
-
|
28
|
+
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= content_tag(:div, id: active_scaffold_id, class: as_main_div_class, data:
|
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>
|
@@ -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
|
-
|
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
|
-
<%
|
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.
|
2
|
+
<% columns.each_column(for: record) do |column| %>
|
3
3
|
<dt><%= show_label(column) -%></dt>
|
4
|
-
<% if column.respond_to? :
|
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.
|
6
|
+
<% columns.each_column(for: record) do |column| -%>
|
7
7
|
<%
|
8
|
-
if column.respond_to? :
|
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 |
|
17
|
+
<% columns_groups.each do |columns_group| %>
|
18
18
|
<tr>
|
19
19
|
<td colspan="<%= columns_length %>">
|
20
|
-
<%
|
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) &&
|
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
|
15
|
-
<%= render(:partial => 'update_column', :collection => column.update_columns & active_scaffold_config.list.columns.
|
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,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
|
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
|
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
|
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
|
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
|
22
|
-
|
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
|
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(:
|
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,7 +15,7 @@
|
|
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.
|
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 -%>
|
data/config/locales/de.yml
CHANGED
@@ -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
|
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
|
data/config/locales/en.yml
CHANGED
data/config/locales/es.yml
CHANGED
data/config/locales/fr.yml
CHANGED
@@ -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
|
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
|
data/config/locales/hu.yml
CHANGED
data/config/locales/ja.yml
CHANGED
data/config/locales/ru.yml
CHANGED
data/lib/active_scaffold.rb
CHANGED
@@ -9,6 +9,7 @@ module ActiveScaffold
|
|
9
9
|
autoload :Finder, 'active_scaffold/finder'
|
10
10
|
autoload :MarkedModel, 'active_scaffold/marked_model'
|
11
11
|
autoload :OrmChecks, 'active_scaffold/orm_checks'
|
12
|
+
autoload :Registry, 'active_scaffold/registry'
|
12
13
|
autoload :RespondsToParent, 'active_scaffold/responds_to_parent'
|
13
14
|
autoload :Tableless, 'active_scaffold/tableless'
|
14
15
|
autoload :Version, 'active_scaffold/version'
|
@@ -40,20 +41,22 @@ module ActiveScaffold
|
|
40
41
|
|
41
42
|
class ControllerNotFound < RuntimeError; end
|
42
43
|
class MalformedConstraint < RuntimeError; end
|
43
|
-
class RecordNotAllowed <
|
44
|
-
class ActionNotAllowed <
|
44
|
+
class RecordNotAllowed < RuntimeError; end
|
45
|
+
class ActionNotAllowed < RuntimeError; end
|
45
46
|
class ReverseAssociationRequired < RuntimeError; end
|
46
47
|
|
47
|
-
mattr_accessor :delayed_setup
|
48
|
-
mattr_accessor :stylesheets
|
48
|
+
mattr_accessor :delayed_setup, instance_writer: false
|
49
|
+
mattr_accessor :stylesheets, instance_writer: false
|
49
50
|
self.stylesheets = []
|
50
|
-
mattr_accessor :javascripts
|
51
|
+
mattr_accessor :javascripts, instance_writer: false
|
51
52
|
self.javascripts = []
|
52
53
|
|
53
|
-
|
54
|
-
|
54
|
+
mattr_reader :threadsafe
|
55
|
+
def self.threadsafe!
|
56
|
+
@@threadsafe = true
|
55
57
|
end
|
56
58
|
|
59
|
+
mattr_writer :js_framework, instance_writer: false
|
57
60
|
def self.js_framework
|
58
61
|
@@js_framework ||=
|
59
62
|
if defined? Jquery
|
@@ -63,10 +66,7 @@ module ActiveScaffold
|
|
63
66
|
end
|
64
67
|
end
|
65
68
|
|
66
|
-
|
67
|
-
@@js_config = config
|
68
|
-
end
|
69
|
-
|
69
|
+
mattr_writer :js_config, instance_writer: false
|
70
70
|
def self.js_config
|
71
71
|
@@js_config ||= {:scroll_on_close => :checkInViewport}
|
72
72
|
end
|
@@ -75,10 +75,7 @@ module ActiveScaffold
|
|
75
75
|
# name of bridge subdir should be used to exclude it
|
76
76
|
# eg
|
77
77
|
# ActiveScaffold.exclude_bridges = [:cancan, :ancestry]
|
78
|
-
|
79
|
-
@@exclude_bridges = bridges
|
80
|
-
end
|
81
|
-
|
78
|
+
mattr_writer :exclude_bridges, instance_writer: false
|
82
79
|
def self.exclude_bridges
|
83
80
|
@@exclude_bridges ||= []
|
84
81
|
end
|
@@ -87,12 +84,18 @@ module ActiveScaffold
|
|
87
84
|
File.dirname(__FILE__) + '/..'
|
88
85
|
end
|
89
86
|
|
90
|
-
def self.set_defaults(&block)
|
87
|
+
def self.set_defaults(&block) # rubocop:disable Naming/AccessorMethodName
|
88
|
+
ActiveSupport::Deprecation.warn 'use ActiveScaffold.defaults'
|
89
|
+
defaults(&block)
|
90
|
+
end
|
91
|
+
|
92
|
+
def self.defaults(&block)
|
91
93
|
ActiveScaffold::Config::Core.configure(&block)
|
92
94
|
end
|
93
95
|
end
|
94
96
|
require 'active_scaffold/engine'
|
95
97
|
require 'ice_nine'
|
96
98
|
require 'ice_nine/core_ext/object'
|
99
|
+
require 'request_store'
|
97
100
|
# TODO: clean up extensions. some could be organized for autoloading, and others could be removed entirely.
|
98
101
|
Dir["#{File.dirname __FILE__}/active_scaffold/extensions/*.rb"].each { |file| require file }
|