active_scaffold 3.6.0 → 3.6.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c98847307a3be61b8137eba789a6e1779c2c9dccc9190b8c4d50428d6dffd33
4
- data.tar.gz: f82b68052234f72ac8bc715eb88f7aabaed422e8ef8b929b63244e9d3cf5500d
3
+ metadata.gz: c2aecb1c0513a318aeaa726f5c077b7b8f31608861890f316615187e6e53e7a8
4
+ data.tar.gz: de1535be3e41666fcf2e7a9a50b61a39d328466f3094a8d0089a83fe8ab56c98
5
5
  SHA512:
6
- metadata.gz: a60af5b75baee4785e3ad1bc3353a59db2e2677aa14f82eabac52dd5d732486185731e1f2e66cb35f3bf3ebac14322ea3038bdca39c497bd163a600566d13198
7
- data.tar.gz: 59bddf1ef940582d370591bd4003408505733abd2c45f7cac115f3033d8925266f92339c1deb6aae2c484a73ebe27e137d6b518b3199064fea187f5726f35ba4
6
+ metadata.gz: 29d77b4bdf5901be5b856242aee5a511208541dd7ef70e83e06ad0c411999406ab39e4bfe2ed864ed88da8d0aa7369df023b823f00be9dfdfa87a0e6b44e06e4
7
+ data.tar.gz: e00f0ade90a6a1a4e62f7b3590bd039aed8d8b5d9a00f9d6d1e12d68662aed6be672aec16563bd5014bda61810e3cedcbbb178070b052e2f8a5eb26bbc46b2b9
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,22 @@
1
+ = 3.6.4
2
+ - Fix country_select bridge for latest gem version
3
+
4
+ = 3.6.3
5
+ - Fix search on nested or embedded lists with rails_ujs
6
+ - Fix inplace edit when collection action link opens a view with table and th
7
+
8
+ = 3.6.2
9
+ - Fix count query when association's primary key is string
10
+ - Fix unauthorized_columns and constraint_columns with threadsafe enabled
11
+ - Fix changing list.sorting and column.sort_by per request when threadsafe is enabled
12
+
13
+ = 3.6.1
14
+ - Display group cols vertically when subform layout is vertical
15
+ - Fix html attributes for input datetime on field search, when jquery ui is not used
16
+ - Fix constraint columns for nested list on through assocaitions
17
+ - Support rails 6.1
18
+
19
+ = 3.6.0
1
20
  - Fix i18n at ruby 3.0.0
2
21
  - Add list helper for bitfield column, so it display labels of selected checkboxes in list
3
22
  - Support rails 6.0
data/README.md CHANGED
@@ -9,14 +9,13 @@ Overview
9
9
  [![Inline docs](https://inch-ci.org/github/activescaffold/active_scaffold.svg?branch=master)](https://inch-ci.org/github/activescaffold/active_scaffold)
10
10
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
11
11
 
12
- ActiveScaffold provides a quick and powerful user interfaces for CRUD (create, read, update, delete) operations for Rails applications. It offers additonal features including searching, pagination & layout control. Rails >= 4.2.0 and Rails < 6.1 is supported, ruby >= 2.3 required.
12
+ ActiveScaffold provides a quick and powerful user interfaces for CRUD (create, read, update, delete) operations for Rails applications. It offers additonal features including searching, pagination & layout control. Rails >= 4.2.0 and Rails <= 6.1 is supported, ruby >= 2.3 required.
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
@@ -1024,7 +1024,7 @@ var ActiveScaffold = {
1024
1024
 
1025
1025
  if (my_parent.is('td')) {
1026
1026
  var column_no = my_parent.prevAll('td').length;
1027
- column_heading = my_parent.closest('.active-scaffold').find('th:eq(' + column_no + ')');
1027
+ column_heading = my_parent.closest('table').find('th:eq(' + column_no + ')');
1028
1028
  } else if (my_parent.is('th')) {
1029
1029
  column_heading = my_parent;
1030
1030
  }
@@ -9,8 +9,16 @@
9
9
  data: {loading: true},
10
10
  method: :get
11
11
  }
12
+
13
+ hidden_params = url_options.except(:controller, :action, :id, :search).to_query.split(Rack::Utils::DEFAULT_SEP)
12
14
  -%>
15
+
13
16
  <%= form_tag url_options, options %>
17
+ <% hidden_params.each do |pair| -%>
18
+ <% key, value = pair.split('=', 2).map { |str| Rack::Utils.unescape(str) } -%>
19
+ <%= hidden_field_tag(key, value) %>
20
+ <% end -%>
21
+
14
22
  <ol class="form">
15
23
  <% visibles, hiddens = visibles_and_hiddens(active_scaffold_config.field_search) %>
16
24
  <% visibles.each do |column| -%>
@@ -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 %>
@@ -10,8 +10,15 @@
10
10
  data: {loading: true},
11
11
  method: :get
12
12
  }
13
+
14
+ hidden_params = url_options.except(:controller, :action, :id, :search).to_query.split(Rack::Utils::DEFAULT_SEP)
13
15
  -%>
16
+
14
17
  <%= form_tag url_options, options do %>
18
+ <% hidden_params.each do |pair| -%>
19
+ <% key, value = pair.split('=', 2).map { |str| Rack::Utils.unescape(str) } -%>
20
+ <%= hidden_field_tag(key, value) %>
21
+ <% end -%>
15
22
  <%= search_field_tag :search, (search_params if search_params.is_a? String), :class => 'text-input', :id => search_input_id, :size => 50, :autocomplete => :off, :placeholder => as_(live_search ? :live_search : :search_terms) %>
16
23
  <%= submit_tag as_(submit_text), :class => "submit", :style => ('display:none;' if live_search) %>
17
24
  <%= link_to as_(:reset), url_for(url_options.merge(:search => '')), :class => 'as_cancel reset', :remote => true, :data => {:refresh => true} unless local_assigns[:skip_reset] %>
@@ -161,7 +161,7 @@ module ActiveScaffold::Actions
161
161
 
162
162
  def count_query_on_association_class(column)
163
163
  key = column.association.primary_key || :id
164
- query = column.association.klass.where(column.association.foreign_key => @records.map(&key))
164
+ query = column.association.klass.where(column.association.foreign_key => @records.map(&key.to_sym))
165
165
  if column.association.as
166
166
  query.where!(column.association.reverse_association.foreign_type => active_scaffold_config.model.name)
167
167
  end
@@ -2,7 +2,8 @@ module ActiveScaffold::Bridges
2
2
  class CountrySelect
3
3
  module FormColumnHelpers
4
4
  def active_scaffold_input_country(column, options)
5
- select_options = {:prompt => as_(:_select_), :priority_countries => column.options[:priority] || [:us], :format => column.options[:format]}
5
+ select_options = {:prompt => as_(:_select_), :priority_countries => column.options[:priority] || [:us]}
6
+ select_options[:format] = column.options[:format]
6
7
  select_options.merge!(options)
7
8
  options.reverse_merge!(column.options).except!(:prompt, :priority, :format)
8
9
  active_scaffold_select_name_with_multiple options
@@ -292,7 +292,7 @@ module ActiveScaffold::Config
292
292
  @_sorting = sorting
293
293
  else
294
294
  @_sorting = default_sorting
295
- @_sorting.set(@sorting) if @sorting
295
+ @_sorting.set(*@sorting) if @sorting
296
296
  if @conf.columns.constraint_columns.present?
297
297
  @_sorting.constraint_columns = @conf.columns.constraint_columns
298
298
  end
@@ -124,7 +124,7 @@ module ActiveScaffold::DataStructures
124
124
  end
125
125
 
126
126
  def action_name
127
- @action.class.name.demodulize.underscore
127
+ @action.user_settings_key
128
128
  end
129
129
 
130
130
  def columns_key
@@ -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
@@ -18,10 +18,6 @@ module CowProxy
18
18
  end
19
19
  super
20
20
  end
21
-
22
- def sort_by(options)
23
- @sort = options
24
- end
25
21
  end
26
22
 
27
23
  class Set < ::CowProxy::WrapClass(::ActiveScaffold::DataStructures::Set)
@@ -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 = 4
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
@@ -5,7 +5,7 @@ require 'test_helper'
5
5
  class ActionColumnsTest < MiniTest::Test
6
6
  def setup
7
7
  @columns = ActiveScaffold::DataStructures::ActionColumns.new(%i[a b])
8
- @columns.action = stub(:core => stub(:model_id => 'model_stub'))
8
+ @columns.action = stub(core: stub(model_id: 'model_stub'), user_settings_key: :"model_stub_active_scaffold/config/test")
9
9
  end
10
10
 
11
11
  def test_label
@@ -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.4
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: 2022-02-11 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.9
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