comfortable_mexican_sofa 1.0.38 → 1.0.39

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.38
1
+ 1.0.39
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{comfortable_mexican_sofa}
8
- s.version = "1.0.38"
8
+ s.version = "1.0.39"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Oleg Khabarov", "The Working Group Inc"]
@@ -192,6 +192,7 @@ Gem::Specification.new do |s|
192
192
  "test/fixtures/files/invalid_file.gif",
193
193
  "test/fixtures/files/valid_image.jpg",
194
194
  "test/fixtures/views/_nav_hook.html.erb",
195
+ "test/fixtures/views/_nav_hook_2.html.erb",
195
196
  "test/functional/cms_admin/layouts_controller_test.rb",
196
197
  "test/functional/cms_admin/pages_controller_test.rb",
197
198
  "test/functional/cms_admin/sites_controller_test.rb",
@@ -7,16 +7,19 @@ module ComfortableMexicanSofa::ViewHooks
7
7
 
8
8
  # Renders hook content
9
9
  def self.render(name, template, options = {})
10
- if self.hooks[name.to_sym]
11
- template.render({:partial => self.hooks[name.to_sym]}.merge(options))
10
+ out = ''
11
+ (self.hooks[name.to_sym] || []).each do |path|
12
+ out += template.render({:partial => path}.merge(options))
12
13
  end
14
+ return out
13
15
  end
14
16
 
15
17
  # Will declare a partial that will be rendered for this hook
16
18
  # Example:
17
19
  # ComfortableMexicanSofa::ViewHooks.add(:navigation, 'shared/navigation')
18
20
  def self.add(name, partial_path)
19
- self.hooks[name.to_sym] = partial_path
21
+ self.hooks[name.to_sym] ||= []
22
+ self.hooks[name.to_sym] << partial_path
20
23
  end
21
24
 
22
25
  # Removing previously declared hook
@@ -0,0 +1 @@
1
+ hook_content_2
@@ -11,6 +11,17 @@ class ViewHooksTest < ActionDispatch::IntegrationTest
11
11
  assert_match /hook_content/, response.body
12
12
  end
13
13
 
14
+ def test_hooks_rendering_with_multiples
15
+ CmsAdmin::SitesController.append_view_path(File.expand_path('../fixtures/views', File.dirname(__FILE__)))
16
+ ComfortableMexicanSofa::ViewHooks.add(:navigation, '/nav_hook')
17
+ ComfortableMexicanSofa::ViewHooks.add(:navigation, '/nav_hook_2')
18
+
19
+ http_auth :get, cms_admin_sites_path
20
+ assert_response :success
21
+ assert_match /hook_content/, response.body
22
+ assert_match /hook_content_2/, response.body
23
+ end
24
+
14
25
  def test_hooks_rendering_with_no_hook
15
26
  ComfortableMexicanSofa::ViewHooks.remove(:navigation)
16
27
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 38
9
- version: 1.0.38
8
+ - 39
9
+ version: 1.0.39
10
10
  platform: ruby
11
11
  authors:
12
12
  - Oleg Khabarov
@@ -319,6 +319,7 @@ files:
319
319
  - test/fixtures/files/invalid_file.gif
320
320
  - test/fixtures/files/valid_image.jpg
321
321
  - test/fixtures/views/_nav_hook.html.erb
322
+ - test/fixtures/views/_nav_hook_2.html.erb
322
323
  - test/functional/cms_admin/layouts_controller_test.rb
323
324
  - test/functional/cms_admin/pages_controller_test.rb
324
325
  - test/functional/cms_admin/sites_controller_test.rb
@@ -367,7 +368,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
367
368
  requirements:
368
369
  - - ">="
369
370
  - !ruby/object:Gem::Version
370
- hash: 1387758075576454082
371
+ hash: -1835926868299303327
371
372
  segments:
372
373
  - 0
373
374
  version: "0"