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.
@@ -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
- content_type :json
79
- return record.errors.messages.to_json
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
@@ -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 "#{record._type}/#{connection.file}", {}, {record: record}
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
@@ -110,7 +110,8 @@ class TopPanel
110
110
 
111
111
  create: (url) ->
112
112
  $j.post url, $j(@p.form).serialize(), (data) =>
113
- if data == ''
113
+ alert data
114
+ if data == null
114
115
  window.location.reload()
115
116
  else
116
117
  $j.each data, (index, value)=>
@@ -1,9 +1,9 @@
1
1
  #to run:
2
2
  # QUEUE=* rake resque:work
3
- require 'classiccms'
3
+ require 'rubygems'
4
+ require 'bundler'
4
5
 
5
- ENV['RACK_ENV'] = 'development'
6
+ Bundler.require
6
7
  Classiccms.boot
7
8
 
8
9
  require 'resque/tasks'
9
-
@@ -2,8 +2,6 @@ require 'rubygems'
2
2
  require 'bundler'
3
3
 
4
4
  Bundler.require
5
-
6
- ENV['RACK_ENV'] = 'development'
7
5
  Classiccms.boot
8
6
 
9
7
 
@@ -1,3 +1,3 @@
1
1
  module Classiccms #:nodoc
2
- VERSION = "0.3.8"
2
+ VERSION = "0.3.9"
3
3
  end
@@ -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.8
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-06-11 00:00:00.000000000 Z
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.21
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: