active_scaffold_vho 3.1.0 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{active_scaffold_vho}
8
- s.version = "3.1.0"
8
+ s.version = "3.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Many, see README"]
12
- s.date = %q{2011-11-05}
12
+ s.date = %q{2011-12-22}
13
13
  s.description = %q{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.}
14
14
  s.email = %q{activescaffold@googlegroups.com}
15
15
  s.extra_rdoc_files = [
@@ -144,7 +144,7 @@ $(document).ready(function() {
144
144
  event.data_url = url;
145
145
  return true;
146
146
  });
147
- $('input.update_form, select.update_form').live('change', function(event) {
147
+ $('input.update_form, textarea.update_form, select.update_form').live('change', function(event) {
148
148
  var element = $(this);
149
149
  var as_form = element.closest('form.as_form');
150
150
  var params = null;
@@ -1,3 +1,4 @@
1
+ <% ActiveScaffold::Bridges::Bridge.run_all unless defined?(ActiveScaffold::Bridges::DatePickerBridge) %>
1
2
  <%= ActiveScaffold::Bridges::DatePickerBridge.localization %>
2
3
 
3
4
  $(document).ready(function() {
@@ -236,7 +236,7 @@ document.observe("dom:loaded", function() {
236
236
  event.memo.url = url;
237
237
  return true;
238
238
  });
239
- document.on('change', 'input.update_form, select.update_form', function(event) {
239
+ document.on('change', 'input.update_form, textarea.update_form, select.update_form', function(event) {
240
240
  var element = event.findElement();
241
241
  var as_form = element.up('form.as_form');
242
242
  var params = null;
@@ -409,9 +409,14 @@ var ActiveScaffold = {
409
409
  replace: function(element, html) {
410
410
  element = $(element);
411
411
  var elements = element.select('[data-as_load]');
412
+ var new_element = null;
412
413
  elements.unshift(element);
413
414
  ActiveScaffold.trigger_unload_events(elements);
414
- var new_element = new Element('div').update(html);
415
+ if (html.startsWith('<tr')) {
416
+ new_element = new Element('tbody').update(html);
417
+ } else {
418
+ new_element = new Element('div').update(html);
419
+ }
415
420
  new_element = new_element.firstDescendant();
416
421
  Element.replace(element, new_element);
417
422
  elements = new_element.select('[data-as_load]');
@@ -171,21 +171,21 @@ background-repeat: no-repeat;
171
171
  }
172
172
 
173
173
  .active-scaffold-header div.actions div.action_group div {
174
- background-image: url(<%= asset_path 'gears.png' %>); /* default icon for actions or override with css */
174
+ background-image: url(<%= asset_data_uri 'gears.png' %>); /* default icon for actions or override with css */
175
175
  }
176
176
 
177
177
  .active-scaffold-header div.actions a.show_config_list {
178
- background-image: url(<%= asset_path 'config.png' %>);
178
+ background-image: url(<%= asset_data_uri 'config.png' %>);
179
179
  }
180
180
 
181
181
  .active-scaffold-header div.actions a.new,
182
182
  .active-scaffold-header div.actions a.new_existing {
183
- background-image: url(<%= asset_path 'add.gif' %>);
183
+ background-image: url(<%= asset_data_uri 'add.gif' %>);
184
184
  }
185
185
 
186
186
  .active-scaffold-header div.actions a.show_search {
187
187
 
188
- background-image: url(<%= asset_path 'magnifier.png' %>);
188
+ background-image: url(<%= asset_data_uri 'magnifier.png' %>);
189
189
  }
190
190
 
191
191
  .blue-theme .active-scaffold-header div.actions a:hover {
@@ -244,17 +244,17 @@ padding-right: 18px;
244
244
 
245
245
  .active-scaffold th.asc a,
246
246
  .active-scaffold th.asc a:hover {
247
- background: #333 url(<%= asset_path 'arrow_up.gif' %>) right 50% no-repeat;
247
+ background: #333 url(<%= asset_data_uri 'arrow_up.gif' %>) right 50% no-repeat;
248
248
  }
249
249
 
250
250
  .active-scaffold th.desc a,
251
251
  .active-scaffold th.desc a:hover {
252
- background: #333 url(<%= asset_path 'arrow_down.gif' %>) right 50% no-repeat;
252
+ background: #333 url(<%= asset_data_uri 'arrow_down.gif' %>) right 50% no-repeat;
253
253
  }
254
254
 
255
255
  .active-scaffold th.loading a,
256
256
  .active-scaffold th.loading a:hover {
257
- background: #333 url(<%= asset_path 'indicator-small.gif' %>) right 50% no-repeat;
257
+ background: #333 url(<%= asset_data_uri 'indicator-small.gif' %>) right 50% no-repeat;
258
258
  }
259
259
 
260
260
  .active-scaffold th .mark_heading {
@@ -433,7 +433,7 @@ float: right;
433
433
  text-indent: -4000px;
434
434
  width: 16px;
435
435
  height: 17px;
436
- background: url(<%= asset_path 'close.gif' %>) 0 0 no-repeat;
436
+ background: url(<%= asset_data_uri 'close.gif' %>) 0 0 no-repeat;
437
437
  }
438
438
 
439
439
  /* Nested
@@ -955,7 +955,7 @@ height: 16px;
955
955
  padding: 0;
956
956
  width: 16px;
957
957
  text-indent: -4000px;
958
- background: url(<%= asset_path 'cross.png' %>) 0 0 no-repeat;
958
+ background: url(<%= asset_data_uri 'cross.png' %>) 0 0 no-repeat;
959
959
  }
960
960
 
961
961
  .active-scaffold .sub-form .locked a.destroy {
@@ -1000,7 +1000,7 @@ font-size: 100%;
1000
1000
  .as_touch a.inline-adapter-close {
1001
1001
  width: 25px;
1002
1002
  height: 27px;
1003
- background: url(<%= asset_path 'close_touch.png' %>) 0 0 no-repeat;
1003
+ background: url(<%= asset_data_uri 'close_touch.png' %>) 0 0 no-repeat;
1004
1004
  }
1005
1005
 
1006
1006
  .as_touch .as_paginate {
@@ -6,9 +6,8 @@ tr_class += " #{list_row_class(record)}" if respond_to? :list_row_class
6
6
  url_options = params_for(:action => :list, :id => record.id)
7
7
  action_links ||= active_scaffold_config.action_links.member
8
8
  -%>
9
-
10
9
  <tr class="record <%= tr_class %>" id="<%= element_row_id(:action => :list, :id => record.id) %>" data-refresh="<%= url_for(params_for(:action => :row, :id => record.id, :_method => :get, :escape => false)).html_safe %>" data-as_load="tr">
11
10
  <%= render :partial => 'list_record_columns', :locals => {:record => record, :columns => columns} %>
12
11
  <%= render :partial => 'list_actions', :locals => {:record => record, :url_options => url_options, :action_links => action_links} unless action_links.empty? %>
13
12
  <%= render_nested_view(action_links, url_options, record) unless @nested_auto_open.nil? %>
14
- </tr>
13
+ </tr>
@@ -362,6 +362,17 @@ module ActiveScaffold
362
362
  raise ActiveScaffold::ControllerNotFound, "Could not find " + error_message.join(" or "), caller
363
363
  end
364
364
 
365
+ # tries to find activescaffoldcontroller by controllername eg. admin/teams, or teams
366
+ def active_scaffold_controller_by_controller_name(controller_name)
367
+ begin
368
+ controller = "#{controller_name.camelize}Controller".constantize
369
+ rescue NameError => error
370
+ raise ActiveScaffold::ControllerNotFound, "#{controller} not found", caller
371
+ end
372
+ raise ActiveScaffold::ControllerNotFound, "#{controller} missing ActiveScaffold", caller unless controller.uses_active_scaffold?
373
+ return controller
374
+ end
375
+
365
376
  def uses_active_scaffold?
366
377
  !active_scaffold_config.nil?
367
378
  end
@@ -8,7 +8,7 @@ module ActiveScaffold
8
8
  options[:class] = "#{options[:class]} as_mceEditor #{column.options[:class]}".strip
9
9
  html = []
10
10
  html << send(override_input(:textarea), column, options)
11
- html.join "\n"
11
+ html.join("\n").html_safe
12
12
  end
13
13
  end
14
14
 
@@ -44,7 +44,7 @@ module ActionView #:nodoc:
44
44
  def render_with_active_scaffold(context, options, &block)
45
45
  if options && options[:partial] == :super
46
46
  render_as_super_view(context, options, &block)
47
- elsif context.is_a?(Hash) and context[:active_scaffold]
47
+ elsif options[:active_scaffold]
48
48
  render_as_embedded_view(context, options, &block)
49
49
  else
50
50
  render_as_view(context, options, &block)
@@ -92,18 +92,20 @@ module ActionView #:nodoc:
92
92
  remote_controller = options[:active_scaffold]
93
93
  constraints = options[:constraints]
94
94
  conditions = options[:conditions]
95
- eid = Digest::MD5.hexdigest(params[:controller] + remote_controller.to_s + constraints.to_s + conditions.to_s)
96
- session["as:#{eid}"] = {:constraints => constraints, :conditions => conditions, :list => {:label => args.first[:label]}}
95
+ eid = Digest::MD5.hexdigest(context.controller.controller_name + remote_controller.to_s + constraints.to_s + conditions.to_s)
97
96
  options[:params] ||= {}
98
97
  options[:params].merge! :eid => eid, :embedded => true
99
-
100
- id = "as_#{eid}-content"
101
98
  url_options = {:controller => remote_controller.to_s, :action => 'index'}.merge(options[:params])
102
99
 
103
- if controller.respond_to?(:render_component_into_view)
104
- controller.send(:render_component_into_view, url_options)
100
+ label = options[:label] || context.controller.class.active_scaffold_controller_by_controller_name(remote_controller.to_s).active_scaffold_config.list.label
101
+ context.controller.session["as:#{eid}"] = {:constraints => constraints, :conditions => conditions, :list => {:label => options[:label]}}
102
+
103
+ id = "as_#{eid}-content"
104
+
105
+ if context.controller.respond_to?(:render_component_into_view)
106
+ context.controller.send(:render_component_into_view, url_options)
105
107
  else
106
- content_tag(:div, {:id => id}) do
108
+ content_tag(:div, {:id => id, :class => 'active-scaffold-component'}) do
107
109
  url = url_for(url_options)
108
110
  link_to(remote_controller.to_s, url, {:remote => true, :id => id}) <<
109
111
  if ActiveScaffold.js_framework == :prototype
@@ -225,13 +225,21 @@ module ActiveScaffold
225
225
  # issue 260, use url_options[:link] if it exists. This prevents DB data from being localized.
226
226
  label = url.delete(:link) if url.is_a?(Hash)
227
227
  label ||= link.label
228
- if link.image.nil?
229
- html = link_to(label, url, html_options)
230
- else
231
- html = link_to(image_tag(link.image[:name] , :size => link.image[:size], :alt => label), url, html_options)
228
+ begin
229
+ if link.image.nil?
230
+ #http://www.continuousthinking.com/2011/09/22/rails-3-1-engine-namespaces-can-creep-into-urls-in-application-layout.html
231
+ #its not possible to link from a namespacedcontroller back to a non namespaced-controller anymore
232
+ # seems to be only working with named_routes...
233
+ html = link_to(label, url, html_options)
234
+ else
235
+ html = link_to(image_tag(link.image[:name] , :size => link.image[:size], :alt => label), url, html_options)
236
+ end
237
+ # if url is nil we would like to generate an anchor without href attribute
238
+ url.nil? ? html.sub(/href=".*?"/, '').html_safe : html.html_safe
239
+ rescue ActionController::RoutingError => e
240
+ Rails.logger.error("ActiveScaffold link_to routing Error: #{e.inspect}")
241
+ "Routing Error"
232
242
  end
233
- # if url is nil we would like to generate an anchor without href attribute
234
- url.nil? ? html.sub(/href=".*?"/, '').html_safe : html.html_safe
235
243
  end
236
244
 
237
245
  def url_options_for_nested_link(column, record, link, url_options, options = {})
@@ -2,7 +2,7 @@ module ActiveScaffold
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 1
5
- PATCH = 0
5
+ PATCH = 1
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_vho
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
5
4
  prerelease: false
6
5
  segments:
7
6
  - 3
8
7
  - 1
9
- - 0
10
- version: 3.1.0
8
+ - 1
9
+ segments_generated: true
10
+ version: 3.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Many, see README
@@ -15,97 +15,97 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-11-05 00:00:00 +01:00
18
+ date: 2011-12-22 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
+ name: shoulda
22
23
  requirement: &id001 !ruby/object:Gem::Requirement
23
24
  none: false
24
25
  requirements:
25
26
  - - ">="
26
27
  - !ruby/object:Gem::Version
27
- hash: 3
28
28
  segments:
29
29
  - 0
30
+ segments_generated: true
30
31
  version: "0"
31
32
  type: :development
32
- name: shoulda
33
33
  prerelease: false
34
34
  version_requirements: *id001
35
35
  - !ruby/object:Gem::Dependency
36
+ name: bundler
36
37
  requirement: &id002 !ruby/object:Gem::Requirement
37
38
  none: false
38
39
  requirements:
39
40
  - - ~>
40
41
  - !ruby/object:Gem::Version
41
- hash: 23
42
42
  segments:
43
43
  - 1
44
44
  - 0
45
45
  - 0
46
+ segments_generated: true
46
47
  version: 1.0.0
47
48
  type: :development
48
- name: bundler
49
49
  prerelease: false
50
50
  version_requirements: *id002
51
51
  - !ruby/object:Gem::Dependency
52
+ name: jeweler
52
53
  requirement: &id003 !ruby/object:Gem::Requirement
53
54
  none: false
54
55
  requirements:
55
56
  - - ~>
56
57
  - !ruby/object:Gem::Version
57
- hash: 7
58
58
  segments:
59
59
  - 1
60
60
  - 5
61
61
  - 2
62
+ segments_generated: true
62
63
  version: 1.5.2
63
64
  type: :development
64
- name: jeweler
65
65
  prerelease: false
66
66
  version_requirements: *id003
67
67
  - !ruby/object:Gem::Dependency
68
+ name: rcov
68
69
  requirement: &id004 !ruby/object:Gem::Requirement
69
70
  none: false
70
71
  requirements:
71
72
  - - ">="
72
73
  - !ruby/object:Gem::Version
73
- hash: 3
74
74
  segments:
75
75
  - 0
76
+ segments_generated: true
76
77
  version: "0"
77
78
  type: :development
78
- name: rcov
79
79
  prerelease: false
80
80
  version_requirements: *id004
81
81
  - !ruby/object:Gem::Dependency
82
+ name: render_component_vho
82
83
  requirement: &id005 !ruby/object:Gem::Requirement
83
84
  none: false
84
85
  requirements:
85
86
  - - ">="
86
87
  - !ruby/object:Gem::Version
87
- hash: 3
88
88
  segments:
89
89
  - 0
90
+ segments_generated: true
90
91
  version: "0"
91
92
  type: :runtime
92
- name: render_component_vho
93
93
  prerelease: false
94
94
  version_requirements: *id005
95
95
  - !ruby/object:Gem::Dependency
96
+ name: rails
96
97
  requirement: &id006 !ruby/object:Gem::Requirement
97
98
  none: false
98
99
  requirements:
99
100
  - - ~>
100
101
  - !ruby/object:Gem::Version
101
- hash: 3
102
102
  segments:
103
103
  - 3
104
104
  - 1
105
105
  - 0
106
+ segments_generated: true
106
107
  version: 3.1.0
107
108
  type: :runtime
108
- name: rails
109
109
  prerelease: false
110
110
  version_requirements: *id006
111
111
  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.
@@ -420,18 +420,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
420
420
  requirements:
421
421
  - - ">="
422
422
  - !ruby/object:Gem::Version
423
- hash: 3
423
+ hash: -1540629792815748302
424
424
  segments:
425
425
  - 0
426
+ segments_generated: true
426
427
  version: "0"
427
428
  required_rubygems_version: !ruby/object:Gem::Requirement
428
429
  none: false
429
430
  requirements:
430
431
  - - ">="
431
432
  - !ruby/object:Gem::Version
432
- hash: 3
433
433
  segments:
434
434
  - 0
435
+ segments_generated: true
435
436
  version: "0"
436
437
  requirements: []
437
438