active_scaffold_vho 3.1.3 → 3.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/active_scaffold_vho.gemspec +4 -2
- data/app/assets/javascripts/jquery/active_scaffold.js +118 -12
- data/app/assets/javascripts/jquery/date_picker_bridge.js.erb +27 -13
- data/app/assets/javascripts/jquery/jquery.editinplace.js +1 -1
- data/app/assets/javascripts/jquery/tiny_mce_bridge.js +3 -3
- data/app/assets/javascripts/prototype/active_scaffold.js +13 -6
- data/app/assets/stylesheets/active_scaffold.css.erb +4 -1077
- data/app/assets/stylesheets/active_scaffold_core.css.erb +1077 -0
- data/frontends/default/views/_embedded_controller.html.erb +4 -0
- data/frontends/default/views/_form_association_footer.html.erb +7 -11
- data/frontends/default/views/_horizontal_subform_record.html.erb +9 -5
- data/frontends/default/views/_vertical_subform_record.html.erb +9 -5
- data/lib/active_scaffold.rb +18 -23
- data/lib/active_scaffold/active_record_permissions.rb +0 -2
- data/lib/active_scaffold/attribute_params.rb +37 -19
- data/lib/active_scaffold/data_structures/action_link.rb +1 -10
- data/lib/active_scaffold/extensions/action_view_rendering.rb +11 -7
- data/lib/active_scaffold/extensions/unsaved_associated.rb +1 -1
- data/lib/active_scaffold/finder.rb +17 -0
- data/lib/active_scaffold/helpers/list_column_helpers.rb +3 -3
- data/lib/active_scaffold/helpers/pagination_helpers.rb +1 -1
- data/lib/active_scaffold/helpers/view_helpers.rb +4 -10
- data/lib/active_scaffold/version.rb +1 -1
- data/lib/generators/active_scaffold_setup/active_scaffold_setup_generator.rb +10 -24
- metadata +20 -19
@@ -10,17 +10,15 @@ show_add_new = column_show_add_new(column, associated, @record)
|
|
10
10
|
|
11
11
|
return unless show_add_new or show_add_existing
|
12
12
|
|
13
|
-
edit_associated_url = url_for(:action => 'edit_associated', :id => parent_record.id, :association => column.name, :associated_id => '--ID--', :escape => false, :eid => params[:eid], :parent_controller => params[:parent_controller], :parent_id => params[:parent_id]) if show_add_existing
|
14
|
-
add_new_url = url_for(:action => 'edit_associated', :id => parent_record.id, :association => column.name, :escape => false, :eid => params[:eid], :parent_controller => params[:parent_controller], :parent_id => params[:parent_id]) if show_add_new
|
13
|
+
edit_associated_url = url_for(:action => 'edit_associated', :id => parent_record.id, :association => column.name, :associated_id => '--ID--', :escape => false, :eid => params[:eid], :parent_controller => params[:parent_controller], :parent_id => params[:parent_id]).html_safe if show_add_existing
|
14
|
+
add_new_url = url_for(:action => 'edit_associated', :id => parent_record.id, :association => column.name, :escape => false, :eid => params[:eid], :parent_controller => params[:parent_controller], :parent_id => params[:parent_id]).html_safe if show_add_new
|
15
15
|
|
16
16
|
-%>
|
17
17
|
<div class="footer-wrapper">
|
18
18
|
<div class="footer">
|
19
19
|
<% if show_add_new -%>
|
20
|
-
<% add_label = column.plural_association? ? as_(:create_another, :model => column.association.klass.model_name.human) : as_(:replace_with_new)
|
21
|
-
|
22
|
-
<%= tag(:input, {:id => create_another_id, :type => 'button', :value => add_label, :href => add_new_url.html_safe, 'data-remote' => true, :style=> "display: none;"}) %>
|
23
|
-
<%= javascript_tag("ActiveScaffold.show('#{create_another_id}');") %>
|
20
|
+
<% add_label = column.plural_association? ? as_(:create_another, :model => column.association.klass.model_name.human) : as_(:replace_with_new) %>
|
21
|
+
<%= link_to add_label, add_new_url, :class => 'as_associated_form_link', :remote => true, :style=> "display: none;" %>
|
24
22
|
<% end -%>
|
25
23
|
|
26
24
|
<%= '|' if show_add_new and show_add_existing %>
|
@@ -29,11 +27,9 @@ add_new_url = url_for(:action => 'edit_associated', :id => parent_record.id, :as
|
|
29
27
|
<% if remote_controller and remote_controller.respond_to? :uses_record_select? and remote_controller.uses_record_select? -%>
|
30
28
|
<%= link_to_record_select as_(:add_existing), remote_controller.controller_path, :onselect => "ActiveScaffold.record_select_onselect(#{edit_associated_url.to_json}, #{active_scaffold_id.to_json}, id);" -%>
|
31
29
|
<% else -%>
|
32
|
-
<% select_options = options_for_select(options_for_association(column.association))
|
33
|
-
|
34
|
-
<%=
|
35
|
-
<%= tag(:input, {:id => add_existing_id, :type => 'button', :value => as_(:add_existing), :href => edit_associated_url.html_safe, 'data-remote' => true, :class=> 'as_add_existing', :style => "display: none;"}) %>
|
36
|
-
<%= javascript_tag("ActiveScaffold.show('#{add_existing_id}');") %>
|
30
|
+
<% select_options = options_for_select(options_for_association(column.association)) %>
|
31
|
+
<%= select_tag 'associated_id', '<option value="">'.html_safe + as_(:_select_) + '</option>'.html_safe + select_options, :id => nil, :style => "display: none;" %>
|
32
|
+
<%= link_to as_(:add_existing), edit_associated_url, :remote => true, :class => 'as_associated_form_link as_add_existing', :style => "display: none;" %>
|
37
33
|
<% end -%>
|
38
34
|
<% end -%>
|
39
35
|
</div>
|
@@ -5,6 +5,7 @@
|
|
5
5
|
config = active_scaffold_config_for(@record.class)
|
6
6
|
options = active_scaffold_input_options(config.columns[@record.class.primary_key], scope)
|
7
7
|
tr_id = "association-#{options[:id]}"
|
8
|
+
associated_action = @record.new_record? ? :create_or_empty : :update
|
8
9
|
%>
|
9
10
|
<tr id="<%= tr_id %>" class="association-record <%= 'association-record-new' if @record.new_record? -%> <%= 'locked' if locked -%>">
|
10
11
|
<% config.subform.columns.each :for => @record.class, :crud_type => crud_type, :flatten => true do |column| %>
|
@@ -25,13 +26,16 @@
|
|
25
26
|
<% if show_actions -%>
|
26
27
|
<td class="actions">
|
27
28
|
<% if record_column.plural_association? and (@record.authorized_for?(:crud_type => :delete) or not [:destroy, :delete_all].include?(record_column.association.options[:dependent])) %>
|
28
|
-
<%
|
29
|
-
|
30
|
-
<%=
|
29
|
+
<% link_classes = ['destroy', 'as_destroy_existing']
|
30
|
+
link_classes << 'as_associated_form_link' if !locked %>
|
31
|
+
<%= link_to as_(:remove), '#', :class => link_classes.join(' '), :style=> "display: none;" %>
|
31
32
|
<% end %>
|
33
|
+
</td>
|
34
|
+
<% end -%>
|
35
|
+
<td>
|
32
36
|
<% unless @record.new_record? %>
|
33
|
-
|
37
|
+
<input type="hidden" name="<%= options[:name] -%>" id="<%= options[:id] -%>" value="<%= @record.id -%>" />
|
34
38
|
<% end -%>
|
39
|
+
<input type="hidden" name="<%= scope ? "record#{scope}[associated_action]" : "record[associated_action]" -%>" class="associated_action" value="<%= associated_action -%>" />
|
35
40
|
</td>
|
36
|
-
<% end -%>
|
37
41
|
</tr>
|
@@ -6,6 +6,7 @@
|
|
6
6
|
config = active_scaffold_config_for(@record.class)
|
7
7
|
options = active_scaffold_input_options(config.columns[@record.class.primary_key], scope)
|
8
8
|
tr_id = "association-#{options[:id]}"
|
9
|
+
associated_action = @record.new_record? ? :create_or_empty : :update
|
9
10
|
-%>
|
10
11
|
<ol id="<%= tr_id %>" class="association-record <%= 'association-record-new' if @record.new_record? -%> <%= 'locked' if locked -%>">
|
11
12
|
<% config.subform.columns.each :for => @record, :crud_type => crud_type, :flatten => true do |column| %>
|
@@ -26,13 +27,16 @@
|
|
26
27
|
<% if show_actions -%>
|
27
28
|
<li class="actions">
|
28
29
|
<% if record_column.plural_association? and (@record.authorized_for?(:crud_type => :delete) or not [:destroy, :delete_all].include?(record_column.association.options[:dependent])) %>
|
29
|
-
<%
|
30
|
-
|
31
|
-
<%=
|
30
|
+
<% link_classes = ['destroy', 'as_destroy_existing']
|
31
|
+
link_classes << 'as_associated_form_link' if !locked %>
|
32
|
+
<%= link_to as_(:remove), '#', :class => link_classes.join(' '), :style=> "display: none;" %>
|
32
33
|
<% end %>
|
34
|
+
</li>
|
35
|
+
<% end -%>
|
36
|
+
<li>
|
33
37
|
<% unless @record.new_record? %>
|
34
|
-
|
38
|
+
<input type="hidden" name="<%= options[:name] -%>" id="<%= options[:id] -%>" value="<%= @record.id -%>" />
|
35
39
|
<% end -%>
|
40
|
+
<input type="hidden" name="<%= scope ? "record#{scope}[associated_action]" : "record[associated_action]" -%>" class="associated_action" value="<%= associated_action -%>" />
|
36
41
|
</li>
|
37
|
-
<% end -%>
|
38
42
|
</ol>
|
data/lib/active_scaffold.rb
CHANGED
@@ -149,6 +149,19 @@ module ActiveScaffold
|
|
149
149
|
File.dirname(__FILE__) + "/.."
|
150
150
|
end
|
151
151
|
|
152
|
+
def self.default_view_paths
|
153
|
+
default_paths = []
|
154
|
+
ActionController::Base.view_paths.each do |dir|
|
155
|
+
active_scaffold_override_dir = File.join(dir.to_s,"active_scaffold_overrides")
|
156
|
+
default_paths << active_scaffold_override_dir if File.exists?(active_scaffold_override_dir)
|
157
|
+
end
|
158
|
+
default_paths.uniq!
|
159
|
+
|
160
|
+
active_scaffold_default_frontend_path = File.join(ActiveScaffold::Config::Core.plugin_directory, 'frontends', 'default' , 'views')
|
161
|
+
default_paths << active_scaffold_default_frontend_path
|
162
|
+
default_paths
|
163
|
+
end
|
164
|
+
|
152
165
|
module ClassMethods
|
153
166
|
def active_scaffold(model_id = nil, &block)
|
154
167
|
# initialize bridges here
|
@@ -162,20 +175,9 @@ module ActiveScaffold
|
|
162
175
|
@active_scaffold_config_block = block
|
163
176
|
self.links_for_associations
|
164
177
|
|
165
|
-
@active_scaffold_overrides = []
|
166
|
-
ActionController::Base.view_paths.each do |dir|
|
167
|
-
active_scaffold_overrides_dir = File.join(dir.to_s,"active_scaffold_overrides")
|
168
|
-
@active_scaffold_overrides << active_scaffold_overrides_dir if File.exists?(active_scaffold_overrides_dir)
|
169
|
-
end
|
170
|
-
@active_scaffold_overrides.uniq! # Fix rails duplicating some view_paths
|
171
|
-
@active_scaffold_frontends = []
|
172
178
|
if active_scaffold_config.frontend.to_sym != :default
|
173
|
-
|
174
|
-
@active_scaffold_frontends << active_scaffold_custom_frontend_path
|
179
|
+
self.add_active_scaffold_view_path(File.join(ActiveScaffold::Config::Core.plugin_directory, 'frontends', active_scaffold_config.frontend.to_s , 'views'))
|
175
180
|
end
|
176
|
-
active_scaffold_default_frontend_path = File.join(ActiveScaffold::Config::Core.plugin_directory, 'frontends', 'default' , 'views')
|
177
|
-
@active_scaffold_frontends << active_scaffold_default_frontend_path
|
178
|
-
@active_scaffold_custom_paths = []
|
179
181
|
|
180
182
|
self.active_scaffold_superclasses_blocks.each {|superblock| self.active_scaffold_config.configure &superblock}
|
181
183
|
self.active_scaffold_config.sti_children = nil # reset sti_children if set in parent block
|
@@ -206,7 +208,7 @@ module ActiveScaffold
|
|
206
208
|
end
|
207
209
|
end
|
208
210
|
end
|
209
|
-
|
211
|
+
active_scaffold_view_paths.each do |path|
|
210
212
|
self.append_view_path(ActionView::ActiveScaffoldResolver.new(path))
|
211
213
|
end
|
212
214
|
self._add_sti_create_links if self.active_scaffold_config.add_sti_create_links?
|
@@ -284,22 +286,15 @@ module ActiveScaffold
|
|
284
286
|
|
285
287
|
def add_active_scaffold_path(path)
|
286
288
|
@active_scaffold_paths = nil # Force active_scaffold_paths to rebuild
|
289
|
+
@active_scaffold_custom_paths ||= []
|
287
290
|
@active_scaffold_custom_paths << path
|
288
291
|
end
|
289
292
|
|
290
|
-
def
|
291
|
-
@active_scaffold_paths = nil # Force active_scaffold_paths to rebuild
|
292
|
-
@active_scaffold_overrides.unshift path
|
293
|
-
end
|
294
|
-
|
295
|
-
def active_scaffold_paths
|
293
|
+
def active_scaffold_view_paths
|
296
294
|
return @active_scaffold_paths unless @active_scaffold_paths.nil?
|
297
295
|
|
298
|
-
|
299
|
-
@active_scaffold_paths = []
|
300
|
-
@active_scaffold_paths.concat @active_scaffold_overrides unless @active_scaffold_overrides.nil?
|
296
|
+
@active_scaffold_paths = ActiveScaffold.default_view_paths
|
301
297
|
@active_scaffold_paths.concat @active_scaffold_custom_paths unless @active_scaffold_custom_paths.nil?
|
302
|
-
@active_scaffold_paths.concat @active_scaffold_frontends unless @active_scaffold_frontends.nil?
|
303
298
|
@active_scaffold_paths
|
304
299
|
end
|
305
300
|
|
@@ -82,8 +82,6 @@ module ActiveRecordPermissions
|
|
82
82
|
# options[:column] should be the name of a model attribute
|
83
83
|
# options[:action] is the name of a method
|
84
84
|
def authorized_for?(options = {})
|
85
|
-
raise ArgumentError, "unknown crud type #{options[:crud_type]}" if options[:crud_type] and ![:create, :read, :update, :delete].include?(options[:crud_type])
|
86
|
-
|
87
85
|
# column_authorized_for_crud_type? has the highest priority over other methods,
|
88
86
|
# you can disable a crud verb and enable that verb for a column
|
89
87
|
# (for example, disable update and enable inplace_edit in a column)
|
@@ -87,7 +87,7 @@ module ActiveScaffold
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def manage_nested_record_from_params(parent_record, column, attributes)
|
90
|
-
record =
|
90
|
+
record = nested_record_for_action(parent_record, column, attributes)
|
91
91
|
if record
|
92
92
|
record_columns = active_scaffold_config_for(column.association.klass).subform.columns
|
93
93
|
update_record_from_params(record, record_columns, attributes)
|
@@ -95,6 +95,23 @@ module ActiveScaffold
|
|
95
95
|
end
|
96
96
|
record
|
97
97
|
end
|
98
|
+
|
99
|
+
def nested_record_for_action(parent_record, column, attributes)
|
100
|
+
associated_action = attributes.delete(:associated_action)
|
101
|
+
|
102
|
+
case associated_action.to_sym
|
103
|
+
when :create then create_nested_record(column, parent_record)
|
104
|
+
when :update then find_nested_record(attributes[:id], column, parent_record)
|
105
|
+
when :empty then nil
|
106
|
+
when :delete then nil
|
107
|
+
when :create_or_empty then
|
108
|
+
if column.show_blank_record && attributes_hash_is_empty?(attributes, column.association.klass)
|
109
|
+
nil
|
110
|
+
else
|
111
|
+
create_nested_record(column, parent_record)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
98
115
|
|
99
116
|
def column_value_from_param_value(parent_record, column, value)
|
100
117
|
# convert the value, possibly by instantiating associated objects
|
@@ -149,33 +166,34 @@ module ActiveScaffold
|
|
149
166
|
end
|
150
167
|
end
|
151
168
|
|
152
|
-
|
153
|
-
# request parameters given. If params[:id] exists it will attempt to find an existing object
|
154
|
-
# otherwise it will build a new one.
|
155
|
-
def find_or_create_for_params(params, parent_column, parent_record)
|
156
|
-
current = parent_record.send(parent_column.name)
|
169
|
+
def create_nested_record(parent_column, parent_record)
|
157
170
|
klass = parent_column.association.klass
|
158
|
-
|
171
|
+
|
172
|
+
if klass.authorized_for?(:crud_type => :create)
|
173
|
+
if parent_column.singular_association?
|
174
|
+
return parent_record.send("build_#{parent_column.name}")
|
175
|
+
else
|
176
|
+
return parent_record.send(parent_column.name).build
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
159
180
|
|
160
|
-
|
181
|
+
def find_nested_record(id, parent_column, parent_record)
|
182
|
+
klass = parent_column.association.klass
|
183
|
+
if id
|
184
|
+
current = parent_record.send(parent_column.name)
|
161
185
|
# modifying the current object of a singular association
|
162
|
-
if current
|
186
|
+
if current && current.is_a?(ActiveRecord::Base) && current.id.to_s == id
|
163
187
|
return current
|
164
188
|
# modifying one of the current objects in a plural association
|
165
|
-
elsif current
|
166
|
-
return current.detect {|o| o.id.to_s ==
|
189
|
+
elsif current && current.respond_to?(:any?) && current.any? {|o| o.id.to_s == id}
|
190
|
+
return current.detect {|o| o.id.to_s == id}
|
167
191
|
# attaching an existing but not-current object
|
168
192
|
else
|
169
|
-
return klass.find(
|
193
|
+
return klass.find(id)
|
170
194
|
end
|
171
195
|
else
|
172
|
-
|
173
|
-
if parent_column.singular_association?
|
174
|
-
return parent_record.send("build_#{parent_column.name}")
|
175
|
-
else
|
176
|
-
return parent_record.send(parent_column.name).build
|
177
|
-
end
|
178
|
-
end
|
196
|
+
Rails.logger.info("Activescaffold find_nested_record missing id")
|
179
197
|
end
|
180
198
|
end
|
181
199
|
|
@@ -67,16 +67,7 @@ module ActiveScaffold::DataStructures
|
|
67
67
|
def confirm?
|
68
68
|
@confirm ? true : false
|
69
69
|
end
|
70
|
-
|
71
|
-
# if the action uses a DHTML based (i.e. 2-phase) confirmation
|
72
|
-
attr_writer :dhtml_confirm
|
73
|
-
def dhtml_confirm
|
74
|
-
@dhtml_confirm
|
75
|
-
end
|
76
|
-
def dhtml_confirm?
|
77
|
-
@dhtml_confirm
|
78
|
-
end
|
79
|
-
|
70
|
+
|
80
71
|
# what method to call on the controller to see if this action_link should be visible
|
81
72
|
# note that this is only the UI part of the security. to prevent URL hax0rz, you also need security on requests (e.g. don't execute update method unless authorized).
|
82
73
|
attr_writer :security_method
|
@@ -109,15 +109,19 @@ module ActionView #:nodoc:
|
|
109
109
|
if context.controller.respond_to?(:render_component_into_view)
|
110
110
|
context.controller.send(:render_component_into_view, url_options)
|
111
111
|
else
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
javascript_tag("new Ajax.Updater('#{id}', '#{url}', {method: 'get', evalScripts: true});")
|
117
|
-
elsif ActiveScaffold.js_framework == :jquery
|
118
|
-
javascript_tag("$('##{id}').load('#{url}');")
|
112
|
+
if !context.controller.respond_to?(:uses_active_scaffold?) || context.controller.send(:uses_active_scaffold?) == false
|
113
|
+
# have to add activescaffold view path cause parentcontroller is not activescaffold enabled
|
114
|
+
ActiveScaffold.default_view_paths.each do |path|
|
115
|
+
context.controller.append_view_path(ActionView::ActiveScaffoldResolver.new(path))
|
119
116
|
end
|
120
117
|
end
|
118
|
+
url_options.delete(:embedded)
|
119
|
+
options[:locals] ||= {}
|
120
|
+
options[:locals].merge!({:url_options => url_options, :id=> id, :remote_controller => remote_controller})
|
121
|
+
options[:partial] = 'embedded_controller'
|
122
|
+
options.delete(:active_scaffold)
|
123
|
+
options.delete(:params)
|
124
|
+
render(context, options)
|
121
125
|
end
|
122
126
|
end
|
123
127
|
|
@@ -48,7 +48,7 @@ class ActiveRecord::Base
|
|
48
48
|
# returns true otherwise, even when none of the associations have been instantiated. build wrapper methods accordingly.
|
49
49
|
def with_unsaved_associated
|
50
50
|
associations_for_update.all? do |association|
|
51
|
-
association_proxy =
|
51
|
+
association_proxy = send(association.name)
|
52
52
|
if association_proxy
|
53
53
|
records = association_proxy
|
54
54
|
records = [records] unless records.is_a? Array # convert singular associations into collections for ease of use
|
@@ -275,6 +275,8 @@ module ActiveScaffold
|
|
275
275
|
# Converts count to an integer if ActiveRecord returned an OrderedHash
|
276
276
|
# that happens when finder_options contains a :group key
|
277
277
|
count = count.length if count.is_a? ActiveSupport::OrderedHash
|
278
|
+
|
279
|
+
full_includes = add_association_to_includes_for_sorting(options[:sorting], full_includes)
|
278
280
|
finder_options.merge! :includes => full_includes
|
279
281
|
|
280
282
|
# we build the paginator differently for method- and sql-based sorting
|
@@ -292,6 +294,21 @@ module ActiveScaffold
|
|
292
294
|
end
|
293
295
|
pager.page(options[:page])
|
294
296
|
end
|
297
|
+
|
298
|
+
# if someone excludes association from includes in configuration
|
299
|
+
# and sorts by that that column... database will not be happy about it :-)
|
300
|
+
# just a safety check to prevent many many database queries
|
301
|
+
def add_association_to_includes_for_sorting(sorting, full_includes)
|
302
|
+
if sorting && sorting.sorts_by_method?
|
303
|
+
sorting_column = sorting.first.first
|
304
|
+
#wants to sort by assocation which is not included bad performance...
|
305
|
+
if sorting_column.association && !sorting_column.polymorphic_association? &&
|
306
|
+
sorting_column.includes.empty? && !full_includes.include?(sorting_column.association.name)
|
307
|
+
full_includes << sorting_column.association.name
|
308
|
+
end
|
309
|
+
end
|
310
|
+
full_includes
|
311
|
+
end
|
295
312
|
|
296
313
|
def append_to_query(query, options)
|
297
314
|
options.assert_valid_keys :where, :select, :group, :order, :limit, :offset, :joins, :includes, :lock, :readonly, :from
|
@@ -353,15 +353,15 @@ module ActiveScaffold
|
|
353
353
|
|
354
354
|
def render_nested_view(action_links, url_options, record)
|
355
355
|
rendered = []
|
356
|
-
|
356
|
+
link_nested_controllers = []
|
357
357
|
action_links.member.each do |link|
|
358
358
|
if link.nested_link? && link.column && @nested_auto_open[link.column.name] && @records.length <= @nested_auto_open[link.column.name] && controller.respond_to?(:render_component_into_view)
|
359
359
|
link_url_options = {:embedded => true, :format => :js}.merge(action_link_url_options(link, url_options, record, options = {:reuse_eid => true}))
|
360
|
-
|
360
|
+
link_nested_controllers << link.controller.to_s if link.controller
|
361
361
|
rendered << (controller.send(:render_component_into_view, link_url_options))
|
362
362
|
end
|
363
363
|
end
|
364
|
-
content_tag(:tr, content_tag(:td, rendered.join(' ').html_safe), :class => "inline-adapter-autoopen", 'data-
|
364
|
+
content_tag(:tr, content_tag(:td, rendered.join(' ').html_safe), :class => "inline-adapter-autoopen", 'data-actionlink-controllers' => link_nested_controllers.join('::').html_safe, 'data-as_load'=>"tr");
|
365
365
|
end
|
366
366
|
end
|
367
367
|
end
|
@@ -24,7 +24,7 @@ module ActiveScaffold
|
|
24
24
|
page = current_page.number - offset
|
25
25
|
if page < start_number && page > 1
|
26
26
|
html << '..' if page > last_page + 1
|
27
|
-
html << pagination_ajax_link(page, params)
|
27
|
+
html << pagination_ajax_link(page, params, options)
|
28
28
|
last_page = page
|
29
29
|
end
|
30
30
|
end
|
@@ -166,7 +166,6 @@ module ActiveScaffold
|
|
166
166
|
end
|
167
167
|
|
168
168
|
def action_link_html_options(link, url_options, record, html_options)
|
169
|
-
link_id = get_action_link_id(url_options, record, link.column)
|
170
169
|
html_options.reverse_merge! link.html_options.merge(:class => link.action)
|
171
170
|
|
172
171
|
# Needs to be in html_options to as the adding _method to the url is no longer supported by Rails
|
@@ -181,14 +180,7 @@ module ActiveScaffold
|
|
181
180
|
html_options['data-popup'] = true
|
182
181
|
html_options[:target] = '_blank'
|
183
182
|
end
|
184
|
-
html_options[:id] = link_id
|
185
183
|
html_options[:remote] = true unless link.page? || link.popup?
|
186
|
-
if link.dhtml_confirm?
|
187
|
-
html_options[:class] += ' as_action' if !link.inline?
|
188
|
-
html_options[:page_link] = 'true' if !link.inline?
|
189
|
-
html_options[:dhtml_confirm] = link.dhtml_confirm.value
|
190
|
-
html_options[:onclick] = link.dhtml_confirm.onclick_function(controller, link_id)
|
191
|
-
end
|
192
184
|
html_options[:class] += " #{link.html_options[:class]}" unless link.html_options[:class].blank?
|
193
185
|
html_options
|
194
186
|
end
|
@@ -256,6 +248,7 @@ module ActiveScaffold
|
|
256
248
|
end
|
257
249
|
|
258
250
|
def column_class(column, column_value, record)
|
251
|
+
@numeric_classes ||= [:decimal, :float, :integer]
|
259
252
|
classes = []
|
260
253
|
classes << "#{column.name}-column"
|
261
254
|
if column.css_class.is_a?(Proc)
|
@@ -267,7 +260,7 @@ module ActiveScaffold
|
|
267
260
|
|
268
261
|
classes << 'empty' if column_empty? column_value
|
269
262
|
classes << 'sorted' if active_scaffold_config.list.user.sorting.sorts_on?(column)
|
270
|
-
classes << 'numeric' if column.column
|
263
|
+
classes << 'numeric' if column.column && @numeric_classes.include?(column.column.type)
|
271
264
|
classes.join(' ').rstrip
|
272
265
|
end
|
273
266
|
|
@@ -286,9 +279,10 @@ module ActiveScaffold
|
|
286
279
|
end
|
287
280
|
|
288
281
|
def column_empty?(column_value)
|
282
|
+
@empty_column_strings ||= [' ', active_scaffold_config.list.empty_field_text]
|
289
283
|
empty = column_value.nil?
|
290
284
|
empty ||= column_value.empty? if column_value.respond_to? :empty?
|
291
|
-
empty ||=
|
285
|
+
empty ||= @empty_column_strings.include?(column_value) if String === column_value
|
292
286
|
return empty
|
293
287
|
end
|
294
288
|
|