active_scaffold 3.4.16 → 3.4.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +4 -0
- data/app/assets/stylesheets/{active_scaffold-ie.css.scss → active_scaffold-ie.scss} +0 -0
- data/app/assets/stylesheets/{active_scaffold.css.scss → active_scaffold.scss} +0 -0
- data/app/assets/stylesheets/{active_scaffold_colors.css.scss → active_scaffold_colors.scss} +0 -0
- data/app/assets/stylesheets/{active_scaffold_images.css.scss → active_scaffold_images.scss} +0 -0
- data/lib/active_scaffold/actions/mark.rb +4 -4
- data/lib/active_scaffold/core.rb +4 -2
- data/lib/active_scaffold/finder.rb +19 -19
- data/lib/active_scaffold/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b1be864fa28fa3a7caca50a268de1ecd1070426
|
4
|
+
data.tar.gz: db83b56413734d2fdc7aab465efa47b89dd3edfe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f98c93d4d03d4347e73dd18793629c1bc8cb16ee6b0ee900a130b86f9c7e27f6aec751d67cf2abd255d74a087bab3af16f54466ddcbf17d2ec5cab568b947171
|
7
|
+
data.tar.gz: 36e97b6c0e09d2aecb3f27d63690e0bcbea16239d371ccd6711820de75ab059b43796e2a3af63b69c206143e25e7efc9e43d3cbc374ea6ba7743c9f0fb8181c7
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
= 3.4.17
|
2
|
+
- Fix deprecation warning "Extra .css in SCSS file is unnecessary"
|
3
|
+
- Improve support for namespaced models on namespaced controllers with different namespace
|
4
|
+
|
1
5
|
= 3.4.16
|
2
6
|
- add scoped_query to list methods, so it can be used for calculations, like each_record_in_scope is used to iterate over every filtered record
|
3
7
|
- fix field_search_ignore? and search_ignore?
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -13,7 +13,7 @@ module ActiveScaffold::Actions
|
|
13
13
|
else
|
14
14
|
do_demark
|
15
15
|
end
|
16
|
-
if marked_records.
|
16
|
+
if marked_records.any?
|
17
17
|
count = marked_records.length
|
18
18
|
flash[:info] = as_(:records_marked, :count => count, :model => active_scaffold_config.label(:count => count))
|
19
19
|
end
|
@@ -37,7 +37,7 @@ module ActiveScaffold::Actions
|
|
37
37
|
render :action => 'on_mark', :locals => {:checked => mark?}
|
38
38
|
end
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
# We need to give the ActiveRecord classes a handle to currently marked records. We don't want to just pass the object,
|
42
42
|
# because the object may change. So we give ActiveRecord a proc that ties to the marked_records_method on this ApplicationController.
|
43
43
|
def assign_marked_records_to_model
|
@@ -71,12 +71,12 @@ module ActiveScaffold::Actions
|
|
71
71
|
each_record_in_scope { |record| record.as_marked = false }
|
72
72
|
end
|
73
73
|
end
|
74
|
-
|
74
|
+
|
75
75
|
def do_destroy
|
76
76
|
super
|
77
77
|
@record.as_marked = false if successful?
|
78
78
|
end
|
79
|
-
|
79
|
+
|
80
80
|
# The default security delegates to ActiveRecordPermissions.
|
81
81
|
# You may override the method to customize.
|
82
82
|
def mark_authorized?
|
data/lib/active_scaffold/core.rb
CHANGED
@@ -186,7 +186,8 @@ module ActiveScaffold
|
|
186
186
|
end
|
187
187
|
|
188
188
|
def active_scaffold_controller_for(klass)
|
189
|
-
|
189
|
+
return self if uses_active_scaffold? && klass == active_scaffold_config.model
|
190
|
+
ActiveScaffold::Core.active_scaffold_controller_for(klass, self.to_s.deconstantize + '::')
|
190
191
|
end
|
191
192
|
|
192
193
|
|
@@ -200,8 +201,9 @@ module ActiveScaffold
|
|
200
201
|
# You may override this method to customize the search routine.
|
201
202
|
def self.active_scaffold_controller_for(klass, controller_namespace = '::')
|
202
203
|
error_message = []
|
204
|
+
class_names = [klass.to_s, klass.to_s.demodulize].map { |k| k.underscore.pluralize }.map { |k| [k, k.singularize] }.flatten
|
203
205
|
[controller_namespace, ''].each do |namespace|
|
204
|
-
|
206
|
+
class_names.each do |controller_name|
|
205
207
|
begin
|
206
208
|
controller = "#{namespace}#{controller_name.camelize}Controller".constantize
|
207
209
|
rescue NameError => error
|
@@ -10,7 +10,7 @@ module ActiveScaffold
|
|
10
10
|
# token is found in at least one of the columns.
|
11
11
|
def create_conditions_for_columns(tokens, columns, text_search = :full)
|
12
12
|
# if there aren't any columns, then just return a nil condition
|
13
|
-
return unless columns.
|
13
|
+
return unless columns.any?
|
14
14
|
like_pattern = like_pattern(text_search)
|
15
15
|
|
16
16
|
tokens = [tokens] if tokens.is_a? String
|
@@ -132,7 +132,7 @@ module ActiveScaffold
|
|
132
132
|
end
|
133
133
|
value
|
134
134
|
end
|
135
|
-
|
135
|
+
|
136
136
|
def condition_value_for_datetime(column, value, conversion = :to_time)
|
137
137
|
if value.is_a? Hash
|
138
138
|
Time.zone.local(*[:year, :month, :day, :hour, :minute, :second].collect {|part| value[part].to_i}) rescue nil
|
@@ -184,7 +184,7 @@ module ActiveScaffold
|
|
184
184
|
value
|
185
185
|
end
|
186
186
|
end
|
187
|
-
|
187
|
+
|
188
188
|
def datetime_conversion_for_condition(column)
|
189
189
|
if column.column
|
190
190
|
column.column.type == :date ? :to_date : :to_time
|
@@ -192,7 +192,7 @@ module ActiveScaffold
|
|
192
192
|
:to_time
|
193
193
|
end
|
194
194
|
end
|
195
|
-
|
195
|
+
|
196
196
|
def condition_for_datetime(column, value, like_pattern = nil)
|
197
197
|
conversion = datetime_conversion_for_condition(column)
|
198
198
|
from_value = condition_value_for_datetime(column, value[:from], conversion)
|
@@ -216,7 +216,7 @@ module ActiveScaffold
|
|
216
216
|
["%{search_sql} = ?", value]
|
217
217
|
end
|
218
218
|
end
|
219
|
-
|
219
|
+
|
220
220
|
def condition_for_null_type(column, value, like_pattern = nil)
|
221
221
|
case value.to_sym
|
222
222
|
when :null
|
@@ -256,8 +256,8 @@ module ActiveScaffold
|
|
256
256
|
'null',
|
257
257
|
'not_null'
|
258
258
|
]
|
259
|
-
|
260
|
-
|
259
|
+
|
260
|
+
|
261
261
|
|
262
262
|
def self.included(klass)
|
263
263
|
klass.extend ClassMethods
|
@@ -289,12 +289,12 @@ module ActiveScaffold
|
|
289
289
|
def active_scaffold_habtm_joins
|
290
290
|
@active_scaffold_habtm_joins ||= []
|
291
291
|
end
|
292
|
-
|
292
|
+
|
293
293
|
attr_writer :active_scaffold_outer_joins
|
294
294
|
def active_scaffold_outer_joins
|
295
295
|
@active_scaffold_outer_joins ||= []
|
296
296
|
end
|
297
|
-
|
297
|
+
|
298
298
|
attr_writer :active_scaffold_references
|
299
299
|
def active_scaffold_references
|
300
300
|
@active_scaffold_references ||= []
|
@@ -303,11 +303,11 @@ module ActiveScaffold
|
|
303
303
|
# Override this method on your controller to define conditions to be used when querying a recordset (e.g. for List). The return of this method should be any format compatible with the :conditions clause of ActiveRecord::Base's find.
|
304
304
|
def conditions_for_collection
|
305
305
|
end
|
306
|
-
|
306
|
+
|
307
307
|
# Override this method on your controller to define joins to be used when querying a recordset (e.g. for List). The return of this method should be any format compatible with the :joins clause of ActiveRecord::Base's find.
|
308
308
|
def joins_for_collection
|
309
309
|
end
|
310
|
-
|
310
|
+
|
311
311
|
# Override this method on your controller to provide custom finder options to the find() call. The return of this method should be a hash.
|
312
312
|
def custom_finder_options
|
313
313
|
{}
|
@@ -327,7 +327,7 @@ module ActiveScaffold
|
|
327
327
|
def id_condition
|
328
328
|
{active_scaffold_config.model.primary_key => params[:id]} if params[:id]
|
329
329
|
end
|
330
|
-
|
330
|
+
|
331
331
|
# returns a single record (the given id) but only if it's allowed for the specified security options.
|
332
332
|
# security options can be a hash for authorized_for? method or a value to check as a :crud_type
|
333
333
|
# accomplishes this by checking model.#{action}_authorized?
|
@@ -361,7 +361,7 @@ module ActiveScaffold
|
|
361
361
|
end
|
362
362
|
finder_options.merge!(:references => active_scaffold_references)
|
363
363
|
end
|
364
|
-
|
364
|
+
|
365
365
|
finder_options.merge! custom_finder_options
|
366
366
|
finder_options
|
367
367
|
end
|
@@ -371,9 +371,9 @@ module ActiveScaffold
|
|
371
371
|
options = find_options.reject{|k,v| [:select, :reorder].include? k}
|
372
372
|
# NOTE: we must use includes in the count query, because some conditions may reference other tables
|
373
373
|
options[:includes] = count_includes
|
374
|
-
|
374
|
+
|
375
375
|
count = append_to_query(query, options).count
|
376
|
-
|
376
|
+
|
377
377
|
# Converts count to an integer if ActiveRecord returned an OrderedHash
|
378
378
|
# that happens when find_options contains a :group key
|
379
379
|
count = count.length if count.is_a?(Hash)
|
@@ -389,7 +389,7 @@ module ActiveScaffold
|
|
389
389
|
|
390
390
|
find_options = finder_options(options)
|
391
391
|
query = beginning_of_chain.where(nil) # where(nil) is needed because we need a relation
|
392
|
-
|
392
|
+
|
393
393
|
# NOTE: we must use :include in the count query, because some conditions may reference other tables
|
394
394
|
if options[:pagination] && options[:pagination] != :infinite
|
395
395
|
count = count_items(query, find_options, options[:count_includes])
|
@@ -430,7 +430,7 @@ module ActiveScaffold
|
|
430
430
|
subquery = append_to_query(beginning_of_chain, :conditions => conditions, :joins => joins_for_finder, :outer_joins => outer_joins, :select => active_scaffold_config.columns[primary_key].field)
|
431
431
|
active_scaffold_config.model.where(primary_key => subquery)
|
432
432
|
end
|
433
|
-
|
433
|
+
|
434
434
|
def append_to_query(query, options)
|
435
435
|
options.assert_valid_keys :where, :select, :group, :reorder, :limit, :offset, :joins, :outer_joins, :includes, :lock, :readonly, :from, :conditions, :preload, (:references if Rails::VERSION::MAJOR >= 4)
|
436
436
|
query = options.reject{|k,v| v.blank?}.inject(query) do |query, (k, v)|
|
@@ -438,7 +438,7 @@ module ActiveScaffold
|
|
438
438
|
end
|
439
439
|
if options[:outer_joins].present?
|
440
440
|
if Rails::VERSION::MAJOR >= 4
|
441
|
-
query.distinct_value = true
|
441
|
+
query.distinct_value = true
|
442
442
|
else
|
443
443
|
query = query.uniq
|
444
444
|
end
|
@@ -456,7 +456,7 @@ module ActiveScaffold
|
|
456
456
|
[]
|
457
457
|
end + active_scaffold_habtm_joins
|
458
458
|
end
|
459
|
-
|
459
|
+
|
460
460
|
def apply_conditions(query, *conditions)
|
461
461
|
conditions.reject(&:blank?).inject(query) do |query, condition|
|
462
462
|
if condition.is_a?(Array) && !condition.first.is_a?(String) # multiple conditions
|
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.17
|
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: 2015-
|
11
|
+
date: 2015-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: shoulda
|
@@ -96,11 +96,11 @@ files:
|
|
96
96
|
- app/assets/javascripts/prototype/form_enhancements.js
|
97
97
|
- app/assets/javascripts/prototype/rico_corner.js
|
98
98
|
- app/assets/javascripts/prototype/tiny_mce_bridge.js
|
99
|
-
- app/assets/stylesheets/active_scaffold-ie.
|
100
|
-
- app/assets/stylesheets/active_scaffold.
|
101
|
-
- app/assets/stylesheets/active_scaffold_colors.
|
99
|
+
- app/assets/stylesheets/active_scaffold-ie.scss
|
100
|
+
- app/assets/stylesheets/active_scaffold.scss
|
101
|
+
- app/assets/stylesheets/active_scaffold_colors.scss
|
102
102
|
- app/assets/stylesheets/active_scaffold_extensions.css.erb
|
103
|
-
- app/assets/stylesheets/active_scaffold_images.
|
103
|
+
- app/assets/stylesheets/active_scaffold_images.scss
|
104
104
|
- app/assets/stylesheets/active_scaffold_jquery_ui.css.erb
|
105
105
|
- app/assets/stylesheets/active_scaffold_layout.css
|
106
106
|
- app/assets/stylesheets/blue-theme.css
|