active_scaffold 4.0.0.rc3 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ce97fc27fd6db228fc8c934c9559a9af750b0e19837c5eb30e6bb868fc108ef
4
- data.tar.gz: d3568381187bb6ab2fb1245d5588063a09db42057704d0645abd5e04139f2cf2
3
+ metadata.gz: cadefffe75f1a7bdf8afba8418f0ffff986086b93a5045b4680b06c4ffe47c1a
4
+ data.tar.gz: ca800128c2c114e3acd598c3ec35172cff9b271171b1dd6a95c098ba1114ae94
5
5
  SHA512:
6
- metadata.gz: 445f89948894b2989ce7f20efb69ce649b1bbd045a124b7c0243e1ea8e4168922a54b901ee653a51fde2ad7b61b3014fa47521d62fa17120ab58671032a7afb4
7
- data.tar.gz: ab62a6b00a0c403eeaa4bc94c346fa46871350d4b9a5ebcbe7d6d9c63c7e8d8b862f5083ba5c3045ff3ce533ea015e441f8adea9d35c7d6807d876a88202043f
6
+ metadata.gz: c26cfb49d8896404c8702bf908740e2e1a19f3b18478411bd1244f3a7b4f940dacf89b2cbd260e7ea1ab90afc4b262a637f3260f784bd5b58f8fe7fd0f9b9571
7
+ data.tar.gz: 6327f74958e882da485fffefaa098845016ccf83d4dc19b46d525e6d6d7f6017e57ec0ea612c39431f54c5f925615dd3c279b453126998033875ffd81da8762c
data/CHANGELOG.rdoc CHANGED
@@ -5,8 +5,9 @@
5
5
  - Action links can't be changed, added or removed, add all links and use ignore_method to control when they are displayed
6
6
  - Require using active_scaffold_config.override_columns to exclude or add columns
7
7
  - Thread safety enabled by default, can't be disabled, deprecate ActiveScaffold.threadsafe!
8
+ - Support subgroups on field search
8
9
 
9
- = 3.7.11 (not released yet)
10
+ = 3.7.11
10
11
  - Add partial list_messages_content to reduce code duplication, and better support replacing list view with other way to render records
11
12
  - Support selector for records body in create_record_row JS method, better support replacing list view with other way to render records
12
13
  - Improve detection of member action links when list view is replaced with other structure, based on 'record' html class, instead of tags
data/README.md CHANGED
@@ -61,6 +61,17 @@ Threadsafe
61
61
 
62
62
  Threadsafe is enabled always since 4.0, and it can't be disabled.
63
63
 
64
+ Breaking Changes
65
+ ----------------
66
+
67
+ Changing column settings on a request has changed, it must use `active_scaffold_config.columns.override(:name)` at least the first time. After calling `columns.override(:name)`, calling it again or calling `columns[:name]` will return the overrided column. It also supports a block. See [Per Request Configuration](https://github.com/activescaffold/active_scaffold/wiki/Per-Request-Configuration) for examples and more comprehensive explanation.
68
+
69
+ Changing columns for an action (e.g. add or exclude) on a request must use active_scaffold_config.actions.override_columns, the first time, or use assignment.
70
+
71
+ If you have a `_form_association_record` partial view overrided, use `record` local variable instead of `form_association_record`.
72
+
73
+ If you have code rendering `form_association_record` partial, the pass `record` local variable, or use `as: :record` if using render with collection key.
74
+
64
75
  Configuration
65
76
  -------------
66
77
  See Wiki for instructions on customising ActiveScaffold and to find the full API details.
@@ -535,6 +535,9 @@
535
535
  ActiveScaffold.sliders(container);
536
536
  ActiveScaffold.disable_optional_subforms(container);
537
537
  ActiveScaffold.update_floating_form_footer(); // check other forms too, state may change
538
+ if (container != document) {
539
+ jQuery('[data-rs-type]', container).each(function() { RecordSelect.from_attributes(jQuery(this)); });
540
+ }
538
541
  },
539
542
  setup_history_state: function() {
540
543
  if (!jQuery('.active-scaffold').length) return;
@@ -19,27 +19,9 @@
19
19
  <% key, value = pair.split('=', 2).map { |str| Rack::Utils.unescape(str) } -%>
20
20
  <%= hidden_field_tag(key, value) %>
21
21
  <% end -%>
22
-
23
- <ol class="form">
24
- <% visibles, hiddens = visibles_and_hiddens(active_scaffold_config.field_search) %>
25
- <% visibles.each do |column| -%>
26
- <li class="form-element <%= column.css_class unless column.css_class.is_a?(Proc) %>"><%= search_attribute(column, @record) %></li>
27
- <% end -%>
28
- <% unless hiddens.empty? -%>
29
- <li class="sub-section">
30
- <% further_options_id = sub_section_id(sub_section: 'further_options') %>
31
- <h5>
32
- <%= as_(:optional_attributes) %>
33
- <%= link_to_visibility_toggle(further_options_id, default_visible: false) %>
34
- </h5>
35
- <ol id ="<%= further_options_id %>" class="form" style="display:none;">
36
- <% hiddens.each do |column| -%>
37
- <li class="form-element <%= column.css_class unless column.css_class.is_a?(Proc) %>"><%= search_attribute(column, @record) %></li>
38
- <% end -%>
39
- </ol>
40
- </li>
41
- <% end -%>
42
- </ol>
22
+
23
+ <%= render 'field_search_columns', columns: active_scaffold_config.field_search.columns %>
24
+
43
25
  <p class="form-footer">
44
26
  <%
45
27
  reset_attrs = {class: 'reset'}
@@ -0,0 +1,32 @@
1
+ <ol class="form" <%= "id=#{subsection_id}" unless local_assigns[:subsection_id].nil? %> <%= 'style="display: none;"'.html_safe if columns.collapsed %>>
2
+ <% visibles, hiddens = visibles_and_hiddens(active_scaffold_config.field_search, columns) %>
3
+ <% visibles.each do |column| -%>
4
+ <% if column.respond_to? :each_column %>
5
+ <li class="sub-section <%= column.css_class unless column.css_class.is_a?(Proc) %>">
6
+ <%= render_subsection column, @record, nil, :field_search, partial: 'field_search_columns' %>
7
+ </li>
8
+ <% else %>
9
+ <li class="form-element <%= column.css_class unless column.css_class.is_a?(Proc) %>"><%= search_attribute(column, @record) %></li>
10
+ <% end %>
11
+ <% end -%>
12
+ <% unless hiddens.empty? -%>
13
+ <li class="sub-section">
14
+ <% further_options_id = sub_section_id(sub_section: 'further_options') %>
15
+ <h5>
16
+ <%= as_(:optional_attributes) %>
17
+ <%= link_to_visibility_toggle(further_options_id, default_visible: false) %>
18
+ </h5>
19
+ <ol id="<%= further_options_id %>" class="form" style="display:none;">
20
+ <% hiddens.each do |column| -%>
21
+ <% if column.respond_to? :each_column %>
22
+ <li class="sub-section <%= column.css_class unless column.css_class.is_a?(Proc) %>">
23
+ <%= render_subsection column, @record, nil, :field_search, partial: 'field_search_columns' %>
24
+ </li>
25
+ <% else %>
26
+ <li class="form-element <%= column.css_class unless column.css_class.is_a?(Proc) %>"><%= search_attribute(column, @record) %></li>
27
+ <% end %>
28
+ <% end -%>
29
+ </ol>
30
+ </li>
31
+ <% end -%>
32
+ </ol>
@@ -154,7 +154,7 @@ module ActiveScaffold
154
154
  {}
155
155
  end
156
156
 
157
- def render_subsection(column, record, scope, form_action)
157
+ def render_subsection(column, record, scope, form_action, partial: 'form')
158
158
  subsection_id = sub_section_id(sub_section: column.label)
159
159
  locals = {columns: column, form_action: form_action, scope: scope}
160
160
  header = content_tag(:h5) do
@@ -165,11 +165,11 @@ module ActiveScaffold
165
165
  locals[:tabbed_by] = column.tabbed_by
166
166
  header << content_tag(:div, id: subsection_id) do
167
167
  active_scaffold_tabbed_by(column, record, scope, subsection_id) do |tab_value, tab_id|
168
- render 'form', locals.merge(subsection_id: "#{subsection_id}-#{tab_id}", tab_id: tab_id, tab_value: tab_value)
168
+ render partial, locals.merge(subsection_id: "#{subsection_id}-#{tab_id}", tab_id: tab_id, tab_value: tab_value)
169
169
  end
170
170
  end
171
171
  else
172
- header << render('form', locals.merge(subsection_id: subsection_id))
172
+ header << render(partial, locals.merge(subsection_id: subsection_id))
173
173
  end
174
174
  end
175
175
 
@@ -330,7 +330,7 @@ module ActiveScaffold
330
330
 
331
331
  def active_scaffold_input_singular_association(column, html_options, options = {}, ui_options: column.options)
332
332
  record = html_options.delete(:object)
333
- associated = record.send(column.association.name)
333
+ associated = html_options.include?(:associated) ? html_options.delete(:associated) : record.send(column.association.name)
334
334
 
335
335
  select_options = sorted_association_options_find(column.association, nil, record)
336
336
  select_options.unshift(associated) unless associated.nil? || select_options.include?(associated)
@@ -396,11 +396,11 @@ module ActiveScaffold
396
396
  method if respond_to? method
397
397
  end
398
398
 
399
- def visibles_and_hiddens(search_config)
399
+ def visibles_and_hiddens(search_config, columns = search_config.columns)
400
400
  visibles = []
401
401
  hiddens = []
402
- search_config.columns.each_column(flatten: true) do |column|
403
- next unless column.search_sql
402
+ columns.each_column do |column|
403
+ next unless column.respond_to?(:each_column) || column.search_sql
404
404
 
405
405
  if search_config.optional_columns.include?(column.name) && !searched_by?(column)
406
406
  hiddens << column
@@ -409,8 +409,8 @@ module ActiveScaffold
409
409
  end
410
410
  end
411
411
  if active_scaffold_group_column
412
- columns = grouped_search? || search_config.optional_columns.empty? ? visibles : hiddens
413
- columns << active_scaffold_group_column
412
+ group = grouped_search? || search_config.optional_columns.empty? ? visibles : hiddens
413
+ group << active_scaffold_group_column
414
414
  end
415
415
  [visibles, hiddens]
416
416
  end
@@ -3,7 +3,7 @@ module ActiveScaffold
3
3
  MAJOR = 4
4
4
  MINOR = 0
5
5
  PATCH = 0
6
- FIX = 'rc3'.freeze
6
+ FIX = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, FIX].compact.join('.')
9
9
  end
@@ -51,9 +51,7 @@ module ActiveScaffold
51
51
  mattr_accessor :javascripts, instance_writer: false
52
52
  self.javascripts = []
53
53
 
54
- def self.threadsafe!
55
- ActiveSupport::Deprecation.warn 'Threadsafe is enabled always, no need to require it anymore'
56
- end
54
+ def self.threadsafe!; end
57
55
 
58
56
  mattr_writer :jquery_ui_loaded, instance_writer: false
59
57
  def self.jquery_ui_included?
@@ -77,9 +75,6 @@ module ActiveScaffold
77
75
  end
78
76
 
79
77
  mattr_accessor :nested_subforms, instance_writer: false
80
- def nested_subforms=(*)
81
- ActiveSupport::Deprecation.warn 'Nested subforms are enabled by default already'
82
- end
83
78
 
84
79
  def self.root
85
80
  "#{File.dirname(__FILE__)}/.."
@@ -88,6 +83,14 @@ module ActiveScaffold
88
83
  def self.defaults(&block)
89
84
  ActiveScaffold::Config::Core.configure(&block)
90
85
  end
86
+
87
+ def self.deprecator
88
+ @deprecator ||= ActiveSupport::Deprecation.new('4.1', 'ActiveScaffold')
89
+ end
90
+
91
+ class << self
92
+ ActiveScaffold.deprecator.deprecate_methods self, :nested_subforms= => 'is enabled always', threadsafe!: 'is enabled always'
93
+ end
91
94
  end
92
95
  require 'active_scaffold/engine'
93
96
  require 'ice_nine'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_scaffold
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.rc3
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Many, see README
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-08 00:00:00.000000000 Z
11
+ date: 2025-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -114,6 +114,7 @@ files:
114
114
  - app/views/active_scaffold_overrides/_create_form.html.erb
115
115
  - app/views/active_scaffold_overrides/_create_form_on_list.html.erb
116
116
  - app/views/active_scaffold_overrides/_field_search.html.erb
117
+ - app/views/active_scaffold_overrides/_field_search_columns.html.erb
117
118
  - app/views/active_scaffold_overrides/_form.html.erb
118
119
  - app/views/active_scaffold_overrides/_form_association.html.erb
119
120
  - app/views/active_scaffold_overrides/_form_association_footer.html.erb