active_scaffold 3.4.33 → 3.4.34
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +10 -0
- data/app/assets/javascripts/jquery/active_scaffold.js +2 -2
- data/lib/active_scaffold/actions/common_search.rb +1 -1
- data/lib/active_scaffold/actions/list.rb +3 -1
- data/lib/active_scaffold/actions/nested.rb +2 -1
- data/lib/active_scaffold/actions/update.rb +3 -1
- data/lib/active_scaffold/bridges/shared/date_bridge.rb +17 -11
- data/lib/active_scaffold/data_structures/column.rb +11 -5
- data/lib/active_scaffold/engine.rb +2 -0
- data/lib/active_scaffold/helpers/human_condition_helpers.rb +1 -1
- data/lib/active_scaffold/helpers/search_column_helpers.rb +1 -1
- data/lib/active_scaffold/tableless.rb +1 -1
- data/lib/active_scaffold/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5831aedbc0ccb79952a771522d0a768fdf0162cd
|
4
|
+
data.tar.gz: 49eae4e8f8fa5aaf500b3217fbc9581379904131
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4a7f15f906733e041f3fdc3fe19f02bd425476735a7513048b425ee830d7617f5ac4ef958a4df30ea9413f85a3d4f72f06a93b4fa8834fc11e04bd39c12921c
|
7
|
+
data.tar.gz: 8d4b52569bad66e17e3f7230d48592175d35ca20e8855e8ec8e29c9a27327c886128ff848e9ba1917f8300389b6661a5364ab523097ea3f7faf8def0cb1c65c9
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
= 3.4.34
|
2
|
+
- Fix past, future and range on field search with rails 4, local time was used instead of UTC
|
3
|
+
- Ignore search params when params[:id] is set
|
4
|
+
- Eager load HABTM with scope using left join
|
5
|
+
- Add active_scaffold/indicator.gif to precompile so rails 4.2 precompiles it
|
6
|
+
- Add support for ActiveRecord::Enum so :select form_ui is used by default
|
7
|
+
- Fix nested link on self-association belongs_to for rails >= 4.1
|
8
|
+
- Fix update_column for boolean columns with default true on rails 4.2
|
9
|
+
- Fix columns lost on tableless models on rails 4.2
|
10
|
+
|
1
11
|
= 3.4.33
|
2
12
|
- Fix _base_form when used with actions, so :multipart and :persistent can set to false instead of getting them from action config
|
3
13
|
- Copy update.columns from create.columns, if not defined
|
@@ -199,7 +199,7 @@ jQuery(document).ready(function($) {
|
|
199
199
|
});
|
200
200
|
jQuery(document).on('ajax:complete', '.action_group.dyn > ul a', function(event) {
|
201
201
|
var action_link = ActiveScaffold.find_action_link(event.target);
|
202
|
-
if (action_link.loading_indicator) action_link.loading_indicator.css('visibility','hidden');
|
202
|
+
if (action_link && action_link.loading_indicator) action_link.loading_indicator.css('visibility','hidden');
|
203
203
|
jQuery(event.target).closest('.action_group.dyn > ul').remove();
|
204
204
|
});
|
205
205
|
|
@@ -984,7 +984,7 @@ var ActiveScaffold = {
|
|
984
984
|
complete: function(xhr, status) {
|
985
985
|
element = as_form.find('#'+element.attr('id'));
|
986
986
|
element.nextAll('img.loading-indicator').css('visibility','hidden');
|
987
|
-
var complete_element = element.length ? element : as_form;
|
987
|
+
var complete_element = element.length ? element : as_form;
|
988
988
|
complete_element.trigger('ajax:complete', [xhr, status]);
|
989
989
|
if (ActiveScaffold.last_focus) {
|
990
990
|
var item = jQuery(ActiveScaffold.last_focus);
|
@@ -38,7 +38,7 @@ module ActiveScaffold::Actions
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def search_params
|
41
|
-
@search_params || active_scaffold_session_storage['search']
|
41
|
+
@search_params || active_scaffold_session_storage['search'] unless params[:id]
|
42
42
|
end
|
43
43
|
|
44
44
|
# The default security delegates to ActiveRecordPermissions.
|
@@ -73,7 +73,9 @@ module ActiveScaffold::Actions
|
|
73
73
|
active_scaffold_config.send(action).columns.collect_visible(:flatten => true)
|
74
74
|
end
|
75
75
|
sorting = active_scaffold_config.list.user.sorting
|
76
|
-
columns_for_joins, columns_for_includes = columns.select { |c| c.includes.present? }.partition
|
76
|
+
columns_for_joins, columns_for_includes = columns.select { |c| c.includes.present? }.partition do |c|
|
77
|
+
sorting.sorts_on?(c) || (c.plural_association? && c.association.macro == :has_and_belongs_to_many && c.association.scope)
|
78
|
+
end
|
77
79
|
active_scaffold_preload.concat columns_for_includes.map(&:includes).flatten.uniq
|
78
80
|
active_scaffold_references.concat columns_for_joins.map(&:includes).flatten.uniq
|
79
81
|
end
|
@@ -91,7 +91,8 @@ module ActiveScaffold::Actions
|
|
91
91
|
table_name =
|
92
92
|
if active_scaffold_config.model == nested.association.active_record
|
93
93
|
dependency = ActiveRecord::Associations::JoinDependency.new(chain.klass, chain.joins_values, [])
|
94
|
-
|
94
|
+
join_associations = Rails.version >= '4.1.0' ? dependency.join_root.children : dependency.join_associations
|
95
|
+
join_associations.find {|join| join.try(:reflection).try(:name) == nested.child_association.name}.try(:table).try(:right)
|
95
96
|
end
|
96
97
|
table_name ||= nested.association.active_record.table_name
|
97
98
|
chain.where(table_name => {nested.association.active_record.primary_key => nested_parent_record}).readonly(false)
|
@@ -144,7 +144,9 @@ module ActiveScaffold::Actions
|
|
144
144
|
|
145
145
|
value ||=
|
146
146
|
unless @column.column.nil? || @column.column.null
|
147
|
-
|
147
|
+
default_val = @column.column.default
|
148
|
+
default_val = @column.column.cast_type.type_cast_from_user default_val if Rails.version >= '4.2.0'
|
149
|
+
default_val == true ? false : default_val
|
148
150
|
end
|
149
151
|
unless @column.nil?
|
150
152
|
value = column_value_from_param_value(@record, @column, value)
|
@@ -76,18 +76,18 @@ module ActiveScaffold
|
|
76
76
|
|
77
77
|
module HumanConditionHelpers
|
78
78
|
def active_scaffold_human_condition_date_bridge(column, value)
|
79
|
-
case value[
|
79
|
+
case value['opt']
|
80
80
|
when 'RANGE'
|
81
|
-
range_type, range = value[
|
81
|
+
range_type, range = value['range'].downcase.split('_')
|
82
82
|
format = active_scaffold_human_condition_date_bridge_range_format(range_type, range)
|
83
83
|
from, to = controller.class.date_bridge_from_to(column, value)
|
84
|
-
"#{column.active_record_class.human_attribute_name(column.name)} = #{as_(value[
|
84
|
+
"#{column.active_record_class.human_attribute_name(column.name)} = #{as_(value['range'].downcase).downcase} (#{I18n.l(from, :format => format)})"
|
85
85
|
when 'PAST', 'FUTURE'
|
86
86
|
from, to = controller.class.date_bridge_from_to(column, value)
|
87
87
|
"#{column.active_record_class.human_attribute_name(column.name)} #{as_('BETWEEN'.downcase).downcase} #{I18n.l(from)} - #{I18n.l(to)}"
|
88
88
|
else
|
89
89
|
from, to = controller.class.date_bridge_from_to(column, value)
|
90
|
-
"#{column.active_record_class.human_attribute_name(column.name)} #{as_(value[
|
90
|
+
"#{column.active_record_class.human_attribute_name(column.name)} #{as_(value['opt'].downcase).downcase} #{I18n.l(from)} #{value['opt'] == 'BETWEEN' ? '- ' + I18n.l(to) : ''}"
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
@@ -113,7 +113,7 @@ module ActiveScaffold
|
|
113
113
|
module Finder
|
114
114
|
module ClassMethods
|
115
115
|
def condition_for_date_bridge_type(column, value, like_pattern)
|
116
|
-
operator = ActiveScaffold::Finder::NUMERIC_COMPARATORS.include?(value[
|
116
|
+
operator = ActiveScaffold::Finder::NUMERIC_COMPARATORS.include?(value['opt']) && value['opt'] != 'BETWEEN' ? value['opt'] : nil
|
117
117
|
from_value, to_value = date_bridge_from_to(column, value)
|
118
118
|
|
119
119
|
if column.search_sql.is_a? Proc
|
@@ -122,18 +122,24 @@ module ActiveScaffold
|
|
122
122
|
if operator.nil?
|
123
123
|
['%{search_sql} BETWEEN ? AND ?', from_value.to_s(:db), to_value.to_s(:db)] unless from_value.nil? || to_value.nil?
|
124
124
|
else
|
125
|
-
["%{search_sql} #{value[
|
125
|
+
["%{search_sql} #{value['opt']} ?", from_value.to_s(:db)] unless from_value.nil?
|
126
126
|
end
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
130
130
|
def date_bridge_from_to(column, value)
|
131
131
|
conversion = datetime_conversion_for_condition(column)
|
132
|
-
case value[
|
132
|
+
case value['opt']
|
133
133
|
when 'RANGE'
|
134
|
-
date_bridge_from_to_for_range(column, value)
|
134
|
+
values = date_bridge_from_to_for_range(column, value)
|
135
|
+
# Avoid calling to_time, not needed and broken on rails >= 4, because return local time instead of UTC
|
136
|
+
values.collect!(&conversion) if conversion != :to_time
|
137
|
+
values
|
135
138
|
when 'PAST', 'FUTURE'
|
136
|
-
date_bridge_from_to_for_trend(column, value)
|
139
|
+
values = date_bridge_from_to_for_trend(column, value)
|
140
|
+
# Avoid calling to_time, not needed and broken on rails >= 4, because return local time instead of UTC
|
141
|
+
values.collect!(&conversion) if conversion != :to_time
|
142
|
+
values
|
137
143
|
else
|
138
144
|
%w(from to).collect { |field| condition_value_for_datetime(column, value[field], conversion) }
|
139
145
|
end
|
@@ -171,7 +177,7 @@ module ActiveScaffold
|
|
171
177
|
end
|
172
178
|
|
173
179
|
def date_bridge_from_to_for_range(column, value)
|
174
|
-
case value[
|
180
|
+
case value['range']
|
175
181
|
when 'TODAY'
|
176
182
|
return date_bridge_now.beginning_of_day, date_bridge_now.end_of_day
|
177
183
|
when 'YESTERDAY'
|
@@ -179,7 +185,7 @@ module ActiveScaffold
|
|
179
185
|
when 'TOMORROW'
|
180
186
|
return date_bridge_now.in(1.day).beginning_of_day, date_bridge_now.in(1.day).end_of_day
|
181
187
|
else
|
182
|
-
range_type, range = value[
|
188
|
+
range_type, range = value['range'].downcase.split('_')
|
183
189
|
raise ArgumentError unless %w(week month year).include?(range)
|
184
190
|
case range_type
|
185
191
|
when 'this'
|
@@ -14,6 +14,8 @@ module ActiveScaffold::DataStructures
|
|
14
14
|
@inplace_edit = value
|
15
15
|
end
|
16
16
|
|
17
|
+
# :table to refresh list
|
18
|
+
# true or :row to refresh row
|
17
19
|
attr_accessor :inplace_edit_update
|
18
20
|
|
19
21
|
# Whether this column set is collapsed by default in contexts where collapsing is supported
|
@@ -335,14 +337,18 @@ module ActiveScaffold::DataStructures
|
|
335
337
|
|
336
338
|
@text = @column.nil? || [:string, :text].include?(@column.type)
|
337
339
|
if @column
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
if @column.number?
|
340
|
+
if active_record_class.respond_to?(:defined_enums) && active_record_class.defined_enums[name.to_s]
|
341
|
+
@form_ui = :select
|
342
|
+
@options = {:options => active_record_class.send(name.to_s.pluralize).keys}
|
343
|
+
elsif @column.number?
|
343
344
|
@number = true
|
344
345
|
@form_ui = :number
|
345
346
|
@options = {:format => :i18n_number}
|
347
|
+
else
|
348
|
+
@form_ui = case @column.type
|
349
|
+
when :boolean then :checkbox
|
350
|
+
when :text then :textarea
|
351
|
+
end
|
346
352
|
end
|
347
353
|
end
|
348
354
|
@allow_add_existing = true
|
@@ -3,7 +3,7 @@ module ActiveScaffold
|
|
3
3
|
# Helpers that assist with rendering of a human readable search statement
|
4
4
|
module HumanConditionHelpers
|
5
5
|
def active_scaffold_human_condition_for(column)
|
6
|
-
return if (value = field_search_params[column.name]).nil?
|
6
|
+
return if (value = field_search_params[column.name.to_s]).nil?
|
7
7
|
search_ui = column.search_ui
|
8
8
|
search_ui ||= column.column.type if column.column
|
9
9
|
if override_human_condition_column?(column)
|
@@ -54,7 +54,7 @@ module ActiveScaffold
|
|
54
54
|
|
55
55
|
# the standard active scaffold options used for class, name and scope
|
56
56
|
def active_scaffold_search_options(column)
|
57
|
-
{:name => "search[#{column.name}]", :class => "#{column.name}-input", :id => "search_#{column.name}", :value => field_search_params[column.name]}
|
57
|
+
{:name => "search[#{column.name}]", :class => "#{column.name}-input", :id => "search_#{column.name}", :value => field_search_params[column.name.to_s]}
|
58
58
|
end
|
59
59
|
|
60
60
|
def search_attribute(column, record)
|
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.4.
|
4
|
+
version: 3.4.34
|
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: 2016-
|
11
|
+
date: 2016-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 3.2.
|
33
|
+
version: 3.2.22.2
|
34
34
|
- - <
|
35
35
|
- !ruby/object:Gem::Version
|
36
36
|
version: '5'
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
requirements:
|
41
41
|
- - '>='
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 3.2.
|
43
|
+
version: 3.2.22.2
|
44
44
|
- - <
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '5'
|