comfortable_mexican_sofa 1.0.36 → 1.0.37
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +0 -32
- data/VERSION +1 -1
- data/app/controllers/cms_admin/pages_controller.rb +10 -2
- data/app/models/cms_layout.rb +2 -0
- data/app/models/cms_page.rb +2 -0
- data/app/models/cms_snippet.rb +2 -0
- data/app/views/cms_admin/pages/_form.html.erb +6 -1
- data/app/views/cms_admin/pages/edit.html.erb +0 -1
- data/app/views/cms_admin/pages/new.html.erb +0 -1
- data/app/views/cms_admin/uploads/_file.html.erb +1 -1
- data/app/views/cms_admin/uploads/_index.html.erb +4 -2
- data/comfortable_mexican_sofa.gemspec +5 -2
- data/db/migrate/01_create_cms.rb +0 -1
- data/lib/comfortable_mexican_sofa/form_builder.rb +4 -4
- data/lib/tasks/comfortable_mexican_sofa.rake +18 -6
- data/public/javascripts/comfortable_mexican_sofa/cms.js +10 -0
- data/public/stylesheets/comfortable_mexican_sofa/structure.css +20 -7
- data/test/cms_seeds/test.host/layouts/broken.yml +1 -0
- data/test/cms_seeds/test.host/pages/broken.yml +1 -0
- data/test/cms_seeds/test.host/snippets/broken.yml +1 -0
- data/test/functional/cms_admin/layouts_controller_test.rb +1 -1
- data/test/functional/cms_admin/pages_controller_test.rb +44 -14
- data/test/functional/cms_admin/sites_controller_test.rb +1 -1
- data/test/functional/cms_admin/snippets_controller_test.rb +1 -1
- data/test/functional/cms_admin/uploads_controller_test.rb +1 -1
- data/test/functional/cms_content_controller_test.rb +1 -1
- data/test/integration/authentication_test.rb +1 -1
- data/test/integration/rake_tasks_test.rb +1 -1
- data/test/integration/render_cms_seed_test.rb +1 -1
- data/test/integration/render_cms_test.rb +1 -1
- data/test/integration/sites_test.rb +1 -1
- data/test/integration/view_hooks_test.rb +1 -1
- data/test/unit/cms_block_test.rb +1 -1
- data/test/unit/cms_layout_test.rb +9 -1
- data/test/unit/cms_page_test.rb +10 -2
- data/test/unit/cms_site_test.rb +1 -1
- data/test/unit/cms_snippet_test.rb +9 -1
- metadata +15 -22
data/Rakefile
CHANGED
@@ -23,36 +23,4 @@ begin
|
|
23
23
|
Jeweler::GemcutterTasks.new
|
24
24
|
rescue LoadError
|
25
25
|
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
26
|
-
end
|
27
|
-
|
28
|
-
require 'rake/testtask'
|
29
|
-
Rake::TestTask.new(:test) do |test|
|
30
|
-
test.libs << 'lib' << 'test'
|
31
|
-
test.pattern = 'test/**/test_*.rb'
|
32
|
-
test.verbose = true
|
33
|
-
end
|
34
|
-
|
35
|
-
begin
|
36
|
-
require 'rcov/rcovtask'
|
37
|
-
Rcov::RcovTask.new do |test|
|
38
|
-
test.libs << 'test'
|
39
|
-
test.pattern = 'test/**/test_*.rb'
|
40
|
-
test.verbose = true
|
41
|
-
end
|
42
|
-
rescue LoadError
|
43
|
-
task :rcov do
|
44
|
-
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
task :default => :test
|
49
|
-
|
50
|
-
require 'rake/rdoctask'
|
51
|
-
Rake::RDocTask.new do |rdoc|
|
52
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
53
|
-
|
54
|
-
rdoc.rdoc_dir = 'rdoc'
|
55
|
-
rdoc.title = "gem #{version}"
|
56
|
-
rdoc.rdoc_files.include('README*')
|
57
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
58
26
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.37
|
@@ -1,8 +1,9 @@
|
|
1
1
|
class CmsAdmin::PagesController < CmsAdmin::BaseController
|
2
2
|
|
3
3
|
before_filter :build_cms_page, :only => [:new, :create]
|
4
|
-
before_filter :build_upload_file, :only => [:new, :edit]
|
5
4
|
before_filter :load_cms_page, :only => [:edit, :update, :destroy]
|
5
|
+
before_filter :preview_cms_page, :only => [:create, :update]
|
6
|
+
before_filter :build_upload_file, :only => [:new, :edit]
|
6
7
|
|
7
8
|
def index
|
8
9
|
return redirect_to :action => :new if @cms_site.cms_pages.count == 0
|
@@ -27,7 +28,7 @@ class CmsAdmin::PagesController < CmsAdmin::BaseController
|
|
27
28
|
end
|
28
29
|
|
29
30
|
def update
|
30
|
-
@cms_page.
|
31
|
+
@cms_page.save!
|
31
32
|
flash[:notice] = 'Page updated'
|
32
33
|
redirect_to :action => :edit, :id => @cms_page
|
33
34
|
rescue ActiveRecord::RecordInvalid
|
@@ -60,10 +61,17 @@ protected
|
|
60
61
|
|
61
62
|
def load_cms_page
|
62
63
|
@cms_page = @cms_site.cms_pages.find(params[:id])
|
64
|
+
@cms_page.attributes = params[:cms_page]
|
63
65
|
@cms_page.cms_layout ||= (@cms_page.parent && @cms_page.parent.cms_layout || @cms_site.cms_layouts.first)
|
64
66
|
rescue ActiveRecord::RecordNotFound
|
65
67
|
flash[:error] = 'Page not found'
|
66
68
|
redirect_to :action => :index
|
67
69
|
end
|
68
70
|
|
71
|
+
def preview_cms_page
|
72
|
+
if params[:preview]
|
73
|
+
layout = @cms_page.cms_layout.app_layout.blank?? false : @cms_page.cms_layout.app_layout
|
74
|
+
render :inline => @cms_page.content(true), :layout => layout
|
75
|
+
end
|
76
|
+
end
|
69
77
|
end
|
data/app/models/cms_layout.rb
CHANGED
@@ -55,6 +55,8 @@ class CmsLayout < ActiveRecord::Base
|
|
55
55
|
attributes[:parent] = CmsLayout.load_from_file(site, attributes[:parent])
|
56
56
|
attributes[:cms_site] = site
|
57
57
|
new(attributes)
|
58
|
+
rescue
|
59
|
+
raise "Failed to load from #{file_path}"
|
58
60
|
end
|
59
61
|
|
60
62
|
# Wrapper around load_from_file and find_by_slug
|
data/app/models/cms_page.rb
CHANGED
@@ -63,6 +63,8 @@ class CmsPage < ActiveRecord::Base
|
|
63
63
|
attributes[:parent] = CmsPage.load_from_file(site, attributes[:parent])
|
64
64
|
attributes[:cms_site] = site
|
65
65
|
new(attributes)
|
66
|
+
rescue
|
67
|
+
raise "Failed to load from #{file_path}"
|
66
68
|
end
|
67
69
|
|
68
70
|
# Wrapper around load_from_file and find_by_full_path
|
data/app/models/cms_snippet.rb
CHANGED
@@ -33,6 +33,8 @@ class CmsSnippet < ActiveRecord::Base
|
|
33
33
|
return nil unless File.exists?(file_path)
|
34
34
|
attributes = YAML.load_file(file_path).symbolize_keys!
|
35
35
|
new(attributes)
|
36
|
+
rescue
|
37
|
+
raise "Failed to load from #{file_path}"
|
36
38
|
end
|
37
39
|
|
38
40
|
# Wrapper around load_from_file and find_by_slug
|
@@ -29,4 +29,9 @@
|
|
29
29
|
|
30
30
|
<%= render :partial => 'form_blocks' %>
|
31
31
|
|
32
|
-
<%= form.
|
32
|
+
<%= form.simple_field nil, nil, :class => 'form_save' do %>
|
33
|
+
<%= form.check_box :is_published, :disable_builder => true %>
|
34
|
+
<%= form.label_for :is_published, :label => 'Published' %>
|
35
|
+
<%= form.submit @cms_page.new_record?? 'Create Page' : 'Update Page', :disable_builder => true %>
|
36
|
+
<%= form.submit 'Preview', :name => 'preview', :id => 'cms_page_preview', :disable_builder => true %>
|
37
|
+
<% end %>
|
@@ -5,6 +5,6 @@
|
|
5
5
|
file_name = file_name.truncate(30) + file_ext
|
6
6
|
end
|
7
7
|
%>
|
8
|
-
<%= link_to file_name, file.file.url, :target => '_blank' %>
|
8
|
+
<%= link_to file_name, file.file.url, :target => '_blank', :class => 'filename' %>
|
9
9
|
<%= link_to span_tag('x'), cms_admin_upload_path(file), :method => :delete, :remote => true, :class => 'delete' %>
|
10
10
|
</div>
|
@@ -1,7 +1,9 @@
|
|
1
1
|
<div id='file_uploads' class='box'>
|
2
|
-
<
|
2
|
+
<div class='actions'>
|
3
|
+
<button id="uploader_button" href="#">Upload Files</button>
|
4
|
+
</div>
|
3
5
|
<div id='uploaded_files'>
|
4
|
-
<% CmsUpload.order('
|
6
|
+
<% CmsUpload.order('file_file_name').all.each do |file| %>
|
5
7
|
<%= render :partial => 'cms_admin/uploads/file', :object => file %>
|
6
8
|
<% end %>
|
7
9
|
</div>
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{comfortable_mexican_sofa}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.37"
|
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 = %q{
|
12
|
+
s.date = %q{2011-01-07}
|
13
13
|
s.description = %q{}
|
14
14
|
s.email = %q{oleg@theworkinggroup.ca}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -166,11 +166,14 @@ Gem::Specification.new do |s|
|
|
166
166
|
"public/stylesheets/comfortable_mexican_sofa/structure.css",
|
167
167
|
"public/stylesheets/comfortable_mexican_sofa/typography.css",
|
168
168
|
"script/rails",
|
169
|
+
"test/cms_seeds/test.host/layouts/broken.yml",
|
169
170
|
"test/cms_seeds/test.host/layouts/default.yml",
|
170
171
|
"test/cms_seeds/test.host/layouts/nested.yml",
|
172
|
+
"test/cms_seeds/test.host/pages/broken.yml",
|
171
173
|
"test/cms_seeds/test.host/pages/child.yml",
|
172
174
|
"test/cms_seeds/test.host/pages/child/subchild.yml",
|
173
175
|
"test/cms_seeds/test.host/pages/index.yml",
|
176
|
+
"test/cms_seeds/test.host/snippets/broken.yml",
|
174
177
|
"test/cms_seeds/test.host/snippets/default.yml",
|
175
178
|
"test/fixtures/cms_blocks.yml",
|
176
179
|
"test/fixtures/cms_layouts.yml",
|
data/db/migrate/01_create_cms.rb
CHANGED
@@ -24,10 +24,10 @@ class ComfortableMexicanSofa::FormBuilder < ActionView::Helpers::FormBuilder
|
|
24
24
|
).html_safe
|
25
25
|
end
|
26
26
|
|
27
|
-
def simple_field(label = nil, content = nil, &block)
|
27
|
+
def simple_field(label = nil, content = nil, options = {}, &block)
|
28
28
|
content ||= @template.capture(&block) if block_given?
|
29
29
|
%(
|
30
|
-
<div class='form_element'>
|
30
|
+
<div class='form_element #{options.delete(:class)}'>
|
31
31
|
<div class='label'>#{label}</div>
|
32
32
|
<div class='value'>#{content}</div>
|
33
33
|
</div>
|
@@ -40,11 +40,11 @@ class ComfortableMexicanSofa::FormBuilder < ActionView::Helpers::FormBuilder
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def submit(value, options = {}, &block)
|
43
|
+
return super if options.delete(:disable_builder)
|
43
44
|
extra_content = @template.capture(&block) if block_given?
|
44
|
-
cancel_link ||= options[:cancel_url] ? ' or ' + options.delete(:cancel_url) : ''
|
45
45
|
%(
|
46
46
|
<div class='form_element submit_element'>
|
47
|
-
#{super(value, options)} #{extra_content}
|
47
|
+
#{super(value, options)} #{extra_content}
|
48
48
|
</div>
|
49
49
|
).html_safe
|
50
50
|
end
|
@@ -32,8 +32,12 @@ namespace :comfortable_mexican_sofa do
|
|
32
32
|
puts 'Importing Layouts'
|
33
33
|
puts '-----------------'
|
34
34
|
layouts = Dir.glob(File.expand_path('layouts/*.yml', @seed_path)).collect do |layout_file_path|
|
35
|
-
|
36
|
-
|
35
|
+
begin
|
36
|
+
attributes = YAML.load_file(layout_file_path).symbolize_keys!
|
37
|
+
@site.cms_layouts.load_from_file(@site, attributes[:slug])
|
38
|
+
rescue
|
39
|
+
nil
|
40
|
+
end
|
37
41
|
end.compact
|
38
42
|
CmsLayout.connection.transaction do
|
39
43
|
# Fixtures are not ordered in any particular way. Saving order matters,
|
@@ -71,8 +75,12 @@ namespace :comfortable_mexican_sofa do
|
|
71
75
|
puts 'Importing Pages'
|
72
76
|
puts '---------------'
|
73
77
|
pages = Dir.glob(File.expand_path('pages/**/*.yml', @seed_path)).collect do |page_file_path|
|
74
|
-
|
75
|
-
|
78
|
+
begin
|
79
|
+
attributes = YAML.load_file(page_file_path).symbolize_keys!
|
80
|
+
@site.cms_pages.load_from_file(@site, attributes[:full_path])
|
81
|
+
rescue
|
82
|
+
nil
|
83
|
+
end
|
76
84
|
end.compact
|
77
85
|
CmsPage.connection.transaction do
|
78
86
|
# Fixtures are not ordered in any particular way. Saving order matters,
|
@@ -120,8 +128,12 @@ namespace :comfortable_mexican_sofa do
|
|
120
128
|
puts 'Importing Snippets'
|
121
129
|
puts '------------------'
|
122
130
|
snippets = Dir.glob(File.expand_path('snippets/*.yml', @seed_path)).collect do |snippet_file_path|
|
123
|
-
|
124
|
-
|
131
|
+
begin
|
132
|
+
attributes = YAML.load_file(snippet_file_path).symbolize_keys!
|
133
|
+
@site.cms_snippets.load_from_file(@site, attributes[:slug])
|
134
|
+
rescue
|
135
|
+
nil
|
136
|
+
end
|
125
137
|
end.compact
|
126
138
|
CmsSnippet.connection.transaction do
|
127
139
|
snippets.each do |snippet|
|
@@ -9,6 +9,7 @@ $.CMS = function(){
|
|
9
9
|
$.CMS.load_page_blocks();
|
10
10
|
$.CMS.enable_rich_text();
|
11
11
|
$.CMS.enable_date_picker();
|
12
|
+
if($('form.new_cms_page, form.edit_cms_page').get(0)) $.CMS.enable_page_save_form();
|
12
13
|
if($('#page_save').get(0)) $.CMS.enable_page_save_widget();
|
13
14
|
if($('#uploader_button').get(0)) $.CMS.enable_uploader();
|
14
15
|
|
@@ -103,6 +104,15 @@ $.CMS = function(){
|
|
103
104
|
})
|
104
105
|
},
|
105
106
|
|
107
|
+
enable_page_save_form : function(){
|
108
|
+
$('input[name=commit]').click(function() {
|
109
|
+
$(this).parents('form').attr('target', '');
|
110
|
+
});
|
111
|
+
$('input[name=preview]').click(function() {
|
112
|
+
$(this).parents('form').attr('target', '_blank');
|
113
|
+
});
|
114
|
+
},
|
115
|
+
|
106
116
|
enable_uploader : function(){
|
107
117
|
auth_token = $("meta[name=csrf-token]").attr('content');
|
108
118
|
var uploader = new plupload.Uploader({
|
@@ -59,7 +59,7 @@ html, body {
|
|
59
59
|
padding: 5px;
|
60
60
|
border-radius: 3px;
|
61
61
|
-moz-border-radius: 3px;
|
62
|
-
margin-bottom:
|
62
|
+
margin-bottom: 10px;
|
63
63
|
overflow: hidden;
|
64
64
|
}
|
65
65
|
#page_save button {
|
@@ -73,9 +73,11 @@ html, body {
|
|
73
73
|
margin-right: 5px;
|
74
74
|
}
|
75
75
|
|
76
|
-
#file_uploads
|
77
|
-
|
78
|
-
|
76
|
+
#file_uploads .actions {
|
77
|
+
overflow: hidden;
|
78
|
+
}
|
79
|
+
#file_uploads .actions button {
|
80
|
+
float: right;
|
79
81
|
}
|
80
82
|
#file_uploads #uploaded_files {
|
81
83
|
max-height: 500px;
|
@@ -86,7 +88,7 @@ html, body {
|
|
86
88
|
overflow: hidden;
|
87
89
|
font-size: 11px;
|
88
90
|
background-color: #fff;
|
89
|
-
margin-
|
91
|
+
margin-top: 2px;
|
90
92
|
opacity: 0.8;
|
91
93
|
}
|
92
94
|
#file_uploads #uploaded_files .file.pending {
|
@@ -158,12 +160,14 @@ html, body {
|
|
158
160
|
.form_element .value {
|
159
161
|
margin-left: 160px;
|
160
162
|
}
|
161
|
-
.form_element .value input,
|
163
|
+
.form_element .value input[type='text'],
|
164
|
+
.form_element .value input[type='password'],
|
162
165
|
.form_element .value textarea,
|
163
166
|
.form_element .value select {
|
164
167
|
width: 98%;
|
165
168
|
}
|
166
|
-
.form_element .value input,
|
169
|
+
.form_element .value input[type='text'],
|
170
|
+
.form_element .value input[type='password'],
|
167
171
|
.form_element .value select,
|
168
172
|
.form_element .value textarea {
|
169
173
|
border: 1px solid #ccc;
|
@@ -207,6 +211,15 @@ html, body {
|
|
207
211
|
.form_element .value .field_with_errors textarea {
|
208
212
|
border-color: #9e0b0f;
|
209
213
|
}
|
214
|
+
.form_element.form_save {
|
215
|
+
background-color: #E0E0E0;
|
216
|
+
border-radius: 3px;
|
217
|
+
-moz-border-radius: 3px;
|
218
|
+
padding: 5px 0px;
|
219
|
+
}
|
220
|
+
.form_element.form_save label {
|
221
|
+
margin: 0px 5px;
|
222
|
+
}
|
210
223
|
|
211
224
|
/* -- Listings ----------------------------------------------------------- */
|
212
225
|
ul.list li .item {
|
@@ -0,0 +1 @@
|
|
1
|
+
broken yml file
|
@@ -0,0 +1 @@
|
|
1
|
+
broken yml file
|
@@ -0,0 +1 @@
|
|
1
|
+
broken yml file
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require File.expand_path('../../test_helper', File.dirname(__FILE__))
|
2
2
|
|
3
3
|
class CmsAdmin::PagesControllerTest < ActionController::TestCase
|
4
4
|
|
@@ -126,19 +126,17 @@ class CmsAdmin::PagesControllerTest < ActionController::TestCase
|
|
126
126
|
|
127
127
|
def test_creation
|
128
128
|
assert_difference 'CmsPage.count' do
|
129
|
-
assert_difference 'CmsBlock.count',
|
129
|
+
assert_difference 'CmsBlock.count', 2 do
|
130
130
|
post :create, :cms_page => {
|
131
131
|
:label => 'Test Page',
|
132
132
|
:slug => 'test-page',
|
133
133
|
:parent_id => cms_pages(:default).id,
|
134
134
|
:cms_layout_id => cms_layouts(:default).id,
|
135
135
|
:cms_blocks_attributes => [
|
136
|
-
{ :label => '
|
136
|
+
{ :label => 'default_page_text',
|
137
137
|
:content => 'content content' },
|
138
|
-
{ :label => '
|
139
|
-
:content => 'title content' }
|
140
|
-
{ :label => 'number',
|
141
|
-
:content => '999' }
|
138
|
+
{ :label => 'default_field_text',
|
139
|
+
:content => 'title content' }
|
142
140
|
]
|
143
141
|
}
|
144
142
|
assert_response :redirect
|
@@ -155,18 +153,16 @@ class CmsAdmin::PagesControllerTest < ActionController::TestCase
|
|
155
153
|
post :create, :cms_page => {
|
156
154
|
:cms_layout_id => cms_layouts(:default).id,
|
157
155
|
:cms_blocks_attributes => [
|
158
|
-
{ :label => '
|
156
|
+
{ :label => 'default_page_text',
|
159
157
|
:content => 'content content' },
|
160
|
-
{ :label => '
|
161
|
-
:content => 'title content' }
|
162
|
-
{ :label => 'number',
|
163
|
-
:content => '999' }
|
158
|
+
{ :label => 'default_field_text',
|
159
|
+
:content => 'title content' }
|
164
160
|
]
|
165
161
|
}
|
166
162
|
assert_response :success
|
167
163
|
page = assigns(:cms_page)
|
168
|
-
assert_equal
|
169
|
-
assert_equal ['content content', 'title content'
|
164
|
+
assert_equal 2, page.cms_blocks.size
|
165
|
+
assert_equal ['content content', 'title content'], page.cms_blocks.collect{|b| b.content}
|
170
166
|
assert_template :new
|
171
167
|
assert_equal 'Failed to create page', flash[:error]
|
172
168
|
end
|
@@ -252,4 +248,38 @@ class CmsAdmin::PagesControllerTest < ActionController::TestCase
|
|
252
248
|
assert_template :form_blocks
|
253
249
|
end
|
254
250
|
|
251
|
+
def test_creation_preview
|
252
|
+
assert_no_difference 'CmsPage.count' do
|
253
|
+
post :create, :preview => 'Preview', :cms_page => {
|
254
|
+
:label => 'Test Page',
|
255
|
+
:slug => 'test-page',
|
256
|
+
:parent_id => cms_pages(:default).id,
|
257
|
+
:cms_layout_id => cms_layouts(:default).id,
|
258
|
+
:cms_blocks_attributes => [
|
259
|
+
{ :label => 'default_page_text',
|
260
|
+
:content => 'preview content' }
|
261
|
+
]
|
262
|
+
}
|
263
|
+
assert_response :success
|
264
|
+
assert_match /preview content/, response.body
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
def test_update_preview
|
269
|
+
page = cms_pages(:default)
|
270
|
+
assert_no_difference 'CmsPage.count' do
|
271
|
+
put :update, :preview => 'Preview', :id => page, :cms_page => {
|
272
|
+
:label => 'Updated Label',
|
273
|
+
:cms_blocks_attributes => [
|
274
|
+
{ :label => 'default_page_text',
|
275
|
+
:content => 'preview content',
|
276
|
+
:id => cms_blocks(:default_page_text).id}
|
277
|
+
]
|
278
|
+
}
|
279
|
+
assert_response :success
|
280
|
+
assert_match /preview content/, response.body
|
281
|
+
page.reload
|
282
|
+
assert_not_equal 'Updated Label', page.label
|
283
|
+
end
|
284
|
+
end
|
255
285
|
end
|
data/test/unit/cms_block_test.rb
CHANGED
@@ -4,7 +4,7 @@ class CmsLayoutTest < ActiveSupport::TestCase
|
|
4
4
|
|
5
5
|
def test_fixtures_validity
|
6
6
|
CmsLayout.all.each do |layout|
|
7
|
-
assert layout.valid
|
7
|
+
assert layout.valid?, layout.errors.full_messages.to_s
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -109,6 +109,14 @@ class CmsLayoutTest < ActiveSupport::TestCase
|
|
109
109
|
assert_equal '<html><div>{{cms:page:content}}</div></html>', layout.merged_content
|
110
110
|
end
|
111
111
|
|
112
|
+
def test_load_from_file_broken
|
113
|
+
ComfortableMexicanSofa.configuration.seed_data_path = File.expand_path('../cms_seeds', File.dirname(__FILE__))
|
114
|
+
error_message = "Failed to load from #{ComfortableMexicanSofa.configuration.seed_data_path}/test.host/layouts/broken.yml"
|
115
|
+
assert_exception_raised RuntimeError, error_message do
|
116
|
+
CmsLayout.load_from_file(cms_sites(:default), 'broken')
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
112
120
|
def test_load_for_slug
|
113
121
|
assert layout = CmsLayout.load_for_slug!(cms_sites(:default), 'default')
|
114
122
|
assert !layout.new_record?
|
data/test/unit/cms_page_test.rb
CHANGED
@@ -4,7 +4,7 @@ class CmsPageTest < ActiveSupport::TestCase
|
|
4
4
|
|
5
5
|
def test_fixtures_validity
|
6
6
|
CmsPage.all.each do |page|
|
7
|
-
assert page.valid?, page.errors.full_messages
|
7
|
+
assert page.valid?, page.errors.full_messages.to_s
|
8
8
|
assert_equal page.read_attribute(:content), page.content(true)
|
9
9
|
end
|
10
10
|
end
|
@@ -19,7 +19,7 @@ class CmsPageTest < ActiveSupport::TestCase
|
|
19
19
|
def test_validation_of_parent_presence
|
20
20
|
page = cms_sites(:default).cms_pages.new(new_params)
|
21
21
|
assert !page.parent
|
22
|
-
assert page.valid?, page.errors.full_messages
|
22
|
+
assert page.valid?, page.errors.full_messages.to_s
|
23
23
|
assert_equal cms_pages(:default), page.parent
|
24
24
|
end
|
25
25
|
|
@@ -173,6 +173,14 @@ class CmsPageTest < ActiveSupport::TestCase
|
|
173
173
|
assert_equal '<html><div>Sub Child Page Content Content for Default Snippet</div></html>', page.content
|
174
174
|
end
|
175
175
|
|
176
|
+
def test_load_from_file_broken
|
177
|
+
ComfortableMexicanSofa.configuration.seed_data_path = File.expand_path('../cms_seeds', File.dirname(__FILE__))
|
178
|
+
error_message = "Failed to load from #{ComfortableMexicanSofa.configuration.seed_data_path}/test.host/pages/broken.yml"
|
179
|
+
assert_exception_raised RuntimeError, error_message do
|
180
|
+
CmsPage.load_from_file(cms_sites(:default), '/broken')
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
176
184
|
def test_load_for_full_path
|
177
185
|
assert page = CmsPage.load_for_full_path!(cms_sites(:default), '/')
|
178
186
|
assert !page.new_record?
|
data/test/unit/cms_site_test.rb
CHANGED
@@ -4,7 +4,7 @@ class CmsSnippetTest < ActiveSupport::TestCase
|
|
4
4
|
|
5
5
|
def test_fixtures_validity
|
6
6
|
CmsSnippet.all.each do |snippet|
|
7
|
-
assert snippet.valid?, snippet.errors.full_messages
|
7
|
+
assert snippet.valid?, snippet.errors.full_messages.to_s
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -32,6 +32,14 @@ class CmsSnippetTest < ActiveSupport::TestCase
|
|
32
32
|
assert_equal 'Content for Default Snippet', snippet.content
|
33
33
|
end
|
34
34
|
|
35
|
+
def test_load_from_file_broken
|
36
|
+
ComfortableMexicanSofa.configuration.seed_data_path = File.expand_path('../cms_seeds', File.dirname(__FILE__))
|
37
|
+
error_message = "Failed to load from #{ComfortableMexicanSofa.configuration.seed_data_path}/test.host/snippets/broken.yml"
|
38
|
+
assert_exception_raised RuntimeError, error_message do
|
39
|
+
CmsSnippet.load_from_file(cms_sites(:default), 'broken')
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
35
43
|
def test_load_for_slug
|
36
44
|
assert snippet = CmsSnippet.load_for_slug!(cms_sites(:default), 'default')
|
37
45
|
assert !snippet.new_record?
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comfortable_mexican_sofa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 95
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 1
|
8
7
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
8
|
+
- 37
|
9
|
+
version: 1.0.37
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Oleg Khabarov
|
@@ -16,131 +15,123 @@ autorequire:
|
|
16
15
|
bindir: bin
|
17
16
|
cert_chain: []
|
18
17
|
|
19
|
-
date:
|
18
|
+
date: 2011-01-07 00:00:00 -05:00
|
20
19
|
default_executable:
|
21
20
|
dependencies:
|
22
21
|
- !ruby/object:Gem::Dependency
|
22
|
+
name: rails
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
24
|
none: false
|
25
25
|
requirements:
|
26
26
|
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
hash: 1
|
29
28
|
segments:
|
30
29
|
- 3
|
31
30
|
- 0
|
32
31
|
- 3
|
33
32
|
version: 3.0.3
|
34
33
|
type: :runtime
|
35
|
-
name: rails
|
36
34
|
prerelease: false
|
37
35
|
version_requirements: *id001
|
38
36
|
- !ruby/object:Gem::Dependency
|
37
|
+
name: active_link_to
|
39
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
39
|
none: false
|
41
40
|
requirements:
|
42
41
|
- - ">="
|
43
42
|
- !ruby/object:Gem::Version
|
44
|
-
hash: 19
|
45
43
|
segments:
|
46
44
|
- 0
|
47
45
|
- 0
|
48
46
|
- 6
|
49
47
|
version: 0.0.6
|
50
48
|
type: :runtime
|
51
|
-
name: active_link_to
|
52
49
|
prerelease: false
|
53
50
|
version_requirements: *id002
|
54
51
|
- !ruby/object:Gem::Dependency
|
52
|
+
name: paperclip
|
55
53
|
requirement: &id003 !ruby/object:Gem::Requirement
|
56
54
|
none: false
|
57
55
|
requirements:
|
58
56
|
- - ">="
|
59
57
|
- !ruby/object:Gem::Version
|
60
|
-
hash: 19
|
61
58
|
segments:
|
62
59
|
- 2
|
63
60
|
- 3
|
64
61
|
- 8
|
65
62
|
version: 2.3.8
|
66
63
|
type: :runtime
|
67
|
-
name: paperclip
|
68
64
|
prerelease: false
|
69
65
|
version_requirements: *id003
|
70
66
|
- !ruby/object:Gem::Dependency
|
67
|
+
name: mime-types
|
71
68
|
requirement: &id004 !ruby/object:Gem::Requirement
|
72
69
|
none: false
|
73
70
|
requirements:
|
74
71
|
- - ">="
|
75
72
|
- !ruby/object:Gem::Version
|
76
|
-
hash: 3
|
77
73
|
segments:
|
78
74
|
- 0
|
79
75
|
version: "0"
|
80
76
|
type: :runtime
|
81
|
-
name: mime-types
|
82
77
|
prerelease: false
|
83
78
|
version_requirements: *id004
|
84
79
|
- !ruby/object:Gem::Dependency
|
80
|
+
name: sqlite3-ruby
|
85
81
|
requirement: &id005 !ruby/object:Gem::Requirement
|
86
82
|
none: false
|
87
83
|
requirements:
|
88
84
|
- - ">="
|
89
85
|
- !ruby/object:Gem::Version
|
90
|
-
hash: 3
|
91
86
|
segments:
|
92
87
|
- 0
|
93
88
|
version: "0"
|
94
89
|
type: :development
|
95
|
-
name: sqlite3-ruby
|
96
90
|
prerelease: false
|
97
91
|
version_requirements: *id005
|
98
92
|
- !ruby/object:Gem::Dependency
|
93
|
+
name: rails
|
99
94
|
requirement: &id006 !ruby/object:Gem::Requirement
|
100
95
|
none: false
|
101
96
|
requirements:
|
102
97
|
- - ">="
|
103
98
|
- !ruby/object:Gem::Version
|
104
|
-
hash: 1
|
105
99
|
segments:
|
106
100
|
- 3
|
107
101
|
- 0
|
108
102
|
- 3
|
109
103
|
version: 3.0.3
|
110
104
|
type: :runtime
|
111
|
-
name: rails
|
112
105
|
prerelease: false
|
113
106
|
version_requirements: *id006
|
114
107
|
- !ruby/object:Gem::Dependency
|
108
|
+
name: active_link_to
|
115
109
|
requirement: &id007 !ruby/object:Gem::Requirement
|
116
110
|
none: false
|
117
111
|
requirements:
|
118
112
|
- - ">="
|
119
113
|
- !ruby/object:Gem::Version
|
120
|
-
hash: 19
|
121
114
|
segments:
|
122
115
|
- 0
|
123
116
|
- 0
|
124
117
|
- 6
|
125
118
|
version: 0.0.6
|
126
119
|
type: :runtime
|
127
|
-
name: active_link_to
|
128
120
|
prerelease: false
|
129
121
|
version_requirements: *id007
|
130
122
|
- !ruby/object:Gem::Dependency
|
123
|
+
name: paperclip
|
131
124
|
requirement: &id008 !ruby/object:Gem::Requirement
|
132
125
|
none: false
|
133
126
|
requirements:
|
134
127
|
- - ">="
|
135
128
|
- !ruby/object:Gem::Version
|
136
|
-
hash: 19
|
137
129
|
segments:
|
138
130
|
- 2
|
139
131
|
- 3
|
140
132
|
- 8
|
141
133
|
version: 2.3.8
|
142
134
|
type: :runtime
|
143
|
-
name: paperclip
|
144
135
|
prerelease: false
|
145
136
|
version_requirements: *id008
|
146
137
|
description: ""
|
@@ -302,11 +293,14 @@ files:
|
|
302
293
|
- public/stylesheets/comfortable_mexican_sofa/structure.css
|
303
294
|
- public/stylesheets/comfortable_mexican_sofa/typography.css
|
304
295
|
- script/rails
|
296
|
+
- test/cms_seeds/test.host/layouts/broken.yml
|
305
297
|
- test/cms_seeds/test.host/layouts/default.yml
|
306
298
|
- test/cms_seeds/test.host/layouts/nested.yml
|
299
|
+
- test/cms_seeds/test.host/pages/broken.yml
|
307
300
|
- test/cms_seeds/test.host/pages/child.yml
|
308
301
|
- test/cms_seeds/test.host/pages/child/subchild.yml
|
309
302
|
- test/cms_seeds/test.host/pages/index.yml
|
303
|
+
- test/cms_seeds/test.host/snippets/broken.yml
|
310
304
|
- test/cms_seeds/test.host/snippets/default.yml
|
311
305
|
- test/fixtures/cms_blocks.yml
|
312
306
|
- test/fixtures/cms_layouts.yml
|
@@ -365,7 +359,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
365
359
|
requirements:
|
366
360
|
- - ">="
|
367
361
|
- !ruby/object:Gem::Version
|
368
|
-
hash:
|
362
|
+
hash: 1225201023293296474
|
369
363
|
segments:
|
370
364
|
- 0
|
371
365
|
version: "0"
|
@@ -374,7 +368,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
374
368
|
requirements:
|
375
369
|
- - ">="
|
376
370
|
- !ruby/object:Gem::Version
|
377
|
-
hash: 3
|
378
371
|
segments:
|
379
372
|
- 0
|
380
373
|
version: "0"
|