classiccms 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/classiccms/controllers/cms.rb +1 -1
- data/lib/classiccms/helpers.rb +1 -1
- data/lib/classiccms/version.rb +1 -1
- data/spec/helpers_spec.rb +6 -6
- metadata +1 -1
data/lib/classiccms/helpers.rb
CHANGED
@@ -36,7 +36,7 @@ module Classiccms
|
|
36
36
|
#renders a specific page
|
37
37
|
def layout(section_name, position)
|
38
38
|
id = get_parent_id(position)
|
39
|
-
records = Base.where(:
|
39
|
+
records = Base.where(:_id => id)
|
40
40
|
if records.count > 0 and records.first.connections.where(:section => section_name, :file.ne => nil).count > 0
|
41
41
|
file_name = records.first.connections.where(:section => section_name, :file.ne => nil).first.file
|
42
42
|
show "#{records.first._type}/#{file_name}", {}, {record: records.first}
|
data/lib/classiccms/version.rb
CHANGED
data/spec/helpers_spec.rb
CHANGED
@@ -77,20 +77,20 @@ describe Classiccms do
|
|
77
77
|
describe 'layout helper' do
|
78
78
|
it 'should return 404 when section does not exist' do
|
79
79
|
@routes = [Menu.create.id]
|
80
|
-
layout('menu',
|
80
|
+
layout('menu', 1).should == '404'
|
81
81
|
end
|
82
82
|
it 'should return when there are no records' do
|
83
83
|
@routes = []
|
84
|
-
layout('menu',
|
84
|
+
layout('menu', 1).should == '404'
|
85
85
|
end
|
86
86
|
it 'should return 404 when section exist but no file name is given' do
|
87
87
|
m = Menu.create(connections: [Connection.new(section: 'menu')])
|
88
88
|
@routes = [m.id]
|
89
|
-
layout('menu',
|
89
|
+
layout('menu', 1).should == '404'
|
90
90
|
end
|
91
|
-
it 'should return
|
91
|
+
it 'should return the rendered file' do
|
92
92
|
with_constants :CONFIG => {home: 'application/index4', model: 'Menu', section: 'menu'} do
|
93
|
-
set_file "views/application/index4.haml", "= layout 'menu',
|
93
|
+
set_file "views/application/index4.haml", "= layout 'menu', 1"
|
94
94
|
create_dir 'views/Menu'
|
95
95
|
set_file "views/Menu/index.haml", "%h1 menu"
|
96
96
|
|
@@ -102,7 +102,7 @@ describe Classiccms do
|
|
102
102
|
end
|
103
103
|
it 'should also pass the current record' do
|
104
104
|
with_constants :CONFIG => {home: 'application/index4', model: 'Menu', section: 'menu'} do
|
105
|
-
set_file "views/application/index4.haml", "= layout 'menu',
|
105
|
+
set_file "views/application/index4.haml", "= layout 'menu', 1"
|
106
106
|
create_dir 'views/menu'
|
107
107
|
set_file "views/menu/record.haml", "%h1= record.id"
|
108
108
|
|