active_scaffold 4.0.0.rc3 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ce97fc27fd6db228fc8c934c9559a9af750b0e19837c5eb30e6bb868fc108ef
4
- data.tar.gz: d3568381187bb6ab2fb1245d5588063a09db42057704d0645abd5e04139f2cf2
3
+ metadata.gz: 18ae38a98f317aedf4c54ade9d6cf3090b9de8e7042104dbe8493b10f173603a
4
+ data.tar.gz: 63548a6d7f130d6771818f8387be0b548e74bcd1ed7dc856733b3f72c2a96fda
5
5
  SHA512:
6
- metadata.gz: 445f89948894b2989ce7f20efb69ce649b1bbd045a124b7c0243e1ea8e4168922a54b901ee653a51fde2ad7b61b3014fa47521d62fa17120ab58671032a7afb4
7
- data.tar.gz: ab62a6b00a0c403eeaa4bc94c346fa46871350d4b9a5ebcbe7d6d9c63c7e8d8b862f5083ba5c3045ff3ce533ea015e441f8adea9d35c7d6807d876a88202043f
6
+ metadata.gz: e1380da8c13475de3a825f828bb3d9109a52690f45d49cabd1be5bcbb138a2f36d985a676b9637e8a992a6ee551dc0f204b9103916e17845ee3990673219ab2c
7
+ data.tar.gz: 1861237d6327330311899eb90f0f4e8baee3cf81287f6336fb2c0634ab86073c41fa3838b7c2f923a11093e43ae07d074ac0a1a68bdc8df0ed1b23f91356bee2
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,7 @@
1
+ - Add :text_editor show_ui, to avoid escaping html code
2
+ - Fix action link on association column named record
3
+
4
+ = 4.0.0
1
5
  - Add tabbed_by to group of columns in forms. The columns in the group must be collection associations, with a common column or association, used to partition them in different tabs.
2
6
  - Fix tableless in rails >= 7.1
3
7
  - Stop using cow_proxy for thread safety:
@@ -5,8 +9,12 @@
5
9
  - Action links can't be changed, added or removed, add all links and use ignore_method to control when they are displayed
6
10
  - Require using active_scaffold_config.override_columns to exclude or add columns
7
11
  - Thread safety enabled by default, can't be disabled, deprecate ActiveScaffold.threadsafe!
12
+ - Support subgroups on field search
13
+
14
+ = 3.7.11.1
15
+ - Fix action link on association column named record
8
16
 
9
- = 3.7.11 (not released yet)
17
+ = 3.7.11
10
18
  - Add partial list_messages_content to reduce code duplication, and better support replacing list view with other way to render records
11
19
  - Support selector for records body in create_record_row JS method, better support replacing list view with other way to render records
12
20
  - 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;
@@ -1298,8 +1301,8 @@
1298
1301
  if (element.length > 0) {
1299
1302
  element.data(); // $ 1.4.2 workaround
1300
1303
  if (typeof(element.data('action_link')) === 'undefined' && !element.hasClass('as_adapter')) {
1301
- var parent = element.closest('.record');
1302
- if (parent.length === 0) parent = element.closest('.actions');
1304
+ var parent = element.parent().closest('.record');
1305
+ if (parent.length === 0) parent = element.parent().closest('.actions');
1303
1306
  if (parent.is('.record')) {
1304
1307
  // record action
1305
1308
  var target = parent.find('a.as_action');
@@ -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>
@@ -14,14 +14,13 @@ module ActiveScaffold::Actions
14
14
  # don't apply if scope, subform inside subform, because constraints won't apply to parent_record
15
15
  apply_constraints_to_record parent_record unless @scope
16
16
  create_association_with_parent parent_record, check_match: true if nested?
17
+ cache_generated_id(parent_record, params[:generated_id])
17
18
  parent_record
18
19
  end
19
20
 
20
21
  def do_edit_associated
21
22
  @scope = params[:scope]
22
23
  @parent_record = params[:id].nil? ? new_parent_record : find_if_allowed(params[:id], :update)
23
-
24
- cache_generated_id(@parent_record, params[:generated_id]) if @parent_record.new_record?
25
24
  @column = active_scaffold_config.columns[params[:child_association]]
26
25
 
27
26
  @record = (find_associated_record if params[:associated_id]) ||
@@ -36,5 +36,14 @@ class ActiveScaffold::Bridges::TinyMce
36
36
  base.class_eval { alias_method :active_scaffold_search_text_editor, :active_scaffold_search_text }
37
37
  end
38
38
  end
39
+
40
+ module ShowColumnHelpers
41
+ def active_scaffold_show_text_editor(record, column, ui_options: column.options)
42
+ record.send(column.name).html_safe # rubocop:disable Rails/OutputSafety
43
+ end
44
+
45
+ # Alias, in case the column uses :tinymce form_ui
46
+ alias active_scaffold_show_tinymce active_scaffold_show_text_editor
47
+ end
39
48
  end
40
49
  end
@@ -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
@@ -2,8 +2,8 @@ module ActiveScaffold
2
2
  module Version
3
3
  MAJOR = 4
4
4
  MINOR = 0
5
- PATCH = 0
6
- FIX = 'rc3'.freeze
5
+ PATCH = 1
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.1
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-02-11 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