active_scaffold 3.4.43 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +39 -0
- data/{LICENSE → LICENSE.md} +1 -1
- data/README.md +27 -19
- data/app/assets/javascripts/active_scaffold.js.erb +1 -1
- data/app/assets/javascripts/jquery/active_scaffold.js +95 -43
- data/app/assets/javascripts/jquery/tiny_mce_bridge.js +30 -6
- data/app/assets/javascripts/prototype/tiny_mce_bridge.js +11 -1
- data/app/assets/stylesheets/active_scaffold_colors.scss +2 -2
- data/app/assets/stylesheets/active_scaffold_layout.css +36 -28
- data/app/views/active_scaffold_overrides/_base_form.html.erb +2 -3
- data/app/views/active_scaffold_overrides/_field_search.html.erb +8 -7
- data/app/views/active_scaffold_overrides/_form_association.html.erb +9 -9
- data/app/views/active_scaffold_overrides/_form_association_footer.html.erb +6 -6
- data/app/views/active_scaffold_overrides/_form_association_record.html.erb +52 -50
- 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/_human_conditions.html.erb +3 -1
- data/app/views/active_scaffold_overrides/_list_calculations.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_list_column_headings.html.erb +2 -0
- data/app/views/active_scaffold_overrides/_list_messages.html.erb +5 -3
- data/app/views/active_scaffold_overrides/_list_record.html.erb +3 -1
- data/app/views/active_scaffold_overrides/_list_with_header.html.erb +9 -9
- data/app/views/active_scaffold_overrides/_messages.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_refresh_list.js.erb +18 -10
- data/app/views/active_scaffold_overrides/_render_field.js.erb +3 -3
- data/app/views/active_scaffold_overrides/_search.html.erb +7 -6
- data/app/views/active_scaffold_overrides/_show_actions.html.erb +14 -0
- data/app/views/active_scaffold_overrides/_show_association.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_update_actions.html.erb +6 -2
- data/app/views/active_scaffold_overrides/_update_column.js.erb +1 -1
- data/app/views/active_scaffold_overrides/_update_form.html.erb +1 -1
- data/app/views/active_scaffold_overrides/destroy.js.erb +2 -3
- data/app/views/active_scaffold_overrides/edit_associated.js.erb +4 -3
- data/app/views/active_scaffold_overrides/on_action_update.js.erb +5 -3
- data/app/views/active_scaffold_overrides/on_create.js.erb +4 -4
- data/app/views/active_scaffold_overrides/on_update.js.erb +6 -6
- data/app/views/active_scaffold_overrides/show.html.erb +6 -0
- data/app/views/active_scaffold_overrides/update.html.erb +1 -1
- data/app/views/active_scaffold_overrides/update_column.js.erb +1 -1
- data/config/brakeman.ignore +26 -0
- data/config/brakeman.yml +3 -0
- data/config/i18n-tasks.yml +121 -0
- data/config/locales/de.yml +81 -70
- data/config/locales/en.yml +83 -74
- data/config/locales/es.yml +82 -73
- data/config/locales/fr.yml +86 -75
- data/config/locales/hu.yml +81 -70
- data/config/locales/ja.yml +71 -60
- data/config/locales/ru.yml +85 -74
- data/lib/active_scaffold.rb +3 -0
- data/lib/active_scaffold/actions/common_search.rb +11 -7
- data/lib/active_scaffold/actions/core.rb +119 -47
- data/lib/active_scaffold/actions/create.rb +1 -1
- data/lib/active_scaffold/actions/delete.rb +11 -8
- data/lib/active_scaffold/actions/field_search.rb +104 -6
- data/lib/active_scaffold/actions/list.rb +25 -21
- data/lib/active_scaffold/actions/mark.rb +12 -4
- data/lib/active_scaffold/actions/nested.rb +26 -26
- data/lib/active_scaffold/actions/search.rb +2 -2
- data/lib/active_scaffold/actions/show.rb +4 -5
- data/lib/active_scaffold/actions/subform.rb +9 -7
- data/lib/active_scaffold/actions/update.rb +20 -13
- data/lib/active_scaffold/active_record_permissions.rb +24 -5
- data/lib/active_scaffold/attribute_params.rb +68 -49
- data/lib/active_scaffold/bridges.rb +1 -1
- data/lib/active_scaffold/bridges/ancestry/ancestry_bridge.rb +15 -19
- data/lib/active_scaffold/bridges/bitfields.rb +1 -1
- data/lib/active_scaffold/bridges/bitfields/bitfields_bridge.rb +10 -14
- data/lib/active_scaffold/bridges/calendar_date_select.rb +0 -7
- data/lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb +19 -22
- data/lib/active_scaffold/bridges/cancan.rb +4 -3
- data/lib/active_scaffold/bridges/cancan/cancan_bridge.rb +11 -21
- data/lib/active_scaffold/bridges/carrierwave.rb +2 -1
- data/lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb +2 -6
- data/lib/active_scaffold/bridges/carrierwave/form_ui.rb +6 -39
- data/lib/active_scaffold/bridges/carrierwave/list_ui.rb +1 -1
- data/lib/active_scaffold/bridges/chosen.rb +4 -1
- data/lib/active_scaffold/bridges/chosen/helpers.rb +3 -2
- data/lib/active_scaffold/bridges/country_select/country_select_bridge_helper.rb +2 -2
- data/lib/active_scaffold/bridges/date_picker.rb +3 -0
- data/lib/active_scaffold/bridges/date_picker/ext.rb +43 -38
- data/lib/active_scaffold/bridges/date_picker/helper.rb +24 -23
- data/lib/active_scaffold/bridges/dragonfly.rb +1 -1
- data/lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb +3 -7
- data/lib/active_scaffold/bridges/dragonfly/form_ui.rb +3 -25
- data/lib/active_scaffold/bridges/dragonfly/list_ui.rb +2 -2
- data/lib/active_scaffold/bridges/file_column/as_file_column_bridge.rb +6 -8
- data/lib/active_scaffold/bridges/file_column/file_column_helpers.rb +1 -1
- data/lib/active_scaffold/bridges/file_column/form_ui.rb +0 -2
- data/lib/active_scaffold/bridges/file_column/list_ui.rb +2 -1
- data/lib/active_scaffold/bridges/file_column/test/test_helper.rb +1 -1
- data/lib/active_scaffold/bridges/paper_trail/actions.rb +1 -1
- data/lib/active_scaffold/bridges/paper_trail/helper.rb +1 -2
- data/lib/active_scaffold/bridges/paper_trail/paper_trail_bridge.rb +3 -7
- data/lib/active_scaffold/bridges/paperclip.rb +1 -1
- data/lib/active_scaffold/bridges/paperclip/form_ui.rb +3 -28
- data/lib/active_scaffold/bridges/paperclip/list_ui.rb +1 -1
- data/lib/active_scaffold/bridges/paperclip/paperclip_bridge.rb +3 -7
- data/lib/active_scaffold/bridges/record_select.rb +2 -0
- data/lib/active_scaffold/bridges/record_select/helpers.rb +14 -18
- data/lib/active_scaffold/bridges/semantic_attributes/column.rb +4 -8
- data/lib/active_scaffold/bridges/shared/date_bridge.rb +20 -20
- data/lib/active_scaffold/bridges/tiny_mce/helpers.rb +7 -22
- data/lib/active_scaffold/bridges/usa_state_select/usa_state_select_helper.rb +14 -14
- data/lib/active_scaffold/config/base.rb +9 -6
- data/lib/active_scaffold/config/core.rb +30 -21
- data/lib/active_scaffold/config/create.rb +2 -1
- data/lib/active_scaffold/config/delete.rb +2 -2
- data/lib/active_scaffold/config/field_search.rb +9 -3
- data/lib/active_scaffold/config/form.rb +4 -4
- data/lib/active_scaffold/config/list.rb +27 -23
- data/lib/active_scaffold/config/nested.rb +4 -4
- data/lib/active_scaffold/config/search.rb +6 -6
- data/lib/active_scaffold/config/show.rb +11 -1
- data/lib/active_scaffold/config/subform.rb +1 -1
- data/lib/active_scaffold/config/update.rb +4 -2
- data/lib/active_scaffold/constraints.rb +39 -36
- data/lib/active_scaffold/core.rb +36 -15
- data/lib/active_scaffold/data_structures/action_columns.rb +14 -9
- data/lib/active_scaffold/data_structures/action_link.rb +4 -5
- data/lib/active_scaffold/data_structures/action_links.rb +5 -4
- data/lib/active_scaffold/data_structures/actions.rb +2 -2
- data/lib/active_scaffold/data_structures/association.rb +8 -0
- data/lib/active_scaffold/data_structures/association/abstract.rb +147 -0
- data/lib/active_scaffold/data_structures/association/active_mongoid.rb +42 -0
- data/lib/active_scaffold/data_structures/association/active_record.rb +94 -0
- data/lib/active_scaffold/data_structures/association/mongoid.rb +45 -0
- data/lib/active_scaffold/data_structures/bridge.rb +3 -6
- data/lib/active_scaffold/data_structures/column.rb +100 -82
- data/lib/active_scaffold/data_structures/columns.rb +21 -3
- data/lib/active_scaffold/data_structures/nested_info.rb +22 -37
- data/lib/active_scaffold/data_structures/set.rb +4 -4
- data/lib/active_scaffold/data_structures/sorting.rb +29 -15
- data/lib/active_scaffold/engine.rb +3 -1
- data/lib/active_scaffold/extensions/action_controller_rendering.rb +10 -5
- data/lib/active_scaffold/extensions/action_view_rendering.rb +65 -59
- data/lib/active_scaffold/extensions/left_outer_joins.rb +48 -53
- data/lib/active_scaffold/extensions/localize.rb +3 -4
- data/lib/active_scaffold/extensions/name_option_for_datetime.rb +7 -11
- data/lib/active_scaffold/extensions/paginator_extensions.rb +20 -18
- data/lib/active_scaffold/extensions/routing_mapper.rb +104 -40
- data/lib/active_scaffold/extensions/to_label.rb +1 -1
- data/lib/active_scaffold/extensions/unsaved_associated.rb +4 -13
- data/lib/active_scaffold/extensions/unsaved_record.rb +12 -1
- data/lib/active_scaffold/finder.rb +200 -134
- data/lib/active_scaffold/helpers/action_link_helpers.rb +398 -0
- data/lib/active_scaffold/helpers/association_helpers.rb +12 -30
- data/lib/active_scaffold/helpers/controller_helpers.rb +74 -24
- data/lib/active_scaffold/helpers/form_column_helpers.rb +205 -112
- data/lib/active_scaffold/helpers/human_condition_helpers.rb +21 -11
- data/lib/active_scaffold/helpers/id_helpers.rb +1 -1
- data/lib/active_scaffold/helpers/list_column_helpers.rb +117 -39
- data/lib/active_scaffold/helpers/pagination_helpers.rb +11 -14
- data/lib/active_scaffold/helpers/search_column_helpers.rb +69 -32
- data/lib/active_scaffold/helpers/show_column_helpers.rb +9 -3
- data/lib/active_scaffold/helpers/view_helpers.rb +41 -426
- data/lib/active_scaffold/orm_checks.rb +109 -0
- data/lib/active_scaffold/paginator.rb +1 -1
- data/lib/active_scaffold/responds_to_parent.rb +12 -10
- data/lib/active_scaffold/tableless.rb +81 -43
- data/lib/active_scaffold/version.rb +2 -2
- data/lib/generators/active_scaffold/controller_generator.rb +49 -0
- data/lib/generators/active_scaffold/install_generator.rb +45 -0
- data/lib/generators/active_scaffold/resource_generator.rb +56 -0
- data/lib/generators/{active_scaffold_controller/templates → templates}/controller.rb +0 -0
- data/lib/generators/{active_scaffold_controller/templates → templates}/helper.rb +0 -0
- data/shoulda_macros/macros.rb +3 -3
- data/test/active_scaffold_config_mock.rb +33 -0
- data/test/bridges/bridge_test.rb +9 -9
- data/test/bridges/date_picker_test.rb +3 -1
- data/test/bridges/paper_trail_test.rb +2 -3
- data/test/bridges/paperclip_test.rb +21 -10
- data/test/bridges/tiny_mce_test.rb +20 -21
- data/test/class_with_finder.rb +42 -0
- data/test/company.rb +6 -4
- data/test/config/core_test.rb +1 -1
- data/test/config/create_test.rb +1 -1
- data/test/config/list_test.rb +3 -3
- data/test/config/update_test.rb +3 -3
- data/test/data_structures/action_columns_test.rb +3 -3
- data/test/data_structures/association_column_test.rb +5 -5
- data/test/data_structures/column_test.rb +14 -14
- data/test/data_structures/columns_test.rb +2 -2
- data/test/data_structures/set_test.rb +2 -2
- data/test/data_structures/sorting_test.rb +6 -4
- data/test/extensions/active_record_test.rb +1 -1
- data/test/extensions/routing_mapper_test.rb +64 -13
- data/test/helpers/form_column_helpers_test.rb +6 -6
- data/test/helpers/list_column_helpers_test.rb +9 -5
- data/test/helpers/pagination_helpers_test.rb +1 -0
- data/test/misc/active_record_permissions_test.rb +18 -1
- data/test/misc/attribute_params_test.rb +26 -17
- data/test/misc/calculation_test.rb +8 -31
- data/test/misc/configurable_test.rb +3 -2
- data/test/misc/constraints_test.rb +33 -22
- data/test/misc/convert_numbers_format_test.rb +28 -10
- data/test/misc/finder_test.rb +6 -29
- data/test/misc/parse_datetime_test.rb +160 -0
- data/test/misc/render_test.rb +1 -1
- data/test/misc/tableless_test.rb +24 -0
- data/test/mock_app/app/models/building.rb +2 -1
- data/test/mock_app/config.ru +1 -1
- data/test/mock_app/config/environments/test.rb +1 -1
- data/test/mock_app/config/routes.rb +11 -3
- data/test/model_stub.rb +11 -6
- data/test/run_all.rb +1 -1
- data/test/test_helper.rb +19 -4
- metadata +42 -23
- data/lib/active_scaffold/data_structures/error_message.rb +0 -22
- data/lib/active_scaffold/extensions/reverse_associations.rb +0 -119
- data/lib/generators/active_scaffold/USAGE +0 -29
- data/lib/generators/active_scaffold/active_scaffold_generator.rb +0 -21
- data/lib/generators/active_scaffold_controller/USAGE +0 -19
- data/lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb +0 -29
- data/test/data_structures/error_message_test.rb +0 -25
@@ -1,4 +1,4 @@
|
|
1
|
-
<% column_count ||= columns.length + 1 -%>
|
1
|
+
<% column_count ||= columns.length + (grouped_search? ? 0 : 1) -%>
|
2
2
|
<tbody class="messages">
|
3
3
|
<tr class="record even-record">
|
4
4
|
<td colspan="<%= column_count -%>" class="messages-container">
|
@@ -11,7 +11,9 @@
|
|
11
11
|
<%= render :partial => 'messages' %>
|
12
12
|
</div>
|
13
13
|
<% end %>
|
14
|
-
|
14
|
+
<%= content_tag :div, class: 'filtered-message',
|
15
|
+
style: ('display:none;' unless @filtered),
|
16
|
+
data: ({search: search_params || ''} if active_scaffold_config.store_user_settings && respond_to?(:search_params)) do %>
|
15
17
|
<%= @filtered.is_a?(Array) ? render(:partial => 'human_conditions', :locals => {:columns => @filtered}) : as_(active_scaffold_config.list.filtered_message) %>
|
16
18
|
<% if active_scaffold_config.list.show_search_reset && @filtered -%>
|
17
19
|
<div class="reset">
|
@@ -19,7 +21,7 @@
|
|
19
21
|
<%= render_action_link(active_scaffold_config.list.reset_link) %>
|
20
22
|
</div>
|
21
23
|
<% end -%>
|
22
|
-
|
24
|
+
<% end %>
|
23
25
|
<p id="<%= empty_message_id %>" class="empty-message" <%= ' style="display:none;" '.html_safe unless @page.empty? %>>
|
24
26
|
<%= as_(active_scaffold_config.list.no_entries_message) %>
|
25
27
|
</p>
|
@@ -15,7 +15,8 @@ data_refresh ||= record.to_param
|
|
15
15
|
<%= authorized ? render_list_column(column_value, column, record) : column_value %>
|
16
16
|
<% end %>
|
17
17
|
<% end -%>
|
18
|
-
|
18
|
+
|
19
|
+
<% unless grouped_search? -%>
|
19
20
|
<td class="actions"><table>
|
20
21
|
<tr>
|
21
22
|
<td class="indicator-container">
|
@@ -24,4 +25,5 @@ data_refresh ||= record.to_param
|
|
24
25
|
<%= display_action_links(action_links, record, :level_0_tag => :td, :for => record.persisted? ? record : record.class) %>
|
25
26
|
</tr>
|
26
27
|
</table></td>
|
28
|
+
<% end -%>
|
27
29
|
</tr>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
<%= content_tag(:div, id: active_scaffold_id, class: as_main_div_class, data: params[:eid] ? {eid: id_from_controller(params[:eid])} : {}) do %>
|
2
2
|
<div class="active-scaffold-header">
|
3
3
|
<%= render :partial => 'list_header' %>
|
4
4
|
</div>
|
@@ -10,21 +10,21 @@
|
|
10
10
|
<td>
|
11
11
|
<div class="active-scaffold show_search-view <%= "#{id_from_controller params[:controller]}-view" %> view">
|
12
12
|
<%= render :partial => active_scaffold_config.list.search_partial, :locals => {:xhr => true} %>
|
13
|
-
</div>
|
14
|
-
</td>
|
13
|
+
</div>
|
14
|
+
</td>
|
15
15
|
</tr>
|
16
16
|
<% @record = old_record %>
|
17
17
|
<% else %>
|
18
18
|
<tr><td></td></tr>
|
19
19
|
<% end %>
|
20
|
-
<% if active_scaffold_config.list.always_show_create %>
|
20
|
+
<% if active_scaffold_config.list.always_show_create && controller.send(:create_authorized?) %>
|
21
21
|
<% old_record, @record = @record, new_model %>
|
22
|
-
<tr>
|
23
|
-
<td>
|
22
|
+
<tr>
|
23
|
+
<td>
|
24
24
|
<div class="active-scaffold create-view <%= "#{id_from_controller params[:controller]}-view" %> view">
|
25
25
|
<%= render :partial => 'create_form_on_list' %>
|
26
|
-
</div>
|
27
|
-
</td>
|
26
|
+
</div>
|
27
|
+
</td>
|
28
28
|
</tr>
|
29
29
|
<% @record = old_record %>
|
30
30
|
<% end %>
|
@@ -33,4 +33,4 @@
|
|
33
33
|
<div id="<%= active_scaffold_content_id-%>" class="as_content">
|
34
34
|
<%= render :partial => 'list' %>
|
35
35
|
</div>
|
36
|
-
|
36
|
+
<% end %>
|
@@ -1,12 +1,20 @@
|
|
1
1
|
<% if @auto_pagination -%>
|
2
|
-
<% if @page.items.present? -%>
|
3
|
-
ActiveScaffold.append('<%= active_scaffold_tbody_id %>', '<%= escape_javascript(render(:partial => 'list_record', :collection => @page.items, :locals => {:hidden => false, :columns => list_columns, :action_links => active_scaffold_config.action_links.member})) %>');
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
<% end %>
|
8
|
-
<%
|
9
|
-
|
10
|
-
<%
|
11
|
-
ActiveScaffold.
|
2
|
+
<% if @page.items.present? -%>
|
3
|
+
ActiveScaffold.append('<%= active_scaffold_tbody_id %>', '<%= escape_javascript(render(:partial => 'list_record', :collection => @page.items, :locals => {:hidden => false, :columns => list_columns, :action_links => active_scaffold_config.action_links.member})) %>');
|
4
|
+
|
5
|
+
<% if @page.pager.infinite? || @page.number < @page.pager.number_of_pages -%>
|
6
|
+
ActiveScaffold.auto_load_page('<%= url_for main_path_to_return %>', {auto_pagination: true, page: <%= @page.number + 1 %>});
|
7
|
+
<% end # @page.pager.infinite?... %>
|
8
|
+
<% end # @page.items.present? %>
|
9
|
+
|
10
|
+
<% elsif active_scaffold_config.list.refresh_with_header -%>
|
11
|
+
ActiveScaffold.replace('<%= active_scaffold_id %>', '<%= escape_javascript(render('list_with_header')) %>');
|
12
|
+
<% else -%>
|
13
|
+
ActiveScaffold.replace_html('<%= active_scaffold_content_id %>', '<%= escape_javascript(render('list')) %>');
|
14
|
+
<% end # @auto_pagination -%>
|
15
|
+
|
16
|
+
<% if ActiveScaffold.js_framework == :jquery && !@auto_pagination && !@popstate && !embedded? && !local_assigns[:no_history] -%>
|
17
|
+
if (!jQuery('#<%= active_scaffold_id %>').is('.active-scaffold .active-scaffold')) {
|
18
|
+
ActiveScaffold.add_to_history(<%=raw request.original_url.to_json %>, <%=raw history_state.to_json %>);
|
19
|
+
}
|
12
20
|
<% end -%>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
column = if render_field.is_a? ActiveScaffold::DataStructures::Column
|
3
3
|
render_field
|
4
4
|
else
|
5
|
-
active_scaffold_config.columns[render_field
|
5
|
+
active_scaffold_config.columns[render_field]
|
6
6
|
end
|
7
7
|
return unless @main_columns.include? column.name
|
8
8
|
@rendered ||= Set.new
|
@@ -12,10 +12,10 @@
|
|
12
12
|
if renders_as == :subform
|
13
13
|
options = {:is_subform => true, :field_class => "#{column.name}-sub-form"}
|
14
14
|
else
|
15
|
-
options = {:is_subform => false, :field_class => "#{column.name}-input"}
|
15
|
+
options = {:is_subform => false, :field_class => "#{column.name}-input", :hidden => column.form_ui == :hidden}
|
16
16
|
end
|
17
17
|
html = if scope
|
18
|
-
readonly =
|
18
|
+
readonly = @record.readonly? || !@record.authorized_for?(:crud_type => :update)
|
19
19
|
crud_type = @record.new_record? ? :create : (readonly ? :read : :update)
|
20
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
|
@@ -1,13 +1,14 @@
|
|
1
1
|
<%
|
2
2
|
live_search = active_scaffold_config.search.live?
|
3
|
-
url_options = params_for(:
|
3
|
+
url_options = params_for(action: :index, id: nil, search: nil)
|
4
4
|
submit_text ||= :search
|
5
|
+
xhr ||= request.xhr?
|
5
6
|
options = {
|
6
|
-
:
|
7
|
-
:
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:
|
7
|
+
id: element_form_id(action: 'search'),
|
8
|
+
class: "as_form search#{' live' if live_search}",
|
9
|
+
remote: xhr,
|
10
|
+
data: {loading: true},
|
11
|
+
method: :get
|
11
12
|
}
|
12
13
|
-%>
|
13
14
|
<%= form_tag url_options, options do %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<div class="active-scaffold-<%= position %>">
|
2
|
+
<div class="actions">
|
3
|
+
<% active_scaffold_config.action_links.member.each do |link| -%>
|
4
|
+
<%
|
5
|
+
next unless display_link_in_show?(link, position)
|
6
|
+
next if link.action == 'show' && link.controller.nil? && link.parameters.empty?
|
7
|
+
next if skip_action_link?(link, record)
|
8
|
+
auth, reason = action_link_authorized?(link, record)
|
9
|
+
next unless auth
|
10
|
+
-%>
|
11
|
+
<%= render_action_link(link, record, :authorized => true, :page => true) -%>
|
12
|
+
<% end -%>
|
13
|
+
</div>
|
14
|
+
</div>
|
@@ -1,2 +1,2 @@
|
|
1
|
-
<% associated = column.
|
1
|
+
<% associated = column.association.singular? ? [parent_record.send(column.name)].compact : parent_record.send(column.name).to_a -%>
|
2
2
|
<%= render :partial => "show_association_#{show_partial}", :locals => {:column => column, :parent_record => parent_record, :associated => associated} if associated.present? %>
|
@@ -1,8 +1,12 @@
|
|
1
1
|
<div class="active-scaffold-header">
|
2
2
|
<div class="actions">
|
3
3
|
<% active_scaffold_config.action_links.member.each do |link| -%>
|
4
|
-
<%
|
5
|
-
|
4
|
+
<%
|
5
|
+
next unless link.action == 'index'
|
6
|
+
next if skip_action_link?(link, record)
|
7
|
+
auth, reason = action_link_authorized?(link, record)
|
8
|
+
next unless auth
|
9
|
+
-%>
|
6
10
|
<%= render_action_link(link, record, :authorized => true) -%>
|
7
11
|
<% end -%>
|
8
12
|
</div>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
column = if update_column.is_a? ActiveScaffold::DataStructures::Column
|
3
3
|
update_column
|
4
4
|
else
|
5
|
-
active_scaffold_config.columns[update_column
|
5
|
+
active_scaffold_config.columns[update_column]
|
6
6
|
end
|
7
7
|
@rendered ||= Set.new
|
8
8
|
return if @rendered.include? column.name
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% cancel_link = true if cancel_link.nil? %>
|
2
2
|
<%= render :partial => "base_form", :locals => {:xhr => xhr ||= nil,
|
3
3
|
:form_action => form_action ||= :update,
|
4
|
-
:method => method ||= :
|
4
|
+
:method => method ||= :patch,
|
5
5
|
:cancel_link => cancel_link,
|
6
6
|
:headline => headline ||= @record.to_label.nil? ? active_scaffold_config.update.label : as_(:update_model, :model => h(@record.to_label))} %>
|
@@ -2,9 +2,8 @@
|
|
2
2
|
<% if successful? %>
|
3
3
|
<% if render_parent? %>
|
4
4
|
<% if render_parent_action == :row %>
|
5
|
-
<%# TODO: That s not working with delete.... %>
|
6
5
|
<% current_id = controller_id(params[:eid] || params[:parent_sti]) -%>
|
7
|
-
ActiveScaffold.delete_record_row('<%= element_row_id(:controller_id => current_id, :action => 'list', :id => params[:id]) %>', '<%= url_for
|
6
|
+
ActiveScaffold.delete_record_row('<%= element_row_id(:controller_id => current_id, :action => 'list', :id => params[:id]) %>', '<%= url_for params_for(render_parent_options.merge(id: nil, page: [active_scaffold_config.list.user.page.to_i - 1, 1].max)) %>');
|
8
7
|
<% messages_id = active_scaffold_messages_id(:controller_id => current_id) %>
|
9
8
|
<%= render :partial => 'update_calculations', :locals => {:calculations_id => active_scaffold_calculations_id(:controller_id => current_id)}, :formats => [:js] %>
|
10
9
|
<% elsif render_parent_action == :index %>
|
@@ -15,7 +14,7 @@
|
|
15
14
|
<% end %>
|
16
15
|
<% end %>
|
17
16
|
<% elsif (active_scaffold_config.delete.refresh_list) %>
|
18
|
-
<%= render
|
17
|
+
<%= render 'refresh_list', no_history: true %>
|
19
18
|
<% else %>
|
20
19
|
<%
|
21
20
|
url = main_path_to_return
|
@@ -1,7 +1,8 @@
|
|
1
1
|
<%
|
2
|
-
|
2
|
+
subform_id = sub_form_list_id(:association => @column.name, :id => @parent_record.id || generated_id(@parent_record) || 99999999999)
|
3
|
+
associated_form = render :partial => "form_association_record", :object => @record, :locals => {:scope => @scope, :parent_record => @parent_record, :column => @column, :locked => @record.new_record? && @column.association.singular?}
|
3
4
|
options = {:singular => false}
|
4
|
-
if @column.
|
5
|
+
if @column.association.singular?
|
5
6
|
options[:singular] = true
|
6
7
|
else
|
7
8
|
unless @record.new_record?
|
@@ -9,4 +10,4 @@ else
|
|
9
10
|
options[:id] = active_scaffold_input_options(column, column_scope(@column, @scope, @record))[:id]
|
10
11
|
end
|
11
12
|
end %>
|
12
|
-
ActiveScaffold.create_associated_record_form('<%=
|
13
|
+
ActiveScaffold.create_associated_record_form('<%= subform_id %>','<%=escape_javascript(associated_form)%>', <%= options.to_json.html_safe %>);
|
@@ -3,7 +3,8 @@
|
|
3
3
|
<%= render :partial => 'update_messages' %>
|
4
4
|
<% row = escape_javascript(render(:partial => 'list_record', :locals => {:record => @record})) -%>
|
5
5
|
<% if @action_link.try(:position) %>
|
6
|
-
|
6
|
+
var link = ActiveScaffold.find_action_link('<%= element_form_id(:action => action_name) %>');
|
7
|
+
if (link) link.close('<%= row %>');
|
7
8
|
<% else %>
|
8
9
|
ActiveScaffold.update_row('<%= element_row_id(:action => :list, :id => @record.id) %>', '<%= row %>');
|
9
10
|
ActiveScaffold.scroll_to('<%= element_row_id(:action => :list, :id => @record.id) %>', true);
|
@@ -11,9 +12,10 @@
|
|
11
12
|
<%= render :partial => 'update_calculations', :formats => [:js] %>
|
12
13
|
<% else %>
|
13
14
|
<% if @action_link.try(:position) %>
|
14
|
-
|
15
|
+
var link = ActiveScaffold.find_action_link('<%= element_form_id(:action => action_name) %>');
|
16
|
+
if (link) link.close();
|
15
17
|
<% end %>
|
16
|
-
<%= render
|
18
|
+
<%= render 'refresh_list', no_history: true %>
|
17
19
|
<% end %>
|
18
20
|
<% else %>
|
19
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? %>
|
@@ -9,19 +9,19 @@ var action_link;
|
|
9
9
|
<%= render :partial => 'update_messages' %>
|
10
10
|
<% else -%>
|
11
11
|
action_link = ActiveScaffold.find_action_link('<%= form_selector %>');
|
12
|
-
action_link.update_flash_messages('<%= escape_javascript(render(:partial => 'messages')) %>');
|
12
|
+
if (action_link) action_link.update_flash_messages('<%= escape_javascript(render(:partial => 'messages')) %>');
|
13
13
|
<% end -%>
|
14
14
|
<% if successful? -%>
|
15
15
|
<% if render_parent? %>
|
16
16
|
<% if nested_singular_association? %>
|
17
|
-
|
17
|
+
if (action_link) action_link.close(true);
|
18
18
|
<% elsif params[:parent_sti] && render_parent_action == :row %>
|
19
19
|
ActiveScaffold.create_record_row_from_url(action_link,'<%= url_for(render_parent_options) %>', <%= {:insert_at => insert_at}.to_json.html_safe %>);
|
20
20
|
<% else %>
|
21
21
|
ActiveScaffold.reload('<%= url_for render_parent_options %>');
|
22
22
|
<% end %>
|
23
23
|
<% elsif active_scaffold_config.create.refresh_list %>
|
24
|
-
<%= render
|
24
|
+
<%= render 'refresh_list', no_history: true %>
|
25
25
|
<% elsif params[:parent_controller].nil? %>
|
26
26
|
<% new_row = render :partial => 'list_record', :locals => {:record => @saved_record || @record} %>
|
27
27
|
ActiveScaffold.create_record_row(action_link ? action_link.scaffold() : '<%= active_scaffold_id %>', '<%= escape_javascript(new_row) %>', <%= {:insert_at => insert_at}.to_json.html_safe %>);
|
@@ -35,7 +35,7 @@ action_link.update_flash_messages('<%= escape_javascript(render(:partial => 'mes
|
|
35
35
|
ActiveScaffold.replace('<%= form_selector %>','<%= escape_javascript(render(:partial => 'create_form', :locals => {:xhr => true})) %>');
|
36
36
|
ActiveScaffold.focus_first_element_of_form('<%= form_selector %>');
|
37
37
|
<% else %>
|
38
|
-
action_link.close();
|
38
|
+
if (action_link) action_link.close();
|
39
39
|
<% end %>
|
40
40
|
<% if (active_scaffold_config.create.action_after_create) %>
|
41
41
|
var link = ActiveScaffold.find_action_link('<%= action_link_id active_scaffold_config.create.action_after_create, @record.id || @saved_record.id %>');
|
@@ -1,12 +1,12 @@
|
|
1
1
|
try {
|
2
2
|
<% form_selector ||= "#{element_form_id(:action => :update, :id => @record.try(:id) || params[:id])}" %>
|
3
3
|
var action_link = ActiveScaffold.find_action_link('<%= form_selector %>');
|
4
|
-
action_link.update_flash_messages('<%= escape_javascript(render(:partial => 'messages')) %>');
|
4
|
+
if (action_link) action_link.update_flash_messages('<%= escape_javascript(render(:partial => 'messages')) %>');
|
5
5
|
<% if successful? %>
|
6
6
|
<% if params[:dont_close] %>
|
7
7
|
<% row_selector = element_row_id(:action => :list, :id => @record.id) %>
|
8
8
|
ActiveScaffold.update_row('<%= row_selector %>', '<%= escape_javascript(render(:partial => 'list_record', :locals => {:record => @record})) %>');
|
9
|
-
action_link.target = $('#<%= row_selector %>');
|
9
|
+
if (action_link) action_link.target = $('#<%= row_selector %>');
|
10
10
|
<%= render :partial => 'update_calculations', :formats => [:js] %>
|
11
11
|
<% if params[:iframe] == 'true' %>
|
12
12
|
ActiveScaffold.enable_form('<%= form_selector %>');
|
@@ -14,17 +14,17 @@ action_link.update_flash_messages('<%= escape_javascript(render(:partial => 'mes
|
|
14
14
|
<% else %>
|
15
15
|
<% if render_parent? %>
|
16
16
|
<% if nested_singular_association? || render_parent_action == :row %>
|
17
|
-
action_link.close(true);
|
17
|
+
if (action_link) action_link.close(true);
|
18
18
|
<% else %>
|
19
19
|
ActiveScaffold.reload('<%= url_for render_parent_options %>');
|
20
20
|
<% end %>
|
21
21
|
<% elsif update_refresh_list? %>
|
22
|
-
<%= render
|
22
|
+
<%= render 'refresh_list', no_history: true %>
|
23
23
|
<% else %>
|
24
24
|
<% if @record %>
|
25
|
-
action_link.close('<%= escape_javascript(render(:partial => 'list_record', :locals => {:record => @record})) %>');
|
25
|
+
if (action_link) action_link.close('<%= escape_javascript(render(:partial => 'list_record', :locals => {:record => @record})) %>');
|
26
26
|
<% else %>
|
27
|
-
action_link.close();
|
27
|
+
if (action_link) action_link.close();
|
28
28
|
ActiveScaffold.delete_record_row('<%= element_row_id(:action => :list, :id => params[:id]) %>');
|
29
29
|
<% end %>
|
30
30
|
<%= render :partial => 'update_calculations', :formats => [:js] %>
|
@@ -1,5 +1,11 @@
|
|
1
1
|
<div class="active-scaffold">
|
2
2
|
<div class="show-view <%= "#{id_from_controller params[:controller]}-view" %> view">
|
3
|
+
<% if active_scaffold_config.show.inline_links and !active_scaffold_config.action_links.member.empty? -%>
|
4
|
+
<%= render :partial => 'show_actions', :locals => {:record => @record, :position => :header} %>
|
5
|
+
<% end -%>
|
3
6
|
<%= render :partial => 'show' -%>
|
7
|
+
<% if active_scaffold_config.show.inline_links and !active_scaffold_config.action_links.member.empty? -%>
|
8
|
+
<%= render :partial => 'show_actions', :locals => {:record => @record, :position => :footer} %>
|
9
|
+
<% end -%>
|
4
10
|
</div>
|
5
11
|
</div>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<div class="active-scaffold">
|
2
2
|
<div class="update-view <%= "#{id_from_controller params[:controller]}-view" %> view">
|
3
|
-
<% if active_scaffold_config.update.nested_links and active_scaffold_config.action_links.member.empty? -%>
|
3
|
+
<% if active_scaffold_config.update.nested_links and !active_scaffold_config.action_links.member.empty? -%>
|
4
4
|
<%= render :partial => 'update_actions', :locals => {:record => @record} %>
|
5
5
|
<% end -%>
|
6
6
|
<%= render :partial => 'update_form' -%>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% @column_span_id ||= element_cell_id(:id => @record.id.to_s, :action => 'update_column', :name => @column.name) -%>
|
2
2
|
<% unless successful? -%>
|
3
|
-
|
3
|
+
<%= render 'update_messages' %>
|
4
4
|
<% @record.reload -%>
|
5
5
|
<% end -%>
|
6
6
|
<% if @column.inplace_edit
|
@@ -0,0 +1,26 @@
|
|
1
|
+
{
|
2
|
+
"ignored_warnings": [
|
3
|
+
{
|
4
|
+
"warning_type": "Weak Hash",
|
5
|
+
"warning_code": 90,
|
6
|
+
"fingerprint": "bca53a490b010fea618ad3791c37086988592b4706fc569f244bca2a3a471bef",
|
7
|
+
"check_name": "WeakHash",
|
8
|
+
"message": "Weak hashing algorithm (MD5) used",
|
9
|
+
"file": "lib/active_scaffold/extensions/action_view_rendering.rb",
|
10
|
+
"line": 99,
|
11
|
+
"link": "http://brakemanscanner.org/docs/warning_types/weak_hash/",
|
12
|
+
"code": "Digest::MD5.hexdigest((params[:controller] + options.to_s))",
|
13
|
+
"render_path": null,
|
14
|
+
"location": {
|
15
|
+
"type": "method",
|
16
|
+
"class": "ActiveScaffold::RenderingHelper",
|
17
|
+
"method": "render_embedded"
|
18
|
+
},
|
19
|
+
"user_input": "params",
|
20
|
+
"confidence": "High",
|
21
|
+
"note": "Hash used for uniquely identify different embedded scaffolds with fixed length id"
|
22
|
+
}
|
23
|
+
],
|
24
|
+
"updated": "2017-10-18 08:35:45 +0200",
|
25
|
+
"brakeman_version": "4.0.1"
|
26
|
+
}
|
data/config/brakeman.yml
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
# i18n-tasks finds and manages missing and unused translations: https://github.com/glebm/i18n-tasks
|
2
|
+
|
3
|
+
# The "main" locale.
|
4
|
+
base_locale: en
|
5
|
+
## All available locales are inferred from the data by default. Alternatively, specify them explicitly:
|
6
|
+
#locales: [en]
|
7
|
+
## Reporting locale, default: en. Available: en, ru.
|
8
|
+
# internal_locale: en
|
9
|
+
|
10
|
+
# Read and write translations.
|
11
|
+
data:
|
12
|
+
## Translations are read from the file system. Supported format: YAML, JSON.
|
13
|
+
## Provide a custom adapter:
|
14
|
+
# adapter: I18n::Tasks::Data::FileSystem
|
15
|
+
|
16
|
+
# Locale files or `File.find` patterns where translations are read from:
|
17
|
+
read:
|
18
|
+
## Default:
|
19
|
+
- config/locales/%{locale}.yml
|
20
|
+
## More files:
|
21
|
+
# - config/locales/**/*.%{locale}.yml
|
22
|
+
## Another gem (replace %#= with %=):
|
23
|
+
# - "<%#= %x[bundle show vagrant].chomp %>/templates/locales/%{locale}.yml"
|
24
|
+
|
25
|
+
# Locale files to write new keys to, based on a list of key pattern => file rules. Matched from top to bottom:
|
26
|
+
# `i18n-tasks normalize -p` will force move the keys according to these rules
|
27
|
+
write:
|
28
|
+
## For example, write devise and simple form keys to their respective files:
|
29
|
+
# - ['{devise, simple_form}.*', 'config/locales/\1.%{locale}.yml']
|
30
|
+
## Catch-all default:
|
31
|
+
# - config/locales/%{locale}.yml
|
32
|
+
|
33
|
+
## Specify the router (see Readme for details). Valid values: conservative_router, pattern_router, or a custom class.
|
34
|
+
# router: convervative_router
|
35
|
+
|
36
|
+
yaml:
|
37
|
+
write:
|
38
|
+
# do not wrap lines at 80 characters
|
39
|
+
line_width: -1
|
40
|
+
|
41
|
+
## Pretty-print JSON:
|
42
|
+
# json:
|
43
|
+
# write:
|
44
|
+
# indent: ' '
|
45
|
+
# space: ' '
|
46
|
+
# object_nl: "\n"
|
47
|
+
# array_nl: "\n"
|
48
|
+
|
49
|
+
# Find translate calls
|
50
|
+
search:
|
51
|
+
## Paths or `File.find` patterns to search in:
|
52
|
+
paths:
|
53
|
+
- app/
|
54
|
+
- lib/
|
55
|
+
|
56
|
+
## Root directories for relative keys resolution.
|
57
|
+
# relative_roots:
|
58
|
+
# - app/controllers
|
59
|
+
# - app/helpers
|
60
|
+
# - app/mailers
|
61
|
+
# - app/presenters
|
62
|
+
# - app/views
|
63
|
+
|
64
|
+
## Files or `File.fnmatch` patterns to exclude from search. Some files are always excluded regardless of this setting:
|
65
|
+
## %w(*.jpg *.png *.gif *.svg *.ico *.eot *.otf *.ttf *.woff *.woff2 *.pdf *.css *.sass *.scss *.less *.yml *.json)
|
66
|
+
exclude:
|
67
|
+
- app/assets/images
|
68
|
+
- lib/generators/templates
|
69
|
+
|
70
|
+
## Alternatively, the only files or `File.fnmatch patterns` to search in `paths`:
|
71
|
+
## If specified, this settings takes priority over `exclude`, but `exclude` still applies.
|
72
|
+
# only: ["*.rb", "*.html.slim"]
|
73
|
+
|
74
|
+
## If `strict` is `false`, guess usages such as t("categories.#{category}.title"). The default is `true`.
|
75
|
+
# strict: true
|
76
|
+
|
77
|
+
## Multiple scanners can be used. Their results are merged.
|
78
|
+
## The options specified above are passed down to each scanner. Per-scanner options can be specified as well.
|
79
|
+
## See this example of a custom scanner: https://github.com/glebm/i18n-tasks/wiki/A-custom-scanner-example
|
80
|
+
|
81
|
+
## Google Translate
|
82
|
+
# translation:
|
83
|
+
# # Get an API key and set billing info at https://code.google.com/apis/console to use Google Translate
|
84
|
+
# api_key: "AbC-dEf5"
|
85
|
+
|
86
|
+
## Do not consider these keys missing:
|
87
|
+
ignore_missing:
|
88
|
+
# translations from rails i18n are used
|
89
|
+
- date.formats.default
|
90
|
+
- number.currency.format
|
91
|
+
- number.format
|
92
|
+
- number.human.format
|
93
|
+
- number.percentage.format
|
94
|
+
|
95
|
+
## Consider these keys used:
|
96
|
+
ignore_unused:
|
97
|
+
- 'active_scaffold.*' # used indirectly by the ActiveScaffold
|
98
|
+
|
99
|
+
## Exclude these keys from the `i18n-tasks eq-base' report:
|
100
|
+
# ignore_eq_base:
|
101
|
+
# all:
|
102
|
+
# - common.ok
|
103
|
+
# fr,es:
|
104
|
+
# - common.brand
|
105
|
+
|
106
|
+
## Ignore these keys completely:
|
107
|
+
# ignore:
|
108
|
+
# - kaminari.*
|
109
|
+
|
110
|
+
## Sometimes, it isn't possible for i18n-tasks to match the key correctly,
|
111
|
+
## e.g. in case of a relative key defined in a helper method.
|
112
|
+
## In these cases you can use the built-in PatternMapper to map patterns to keys, e.g.:
|
113
|
+
#
|
114
|
+
# <%# I18n::Tasks.add_scanner 'I18n::Tasks::Scanners::PatternMapper',
|
115
|
+
# only: %w(*.html.haml *.html.slim),
|
116
|
+
# patterns: [['= title\b', '.page_title']] %>
|
117
|
+
#
|
118
|
+
# The PatternMapper can also match key literals via a special %{key} interpolation, e.g.:
|
119
|
+
#
|
120
|
+
# <%# I18n::Tasks.add_scanner 'I18n::Tasks::Scanners::PatternMapper',
|
121
|
+
# patterns: [['\bSpree\.t[( ]\s*%{key}', 'spree.%{key}']] %>
|