active_scaffold 3.0.12 → 3.0.21
Sign up to get free protection for your applications and to get access to all the features.
- data/README +21 -11
- data/frontends/default/images/close_touch.png +0 -0
- data/frontends/default/javascripts/jquery/active_scaffold.js +187 -99
- data/frontends/default/javascripts/prototype/active_scaffold.js +105 -33
- data/frontends/default/javascripts/prototype/dhtml_history.js +80 -77
- data/frontends/default/stylesheets/stylesheet.css +121 -2
- data/frontends/default/views/_action_group.html.erb +6 -2
- data/frontends/default/views/_base_form.html.erb +11 -5
- data/frontends/default/views/_base_form.html.erb~ +42 -0
- data/frontends/default/views/_field_search.html.erb +1 -1
- data/frontends/default/views/_form.html.erb +9 -7
- data/frontends/default/views/_form_association.html.erb +8 -3
- data/frontends/default/views/_form_association_footer.html.erb +10 -3
- data/frontends/default/views/_form_attribute.html.erb +8 -3
- data/frontends/default/views/_horizontal_subform.html.erb +12 -2
- data/frontends/default/views/_horizontal_subform_header.html.erb +1 -1
- data/frontends/default/views/_horizontal_subform_record.html.erb +5 -4
- data/frontends/default/views/_list_messages.html.erb +1 -1
- data/frontends/default/views/_list_with_header.html.erb +1 -1
- data/frontends/default/views/_render_field.js.rjs +4 -6
- data/frontends/default/views/_vertical_subform.html.erb +1 -1
- data/frontends/default/views/_vertical_subform_record.html.erb +2 -2
- data/frontends/default/views/on_action_update.js.rjs +3 -1
- data/frontends/default/views/on_mark_all.js.rjs +12 -0
- data/frontends/default/views/on_update.js.rjs +1 -1
- data/frontends/default/views/render_field.js.rjs +1 -0
- data/frontends/default/views/update_column.js.rjs +1 -1
- data/lib/active_scaffold.rb +60 -21
- data/lib/active_scaffold/actions/common_search.rb +2 -2
- data/lib/active_scaffold/actions/core.rb +30 -9
- data/lib/active_scaffold/actions/create.rb +14 -10
- data/lib/active_scaffold/actions/field_search.rb +6 -6
- data/lib/active_scaffold/actions/list.rb +22 -12
- data/lib/active_scaffold/actions/mark.rb +34 -9
- data/lib/active_scaffold/actions/nested.rb +12 -16
- data/lib/active_scaffold/actions/show.rb +2 -2
- data/lib/active_scaffold/actions/subform.rb +15 -8
- data/lib/active_scaffold/actions/update.rb +14 -4
- data/lib/active_scaffold/attribute_params.rb +15 -10
- data/lib/active_scaffold/bridges/bridge.rb +21 -12
- data/lib/active_scaffold/bridges/calendar_date_select/bridge.rb +3 -3
- data/lib/active_scaffold/bridges/cancan/bridge.rb +12 -0
- data/lib/active_scaffold/bridges/cancan/lib/cancan_bridge.rb +107 -0
- data/lib/active_scaffold/bridges/carrierwave/bridge.rb +1 -1
- data/lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge.rb +3 -8
- data/lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge_helpers.rb +1 -15
- data/lib/active_scaffold/bridges/carrierwave/lib/form_ui.rb +23 -13
- data/lib/active_scaffold/bridges/carrierwave/lib/list_ui.rb +1 -1
- data/lib/active_scaffold/bridges/country_helper/bridge.rb +9 -0
- data/lib/active_scaffold/bridges/country_helper/lib/country_helper_bridge.rb +358 -0
- data/lib/active_scaffold/bridges/date_picker/bridge.rb +5 -3
- data/lib/active_scaffold/bridges/date_picker/lib/datepicker_bridge.rb +9 -0
- data/lib/active_scaffold/bridges/dragonfly/bridge.rb +9 -0
- data/lib/active_scaffold/bridges/dragonfly/bridge.rb~ +12 -0
- data/lib/active_scaffold/bridges/dragonfly/lib/dragonfly_bridge.rb +36 -0
- data/lib/active_scaffold/bridges/dragonfly/lib/dragonfly_bridge.rb~ +36 -0
- data/lib/active_scaffold/bridges/dragonfly/lib/dragonfly_bridge_helpers.rb +12 -0
- data/lib/active_scaffold/bridges/dragonfly/lib/dragonfly_bridge_helpers.rb~ +12 -0
- data/lib/active_scaffold/bridges/dragonfly/lib/form_ui.rb +27 -0
- data/lib/active_scaffold/bridges/dragonfly/lib/form_ui.rb~ +27 -0
- data/lib/active_scaffold/bridges/dragonfly/lib/list_ui.rb +16 -0
- data/lib/active_scaffold/bridges/dragonfly/lib/list_ui.rb~ +16 -0
- data/lib/active_scaffold/bridges/paperclip/bridge.rb +1 -1
- data/lib/active_scaffold/bridges/record_select/bridge.rb +5 -0
- data/lib/active_scaffold/bridges/record_select/lib/record_select_bridge.rb +87 -0
- data/lib/active_scaffold/bridges/record_select/lib/record_select_bridge.rb~ +84 -0
- data/lib/active_scaffold/bridges/shared/date_bridge.rb +56 -34
- data/lib/active_scaffold/bridges/tiny_mce/lib/tiny_mce_bridge.rb +19 -3
- data/lib/active_scaffold/config/base.rb +4 -4
- data/lib/active_scaffold/config/core.rb +4 -0
- data/lib/active_scaffold/config/create.rb +1 -1
- data/lib/active_scaffold/config/field_search.rb +7 -7
- data/lib/active_scaffold/config/form.rb +8 -2
- data/lib/active_scaffold/config/list.rb +22 -8
- data/lib/active_scaffold/config/mark.rb +18 -5
- data/lib/active_scaffold/config/nested.rb +3 -3
- data/lib/active_scaffold/config/search.rb +1 -1
- data/lib/active_scaffold/config/show.rb +1 -1
- data/lib/active_scaffold/data_structures/action_columns.rb +10 -6
- data/lib/active_scaffold/data_structures/action_link.rb +14 -10
- data/lib/active_scaffold/data_structures/action_links.rb +2 -2
- data/lib/active_scaffold/data_structures/column.rb +25 -11
- data/lib/active_scaffold/data_structures/nested_info.rb +21 -21
- data/lib/active_scaffold/data_structures/set.rb +2 -3
- data/lib/active_scaffold/data_structures/sorting.rb +8 -8
- data/lib/{extensions → active_scaffold/extensions}/action_controller_rendering.rb +3 -1
- data/lib/{extensions → active_scaffold/extensions}/action_view_rendering.rb +31 -33
- data/lib/{extensions → active_scaffold/extensions}/action_view_resolver.rb +0 -0
- data/lib/{extensions → active_scaffold/extensions}/active_association_reflection.rb +0 -0
- data/lib/active_scaffold/extensions/active_record_offset.rb +12 -0
- data/lib/{extensions → active_scaffold/extensions}/array.rb +0 -0
- data/lib/{extensions → active_scaffold/extensions}/localize.rb +1 -1
- data/lib/{extensions → active_scaffold/extensions}/name_option_for_datetime.rb +1 -1
- data/lib/{extensions → active_scaffold/extensions}/nil_id_in_url_params.rb +0 -0
- data/lib/{extensions → active_scaffold/extensions}/paginator_extensions.rb +2 -2
- data/lib/{extensions → active_scaffold/extensions}/reverse_associations.rb +1 -1
- data/lib/{extensions → active_scaffold/extensions}/routing_mapper.rb +2 -2
- data/lib/{extensions → active_scaffold/extensions}/to_label.rb +0 -0
- data/lib/{extensions → active_scaffold/extensions}/unsaved_associated.rb +0 -0
- data/lib/{extensions → active_scaffold/extensions}/unsaved_record.rb +0 -0
- data/lib/active_scaffold/extensions/usa_state.rb +46 -0
- data/lib/active_scaffold/finder.rb +30 -19
- data/lib/active_scaffold/helpers/controller_helpers.rb +3 -5
- data/lib/active_scaffold/helpers/form_column_helpers.rb +19 -45
- data/lib/active_scaffold/helpers/human_condition_helpers.rb +1 -1
- data/lib/active_scaffold/helpers/id_helpers.rb +2 -2
- data/lib/active_scaffold/helpers/list_column_helpers.rb +28 -17
- data/lib/active_scaffold/helpers/search_column_helpers.rb +51 -40
- data/lib/active_scaffold/helpers/search_column_helpers.rb~ +215 -0
- data/lib/active_scaffold/helpers/show_column_helpers.rb +8 -4
- data/lib/active_scaffold/helpers/view_helpers.rb +50 -27
- data/lib/active_scaffold/locale/de.yml +111 -0
- data/lib/active_scaffold/locale/en.yml +115 -0
- data/lib/active_scaffold/locale/es.yml +32 -32
- data/lib/active_scaffold/locale/fr.yml +118 -0
- data/lib/active_scaffold/marked_model.rb +6 -6
- data/lib/active_scaffold/version.rb +1 -1
- data/lib/active_scaffold_assets.rb +1 -3
- data/lib/active_scaffold_env.rb +1 -2
- data/lib/generators/active_scaffold/active_scaffold_generator.rb +5 -5
- data/lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb +3 -2
- data/lib/generators/active_scaffold_controller/templates/helper.rb +2 -0
- data/lib/generators/active_scaffold_setup/active_scaffold_setup_generator.rb +17 -19
- data/shoulda_macros/macros.rb +4 -4
- data/test/misc/finder_test.rb +2 -2
- data/test/mock_app/public/stylesheets/active_scaffold/default/stylesheet.css +4 -1
- metadata +144 -126
- data/.autotest +0 -27
- data/.document +0 -5
- data/Gemfile +0 -13
- data/Gemfile.lock +0 -20
- data/Rakefile +0 -53
- data/active_scaffold.gemspec +0 -385
- data/init.rb +0 -2
- data/lib/active_scaffold/helpers/country_helpers.rb +0 -358
- data/lib/active_scaffold/locale/de.rb +0 -120
- data/lib/active_scaffold/locale/en.rb +0 -119
- data/lib/active_scaffold/locale/fr.rb +0 -116
- data/lib/extensions/active_record_offset.rb +0 -12
- data/lib/extensions/usa_state.rb +0 -50
- data/test/mock_app/.gitignore +0 -2
- data/uninstall.rb +0 -13
@@ -2,7 +2,18 @@ module ActiveScaffold
|
|
2
2
|
module TinyMceBridge
|
3
3
|
module ViewHelpers
|
4
4
|
def active_scaffold_includes(*args)
|
5
|
-
|
5
|
+
if ActiveScaffold.js_framework == :jquery
|
6
|
+
tiny_mce_js = javascript_tag(%|
|
7
|
+
var action_link_close = ActiveScaffold.ActionLink.Abstract.prototype.close;
|
8
|
+
ActiveScaffold.ActionLink.Abstract.prototype.close = function() {
|
9
|
+
$(this.adapter).find('textarea.mceEditor').each(function(index, elem) {
|
10
|
+
tinyMCE.execCommand('mceRemoveControl', false, $(elem).attr('id'));
|
11
|
+
});
|
12
|
+
action_link_close.apply(this);
|
13
|
+
};
|
14
|
+
|) if using_tiny_mce?
|
15
|
+
else
|
16
|
+
tiny_mce_js = javascript_tag(%|
|
6
17
|
var action_link_close = ActiveScaffold.ActionLink.Abstract.prototype.close;
|
7
18
|
ActiveScaffold.ActionLink.Abstract.prototype.close = function() {
|
8
19
|
this.adapter.select('textarea.mceEditor').each(function(elem) {
|
@@ -10,7 +21,8 @@ ActiveScaffold.ActionLink.Abstract.prototype.close = function() {
|
|
10
21
|
});
|
11
22
|
action_link_close.apply(this);
|
12
23
|
};
|
13
|
-
|
24
|
+
|) if using_tiny_mce?
|
25
|
+
end
|
14
26
|
super(*args) + (include_tiny_mce_if_needed || '') + (tiny_mce_js || '')
|
15
27
|
end
|
16
28
|
end
|
@@ -25,7 +37,11 @@ ActiveScaffold.ActionLink.Abstract.prototype.close = function() {
|
|
25
37
|
end
|
26
38
|
|
27
39
|
def onsubmit
|
28
|
-
|
40
|
+
if ActiveScaffold.js_framework == :jquery
|
41
|
+
submit_js = 'tinyMCE.triggerSave();$(\'textarea.mceEditor\').each(function(index, elem) { tinyMCE.execCommand(\'mceRemoveControl\', false, $(elem).attr(\'id\')); });' if using_tiny_mce?
|
42
|
+
else
|
43
|
+
submit_js = 'tinyMCE.triggerSave();this.select(\'textarea.mceEditor\').each(function(elem) { tinyMCE.execCommand(\'mceRemoveControl\', false, elem.id); });' if using_tiny_mce?
|
44
|
+
end
|
29
45
|
[super, submit_js].compact.join ';'
|
30
46
|
end
|
31
47
|
end
|
@@ -41,17 +41,17 @@ module ActiveScaffold::Config
|
|
41
41
|
@conf = conf
|
42
42
|
end
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
45
|
def formats
|
46
46
|
@formats ||= []
|
47
47
|
end
|
48
|
-
|
48
|
+
|
49
49
|
def formats=(val)
|
50
50
|
@formats=val
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
private
|
54
|
-
|
54
|
+
|
55
55
|
def columns=(val)
|
56
56
|
@columns = ActiveScaffold::DataStructures::ActionColumns.new(*val)
|
57
57
|
@columns.action = self
|
@@ -211,6 +211,10 @@ module ActiveScaffold::Config
|
|
211
211
|
Dir.entries(javascript_dir).reject { |e| !e.match(/\.js$/) or (!self.dhtml_history? and e.match('dhtml_history')) }
|
212
212
|
end
|
213
213
|
|
214
|
+
def self.available_frontends
|
215
|
+
frontends_dir = File.join(Rails.root, "vendor", "plugins", ActiveScaffold::Config::Core.plugin_directory, "frontends")
|
216
|
+
Dir.entries(frontends_dir).reject { |e| e.match(/^\./) } # Get rid of files that start with .
|
217
|
+
end
|
214
218
|
end
|
215
219
|
end
|
216
220
|
|
@@ -50,26 +50,26 @@ module ActiveScaffold::Config
|
|
50
50
|
# * false: LIKE ?
|
51
51
|
# Default is :full
|
52
52
|
attr_accessor :text_search
|
53
|
-
|
53
|
+
|
54
54
|
# the ActionLink for this action
|
55
55
|
attr_accessor :link
|
56
|
-
|
56
|
+
|
57
57
|
# rarely searched columns may be placed in a hidden subgroup
|
58
58
|
def optional_columns=(optionals)
|
59
59
|
@optional_columns= Array(optionals)
|
60
60
|
end
|
61
|
-
|
61
|
+
|
62
62
|
def optional_columns
|
63
63
|
@optional_columns ||= []
|
64
64
|
end
|
65
|
-
|
65
|
+
|
66
66
|
# default search params
|
67
|
-
# default_params = {:title => {"from"=>"test", "to"=>"", "opt"=>"%?%"}}
|
67
|
+
# default_params = {:title => {"from"=>"test", "to"=>"", "opt"=>"%?%"}}
|
68
68
|
attr_accessor :default_params
|
69
|
-
|
69
|
+
|
70
70
|
# human conditions
|
71
71
|
# instead of just filtered you may show the user a humanized search condition statment
|
72
72
|
attr_accessor :human_conditions
|
73
|
-
|
73
|
+
|
74
74
|
end
|
75
75
|
end
|
@@ -6,6 +6,7 @@ module ActiveScaffold::Config
|
|
6
6
|
# start with the ActionLink defined globally
|
7
7
|
@link = self.class.link.clone unless self.class.link.nil?
|
8
8
|
@action_group = self.class.action_group.clone if self.class.action_group
|
9
|
+
@show_unauthorized_columns = self.class.show_unauthorized_columns
|
9
10
|
|
10
11
|
# no global setting here because multipart should only be set for specific forms
|
11
12
|
@multipart = false
|
@@ -13,10 +14,15 @@ module ActiveScaffold::Config
|
|
13
14
|
|
14
15
|
# global level configuration
|
15
16
|
# --------------------------
|
17
|
+
# show value of unauthorized columns instead of skip them
|
18
|
+
class_inheritable_accessor :show_unauthorized_columns
|
16
19
|
|
17
20
|
# instance-level configuration
|
18
21
|
# ----------------------------
|
19
22
|
|
23
|
+
# show value of unauthorized columns instead of skip them
|
24
|
+
attr_accessor :show_unauthorized_columns
|
25
|
+
|
20
26
|
# the ActionLink for this action
|
21
27
|
attr_accessor :link
|
22
28
|
|
@@ -35,9 +41,9 @@ module ActiveScaffold::Config
|
|
35
41
|
end
|
36
42
|
@columns
|
37
43
|
end
|
38
|
-
|
44
|
+
|
39
45
|
public :columns=
|
40
|
-
|
46
|
+
|
41
47
|
# whether the form should be multipart
|
42
48
|
attr_writer :multipart
|
43
49
|
def multipart?
|
@@ -9,13 +9,14 @@ module ActiveScaffold::Config
|
|
9
9
|
# full configuration path is: defaults => global table => local table
|
10
10
|
@per_page = self.class.per_page
|
11
11
|
@page_links_window = self.class.page_links_window
|
12
|
-
|
12
|
+
|
13
13
|
# originates here
|
14
14
|
@sorting = ActiveScaffold::DataStructures::Sorting.new(@core.columns)
|
15
15
|
@sorting.set_default_sorting(@core.model)
|
16
16
|
|
17
17
|
# inherit from global scope
|
18
18
|
@empty_field_text = self.class.empty_field_text
|
19
|
+
@association_join_text = self.class.association_join_text
|
19
20
|
@pagination = self.class.pagination
|
20
21
|
@show_search_reset = true
|
21
22
|
end
|
@@ -34,6 +35,10 @@ module ActiveScaffold::Config
|
|
34
35
|
cattr_accessor :empty_field_text
|
35
36
|
@@empty_field_text = '-'
|
36
37
|
|
38
|
+
# what string to use to join records from plural associations
|
39
|
+
cattr_accessor :association_join_text
|
40
|
+
@@association_join_text = ', '
|
41
|
+
|
37
42
|
# What kind of pagination to use:
|
38
43
|
# * true: The usual pagination
|
39
44
|
# * :infinite: Treat the source as having an infinite number of pages (i.e. don't count the records; useful for large tables where counting is slow and we don't really care anyway)
|
@@ -49,7 +54,7 @@ module ActiveScaffold::Config
|
|
49
54
|
self.columns = @core.columns._inheritable unless @columns # lazy evaluation
|
50
55
|
@columns
|
51
56
|
end
|
52
|
-
|
57
|
+
|
53
58
|
public :columns=
|
54
59
|
|
55
60
|
# how many rows to show at once
|
@@ -67,6 +72,9 @@ module ActiveScaffold::Config
|
|
67
72
|
# what string to use when a field is empty
|
68
73
|
attr_accessor :empty_field_text
|
69
74
|
|
75
|
+
# what string to use to join records from plural associations
|
76
|
+
attr_accessor :association_join_text
|
77
|
+
|
70
78
|
# show a link to reset the search next to filtered message
|
71
79
|
attr_accessor :show_search_reset
|
72
80
|
|
@@ -79,7 +87,7 @@ module ActiveScaffold::Config
|
|
79
87
|
def sorting
|
80
88
|
@sorting ||= ActiveScaffold::DataStructures::Sorting.new(@core.columns)
|
81
89
|
end
|
82
|
-
|
90
|
+
|
83
91
|
# overwrite the includes used for the count sql query
|
84
92
|
attr_accessor :count_includes
|
85
93
|
|
@@ -98,29 +106,35 @@ module ActiveScaffold::Config
|
|
98
106
|
def filtered_message
|
99
107
|
@filtered_message ? @filtered_message : :filtered
|
100
108
|
end
|
101
|
-
|
109
|
+
|
102
110
|
attr_writer :always_show_search
|
103
111
|
def always_show_search
|
104
112
|
@always_show_search && !search_partial.blank?
|
105
113
|
end
|
106
|
-
|
114
|
+
|
107
115
|
def search_partial
|
108
116
|
return "search" if @core.actions.include?(:search)
|
109
117
|
return "field_search" if @core.actions.include?(:field_search)
|
110
118
|
end
|
111
|
-
|
119
|
+
|
112
120
|
# always show create
|
113
121
|
attr_writer :always_show_create
|
114
122
|
def always_show_create
|
115
123
|
@always_show_create && @core.actions.include?(:create)
|
116
124
|
end
|
117
125
|
|
126
|
+
# if list view is nested hide nested_column
|
127
|
+
attr_writer :hide_nested_column
|
128
|
+
def hide_nested_column
|
129
|
+
@hide_nested_column.nil? ? true : @hide_nested_column
|
130
|
+
end
|
131
|
+
|
118
132
|
# might be set to open nested_link automatically in view
|
119
133
|
# conf.nested.add_link(:players)
|
120
134
|
# conf.list.nested_auto_open = {:players => 2}
|
121
135
|
# will open nested players view if there are 2 or less records in parent
|
122
136
|
attr_accessor :nested_auto_open
|
123
|
-
|
137
|
+
|
124
138
|
class UserSettings < UserSettings
|
125
139
|
# This label has alread been localized.
|
126
140
|
def label
|
@@ -165,7 +179,7 @@ module ActiveScaffold::Config
|
|
165
179
|
return default_sorting
|
166
180
|
end
|
167
181
|
end
|
168
|
-
|
182
|
+
|
169
183
|
def count_includes
|
170
184
|
@conf.count_includes
|
171
185
|
end
|
@@ -2,21 +2,34 @@ module ActiveScaffold::Config
|
|
2
2
|
class Mark < Base
|
3
3
|
self.crud_type = :read
|
4
4
|
|
5
|
+
# What kind of mark all mode to use:
|
6
|
+
# * :search: de-/mark all records using current search conditions
|
7
|
+
# * :page: de-/mark all records on current page
|
8
|
+
cattr_accessor :mark_all_mode
|
9
|
+
@@mark_all_mode = :search
|
10
|
+
|
11
|
+
attr_accessor :mark_all_mode
|
12
|
+
|
5
13
|
def initialize(core_config)
|
6
14
|
@core = core_config
|
7
|
-
@
|
8
|
-
|
15
|
+
@mark_all_mode = self.class.mark_all_mode
|
16
|
+
if core_config.actions.include?(:update)
|
17
|
+
@core.model.send(:include, ActiveScaffold::MarkedModel) unless @core.model.ancestors.include?(ActiveScaffold::MarkedModel)
|
18
|
+
add_mark_column
|
19
|
+
else
|
20
|
+
raise "Mark action requires update action in controller for model: #{core_config.model.to_s}"
|
21
|
+
end
|
9
22
|
end
|
10
|
-
|
23
|
+
|
11
24
|
protected
|
12
|
-
|
25
|
+
|
13
26
|
def add_mark_column
|
14
27
|
@core.columns.add :marked
|
15
28
|
@core.columns[:marked].label = 'M'
|
16
29
|
@core.columns[:marked].form_ui = :checkbox
|
17
30
|
@core.columns[:marked].inplace_edit = true
|
18
31
|
@core.columns[:marked].sort = false
|
19
|
-
@core.list.columns = [:marked] + @core.list.columns.
|
32
|
+
@core.list.columns = [:marked] + @core.list.columns.names_without_auth_check unless @core.list.columns.include? :marked
|
20
33
|
end
|
21
34
|
end
|
22
35
|
end
|
@@ -21,14 +21,14 @@ 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 => 2, :default => column.association.klass.name.pluralize})
|
25
25
|
action_link = @core.link_for_association(column, options)
|
26
26
|
@core.action_links.add_to_group(action_link, action_group) unless action_link.nil?
|
27
27
|
else
|
28
|
-
|
28
|
+
|
29
29
|
end
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
def add_scoped_link(named_scope, options = {})
|
33
33
|
action_link = @core.link_for_association_as_scope(named_scope.to_sym, options)
|
34
34
|
@core.action_links.add_to_group(action_link, action_group) unless action_link.nil?
|
@@ -42,7 +42,7 @@ module ActiveScaffold::Config
|
|
42
42
|
def columns
|
43
43
|
# we want to delay initializing to the @core.columns set for as long as possible. Too soon and .search_sql will not be available to .searchable?
|
44
44
|
unless @columns
|
45
|
-
self.columns = @core.columns.collect{|c| c.name if c.searchable? and c.column and c.column.text?}.compact
|
45
|
+
self.columns = @core.columns.collect{|c| c.name if @core.columns._inheritable.include?(c.name) and c.searchable? and c.column and c.column.text?}.compact
|
46
46
|
end
|
47
47
|
@columns
|
48
48
|
end
|
@@ -15,7 +15,7 @@ module ActiveScaffold::DataStructures
|
|
15
15
|
|
16
16
|
# Whether this column set is collapsed by default in contexts where collapsing is supported
|
17
17
|
attr_accessor :collapsed
|
18
|
-
|
18
|
+
|
19
19
|
# nests a subgroup in the column set
|
20
20
|
def add_subgroup(label, &proc)
|
21
21
|
columns = ActiveScaffold::DataStructures::ActionColumns.new
|
@@ -38,6 +38,10 @@ module ActiveScaffold::DataStructures
|
|
38
38
|
self.collect(&:name)
|
39
39
|
end
|
40
40
|
|
41
|
+
def names_without_auth_check
|
42
|
+
Array(@set)
|
43
|
+
end
|
44
|
+
|
41
45
|
protected
|
42
46
|
|
43
47
|
def collect_columns
|
@@ -73,7 +77,7 @@ module ActiveScaffold::DataStructures
|
|
73
77
|
end
|
74
78
|
end
|
75
79
|
end
|
76
|
-
|
80
|
+
|
77
81
|
def collect_visible(options = {}, &proc)
|
78
82
|
columns = []
|
79
83
|
options[:for] ||= @columns.active_record_class
|
@@ -90,8 +94,8 @@ module ActiveScaffold::DataStructures
|
|
90
94
|
end
|
91
95
|
end
|
92
96
|
columns
|
93
|
-
end
|
94
|
-
|
97
|
+
end
|
98
|
+
|
95
99
|
def skip_column?(column, options)
|
96
100
|
result = false
|
97
101
|
# skip if this matches a constrained column
|
@@ -119,12 +123,12 @@ module ActiveScaffold::DataStructures
|
|
119
123
|
def constraint_columns
|
120
124
|
@constraint_columns ||= []
|
121
125
|
end
|
122
|
-
|
126
|
+
|
123
127
|
attr_writer :unauthorized_columns
|
124
128
|
def unauthorized_columns
|
125
129
|
@unauthorized_columns ||= []
|
126
130
|
end
|
127
|
-
|
131
|
+
|
128
132
|
def length
|
129
133
|
((@set - self.constraint_columns) - self.unauthorized_columns).length
|
130
134
|
end
|
@@ -17,6 +17,7 @@ module ActiveScaffold::DataStructures
|
|
17
17
|
self.html_options = {}
|
18
18
|
self.column = nil
|
19
19
|
self.image = nil
|
20
|
+
self.dynamic_parameters = nil
|
20
21
|
|
21
22
|
# apply quick properties
|
22
23
|
options.each_pair do |k, v|
|
@@ -27,7 +28,7 @@ module ActiveScaffold::DataStructures
|
|
27
28
|
|
28
29
|
# the action-path for this link. what page to request? this is required!
|
29
30
|
attr_accessor :action
|
30
|
-
|
31
|
+
|
31
32
|
# the controller for this action link. if nil, the current controller should be assumed.
|
32
33
|
attr_writer :controller
|
33
34
|
|
@@ -43,6 +44,9 @@ module ActiveScaffold::DataStructures
|
|
43
44
|
# a hash of request parameters
|
44
45
|
attr_accessor :parameters
|
45
46
|
|
47
|
+
# a block for dynamic_parameters
|
48
|
+
attr_accessor :dynamic_parameters
|
49
|
+
|
46
50
|
# the RESTful method
|
47
51
|
attr_accessor :method
|
48
52
|
|
@@ -51,7 +55,7 @@ module ActiveScaffold::DataStructures
|
|
51
55
|
def label
|
52
56
|
@label.is_a?(Symbol) ? as_(@label) : @label
|
53
57
|
end
|
54
|
-
|
58
|
+
|
55
59
|
# image to use {:name => 'arrow.png', :size => '16x16'}
|
56
60
|
attr_accessor :image
|
57
61
|
|
@@ -63,7 +67,7 @@ module ActiveScaffold::DataStructures
|
|
63
67
|
def confirm?
|
64
68
|
@confirm ? true : false
|
65
69
|
end
|
66
|
-
|
70
|
+
|
67
71
|
# if the action uses a DHTML based (i.e. 2-phase) confirmation
|
68
72
|
attr_writer :dhtml_confirm
|
69
73
|
def dhtml_confirm
|
@@ -83,9 +87,9 @@ module ActiveScaffold::DataStructures
|
|
83
87
|
def security_method_set?
|
84
88
|
!!@security_method
|
85
89
|
end
|
86
|
-
|
90
|
+
|
87
91
|
attr_accessor :ignore_method
|
88
|
-
|
92
|
+
|
89
93
|
# the crud type of the (eventual?) action. different than :method, because this crud action may not be imminent.
|
90
94
|
# this is used to determine record-level authorization (e.g. record.authorized_for?(:crud_type => link.crud_type).
|
91
95
|
# options are :create, :read, :update, and :delete
|
@@ -154,18 +158,18 @@ module ActiveScaffold::DataStructures
|
|
154
158
|
|
155
159
|
# html options for the link
|
156
160
|
attr_accessor :html_options
|
157
|
-
|
161
|
+
|
158
162
|
# nested action_links are referencing a column
|
159
163
|
attr_accessor :column
|
160
|
-
|
164
|
+
|
161
165
|
# indicates that this a nested_link
|
162
166
|
def nested_link?
|
163
167
|
@column || (parameters && parameters[:named_scope])
|
164
168
|
end
|
165
|
-
|
169
|
+
|
166
170
|
# Internal use: generated eid for this action_link
|
167
171
|
attr_accessor :eid
|
168
|
-
|
169
|
-
|
172
|
+
|
173
|
+
|
170
174
|
end
|
171
175
|
end
|