comfortable_mexican_sofa 1.5.9 → 1.5.10
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/app/models/cms/file.rb +2 -1
- data/app/models/cms/page.rb +2 -2
- data/comfortable_mexican_sofa.gemspec +2 -2
- data/test/test_helper.rb +1 -1
- data/test/unit/models/block_test.rb +57 -0
- metadata +9 -9
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.5.
|
1
|
+
1.5.10
|
data/app/models/cms/file.rb
CHANGED
@@ -50,7 +50,8 @@ protected
|
|
50
50
|
# FIX: Terrible, but no way of creating cached page content overwise
|
51
51
|
def reload_page_cache
|
52
52
|
return unless self.block
|
53
|
-
self.block.page
|
53
|
+
p = self.block.page
|
54
|
+
Cms::Page.where(:id => p.id).update_all(:content => p.content(true))
|
54
55
|
end
|
55
56
|
|
56
57
|
end
|
data/app/models/cms/page.rb
CHANGED
@@ -18,8 +18,8 @@ class Cms::Page < ActiveRecord::Base
|
|
18
18
|
belongs_to :target_page,
|
19
19
|
:class_name => 'Cms::Page'
|
20
20
|
has_many :blocks,
|
21
|
-
:
|
22
|
-
:
|
21
|
+
:autosave => true,
|
22
|
+
:dependent => :destroy
|
23
23
|
|
24
24
|
# -- Callbacks ------------------------------------------------------------
|
25
25
|
before_validation :assigns_label,
|
@@ -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.10"
|
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-10-
|
12
|
+
s.date = "2011-10-28"
|
13
13
|
s.description = ""
|
14
14
|
s.email = "oleg@theworkinggroup.ca"
|
15
15
|
s.extra_rdoc_files = [
|
data/test/test_helper.rb
CHANGED
@@ -58,6 +58,32 @@ class CmsBlockTest < ActiveSupport::TestCase
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
+
def test_creation_via_page_nested_attributes_as_hash_with_duplicates
|
62
|
+
assert_difference ['Cms::Page.count', 'Cms::Block.count'] do
|
63
|
+
page = Cms::Page.create!(
|
64
|
+
:site => cms_sites(:default),
|
65
|
+
:layout => cms_layouts(:default),
|
66
|
+
:label => 'test page',
|
67
|
+
:slug => 'test_page',
|
68
|
+
:parent_id => cms_pages(:default).id,
|
69
|
+
:blocks_attributes => {
|
70
|
+
'0' => {
|
71
|
+
:label => 'default_page_text',
|
72
|
+
:content => 'test_content'
|
73
|
+
},
|
74
|
+
'1' => {
|
75
|
+
:label => 'default_page_text',
|
76
|
+
:content => 'test_content'
|
77
|
+
}
|
78
|
+
}
|
79
|
+
)
|
80
|
+
assert_equal 1, page.blocks.count
|
81
|
+
block = page.blocks.first
|
82
|
+
assert_equal 'default_page_text', block.label
|
83
|
+
assert_equal 'test_content', block.content
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
61
87
|
def test_creation_and_update_via_nested_attributes_with_file
|
62
88
|
layout = cms_layouts(:default)
|
63
89
|
layout.update_attribute(:content, '{{cms:page_file:file}}')
|
@@ -145,4 +171,35 @@ class CmsBlockTest < ActiveSupport::TestCase
|
|
145
171
|
end
|
146
172
|
end
|
147
173
|
|
174
|
+
def test_creation_via_nested_attributes_with_file
|
175
|
+
layout = cms_layouts(:default)
|
176
|
+
layout.update_attribute(:content, '{{cms:page:header}}{{cms:page_file:file}}{{cms:page:footer}}')
|
177
|
+
|
178
|
+
assert_difference 'Cms::Page.count' do
|
179
|
+
assert_difference 'Cms::Block.count', 3 do
|
180
|
+
page = Cms::Page.create!(
|
181
|
+
:site => cms_sites(:default),
|
182
|
+
:layout => layout,
|
183
|
+
:label => 'test page',
|
184
|
+
:slug => 'test_page',
|
185
|
+
:parent_id => cms_pages(:default).id,
|
186
|
+
:blocks_attributes => {
|
187
|
+
'0' => {
|
188
|
+
:label => 'header',
|
189
|
+
:content => 'header content'
|
190
|
+
},
|
191
|
+
'1' => {
|
192
|
+
:label => 'file',
|
193
|
+
:content => fixture_file_upload('files/document.pdf')
|
194
|
+
},
|
195
|
+
'2' => {
|
196
|
+
:label => 'footer',
|
197
|
+
:content => 'footer content'
|
198
|
+
}
|
199
|
+
}
|
200
|
+
)
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
148
205
|
end
|
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.10
|
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-10-
|
13
|
+
date: 2011-10-28 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
17
|
-
requirement: &
|
17
|
+
requirement: &70149522890920 !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: *70149522890920
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: active_link_to
|
28
|
-
requirement: &
|
28
|
+
requirement: &70149522889800 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: 1.0.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70149522889800
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: paperclip
|
39
|
-
requirement: &
|
39
|
+
requirement: &70149522888620 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ~>
|
@@ -44,7 +44,7 @@ dependencies:
|
|
44
44
|
version: 2.3.0
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70149522888620
|
48
48
|
description: ''
|
49
49
|
email: oleg@theworkinggroup.ca
|
50
50
|
executables: []
|
@@ -359,7 +359,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
359
359
|
version: '0'
|
360
360
|
segments:
|
361
361
|
- 0
|
362
|
-
hash: -
|
362
|
+
hash: -3119090265743627335
|
363
363
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
364
364
|
none: false
|
365
365
|
requirements:
|