comfortable_mexican_sofa 1.5.3 → 1.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +2 -1
- data/Gemfile +1 -1
- data/VERSION +1 -1
- data/app/models/cms/page.rb +4 -6
- data/comfortable_mexican_sofa.gemspec +9 -6
- data/lib/comfortable_mexican_sofa.rb +1 -1
- data/lib/comfortable_mexican_sofa/error.rb +6 -0
- data/lib/comfortable_mexican_sofa/render_methods.rb +72 -0
- data/test/fixtures/views/render_test/_test.html.erb +1 -0
- data/test/fixtures/views/render_test/render_layout.html.erb +1 -0
- data/test/gemfiles/Gemfile.rails-3.0.x +1 -1
- data/test/gemfiles/Gemfile.rails-3.1.stable +10 -0
- data/test/gemfiles/Gemfile.rails-3.1.x +1 -1
- data/test/integration/render_cms_test.rb +120 -33
- data/test/unit/view_methods_test.rb +1 -2
- metadata +14 -11
- data/lib/comfortable_mexican_sofa/controller_methods.rb +0 -41
data/.travis.yml
CHANGED
@@ -2,12 +2,13 @@ rvm:
|
|
2
2
|
- 1.8.7
|
3
3
|
- 1.9.2
|
4
4
|
# - 1.9.3
|
5
|
-
|
5
|
+
- rbx-2.0
|
6
6
|
- ree
|
7
7
|
# - jruby
|
8
8
|
gemfile:
|
9
9
|
- test/gemfiles/Gemfile.rails-3.0.x
|
10
10
|
- test/gemfiles/Gemfile.rails-3.1.x
|
11
|
+
- test/gemfiles/Gemfile.rails-3.1.stable
|
11
12
|
notifications:
|
12
13
|
recipients:
|
13
14
|
- oleg@twg.ca
|
data/Gemfile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.5.
|
1
|
+
1.5.4
|
data/app/models/cms/page.rb
CHANGED
@@ -23,10 +23,10 @@ class Cms::Page < ActiveRecord::Base
|
|
23
23
|
|
24
24
|
# -- Callbacks ------------------------------------------------------------
|
25
25
|
before_validation :assigns_label,
|
26
|
-
:assign_parent
|
27
|
-
:assign_full_path
|
26
|
+
:assign_parent
|
28
27
|
before_create :assign_position
|
29
|
-
before_save :
|
28
|
+
before_save :assign_full_path,
|
29
|
+
:set_cached_content
|
30
30
|
after_save :sync_child_pages
|
31
31
|
|
32
32
|
# -- Validations ----------------------------------------------------------
|
@@ -37,12 +37,10 @@ class Cms::Page < ActiveRecord::Base
|
|
37
37
|
validates :slug,
|
38
38
|
:presence => true,
|
39
39
|
:format => /^\w[a-z0-9_-]*$/i,
|
40
|
+
:uniqueness => { :scope => :parent_id },
|
40
41
|
:unless => lambda{ |p| p.site && (p.site.pages.count == 0 || p.site.pages.root == self) }
|
41
42
|
validates :layout,
|
42
43
|
:presence => true
|
43
|
-
validates :full_path,
|
44
|
-
:presence => true,
|
45
|
-
:uniqueness => { :scope => :site_id }
|
46
44
|
validate :validate_target_page
|
47
45
|
|
48
46
|
# -- Scopes ---------------------------------------------------------------
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "comfortable_mexican_sofa"
|
8
|
-
s.version = "1.5.
|
8
|
+
s.version = "1.5.4"
|
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"]
|
12
|
-
s.date = "2011-
|
12
|
+
s.date = "2011-10-03"
|
13
13
|
s.description = ""
|
14
14
|
s.email = "oleg@theworkinggroup.ca"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -206,7 +206,6 @@ Gem::Specification.new do |s|
|
|
206
206
|
"lib/comfortable_mexican_sofa/authentication/dummy_auth.rb",
|
207
207
|
"lib/comfortable_mexican_sofa/authentication/http_auth.rb",
|
208
208
|
"lib/comfortable_mexican_sofa/configuration.rb",
|
209
|
-
"lib/comfortable_mexican_sofa/controller_methods.rb",
|
210
209
|
"lib/comfortable_mexican_sofa/engine.rb",
|
211
210
|
"lib/comfortable_mexican_sofa/error.rb",
|
212
211
|
"lib/comfortable_mexican_sofa/extensions/acts_as_tree.rb",
|
@@ -216,6 +215,7 @@ Gem::Specification.new do |s|
|
|
216
215
|
"lib/comfortable_mexican_sofa/extensions/rails.rb",
|
217
216
|
"lib/comfortable_mexican_sofa/fixtures.rb",
|
218
217
|
"lib/comfortable_mexican_sofa/form_builder.rb",
|
218
|
+
"lib/comfortable_mexican_sofa/render_methods.rb",
|
219
219
|
"lib/comfortable_mexican_sofa/tag.rb",
|
220
220
|
"lib/comfortable_mexican_sofa/tags/asset.rb",
|
221
221
|
"lib/comfortable_mexican_sofa/tags/collection.rb",
|
@@ -254,6 +254,8 @@ Gem::Specification.new do |s|
|
|
254
254
|
"test/fixtures/files/valid_image.jpg",
|
255
255
|
"test/fixtures/views/_nav_hook.html.erb",
|
256
256
|
"test/fixtures/views/_nav_hook_2.html.erb",
|
257
|
+
"test/fixtures/views/render_test/_test.html.erb",
|
258
|
+
"test/fixtures/views/render_test/render_layout.html.erb",
|
257
259
|
"test/functional/cms_admin/base_controller_test.rb",
|
258
260
|
"test/functional/cms_admin/categories_controller_test.rb",
|
259
261
|
"test/functional/cms_admin/files_controller_test.rb",
|
@@ -264,6 +266,7 @@ Gem::Specification.new do |s|
|
|
264
266
|
"test/functional/cms_admin/snippets_controller_test.rb",
|
265
267
|
"test/functional/cms_content_controller_test.rb",
|
266
268
|
"test/gemfiles/Gemfile.rails-3.0.x",
|
269
|
+
"test/gemfiles/Gemfile.rails-3.1.stable",
|
267
270
|
"test/gemfiles/Gemfile.rails-3.1.x",
|
268
271
|
"test/integration/authentication_test.rb",
|
269
272
|
"test/integration/fixtures_test.rb",
|
@@ -317,16 +320,16 @@ Gem::Specification.new do |s|
|
|
317
320
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
318
321
|
s.add_runtime_dependency(%q<rails>, [">= 3.0.0"])
|
319
322
|
s.add_runtime_dependency(%q<active_link_to>, ["~> 1.0.0"])
|
320
|
-
s.add_runtime_dependency(%q<paperclip>, ["~> 2.
|
323
|
+
s.add_runtime_dependency(%q<paperclip>, ["~> 2.3.0"])
|
321
324
|
else
|
322
325
|
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
323
326
|
s.add_dependency(%q<active_link_to>, ["~> 1.0.0"])
|
324
|
-
s.add_dependency(%q<paperclip>, ["~> 2.
|
327
|
+
s.add_dependency(%q<paperclip>, ["~> 2.3.0"])
|
325
328
|
end
|
326
329
|
else
|
327
330
|
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
328
331
|
s.add_dependency(%q<active_link_to>, ["~> 1.0.0"])
|
329
|
-
s.add_dependency(%q<paperclip>, ["~> 2.
|
332
|
+
s.add_dependency(%q<paperclip>, ["~> 2.3.0"])
|
330
333
|
end
|
331
334
|
end
|
332
335
|
|
@@ -8,7 +8,7 @@ end
|
|
8
8
|
'comfortable_mexican_sofa/configuration',
|
9
9
|
'comfortable_mexican_sofa/authentication/http_auth',
|
10
10
|
'comfortable_mexican_sofa/authentication/dummy_auth',
|
11
|
-
'comfortable_mexican_sofa/
|
11
|
+
'comfortable_mexican_sofa/render_methods',
|
12
12
|
'comfortable_mexican_sofa/view_hooks',
|
13
13
|
'comfortable_mexican_sofa/view_methods',
|
14
14
|
'comfortable_mexican_sofa/form_builder',
|
@@ -0,0 +1,72 @@
|
|
1
|
+
module ComfortableMexicanSofa::RenderMethods
|
2
|
+
|
3
|
+
def self.included(base)
|
4
|
+
|
5
|
+
# If application controller doesn't have template associated with it
|
6
|
+
# CMS will attempt to find one. This is so you don't have to explicitly
|
7
|
+
# call render :cms_page => '/something'
|
8
|
+
base.rescue_from 'ActionView::MissingTemplate' do |e|
|
9
|
+
begin
|
10
|
+
render :cms_page => request.path
|
11
|
+
rescue ComfortableMexicanSofa::MissingPage
|
12
|
+
raise e
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# Now you can render cms_page simply by calling:
|
17
|
+
# render :cms_page => '/path/to/page'
|
18
|
+
# This way application controllers can use CMS content while populating
|
19
|
+
# instance variables that can be used in partials (that are included by
|
20
|
+
# by the cms page and/or layout)
|
21
|
+
#
|
22
|
+
# Or how about not worrying about setting up CMS pages and rendering
|
23
|
+
# application view using a CMS layout?
|
24
|
+
# render :cms_layout => 'layout_slug', :cms_blocks => {
|
25
|
+
# :block_label_a => 'content text',
|
26
|
+
# :block_label_b => { :template => 'path/to/template' },
|
27
|
+
# :block_label_c => { :partial => 'path/to/partial' }
|
28
|
+
# }
|
29
|
+
# This way you are populating page block content and rendering
|
30
|
+
# an instantialized CMS page.
|
31
|
+
def render(options = {}, locals = {}, &block)
|
32
|
+
if options.is_a?(Hash) && path = options.delete(:cms_page)
|
33
|
+
@cms_site = Cms::Site.find_site(request.host.downcase, request.fullpath)
|
34
|
+
if @cms_page = @cms_site && @cms_site.pages.find_by_full_path(path)
|
35
|
+
@cms_layout = @cms_page.layout
|
36
|
+
cms_app_layout = @cms_layout.try(:app_layout)
|
37
|
+
options[:layout] ||= cms_app_layout.blank?? nil : cms_app_layout
|
38
|
+
options[:inline] = @cms_page.content
|
39
|
+
super(options, locals, &block)
|
40
|
+
else
|
41
|
+
raise ComfortableMexicanSofa::MissingPage.new(path)
|
42
|
+
end
|
43
|
+
|
44
|
+
elsif options.is_a?(Hash) && slug = options.delete(:cms_layout)
|
45
|
+
@cms_site = Cms::Site.find_site(request.host.downcase, request.fullpath)
|
46
|
+
if @cms_layout = @cms_site && @cms_site.layouts.find_by_slug(slug)
|
47
|
+
cms_app_layout = @cms_layout.try(:app_layout)
|
48
|
+
cms_page = @cms_site.pages.build(:layout => @cms_layout)
|
49
|
+
cms_blocks = options.delete(:cms_blocks) || { :content => render_to_string }
|
50
|
+
cms_blocks.each do |block_label, value|
|
51
|
+
content = if value.is_a?(Hash)
|
52
|
+
render_to_string(value.keys.first.to_sym => value[value.keys.first])
|
53
|
+
else
|
54
|
+
value.to_s
|
55
|
+
end
|
56
|
+
cms_page.blocks.build(:label => block_label.to_s, :content => content)
|
57
|
+
end
|
58
|
+
options[:layout] ||= cms_app_layout.blank?? nil : cms_app_layout
|
59
|
+
options[:inline] = cms_page.content(true)
|
60
|
+
super(options, locals, &block)
|
61
|
+
else
|
62
|
+
raise ComfortableMexicanSofa::MissingLayout.new(slug)
|
63
|
+
end
|
64
|
+
|
65
|
+
else
|
66
|
+
super(options, locals, &block)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
ActionController::Base.send :include, ComfortableMexicanSofa::RenderMethods
|
@@ -0,0 +1 @@
|
|
1
|
+
TestPartial <%= @test_value %>
|
@@ -0,0 +1 @@
|
|
1
|
+
TestTemplate <%= @test_value %>
|
@@ -4,11 +4,14 @@ class RenderCmsTest < ActionDispatch::IntegrationTest
|
|
4
4
|
|
5
5
|
def setup
|
6
6
|
Rails.application.routes.draw do
|
7
|
-
get '/render-
|
8
|
-
get '/render-
|
9
|
-
get '/render-
|
10
|
-
get '/render-update' => 'render_test#render_update'
|
7
|
+
get '/render-basic' => 'render_test#render_basic'
|
8
|
+
get '/render-page' => 'render_test#render_page'
|
9
|
+
get '/render-layout' => 'render_test#render_layout'
|
11
10
|
end
|
11
|
+
cms_layouts(:default).update_attribute(:content, '{{cms:page:content}}')
|
12
|
+
cms_pages(:child).update_attribute(:blocks_attributes, [
|
13
|
+
{ :label => 'content', :content => 'TestBlockContent' }
|
14
|
+
])
|
12
15
|
super
|
13
16
|
end
|
14
17
|
|
@@ -17,68 +20,152 @@ class RenderCmsTest < ActionDispatch::IntegrationTest
|
|
17
20
|
end
|
18
21
|
|
19
22
|
class ::RenderTestController < ApplicationController
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
23
|
+
append_view_path(File.expand_path('../fixtures/views', File.dirname(__FILE__)))
|
24
|
+
|
25
|
+
def render_basic
|
26
|
+
case params[:type]
|
27
|
+
when 'text'
|
28
|
+
render :text => 'TestText'
|
29
|
+
when 'update'
|
30
|
+
render :update do |page|
|
31
|
+
page.alert('rendered text')
|
32
|
+
end
|
33
|
+
else
|
34
|
+
render
|
35
|
+
end
|
25
36
|
end
|
26
|
-
|
27
|
-
|
37
|
+
|
38
|
+
def render_page
|
39
|
+
case params[:type]
|
40
|
+
when 'page_implicit'
|
41
|
+
render
|
42
|
+
when 'page_explicit'
|
43
|
+
render :cms_page => '/test-page'
|
44
|
+
when 'page_explicit_with_status'
|
45
|
+
render :cms_page => '/test-page', :status => 404
|
46
|
+
else
|
47
|
+
raise 'Invalid or no param[:type] provided'
|
48
|
+
end
|
28
49
|
end
|
29
|
-
|
30
|
-
|
31
|
-
|
50
|
+
|
51
|
+
def render_layout
|
52
|
+
@test_value = 'TestValue'
|
53
|
+
case params[:type]
|
54
|
+
when 'layout_defaults'
|
55
|
+
render :cms_layout => 'default'
|
56
|
+
when 'layout'
|
57
|
+
render :cms_layout => 'default', :cms_blocks => {
|
58
|
+
:content => 'TestText',
|
59
|
+
:content_b => { :partial => 'render_test/test' },
|
60
|
+
:content_c => { :template => 'render_test/render_layout' }
|
61
|
+
}
|
62
|
+
when 'layout_with_status'
|
63
|
+
render :cms_layout => 'default', :status => 404
|
64
|
+
when 'layout_invalid'
|
65
|
+
render :cms_layout => 'invalid'
|
66
|
+
else
|
67
|
+
raise 'Invalid or no param[:type] provided'
|
32
68
|
end
|
33
69
|
end
|
34
70
|
end
|
35
71
|
|
36
|
-
|
72
|
+
# -- Basic Render Tests ---------------------------------------------------
|
73
|
+
def test_text
|
74
|
+
get '/render-basic?type=text'
|
75
|
+
assert_response :success
|
76
|
+
assert_equal 'TestText', response.body
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_update
|
80
|
+
return 'Not supported in >= 3.1' if Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR >= 1
|
81
|
+
get '/render-basic?type=update'
|
82
|
+
assert_response :success
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_implicit_cms_page_failure
|
37
86
|
assert_exception_raised ActionView::MissingTemplate do
|
38
|
-
get '/render-
|
87
|
+
get '/render-basic'
|
39
88
|
end
|
40
89
|
end
|
41
90
|
|
42
|
-
|
91
|
+
# -- Page Render Test -----------------------------------------------------
|
92
|
+
def test_implicit_cms_page
|
43
93
|
page = cms_pages(:child)
|
44
|
-
page.slug
|
45
|
-
|
46
|
-
get '/render-implicit'
|
94
|
+
page.update_attribute(:slug, 'render-basic')
|
95
|
+
get '/render-basic?type=page_implicit'
|
47
96
|
assert_response :success
|
48
97
|
assert assigns(:cms_site)
|
49
98
|
assert assigns(:cms_layout)
|
50
99
|
assert assigns(:cms_page)
|
100
|
+
assert_equal page, assigns(:cms_page)
|
101
|
+
assert_equal 'TestBlockContent', response.body
|
51
102
|
end
|
52
103
|
|
53
|
-
def
|
104
|
+
def test_explicit_cms_page
|
54
105
|
page = cms_pages(:child)
|
55
|
-
page.slug
|
56
|
-
page
|
57
|
-
get '/render-explicit'
|
106
|
+
page.update_attribute(:slug, 'test-page')
|
107
|
+
get '/render-page?type=page_explicit'
|
58
108
|
assert_response :success
|
59
109
|
assert assigns(:cms_site)
|
60
110
|
assert assigns(:cms_layout)
|
61
111
|
assert assigns(:cms_page)
|
112
|
+
assert_equal page, assigns(:cms_page)
|
113
|
+
assert_equal 'TestBlockContent', response.body
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_explicit_cms_page_with_status
|
117
|
+
page = cms_pages(:child)
|
118
|
+
page.update_attribute(:slug, 'test-page')
|
119
|
+
get '/render-page?type=page_explicit_with_status'
|
120
|
+
assert_response 404
|
121
|
+
assert assigns(:cms_site)
|
122
|
+
assert assigns(:cms_layout)
|
123
|
+
assert assigns(:cms_page)
|
124
|
+
assert_equal page, assigns(:cms_page)
|
125
|
+
assert_equal 'TestBlockContent', response.body
|
62
126
|
end
|
63
127
|
|
64
|
-
def
|
128
|
+
def test_explicit_cms_page_failure
|
65
129
|
page = cms_pages(:child)
|
66
|
-
page.slug
|
67
|
-
page.save!
|
130
|
+
page.update_attribute(:slug, 'invalid')
|
68
131
|
assert_exception_raised ComfortableMexicanSofa::MissingPage do
|
69
|
-
get '/render-
|
132
|
+
get '/render-page?type=page_explicit'
|
70
133
|
end
|
71
134
|
end
|
72
135
|
|
73
|
-
|
74
|
-
|
136
|
+
# -- Layout Render Tests --------------------------------------------------
|
137
|
+
def test_cms_layout_defaults
|
138
|
+
get '/render-layout?type=layout_defaults'
|
75
139
|
assert_response :success
|
140
|
+
assert_equal 'TestTemplate TestValue', response.body
|
141
|
+
assert assigns(:cms_site)
|
142
|
+
assert assigns(:cms_layout)
|
143
|
+
assert_equal cms_layouts(:default), assigns(:cms_layout)
|
76
144
|
end
|
77
145
|
|
78
|
-
def
|
79
|
-
|
80
|
-
get '/render-
|
146
|
+
def test_cms_layout
|
147
|
+
cms_layouts(:default).update_attribute(:content, '{{cms:page:content}} {{cms:page:content_b}} {{cms:page:content_c}}')
|
148
|
+
get '/render-layout?type=layout'
|
81
149
|
assert_response :success
|
150
|
+
assert_equal 'TestText TestPartial TestValue TestTemplate TestValue', response.body
|
151
|
+
assert assigns(:cms_site)
|
152
|
+
assert assigns(:cms_layout)
|
153
|
+
assert_equal cms_layouts(:default), assigns(:cms_layout)
|
154
|
+
end
|
155
|
+
|
156
|
+
def test_cms_layout_with_status
|
157
|
+
get '/render-layout?type=layout_with_status'
|
158
|
+
assert_response 404
|
159
|
+
assert_equal 'TestTemplate TestValue', response.body
|
160
|
+
assert assigns(:cms_site)
|
161
|
+
assert assigns(:cms_layout)
|
162
|
+
assert_equal cms_layouts(:default), assigns(:cms_layout)
|
163
|
+
end
|
164
|
+
|
165
|
+
def test_cms_layout_failure
|
166
|
+
assert_exception_raised ComfortableMexicanSofa::MissingLayout do
|
167
|
+
get '/render-layout?type=layout_invalid'
|
168
|
+
end
|
82
169
|
end
|
83
170
|
|
84
171
|
end
|
@@ -1,9 +1,8 @@
|
|
1
1
|
require File.expand_path('../test_helper', File.dirname(__FILE__))
|
2
2
|
|
3
3
|
class ViewMethodsTest < ActionView::TestCase
|
4
|
-
include ComfortableMexicanSofa::ViewMethods
|
5
4
|
|
6
|
-
class HelpersTestController < ActionController::Base
|
5
|
+
class ::HelpersTestController < ActionController::Base
|
7
6
|
helper { def hello; 'hello' end }
|
8
7
|
def test_cms_snippet_content
|
9
8
|
render :inline => '<%= cms_snippet_content(:default) %>'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comfortable_mexican_sofa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-10-03 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
17
|
-
requirement: &
|
17
|
+
requirement: &70223424480860 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 3.0.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70223424480860
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: active_link_to
|
28
|
-
requirement: &
|
28
|
+
requirement: &70223424480280 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
@@ -33,18 +33,18 @@ dependencies:
|
|
33
33
|
version: 1.0.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70223424480280
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: paperclip
|
39
|
-
requirement: &
|
39
|
+
requirement: &70223424479600 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ~>
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
version: 2.
|
44
|
+
version: 2.3.0
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70223424479600
|
48
48
|
description: ''
|
49
49
|
email: oleg@theworkinggroup.ca
|
50
50
|
executables: []
|
@@ -242,7 +242,6 @@ files:
|
|
242
242
|
- lib/comfortable_mexican_sofa/authentication/dummy_auth.rb
|
243
243
|
- lib/comfortable_mexican_sofa/authentication/http_auth.rb
|
244
244
|
- lib/comfortable_mexican_sofa/configuration.rb
|
245
|
-
- lib/comfortable_mexican_sofa/controller_methods.rb
|
246
245
|
- lib/comfortable_mexican_sofa/engine.rb
|
247
246
|
- lib/comfortable_mexican_sofa/error.rb
|
248
247
|
- lib/comfortable_mexican_sofa/extensions/acts_as_tree.rb
|
@@ -252,6 +251,7 @@ files:
|
|
252
251
|
- lib/comfortable_mexican_sofa/extensions/rails.rb
|
253
252
|
- lib/comfortable_mexican_sofa/fixtures.rb
|
254
253
|
- lib/comfortable_mexican_sofa/form_builder.rb
|
254
|
+
- lib/comfortable_mexican_sofa/render_methods.rb
|
255
255
|
- lib/comfortable_mexican_sofa/tag.rb
|
256
256
|
- lib/comfortable_mexican_sofa/tags/asset.rb
|
257
257
|
- lib/comfortable_mexican_sofa/tags/collection.rb
|
@@ -290,6 +290,8 @@ files:
|
|
290
290
|
- test/fixtures/files/valid_image.jpg
|
291
291
|
- test/fixtures/views/_nav_hook.html.erb
|
292
292
|
- test/fixtures/views/_nav_hook_2.html.erb
|
293
|
+
- test/fixtures/views/render_test/_test.html.erb
|
294
|
+
- test/fixtures/views/render_test/render_layout.html.erb
|
293
295
|
- test/functional/cms_admin/base_controller_test.rb
|
294
296
|
- test/functional/cms_admin/categories_controller_test.rb
|
295
297
|
- test/functional/cms_admin/files_controller_test.rb
|
@@ -300,6 +302,7 @@ files:
|
|
300
302
|
- test/functional/cms_admin/snippets_controller_test.rb
|
301
303
|
- test/functional/cms_content_controller_test.rb
|
302
304
|
- test/gemfiles/Gemfile.rails-3.0.x
|
305
|
+
- test/gemfiles/Gemfile.rails-3.1.stable
|
303
306
|
- test/gemfiles/Gemfile.rails-3.1.x
|
304
307
|
- test/integration/authentication_test.rb
|
305
308
|
- test/integration/fixtures_test.rb
|
@@ -355,7 +358,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
355
358
|
version: '0'
|
356
359
|
segments:
|
357
360
|
- 0
|
358
|
-
hash:
|
361
|
+
hash: 1060939018448966854
|
359
362
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
360
363
|
none: false
|
361
364
|
requirements:
|
@@ -1,41 +0,0 @@
|
|
1
|
-
module ComfortableMexicanSofa::ControllerMethods
|
2
|
-
|
3
|
-
def self.included(base)
|
4
|
-
|
5
|
-
# If application controller doesn't have template associated with it
|
6
|
-
# CMS will attempt to find one. This is so you don't have to explicitly
|
7
|
-
# call render :cms_page => '/something'
|
8
|
-
base.rescue_from 'ActionView::MissingTemplate' do |e|
|
9
|
-
begin
|
10
|
-
render :cms_page => request.path
|
11
|
-
rescue ComfortableMexicanSofa::MissingPage
|
12
|
-
raise e
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
# Now you can render cms_page simply by calling:
|
17
|
-
# render :cms_page => '/path/to/page'
|
18
|
-
# This way application controllers can use CMS content while populating
|
19
|
-
# instance variables that can be used in partials (that are included by
|
20
|
-
# by the cms page and/or layout)
|
21
|
-
def render(options = {}, locals = {}, &block)
|
22
|
-
if options.is_a?(Hash) && path = options.delete(:cms_page)
|
23
|
-
@cms_site = Cms::Site.find_site(request.host.downcase, request.fullpath)
|
24
|
-
@cms_page = @cms_site && @cms_site.pages.find_by_full_path(path)
|
25
|
-
if @cms_page
|
26
|
-
@cms_layout = @cms_page.layout
|
27
|
-
cms_app_layout = @cms_layout.try(:app_layout)
|
28
|
-
options[:layout] ||= cms_app_layout.blank?? nil : cms_app_layout
|
29
|
-
options[:inline] = @cms_page.content
|
30
|
-
super(options, locals, &block)
|
31
|
-
else
|
32
|
-
raise ComfortableMexicanSofa::MissingPage.new(path)
|
33
|
-
end
|
34
|
-
else
|
35
|
-
super(options, locals, &block)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
ActionController::Base.send :include, ComfortableMexicanSofa::ControllerMethods
|