active_scaffold 3.6.0 → 3.6.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: 0c98847307a3be61b8137eba789a6e1779c2c9dccc9190b8c4d50428d6dffd33
4
- data.tar.gz: f82b68052234f72ac8bc715eb88f7aabaed422e8ef8b929b63244e9d3cf5500d
3
+ metadata.gz: f4c1c30d71374c44ba52365fd42ce5e355d0a247581d210098efe40ac62f1b61
4
+ data.tar.gz: ca952b27376c9a12b12b3e9bcfde73c33fd0976f4e3490a3a3d1c2a97d1db0bd
5
5
  SHA512:
6
- metadata.gz: a60af5b75baee4785e3ad1bc3353a59db2e2677aa14f82eabac52dd5d732486185731e1f2e66cb35f3bf3ebac14322ea3038bdca39c497bd163a600566d13198
7
- data.tar.gz: 59bddf1ef940582d370591bd4003408505733abd2c45f7cac115f3033d8925266f92339c1deb6aae2c484a73ebe27e137d6b518b3199064fea187f5726f35ba4
6
+ metadata.gz: 72400accea68b295f7b8fe5b1da561d98111d7026a8f63062fe6cec0d949cc9f93108231e09f443214f4079698aba0e1ab0b736df1e0a611b6c1289713516847
7
+ data.tar.gz: 46e0658d19bf28f6f71a01a540fdb98cae584d8d72153f828e30c68ff92c8723e72c19bc22e99981082faed49455ca8768f6416a2e6366f4a6b0b29552b9ab2c
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,9 @@
1
+ - Display group cols vertically when subform layout is vertical
2
+ - Fix html attributes for input datetime on field search, when jquery ui is not used
3
+ - Fix constraint columns for nested list on through assocaitions
4
+ - Support rails 6.1
5
+
6
+ = 3.6.0
1
7
  - Fix i18n at ruby 3.0.0
2
8
  - Add list helper for bitfield column, so it display labels of selected checkboxes in list
3
9
  - Support rails 6.0
data/README.md CHANGED
@@ -13,10 +13,9 @@ ActiveScaffold provides a quick and powerful user interfaces for CRUD (create, r
13
13
 
14
14
  Branch Details
15
15
  --------------
16
- 3-6-stable supports rails >= 4.2.x and ruby >= 2.3.0
17
- 3-5-stable supports rails >= 4.0.x and ruby >= 2.0.0
18
- 3-4-stable supports rails >= 3.2.x and ruby >= 1.9.3
19
- 3-3-stable supports rails >= 3.2.x and ruby >= 1.8
16
+ 3-5-stable supports rails >= 4.0.x and <= 5.1.x, and ruby >= 2.0.0
17
+ 3-4-stable supports rails >= 3.2.x and <= 4.2.x, and ruby >= 1.9.3
18
+ 3-3-stable supports rails 3.2.x and ruby >= 1.8
20
19
  rails-3.2 supports Rails 3.1 & 3.2, and is the current source of the 3.2.x line of gems.
21
20
 
22
21
  Quick Start
@@ -84,10 +84,24 @@
84
84
 
85
85
  <% columns_groups.each do |columns_group| %>
86
86
  <%= content_tag row_tag, :class => 'associated-record' do %>
87
- <%= content_tag column_tag, :colspan => (columns_length if column_tag == :td) do %>
88
- <% columns_group.each_column(for: record.class, crud_type: :read, flatten: true) do |col| %>
89
- <%= active_scaffold_render_subform_column(col, scope, crud_type, readonly, true, record) %>
90
- <% end %>
87
+ <% if layout == :vertical %>
88
+ <% columns_group.each_column(for: record.class, crud_type: :read, flatten: true) do |col| %>
89
+ <%
90
+ col_class = default_col_class.clone
91
+ col_class << 'required' if col.required?
92
+ col_class << col.css_class unless col.css_class.nil? || col.css_class.is_a?(Proc)
93
+ col_class << 'hidden' if column_renders_as(col) == :hidden
94
+ %>
95
+ <%= content_tag column_tag, :class => col_class, :colspan => (columns_length if column_tag == :td) do %>
96
+ <%= active_scaffold_render_subform_column(col, scope, crud_type, readonly, false, record) %>
97
+ <% end %>
98
+ <% end %>
99
+ <% else %>
100
+ <%= content_tag column_tag, :colspan => (columns_length if column_tag == :td) do %>
101
+ <% columns_group.each_column(for: record.class, crud_type: :read, flatten: true) do |col| %>
102
+ <%= active_scaffold_render_subform_column(col, scope, crud_type, readonly, true, record) %>
103
+ <% end %>
104
+ <% end %>
91
105
  <% end %>
92
106
  <% end %>
93
107
  <% end %>
@@ -131,8 +131,8 @@ module ActiveScaffold::DataStructures
131
131
  protected
132
132
 
133
133
  def setup_constrained_fields
134
- @constrained_fields = Array(association.foreign_key).map(&:to_sym) unless association.belongs_to?
135
- @constrained_fields ||= []
134
+ @constrained_fields = [] if association.belongs_to? || association.through?
135
+ @constrained_fields ||= Array(association.foreign_key).map(&:to_sym)
136
136
  return unless child_association && child_association != association
137
137
 
138
138
  @constrained_fields << child_association.name
@@ -245,16 +245,23 @@ module ActiveScaffold
245
245
  options = column.options.merge(options)
246
246
  type = "#{'date' unless options[:discard_date]}#{'time' unless options[:discard_time]}"
247
247
  use_select = options.delete(:use_select)
248
- helper = use_select ? "select_#{type}" : "#{type}#{'_local' if type == 'datetime'}_field"
248
+ from_name = "#{options[:name]}[from]"
249
+ to_name = "#{options[:name]}[to]"
249
250
  if use_select
250
- default_from_options = {include_blank: true, prefix: "#{options[:name]}[from]"}
251
- default_to_options = {include_blank: true, prefix: "#{options[:name]}[to]"}
251
+ helper = "select_#{type}"
252
+ fields = [
253
+ send(helper, field_search_datetime_value(from_value), options.reverse_merge(include_blank: true, prefix: from_name)),
254
+ send(helper, field_search_datetime_value(to_value), options.reverse_merge(include_blank: true, prefix: to_name))
255
+ ]
256
+ else
257
+ helper = "#{type}#{'_local' if type == 'datetime'}_field_tag"
258
+ fields = [
259
+ send(helper, from_name, field_search_datetime_value(from_value), options.except(:name, :object).merge(id: "#{options[:id]}_from")),
260
+ send(helper, to_name, field_search_datetime_value(to_value), options.except(:name, :object).merge(id: "#{options[:id]}_to"))
261
+ ]
252
262
  end
253
263
 
254
- safe_join [
255
- send(helper, field_search_datetime_value(from_value), options.reverse_merge(default_from_options || {})),
256
- send(helper, field_search_datetime_value(to_value), options.reverse_merge(default_to_options || {}))
257
- ], ' - '
264
+ safe_join fields, ' - '
258
265
  end
259
266
 
260
267
  def active_scaffold_search_date(column, options)
@@ -44,7 +44,7 @@ class ActiveScaffold::Tableless < ActiveRecord::Base # rubocop:disable Rails/App
44
44
 
45
45
  class Column < ActiveRecord::ConnectionAdapters::Column
46
46
  if Rails.version >= '5.0.0'
47
- def initialize(name, default, sql_type = nil, null = true)
47
+ def initialize(name, default, sql_type = nil, null = true, **)
48
48
  metadata = ActiveRecord::Base.connection.send :fetch_type_metadata, sql_type
49
49
  super(name, default, metadata, null)
50
50
  end
@@ -2,7 +2,7 @@ module ActiveScaffold
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 6
5
- PATCH = 0
5
+ PATCH = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
@@ -3,7 +3,7 @@ require 'test_helper'
3
3
  module ModelStubs
4
4
  class ModelStub < ActiveRecord::Base
5
5
  self.abstract_class = true
6
- def self.columns; @columns ||= [ColumnMock.new('foo', '')] end
6
+ def self.columns; @columns ||= [ColumnMock.new('foo', '', 'string')] end
7
7
 
8
8
  def self.columns_hash; @hash ||= Hash[@columns.map { |c| [c.name, c] }] end
9
9
 
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: 3.6.0
4
+ version: 3.6.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: 2021-03-21 00:00:00.000000000 Z
11
+ date: 2021-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -17,6 +17,9 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 4.2.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '6.2'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -24,6 +27,9 @@ dependencies:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: 4.2.0
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '6.2'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: cow_proxy
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -469,8 +475,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
469
475
  - !ruby/object:Gem::Version
470
476
  version: '0'
471
477
  requirements: []
472
- rubyforge_project:
473
- rubygems_version: 2.7.11
478
+ rubygems_version: 3.0.8
474
479
  signing_key:
475
480
  specification_version: 4
476
481
  summary: Rails 4.x and 5.x versions of ActiveScaffold supporting prototype and jquery