classiccms 0.3.8 → 0.3.9
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 +5 -3
- data/lib/classiccms/controllers/website.rb +2 -0
- data/lib/classiccms/helpers.rb +1 -1
- data/lib/classiccms/public/js/index.coffee +2 -1
- data/lib/classiccms/scaffold/Rakefile +3 -3
- data/lib/classiccms/scaffold/config.ru +0 -2
- data/lib/classiccms/version.rb +1 -1
- data/spec/helpers_spec.rb +12 -0
- metadata +3 -4
@@ -63,6 +63,8 @@ module Classiccms
|
|
63
63
|
end
|
64
64
|
|
65
65
|
post '/save' do
|
66
|
+
content_type :json
|
67
|
+
errors = []
|
66
68
|
params.each do |key, value|
|
67
69
|
begin
|
68
70
|
if value['id'] != nil
|
@@ -72,13 +74,13 @@ module Classiccms
|
|
72
74
|
end
|
73
75
|
record.update_attributes(value)
|
74
76
|
rescue TypeError
|
75
|
-
''
|
76
77
|
end
|
77
78
|
if !record.save
|
78
|
-
|
79
|
-
|
79
|
+
errors << record.errors.messages.to_json
|
80
|
+
else
|
80
81
|
end
|
81
82
|
end
|
83
|
+
return errors
|
82
84
|
end
|
83
85
|
post '/upload/image' do
|
84
86
|
image = Image.new
|
@@ -16,10 +16,12 @@ module Classiccms
|
|
16
16
|
end
|
17
17
|
get '/javascripts/*.js' do
|
18
18
|
response.headers['Cache-Control'] = ENV['RACK_ENV'] == 'development' ? 'no-cache' : 'public, max-age=86400'
|
19
|
+
content_type :js
|
19
20
|
show params[:splat].join, :views => [File.join(Dir.pwd, 'public/javascripts')]
|
20
21
|
end
|
21
22
|
get '/stylesheets/*.css' do
|
22
23
|
response.headers['Cache-Control'] = ENV['RACK_ENV'] == 'development' ? 'no-cache' : 'public, max-age=86400'
|
24
|
+
content_type :css
|
23
25
|
show params[:splat].join, :views => [File.join(Dir.pwd, 'public/stylesheets')]
|
24
26
|
end
|
25
27
|
get '/:id/?*' do
|
data/lib/classiccms/helpers.rb
CHANGED
@@ -55,7 +55,7 @@ module Classiccms
|
|
55
55
|
connection = record.connections.where(:parent_id => parent_id, :section => section_name, :file.ne => nil).first
|
56
56
|
|
57
57
|
#render html
|
58
|
-
rendering = show "
|
58
|
+
rendering = show connection.file, {views: ["app/views/#{record._type}", "app/views/#{record._type.downcase}"]}, {record: record}
|
59
59
|
|
60
60
|
html.insert(connection.order_id, rendering)
|
61
61
|
end
|
data/lib/classiccms/version.rb
CHANGED
data/spec/helpers_spec.rb
CHANGED
@@ -144,6 +144,18 @@ describe Classiccms do
|
|
144
144
|
last_response.body.should == "<h1>menu</h1>\n"
|
145
145
|
end
|
146
146
|
end
|
147
|
+
it 'should return the rendered file, even if the directory does not match exactly' do
|
148
|
+
with_constants :CONFIG => {home: 'application/index6'} do
|
149
|
+
set_file "views/application/index6.haml", "= section 'menu', 0"
|
150
|
+
create_dir 'views/Menu'
|
151
|
+
set_file "views/Menu/section.haml", "%h1 menu"
|
152
|
+
|
153
|
+
m = Menu.create connections: [Connection.new(section: 'menu', file: 'section')]
|
154
|
+
|
155
|
+
get '/'
|
156
|
+
last_response.body.should == "<h1>menu</h1>\n"
|
157
|
+
end
|
158
|
+
end
|
147
159
|
it 'should add local variable record' do
|
148
160
|
with_constants :CONFIG => {home: 'application/index5'} do
|
149
161
|
set_file "views/application/index5.haml", "= section 'menu', 0"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: classiccms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -10738,7 +10738,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
10738
10738
|
version: '0'
|
10739
10739
|
requirements: []
|
10740
10740
|
rubyforge_project: classiccms
|
10741
|
-
rubygems_version: 1.8.
|
10741
|
+
rubygems_version: 1.8.23
|
10742
10742
|
signing_key:
|
10743
10743
|
specification_version: 3
|
10744
10744
|
summary: An easy to use wrapper for creating basic and more complicated websites
|
@@ -10762,4 +10762,3 @@ test_files:
|
|
10762
10762
|
- spec/models/user_spec.rb
|
10763
10763
|
- spec/queue_spec.rb
|
10764
10764
|
- spec/spec_helper.rb
|
10765
|
-
has_rdoc:
|