active_scaffold 3.1.13 → 3.1.14

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  <%# nested_id, allows us to remove a nested scaffold programmatically %>
2
2
  <tr class="inline-adapter" id="<%= element_row_id :action => :nested %>">
3
3
  <td colspan="99" class="inline-adapter-cell">
4
- <div class="<%= "#{params[:action]}-view" if params[:action] %> <%= "#{params[:associations] ? params[:associations] : params[:controller]}-view" %> view">
4
+ <div class="<%= "#{params[:action]}-view" if params[:action] %> <%= "#{nested? ? nested.name : id_from_controller(params[:controller])}-view" %> view">
5
5
  <%= link_to(as_(:close), '', :class => 'inline-adapter-close as_cancel', :remote => true, :title => as_(:close), 'data-refresh' => (action_name == 'index' ? true : false)) -%>
6
6
  <%= payload -%>
7
7
  </div>
@@ -1,7 +1,7 @@
1
1
  <%# nested_id, allows us to remove a nested scaffold programmatically %>
2
2
  <tr class="inline-adapter" id="<%= element_row_id :action => :nested %>">
3
3
  <td colspan="99" class="inline-adapter-cell">
4
- <div class="<%= "#{params[:action]}-view" if params[:action] %> <%= "#{params[:associations] ? params[:associations] : params[:controller]}-view" %> view">
4
+ <div class="<%= "#{params[:action]}-view" if params[:action] %> <%= "#{params[:association] ? params[:association] : id_from_controller(params[:controller])}-view" %> view">
5
5
  <%= link_to(as_(:close), '', :class => 'inline-adapter-close as_cancel', :remote => true, :title => as_(:close), 'data-refresh' => (action_name == 'index' ? true : false)) -%>
6
6
  <%= payload -%>
7
7
  </div>
@@ -8,7 +8,7 @@
8
8
  <% old_record, @record = @record, new_model %>
9
9
  <tr>
10
10
  <td>
11
- <div class="active-scaffold show_search-view <%= "#{params[:controller]}-view" %> view">
11
+ <div class="active-scaffold show_search-view <%= "#{id_from_controller params[:controller]}-view" %> view">
12
12
  <%= render :partial => active_scaffold_config.list.search_partial %>
13
13
  </div>
14
14
  </td>
@@ -21,7 +21,7 @@
21
21
  <% old_record, @record = @record, new_model %>
22
22
  <tr>
23
23
  <td>
24
- <div class="active-scaffold create-view <%= "#{params[:controller]}-view" %> view">
24
+ <div class="active-scaffold create-view <%= "#{id_from_controller params[:controller]}-view" %> view">
25
25
  <%= render :partial => 'create_form_on_list' %>
26
26
  </div>
27
27
  </td>
@@ -5,24 +5,28 @@
5
5
  <table cellpadding="0" cellspacing="0">
6
6
  <tbody class="before-header" id="<%= before_header_id -%>">
7
7
  <% if active_scaffold_config.list.always_show_search %>
8
+ <% old_record, @record = @record, new_model %>
8
9
  <tr>
9
10
  <td>
10
- <div class="active-scaffold show_search-view <%= "#{params[:controller]}-view" %> view">
11
+ <div class="active-scaffold show_search-view <%= "#{scope_id params[:controller]}-view" %> view">
11
12
  <%= render :partial => active_scaffold_config.list.search_partial %>
12
13
  </div>
13
14
  </td>
14
15
  </tr>
16
+ <% @record = old_record %>
15
17
  <% else %>
16
18
  <tr><td></td></tr>
17
19
  <% end %>
18
20
  <% if !nested? && active_scaffold_config.list.always_show_create %>
21
+ <% old_record, @record = @record, new_model %>
19
22
  <tr>
20
23
  <td>
21
- <div class="active-scaffold create-view <%= "#{params[:controller]}-view" %> view">
24
+ <div class="active-scaffold create-view <%= "#{scope_id params[:controller]}-view" %> view">
22
25
  <%= render :partial => 'create_form_on_list' %>
23
26
  </div>
24
27
  </td>
25
28
  </tr>
29
+ <% @record = old_record %>
26
30
  <% end %>
27
31
  </tbody>
28
32
  </table>
@@ -1,5 +1,5 @@
1
1
  <div class="active-scaffold">
2
- <div class="create-view <%= "#{params[:controller]}-view" %> view">
2
+ <div class="create-view <%= "#{id_from_controller params[:controller]}-view" %> view">
3
3
  <%= render :partial => 'add_existing_form' -%>
4
4
  </div>
5
5
  </div>
@@ -0,0 +1,5 @@
1
+ <div class="active-scaffold">
2
+ <div class="create-view <%= "scope_id #{params[:controller]}-view" %> view">
3
+ <%= render :partial => 'add_existing_form' -%>
4
+ </div>
5
+ </div>
@@ -1,5 +1,5 @@
1
1
  <div class="active-scaffold">
2
- <div class="create-view <%= "#{params[:controller]}-view" %> view">
2
+ <div class="create-view <%= "#{id_from_controller params[:controller]}-view" %> view">
3
3
  <%= render :partial => 'create_form' -%>
4
4
  </div>
5
5
  </div>
@@ -0,0 +1,5 @@
1
+ <div class="active-scaffold">
2
+ <div class="create-view <%= "#{scope_id params[:controller]}-view" %> view">
3
+ <%= render :partial => 'create_form' -%>
4
+ </div>
5
+ </div>
@@ -1,5 +1,5 @@
1
1
  <div class="active-scaffold">
2
- <div class="search-view <%= "#{params[:controller]}-view" %> view">
2
+ <div class="search-view <%= "#{id_from_controller params[:controller]}-view" %> view">
3
3
  <%= render :partial => 'search' -%>
4
4
  </div>
5
5
  </div>
@@ -0,0 +1,5 @@
1
+ <div class="active-scaffold">
2
+ <div class="search-view <%= "#{scope_id params[:controller]}-view" %> view">
3
+ <%= render :partial => 'search' -%>
4
+ </div>
5
+ </div>
@@ -1,5 +1,5 @@
1
1
  <div class="active-scaffold">
2
- <div class="show-view <%= "#{params[:controller]}-view" %> view">
2
+ <div class="show-view <%= "#{id_from_controller params[:controller]}-view" %> view">
3
3
  <%= render :partial => 'show' -%>
4
4
  </div>
5
5
  </div>
@@ -0,0 +1,5 @@
1
+ <div class="active-scaffold">
2
+ <div class="show-view <%= "#{scope_id params[:controller]}-view" %> view">
3
+ <%= render :partial => 'show' -%>
4
+ </div>
5
+ </div>
@@ -1,5 +1,5 @@
1
1
  <div class="active-scaffold">
2
- <div class="update-view <%= "#{params[:controller]}-view" %> view">
2
+ <div class="update-view <%= "#{id_from_controller params[:controller]}-view" %> view">
3
3
  <% if active_scaffold_config.update.nested_links and active_scaffold_config.action_links.member.empty? -%>
4
4
  <%= render :partial => 'update_actions', :locals => {:record => @record, :url_options => params_for(:action => :list, :id => @record.id)} %>
5
5
  <% end -%>
@@ -0,0 +1,8 @@
1
+ <div class="active-scaffold">
2
+ <div class="update-view <%= "#{scope_id params[:controller]}-view" %> view">
3
+ <% if active_scaffold_config.update.nested_links and active_scaffold_config.action_links.member.empty? -%>
4
+ <%= render :partial => 'update_actions', :locals => {:record => @record, :url_options => params_for(:action => :list, :id => @record.id)} %>
5
+ <% end -%>
6
+ <%= render :partial => 'update_form' -%>
7
+ </div>
8
+ </div>
@@ -15,7 +15,7 @@ module ActiveScaffold::Config
15
15
 
16
16
  # the ActionLink for this action
17
17
  cattr_accessor :link
18
- @@link = ActiveScaffold::DataStructures::ActionLink.new('destroy', :label => :delete, :type => :member, :confirm => :are_you_sure_to_delete, :method => :delete, :crud_type => :delete, :position => false, :parameters => {:destroy_action => true}, :security_method => :delete_authorized?)
18
+ @@link = ActiveScaffold::DataStructures::ActionLink.new('destroy', :label => :delete, :type => :member, :confirm => :are_you_sure_to_delete, :method => :delete, :crud_type => :delete, :position => false, :parameters => {:destroy_action => true}, :security_method => :delete_authorized?, :ignore_method => :delete_ignore?)
19
19
 
20
20
  # whether we should refresh list after destroy or not
21
21
  cattr_accessor :refresh_list
@@ -173,7 +173,7 @@ module ActiveScaffold::DataStructures
173
173
  protected
174
174
 
175
175
  def skip_action_link(controller, link, *args)
176
- (!link.ignore_method.nil? and controller.try(link.ignore_method, *args)) || ((link.security_method_set? or controller.respond_to? link.security_method) and !controller.send(link.security_method, *args))
176
+ (!link.ignore_method.nil? && controller.respond_to?(link.ignore_method) && controller.send(link.ignore_method, *args)) || ((link.security_method_set? or controller.respond_to? link.security_method) and !controller.send(link.security_method, *args))
177
177
  end
178
178
 
179
179
  # called during clone or dup. makes the clone/dup deeper.
@@ -70,6 +70,10 @@ module ActiveScaffold::DataStructures
70
70
  iterate_model_associations(model)
71
71
  end
72
72
 
73
+ def name
74
+ self.association.name
75
+ end
76
+
73
77
  def habtm?
74
78
  association.macro == :has_and_belongs_to_many
75
79
  end
@@ -115,7 +119,7 @@ module ActiveScaffold::DataStructures
115
119
  if association.foreign_key == current.foreign_key
116
120
  # show columns for has_many and has_one child associationes
117
121
  constrained_fields << current.name.to_sym if current.belongs_to?
118
- @child_association = current
122
+ @child_association = current if current.klass == @parent_model
119
123
  end
120
124
  end
121
125
  end
@@ -131,5 +135,9 @@ module ActiveScaffold::DataStructures
131
135
  def to_params
132
136
  super.merge(:named_scope => @scope)
133
137
  end
138
+
139
+ def name
140
+ self.scope
141
+ end
134
142
  end
135
143
  end
@@ -61,6 +61,9 @@ module ActiveScaffold::DataStructures
61
61
  def sorted?
62
62
  false
63
63
  end
64
+
65
+ def name
66
+ end
64
67
  end
65
68
 
66
69
  class NestedInfoAssociation < NestedInfo
@@ -70,6 +73,10 @@ module ActiveScaffold::DataStructures
70
73
  iterate_model_associations(model)
71
74
  end
72
75
 
76
+ def name
77
+ self.association.name
78
+ end
79
+
73
80
  def habtm?
74
81
  association.macro == :has_and_belongs_to_many
75
82
  end
@@ -99,7 +106,7 @@ module ActiveScaffold::DataStructures
99
106
  end
100
107
 
101
108
  def to_params
102
- super.merge(:association => @association, :assoc_id => parent_id)
109
+ super.merge(:association => @association.name, :assoc_id => parent_id)
103
110
  end
104
111
 
105
112
  protected
@@ -115,7 +122,7 @@ module ActiveScaffold::DataStructures
115
122
  if association.foreign_key == current.foreign_key
116
123
  # show columns for has_many and has_one child associationes
117
124
  constrained_fields << current.name.to_sym if current.belongs_to?
118
- @child_association = current
125
+ @child_association = current if current.klass == @parent_model
119
126
  end
120
127
  end
121
128
  end
@@ -131,5 +138,9 @@ module ActiveScaffold::DataStructures
131
138
  def to_params
132
139
  super.merge(:named_scope => @scope)
133
140
  end
141
+
142
+ def name
143
+ self.scope
144
+ end
134
145
  end
135
146
  end
@@ -100,7 +100,7 @@ module ActiveScaffold
100
100
  end
101
101
 
102
102
  def skip_action_link(link, *args)
103
- (!link.ignore_method.nil? and controller.try(link.ignore_method, *args)) || ((link.security_method_set? or controller.respond_to? link.security_method) and !controller.send(link.security_method, *args))
103
+ (!link.ignore_method.nil? && controller.respond_to?(link.ignore_method) && controller.send(link.ignore_method, *args)) || ((link.security_method_set? or controller.respond_to? link.security_method) and !controller.send(link.security_method, *args))
104
104
  end
105
105
 
106
106
  def render_action_link(link, url_options, record = nil, html_options = {})
@@ -239,7 +239,7 @@ module ActiveScaffold
239
239
  end
240
240
 
241
241
  def as_main_div_class
242
- classes = ["active-scaffold", "active-scaffold-#{controller_id}", "#{params[:controller]}-view", "#{active_scaffold_config.theme}-theme"]
242
+ classes = ["active-scaffold", "active-scaffold-#{controller_id}", "#{id_from_controller params[:controller]}-view", "#{active_scaffold_config.theme}-theme"]
243
243
  classes << "as_touch" if touch_device?
244
244
  classes.join(' ')
245
245
  end
@@ -100,7 +100,7 @@ module ActiveScaffold
100
100
  end
101
101
 
102
102
  def skip_action_link(link, *args)
103
- (!link.ignore_method.nil? and controller.try(link.ignore_method, *args)) || ((link.security_method_set? or controller.respond_to? link.security_method) and !controller.send(link.security_method, *args))
103
+ (!link.ignore_method.nil? && controller.respond_to?(link.ignore_method) && controller.send(link.ignore_method, *args)) || ((link.security_method_set? or controller.respond_to? link.security_method) and !controller.send(link.security_method, *args))
104
104
  end
105
105
 
106
106
  def render_action_link(link, url_options, record = nil, html_options = {})
@@ -194,7 +194,7 @@ module ActiveScaffold
194
194
  url_options[:eid] = link.eid
195
195
  elsif link.parameters && link.parameters[:named_scope]
196
196
  url_options[:assoc_id] = url_options.delete(:id)
197
- link.eid = "#{controller_id.from(3)}_#{record.id}_#{link.parameters[:named_scope]}" unless record.nil? || options.has_key?(:reuse_eid)
197
+ link.eid = "#{controller_id.from(3)}_#{record.id}_#{link.parameters[:named_scope]}" unless options.has_key?(:reuse_eid)
198
198
  url_options[:eid] = link.eid
199
199
  end
200
200
  end
@@ -265,7 +265,7 @@ module ActiveScaffold
265
265
 
266
266
  def render_column_calculation(column)
267
267
  calculation = column_calculation(column)
268
- override_formatter = "render_#{column.name}_#{column.calculate}"
268
+ override_formatter = "render_#{column.name}_#{column.calculate.is_a?(Proc) ? :calculate : column.calculate}"
269
269
  calculation = send(override_formatter, calculation) if respond_to? override_formatter
270
270
 
271
271
  "#{"#{as_(column.calculate)}: " unless column.calculate.is_a? Proc}#{format_column_value nil, column, calculation}"
@@ -2,7 +2,7 @@ module ActiveScaffold
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 1
5
- PATCH = 13
5
+ PATCH = 14
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
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: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 1
9
- - 13
10
- version: 3.1.13
9
+ - 14
10
+ version: 3.1.14
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: 2011-12-21 00:00:00 Z
18
+ date: 2012-01-12 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  version_requirements: &id001 !ruby/object:Gem::Requirement
@@ -159,22 +159,22 @@ files:
159
159
  - frontends/default/views/delete.html.erb
160
160
  - frontends/default/views/add_existing_form.html.erb
161
161
  - frontends/default/views/create.html.erb
162
- - frontends/default/views/_horizontal_subform_footer.html.erb
162
+ - frontends/default/views/_list_messages.html.erb
163
163
  - frontends/default/views/_human_conditions.html.erb
164
164
  - frontends/default/views/field_search.html.erb
165
165
  - frontends/default/views/add_existing.js.erb
166
166
  - frontends/default/views/search.html.erb
167
167
  - frontends/default/views/destroy.js.erb
168
168
  - frontends/default/views/update.html.erb
169
- - frontends/default/views/_list_messages.html.erb
169
+ - frontends/default/views/_list_with_header.html.erb
170
170
  - frontends/default/views/_list_pagination.html.erb
171
171
  - frontends/default/views/show.html.erb
172
+ - frontends/default/views/form_messages.js.erb
172
173
  - frontends/default/views/_list_record_columns.html.erb
173
- - frontends/default/views/_list_with_header.html.erb
174
+ - frontends/default/views/edit_associated.js.erb
174
175
  - frontends/default/views/_search_attribute.html.erb
175
176
  - frontends/default/views/action_confirmation.html.erb
176
- - frontends/default/views/edit_associated.js.erb
177
- - frontends/default/views/form_messages.js.erb
177
+ - frontends/default/views/_horizontal_subform_footer.html.erb
178
178
  - frontends/default/views/on_action_update.js.erb
179
179
  - frontends/default/views/on_create.js.erb
180
180
  - frontends/default/views/on_mark_all.js.erb
@@ -190,7 +190,6 @@ files:
190
190
  - frontends/default/views/update_column.js.erb~
191
191
  - frontends/default/views/_form_association_footer.html.erb~
192
192
  - frontends/default/views/edit_associated.js.erb~
193
- - frontends/default/views/_list_inline_adapter.html.erb~
194
193
  - frontends/default/views/_form_association.html.erb~
195
194
  - frontends/default/views/_vertical_subform.html.erb~
196
195
  - frontends/default/views/_horizontal_subform.html.erb~
@@ -208,6 +207,12 @@ files:
208
207
  - frontends/default/views/_list_with_header.html.erb~
209
208
  - frontends/default/views/_update_form.html.erb~
210
209
  - frontends/default/views/add_existing.js.erb~
210
+ - frontends/default/views/_list_inline_adapter.html.erb~
211
+ - frontends/default/views/add_existing_form.html.erb~
212
+ - frontends/default/views/update.html.erb~
213
+ - frontends/default/views/search.html.erb~
214
+ - frontends/default/views/create.html.erb~
215
+ - frontends/default/views/show.html.erb~
211
216
  - lib/active_scaffold.rb
212
217
  - lib/active_scaffold_env.rb
213
218
  - lib/active_scaffold/actions/core.rb
@@ -257,11 +262,11 @@ files:
257
262
  - lib/active_scaffold/data_structures/error_message.rb
258
263
  - lib/active_scaffold/data_structures/set.rb
259
264
  - lib/active_scaffold/data_structures/sorting.rb
260
- - lib/active_scaffold/data_structures/bridge.rb
261
265
  - lib/active_scaffold/data_structures/nested_info.rb
266
+ - lib/active_scaffold/data_structures/bridge.rb
267
+ - lib/active_scaffold/data_structures/nested_info.rb~
262
268
  - lib/active_scaffold/data_structures/action_columns.rb~
263
269
  - lib/active_scaffold/data_structures/action_link.rb~
264
- - lib/active_scaffold/data_structures/nested_info.rb~
265
270
  - lib/active_scaffold/finder.rb
266
271
  - lib/active_scaffold/helpers/association_helpers.rb
267
272
  - lib/active_scaffold/helpers/controller_helpers.rb
@@ -324,7 +329,7 @@ files:
324
329
  - lib/active_scaffold/bridges/shared/date_bridge.rb~
325
330
  - lib/active_scaffold/bridges/tiny_mce.rb
326
331
  - lib/active_scaffold/bridges/tiny_mce/helpers.rb
327
- - lib/active_scaffold/engine.rb
332
+ - lib/active_scaffold/version.rb
328
333
  - lib/active_scaffold/marked_model.rb
329
334
  - lib/active_scaffold/extensions/action_controller_rendering.rb
330
335
  - lib/active_scaffold/extensions/action_view_rendering.rb
@@ -351,7 +356,7 @@ files:
351
356
  - lib/active_scaffold/extensions/active_association_reflection.rb~
352
357
  - lib/active_scaffold/paginator.rb
353
358
  - lib/active_scaffold/responds_to_parent.rb
354
- - lib/active_scaffold/version.rb
359
+ - lib/active_scaffold/engine.rb
355
360
  - lib/active_scaffold/attribute_params.rb~
356
361
  - lib/active_scaffold/finder.rb~
357
362
  - lib/active_scaffold/constraints.rb~