active_scaffold 3.2.16 → 3.2.17
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +12 -0
- data/frontends/default/views/_list_inline_adapter.html.erb +1 -1
- data/lib/active_scaffold/bridges/date_picker/ext.rb +1 -1
- data/lib/active_scaffold/bridges/record_select/helpers.rb +9 -2
- data/lib/active_scaffold/config/nested.rb +3 -2
- data/lib/active_scaffold/constraints.rb +2 -2
- data/lib/active_scaffold/data_structures/action_links.rb +1 -0
- data/lib/active_scaffold/helpers/human_condition_helpers.rb +2 -5
- data/lib/active_scaffold/helpers/list_column_helpers.rb +1 -4
- data/lib/active_scaffold/helpers/pagination_helpers.rb +8 -4
- data/lib/active_scaffold/version.rb +1 -1
- metadata +9 -9
data/CHANGELOG
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
= 3.2.17 (not released yet)
|
2
|
+
- fix constraints for columns with multiple columns in search_sql
|
3
|
+
- remove unauthorized collection links
|
4
|
+
- copy parameters and html_options on cloning action link
|
5
|
+
- fix missing argument in datepicker conditions
|
6
|
+
- check authorization in model for plural associations nested links
|
7
|
+
- Allow to set action_group in nested.add_link
|
8
|
+
- fix current page when is inside outer window
|
9
|
+
- Support record select with polymorphic associations
|
10
|
+
- Fix column count in inline adapter for forms and views
|
11
|
+
- Add support for class prefix on human condition helpers
|
12
|
+
|
1
13
|
= 3.2.16
|
2
14
|
- Fix use of column.css_class in form when is a proc, it wasn't skipped when form was a columns group
|
3
15
|
- Fix constraints and colspan in self-referential associations
|
@@ -6,7 +6,7 @@
|
|
6
6
|
active_scaffold_config
|
7
7
|
end
|
8
8
|
# increment in 1 for self-associations, parent_model config will have constraints too
|
9
|
-
config.list.columns.count + 1 + (config == active_scaffold_config ? 1 : 0)
|
9
|
+
config.list.columns.count + 1 + (config == active_scaffold_config && action_name == 'index' ? 1 : 0)
|
10
10
|
end
|
11
11
|
%>
|
12
12
|
<%# nested_id, allows us to remove a nested scaffold programmatically %>
|
@@ -53,7 +53,7 @@ ActiveScaffold::Finder::ClassMethods.module_eval do
|
|
53
53
|
if column.search_ui == :date_picker
|
54
54
|
:to_date
|
55
55
|
else
|
56
|
-
datetime_conversion_for_condition_without_datepicker
|
56
|
+
datetime_conversion_for_condition_without_datepicker(column)
|
57
57
|
end
|
58
58
|
end
|
59
59
|
alias_method_chain :datetime_conversion_for_condition, :datepicker
|
@@ -25,7 +25,14 @@ class ActiveScaffold::Bridges::RecordSelect
|
|
25
25
|
unless column.association
|
26
26
|
raise ArgumentError, "record_select can only work against associations (and #{column.name} is not). A common mistake is to specify the foreign key field (like :user_id), instead of the association (:user)."
|
27
27
|
end
|
28
|
-
|
28
|
+
klass = if column.polymorphic_association?
|
29
|
+
@record.send(column.association.foreign_type).constantize rescue nil
|
30
|
+
else
|
31
|
+
column.association.klass
|
32
|
+
end
|
33
|
+
return content_tag :span, '', :class => options[:class] unless klass
|
34
|
+
|
35
|
+
remote_controller = active_scaffold_controller_for(klass).controller_path
|
29
36
|
|
30
37
|
# if the opposite association is a :belongs_to (in that case association in this class must be has_one or has_many)
|
31
38
|
# then only show records that have not been associated yet
|
@@ -41,7 +48,7 @@ class ActiveScaffold::Bridges::RecordSelect
|
|
41
48
|
html = if multiple
|
42
49
|
record_multi_select_field(options[:name], value || [], record_select_options)
|
43
50
|
else
|
44
|
-
record_select_field(options[:name], value ||
|
51
|
+
record_select_field(options[:name], value || klass.new, record_select_options)
|
45
52
|
end
|
46
53
|
html = self.class.field_error_proc.call(html, self) if @record.errors[column.name].any?
|
47
54
|
html
|
@@ -21,12 +21,13 @@ module ActiveScaffold::Config
|
|
21
21
|
def add_link(attribute, options = {})
|
22
22
|
column = @core.columns[attribute.to_sym]
|
23
23
|
unless column.nil? || column.association.nil?
|
24
|
-
options.reverse_merge! :security_method => :nested_authorized?, :label => column.association.klass.model_name.human({:count => 2, :default => column.association.klass.name.pluralize})
|
24
|
+
options.reverse_merge! :security_method => :nested_authorized?, :label => column.association.klass.model_name.human({:count => column.singular_association? ? 1 : 2, :default => column.association.klass.name.pluralize})
|
25
|
+
action_group = options.delete(:action_group) || self.action_group
|
25
26
|
action_link = @core.link_for_association(column, options)
|
26
27
|
action_link.action ||= :index
|
27
28
|
@core.action_links.add_to_group(action_link, action_group) unless action_link.nil?
|
28
29
|
else
|
29
|
-
|
30
|
+
# TODO: raise exception
|
30
31
|
end
|
31
32
|
end
|
32
33
|
|
@@ -17,7 +17,7 @@ module ActiveScaffold
|
|
17
17
|
constrained_fields |= active_scaffold_constraints.reject{|k, v| v.is_a? Hash}.keys.collect(&:to_sym)
|
18
18
|
exclude_actions = []
|
19
19
|
[:list, :update].each do |action_name|
|
20
|
-
|
20
|
+
if active_scaffold_config.actions.include? action_name
|
21
21
|
exclude_actions << action_name unless active_scaffold_config.send(action_name).hide_nested_column
|
22
22
|
end
|
23
23
|
end
|
@@ -70,7 +70,7 @@ module ActiveScaffold
|
|
70
70
|
# regular column constraints
|
71
71
|
elsif column.searchable? && params[column.name] != v
|
72
72
|
active_scaffold_includes.concat column.includes
|
73
|
-
conditions << ["#{
|
73
|
+
conditions << [column.search_sql.collect { |search_sql| "#{search_sql} = ?" }.join(' OR '), *([v] * column.search_sql.size)]
|
74
74
|
end
|
75
75
|
# unknown-to-activescaffold-but-real-database-column constraint
|
76
76
|
elsif active_scaffold_config.model.columns_hash[k.to_s] && params[column.name] != v
|
@@ -127,6 +127,7 @@ module ActiveScaffold::DataStructures
|
|
127
127
|
else
|
128
128
|
options[:for].nil? ? true : options[:for].authorized_for?(:crud_type => link.crud_type, :action => link.action)
|
129
129
|
end
|
130
|
+
next unless authorized || link.type == :member
|
130
131
|
yield(self, link, {:authorized => authorized, :first_action => first_action, :level => options[:level]})
|
131
132
|
first_action = false
|
132
133
|
end
|
@@ -45,14 +45,11 @@ module ActiveScaffold
|
|
45
45
|
end unless value.nil?
|
46
46
|
end
|
47
47
|
|
48
|
-
def override_human_condition_column?(column)
|
49
|
-
respond_to?(override_human_condition_column(column))
|
50
|
-
end
|
51
|
-
|
52
48
|
# the naming convention for overriding form fields with helpers
|
53
49
|
def override_human_condition_column(column)
|
54
|
-
|
50
|
+
override_helper column, 'human_condition_column'
|
55
51
|
end
|
52
|
+
alias_method :override_human_condition_column?, :override_human_condition_column
|
56
53
|
|
57
54
|
def override_human_condition?(search_ui)
|
58
55
|
respond_to?(override_human_condition(search_ui))
|
@@ -97,11 +97,8 @@ module ActiveScaffold
|
|
97
97
|
|
98
98
|
def column_link_authorized?(link, column, record, associated)
|
99
99
|
if column.association
|
100
|
-
associated_for_authorized = if
|
100
|
+
associated_for_authorized = if column.plural_association? || (associated.respond_to?(:blank?) && associated.blank?)
|
101
101
|
column.association.klass
|
102
|
-
elsif [:has_many, :has_and_belongs_to_many].include? column.association.macro
|
103
|
-
# may be cached with [] or [nil] to avoid some queries
|
104
|
-
associated.first || column.association.klass
|
105
102
|
else
|
106
103
|
associated
|
107
104
|
end
|
@@ -16,10 +16,14 @@ module ActiveScaffold
|
|
16
16
|
end
|
17
17
|
|
18
18
|
html = []
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
last_page =
|
19
|
+
if current_page.number == 1
|
20
|
+
last_page = 0
|
21
|
+
else
|
22
|
+
last_page = 1
|
23
|
+
last_page.upto([last_page + outer_window, current_page.number - 1].min) do |num|
|
24
|
+
html << pagination_ajax_link(num, url_options, options)
|
25
|
+
last_page = num
|
26
|
+
end
|
23
27
|
end
|
24
28
|
if current_page.pager.infinite?
|
25
29
|
offsets.reverse.each do |offset|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_scaffold
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 45
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 3.2.
|
9
|
+
- 17
|
10
|
+
version: 3.2.17
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Many, see README
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-11-12 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
type: :development
|
@@ -29,8 +29,8 @@ dependencies:
|
|
29
29
|
- 0
|
30
30
|
version: "0"
|
31
31
|
version_requirements: *id001
|
32
|
-
name: shoulda
|
33
32
|
prerelease: false
|
33
|
+
name: shoulda
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
type: :development
|
36
36
|
requirement: &id002 !ruby/object:Gem::Requirement
|
@@ -45,8 +45,8 @@ dependencies:
|
|
45
45
|
- 0
|
46
46
|
version: 1.0.0
|
47
47
|
version_requirements: *id002
|
48
|
-
name: bundler
|
49
48
|
prerelease: false
|
49
|
+
name: bundler
|
50
50
|
- !ruby/object:Gem::Dependency
|
51
51
|
type: :development
|
52
52
|
requirement: &id003 !ruby/object:Gem::Requirement
|
@@ -59,8 +59,8 @@ dependencies:
|
|
59
59
|
- 0
|
60
60
|
version: "0"
|
61
61
|
version_requirements: *id003
|
62
|
-
name: rcov
|
63
62
|
prerelease: false
|
63
|
+
name: rcov
|
64
64
|
- !ruby/object:Gem::Dependency
|
65
65
|
type: :runtime
|
66
66
|
requirement: &id004 !ruby/object:Gem::Requirement
|
@@ -75,8 +75,8 @@ dependencies:
|
|
75
75
|
- 3
|
76
76
|
version: 3.1.3
|
77
77
|
version_requirements: *id004
|
78
|
-
name: rails
|
79
78
|
prerelease: false
|
79
|
+
name: rails
|
80
80
|
description: Save time and headaches, and create a more easily maintainable set of pages, with ActiveScaffold. ActiveScaffold handles all your CRUD (create, read, update, delete) user interface needs, leaving you more time to focus on more challenging (and interesting!) problems.
|
81
81
|
email: activescaffold@googlegroups.com
|
82
82
|
executables: []
|
@@ -442,7 +442,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
442
442
|
requirements: []
|
443
443
|
|
444
444
|
rubyforge_project:
|
445
|
-
rubygems_version: 1.8.
|
445
|
+
rubygems_version: 1.8.23
|
446
446
|
signing_key:
|
447
447
|
specification_version: 3
|
448
448
|
summary: Rails 3.1 Version of activescaffold supporting prototype and jquery
|