comfortable_mexican_sofa 1.0.17 → 1.0.18
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_block.rb +13 -14
- data/app/models/cms_page.rb +0 -1
- data/comfortable_mexican_sofa.gemspec +1 -1
- data/db/migrate/01_create_cms.rb +2 -6
- data/lib/comfortable_mexican_sofa/cms_tag.rb +2 -1
- data/lib/comfortable_mexican_sofa/cms_tag/field_datetime.rb +2 -2
- data/lib/comfortable_mexican_sofa/cms_tag/field_integer.rb +2 -2
- data/lib/comfortable_mexican_sofa/cms_tag/field_string.rb +2 -2
- data/lib/comfortable_mexican_sofa/cms_tag/field_text.rb +2 -2
- data/lib/comfortable_mexican_sofa/cms_tag/page_datetime.rb +2 -2
- data/lib/comfortable_mexican_sofa/cms_tag/page_integer.rb +2 -2
- data/lib/comfortable_mexican_sofa/cms_tag/page_string.rb +2 -2
- data/lib/comfortable_mexican_sofa/cms_tag/page_text.rb +2 -2
- data/lib/comfortable_mexican_sofa/cms_tag/snippet.rb +0 -2
- data/lib/comfortable_mexican_sofa/form_builder.rb +2 -3
- data/test/cms_seeds/test.host/pages/child.yml +0 -1
- data/test/cms_seeds/test.host/pages/child/subchild.yml +0 -1
- data/test/cms_seeds/test.host/pages/index.yml +0 -1
- data/test/fixtures/cms_blocks.yml +2 -4
- data/test/functional/cms_admin/pages_controller_test.rb +4 -18
- data/test/unit/cms_block_test.rb +8 -26
- data/test/unit/cms_page_test.rb +0 -1
- data/test/unit/cms_tag_test.rb +0 -25
- data/test/unit/cms_tags/field_datetime_test.rb +0 -1
- data/test/unit/cms_tags/field_integer_test.rb +1 -2
- data/test/unit/cms_tags/field_string_test.rb +0 -1
- data/test/unit/cms_tags/field_text_test.rb +0 -1
- data/test/unit/cms_tags/page_datetime_test.rb +0 -1
- data/test/unit/cms_tags/page_integer_test.rb +1 -2
- data/test/unit/cms_tags/page_string_test.rb +0 -1
- data/test/unit/cms_tags/page_text_test.rb +0 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.18
|
data/app/models/cms_block.rb
CHANGED
@@ -9,20 +9,19 @@ class CmsBlock < ActiveRecord::Base
|
|
9
9
|
:uniqueness => { :scope => :cms_page_id }
|
10
10
|
|
11
11
|
# -- Class Methods --------------------------------------------------------
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
self.new(:label => label.to_s, :type => self.name, :cms_page => cms_page)
|
12
|
+
def self.initialize_or_find(cms_page, label)
|
13
|
+
if block = cms_page.cms_blocks.detect{ |b| b.label == label.to_s }
|
14
|
+
self.new(
|
15
|
+
:record_id => block.id,
|
16
|
+
:cms_page => cms_page,
|
17
|
+
:label => block.label,
|
18
|
+
:content => block.content
|
19
|
+
)
|
20
|
+
else
|
21
|
+
self.new(
|
22
|
+
:label => label.to_s,
|
23
|
+
:cms_page => cms_page
|
24
|
+
)
|
26
25
|
end
|
27
26
|
end
|
28
27
|
|
data/app/models/cms_page.rb
CHANGED
@@ -84,7 +84,6 @@ class CmsPage < ActiveRecord::Base
|
|
84
84
|
def cms_blocks_attributes
|
85
85
|
self.cms_blocks.inject([]) do |arr, block|
|
86
86
|
block_attr = {}
|
87
|
-
block_attr[:type] = block.class.name
|
88
87
|
block_attr[:label] = block.label
|
89
88
|
block_attr[:content] = block.content
|
90
89
|
block_attr[:id] = block.id
|
@@ -5,7 +5,7 @@
|
|
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.18"
|
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"]
|
data/db/migrate/01_create_cms.rb
CHANGED
@@ -43,16 +43,12 @@ class CreateCms < ActiveRecord::Migration
|
|
43
43
|
|
44
44
|
# -- Page Blocks --------------------------------------------------------
|
45
45
|
create_table :cms_blocks do |t|
|
46
|
-
t.string :type
|
47
46
|
t.integer :cms_page_id
|
48
47
|
t.string :label
|
49
|
-
t.
|
50
|
-
t.text :content_text
|
51
|
-
t.integer :content_integer
|
52
|
-
t.datetime :content_datetime
|
48
|
+
t.text :content
|
53
49
|
t.timestamps
|
54
50
|
end
|
55
|
-
add_index :cms_blocks, [:cms_page_id, :
|
51
|
+
add_index :cms_blocks, [:cms_page_id, :label]
|
56
52
|
|
57
53
|
# -- Snippets -----------------------------------------------------------
|
58
54
|
create_table :cms_snippets do |t|
|
@@ -12,11 +12,11 @@ class CmsTag::FieldDateTime < CmsBlock
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def content=(value)
|
15
|
-
write_attribute(:
|
15
|
+
write_attribute(:content, value)
|
16
16
|
end
|
17
17
|
|
18
18
|
def content
|
19
|
-
read_attribute(:
|
19
|
+
read_attribute(:content)
|
20
20
|
end
|
21
21
|
|
22
22
|
def render
|
@@ -12,11 +12,11 @@ class CmsTag::FieldInteger < CmsBlock
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def content=(value)
|
15
|
-
write_attribute(:
|
15
|
+
write_attribute(:content, value)
|
16
16
|
end
|
17
17
|
|
18
18
|
def content
|
19
|
-
read_attribute(:
|
19
|
+
read_attribute(:content)
|
20
20
|
end
|
21
21
|
|
22
22
|
def render
|
@@ -12,11 +12,11 @@ class CmsTag::FieldString < CmsBlock
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def content=(value)
|
15
|
-
write_attribute(:
|
15
|
+
write_attribute(:content, value)
|
16
16
|
end
|
17
17
|
|
18
18
|
def content
|
19
|
-
read_attribute(:
|
19
|
+
read_attribute(:content)
|
20
20
|
end
|
21
21
|
|
22
22
|
def render
|
@@ -12,11 +12,11 @@ class CmsTag::FieldText < CmsBlock
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def content=(value)
|
15
|
-
write_attribute(:
|
15
|
+
write_attribute(:content, value)
|
16
16
|
end
|
17
17
|
|
18
18
|
def content
|
19
|
-
read_attribute(:
|
19
|
+
read_attribute(:content)
|
20
20
|
end
|
21
21
|
|
22
22
|
def render
|
@@ -12,11 +12,11 @@ class CmsTag::PageDateTime < CmsBlock
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def content=(value)
|
15
|
-
write_attribute(:
|
15
|
+
write_attribute(:content, value)
|
16
16
|
end
|
17
17
|
|
18
18
|
def content
|
19
|
-
read_attribute(:
|
19
|
+
read_attribute(:content)
|
20
20
|
end
|
21
21
|
|
22
22
|
end
|
@@ -12,11 +12,11 @@ class CmsTag::PageInteger < CmsBlock
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def content=(value)
|
15
|
-
write_attribute(:
|
15
|
+
write_attribute(:content, value)
|
16
16
|
end
|
17
17
|
|
18
18
|
def content
|
19
|
-
read_attribute(:
|
19
|
+
read_attribute(:content)
|
20
20
|
end
|
21
21
|
|
22
22
|
end
|
@@ -12,11 +12,11 @@ class CmsTag::PageString < CmsBlock
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def content=(value)
|
15
|
-
write_attribute(:
|
15
|
+
write_attribute(:content, value)
|
16
16
|
end
|
17
17
|
|
18
18
|
def content
|
19
|
-
read_attribute(:
|
19
|
+
read_attribute(:content)
|
20
20
|
end
|
21
21
|
|
22
22
|
end
|
@@ -12,11 +12,11 @@ class CmsTag::PageText < CmsBlock
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def content=(value)
|
15
|
-
write_attribute(:
|
15
|
+
write_attribute(:content, value)
|
16
16
|
end
|
17
17
|
|
18
18
|
def content
|
19
|
-
read_attribute(:
|
19
|
+
read_attribute(:content)
|
20
20
|
end
|
21
21
|
|
22
22
|
end
|
@@ -54,9 +54,8 @@ class ComfortableMexicanSofa::FormBuilder < ActionView::Helpers::FormBuilder
|
|
54
54
|
<div class='label'>#{label}</div>
|
55
55
|
<div class='value'>
|
56
56
|
#{field}
|
57
|
-
#{@template.hidden_field_tag('cms_page[cms_blocks_attributes][][label]', tag.label)}
|
58
|
-
#{@template.hidden_field_tag('cms_page[cms_blocks_attributes][][
|
59
|
-
#{@template.hidden_field_tag('cms_page[cms_blocks_attributes][][id]', tag.id) unless tag.new_record?}
|
57
|
+
#{@template.hidden_field_tag('cms_page[cms_blocks_attributes][][label]', tag.label, :id => nil)}
|
58
|
+
#{@template.hidden_field_tag('cms_page[cms_blocks_attributes][][id]', tag.record_id, :id => nil) if tag.record_id}
|
60
59
|
</div>
|
61
60
|
</div>
|
62
61
|
).html_safe
|
@@ -1,14 +1,12 @@
|
|
1
1
|
default_field_text:
|
2
2
|
cms_page: default
|
3
|
-
type: CmsTag::FieldText
|
4
3
|
label: default_field_text
|
5
|
-
|
4
|
+
content: default_field_text_content
|
6
5
|
|
7
6
|
default_page_text:
|
8
7
|
cms_page: default
|
9
|
-
type: CmsTag::PageText
|
10
8
|
label: default_page_text
|
11
|
-
|
9
|
+
content: |-
|
12
10
|
default_page_text_content_a
|
13
11
|
{{cms:snippet:default}}
|
14
12
|
default_page_text_content_b
|
@@ -31,7 +31,6 @@ class CmsAdmin::PagesControllerTest < ActionController::TestCase
|
|
31
31
|
get :new
|
32
32
|
assert_select "input[type='datetime'][name='cms_page[cms_blocks_attributes][][content]']"
|
33
33
|
assert_select "input[type='hidden'][name='cms_page[cms_blocks_attributes][][label]'][value='test_label']"
|
34
|
-
assert_select "input[type='hidden'][name='cms_page[cms_blocks_attributes][][type]'][value='CmsTag::FieldDateTime']"
|
35
34
|
end
|
36
35
|
|
37
36
|
def test_get_new_with_field_integer
|
@@ -39,7 +38,6 @@ class CmsAdmin::PagesControllerTest < ActionController::TestCase
|
|
39
38
|
get :new
|
40
39
|
assert_select "input[type='number'][name='cms_page[cms_blocks_attributes][][content]']"
|
41
40
|
assert_select "input[type='hidden'][name='cms_page[cms_blocks_attributes][][label]'][value='test_label']"
|
42
|
-
assert_select "input[type='hidden'][name='cms_page[cms_blocks_attributes][][type]'][value='CmsTag::FieldInteger']"
|
43
41
|
end
|
44
42
|
|
45
43
|
def test_get_new_with_field_string
|
@@ -47,7 +45,6 @@ class CmsAdmin::PagesControllerTest < ActionController::TestCase
|
|
47
45
|
get :new
|
48
46
|
assert_select "input[type='text'][name='cms_page[cms_blocks_attributes][][content]']"
|
49
47
|
assert_select "input[type='hidden'][name='cms_page[cms_blocks_attributes][][label]'][value='test_label']"
|
50
|
-
assert_select "input[type='hidden'][name='cms_page[cms_blocks_attributes][][type]'][value='CmsTag::FieldString']"
|
51
48
|
end
|
52
49
|
|
53
50
|
def test_get_new_with_field_text
|
@@ -55,7 +52,6 @@ class CmsAdmin::PagesControllerTest < ActionController::TestCase
|
|
55
52
|
get :new
|
56
53
|
assert_select "textarea[name='cms_page[cms_blocks_attributes][][content]']"
|
57
54
|
assert_select "input[type='hidden'][name='cms_page[cms_blocks_attributes][][label]'][value='test_label']"
|
58
|
-
assert_select "input[type='hidden'][name='cms_page[cms_blocks_attributes][][type]'][value='CmsTag::FieldText']"
|
59
55
|
end
|
60
56
|
|
61
57
|
def test_get_new_with_page_datetime
|
@@ -63,7 +59,6 @@ class CmsAdmin::PagesControllerTest < ActionController::TestCase
|
|
63
59
|
get :new
|
64
60
|
assert_select "input[type='datetime'][name='cms_page[cms_blocks_attributes][][content]']"
|
65
61
|
assert_select "input[type='hidden'][name='cms_page[cms_blocks_attributes][][label]'][value='test_label']"
|
66
|
-
assert_select "input[type='hidden'][name='cms_page[cms_blocks_attributes][][type]'][value='CmsTag::PageDateTime']"
|
67
62
|
end
|
68
63
|
|
69
64
|
def test_get_new_with_page_integer
|
@@ -71,7 +66,6 @@ class CmsAdmin::PagesControllerTest < ActionController::TestCase
|
|
71
66
|
get :new
|
72
67
|
assert_select "input[type='number'][name='cms_page[cms_blocks_attributes][][content]']"
|
73
68
|
assert_select "input[type='hidden'][name='cms_page[cms_blocks_attributes][][label]'][value='test_label']"
|
74
|
-
assert_select "input[type='hidden'][name='cms_page[cms_blocks_attributes][][type]'][value='CmsTag::PageInteger']"
|
75
69
|
end
|
76
70
|
|
77
71
|
def test_get_new_with_page_string
|
@@ -79,7 +73,6 @@ class CmsAdmin::PagesControllerTest < ActionController::TestCase
|
|
79
73
|
get :new
|
80
74
|
assert_select "input[type='text'][name='cms_page[cms_blocks_attributes][][content]']"
|
81
75
|
assert_select "input[type='hidden'][name='cms_page[cms_blocks_attributes][][label]'][value='test_label']"
|
82
|
-
assert_select "input[type='hidden'][name='cms_page[cms_blocks_attributes][][type]'][value='CmsTag::PageString']"
|
83
76
|
end
|
84
77
|
|
85
78
|
def test_get_new_with_page_text
|
@@ -87,7 +80,6 @@ class CmsAdmin::PagesControllerTest < ActionController::TestCase
|
|
87
80
|
get :new
|
88
81
|
assert_select "textarea[name='cms_page[cms_blocks_attributes][][content]']"
|
89
82
|
assert_select "input[type='hidden'][name='cms_page[cms_blocks_attributes][][label]'][value='test_label']"
|
90
|
-
assert_select "input[type='hidden'][name='cms_page[cms_blocks_attributes][][type]'][value='CmsTag::PageText']"
|
91
83
|
end
|
92
84
|
|
93
85
|
def test_get_new_as_child_page
|
@@ -105,6 +97,8 @@ class CmsAdmin::PagesControllerTest < ActionController::TestCase
|
|
105
97
|
assert assigns(:cms_page)
|
106
98
|
assert_template :edit
|
107
99
|
assert_select "form[action=/cms-admin/pages/#{page.id}]"
|
100
|
+
assert_select "input[name='cms_page[cms_blocks_attributes][][id]'][value='#{cms_blocks(:default_field_text).id}']"
|
101
|
+
assert_select "input[name='cms_page[cms_blocks_attributes][][id]'][value='#{cms_blocks(:default_field_text).id}']"
|
108
102
|
end
|
109
103
|
|
110
104
|
def test_get_edit_failure
|
@@ -133,13 +127,10 @@ class CmsAdmin::PagesControllerTest < ActionController::TestCase
|
|
133
127
|
:cms_layout_id => cms_layouts(:default).id,
|
134
128
|
:cms_blocks_attributes => [
|
135
129
|
{ :label => 'content',
|
136
|
-
:type => 'CmsTag::PageText',
|
137
130
|
:content => 'content content' },
|
138
131
|
{ :label => 'title',
|
139
|
-
:type => 'CmsTag::PageString',
|
140
132
|
:content => 'title content' },
|
141
133
|
{ :label => 'number',
|
142
|
-
:type => 'CmsTag::PageInteger',
|
143
134
|
:content => '999' }
|
144
135
|
]
|
145
136
|
}
|
@@ -158,20 +149,17 @@ class CmsAdmin::PagesControllerTest < ActionController::TestCase
|
|
158
149
|
:cms_layout_id => cms_layouts(:default).id,
|
159
150
|
:cms_blocks_attributes => [
|
160
151
|
{ :label => 'content',
|
161
|
-
:type => 'CmsTag::PageText',
|
162
152
|
:content => 'content content' },
|
163
153
|
{ :label => 'title',
|
164
|
-
:type => 'CmsTag::PageString',
|
165
154
|
:content => 'title content' },
|
166
155
|
{ :label => 'number',
|
167
|
-
:type => 'CmsTag::PageInteger',
|
168
156
|
:content => '999' }
|
169
157
|
]
|
170
158
|
}
|
171
159
|
assert_response :success
|
172
160
|
page = assigns(:cms_page)
|
173
161
|
assert_equal 3, page.cms_blocks.size
|
174
|
-
assert_equal ['content content', 'title content', 999], page.cms_blocks.collect{|b| b.content}
|
162
|
+
assert_equal ['content content', 'title content', '999'], page.cms_blocks.collect{|b| b.content}
|
175
163
|
assert_template :new
|
176
164
|
assert_equal 'Failed to create page', flash[:error]
|
177
165
|
end
|
@@ -199,11 +187,9 @@ class CmsAdmin::PagesControllerTest < ActionController::TestCase
|
|
199
187
|
:cms_layout_id => cms_layouts(:nested).id,
|
200
188
|
:cms_blocks_attributes => [
|
201
189
|
{ :label => 'content',
|
202
|
-
:type => 'CmsTag::PageText',
|
203
190
|
:content => 'new_page_text_content',
|
204
191
|
:id => cms_blocks(:default_page_text).id },
|
205
192
|
{ :label => 'header',
|
206
|
-
:type => 'CmsTag::PageString',
|
207
193
|
:content => 'new_page_string_content' }
|
208
194
|
]
|
209
195
|
}
|
@@ -212,7 +198,7 @@ class CmsAdmin::PagesControllerTest < ActionController::TestCase
|
|
212
198
|
assert_redirected_to :action => :edit, :id => page
|
213
199
|
assert_equal 'Page updated', flash[:notice]
|
214
200
|
assert_equal 'Updated Label', page.label
|
215
|
-
assert_equal ['
|
201
|
+
assert_equal ['new_page_text_content', 'default_field_text_content', 'new_page_string_content'], page.cms_blocks.collect{|b| b.content}
|
216
202
|
end
|
217
203
|
end
|
218
204
|
|
data/test/unit/cms_block_test.rb
CHANGED
@@ -8,19 +8,7 @@ class CmsBlockTest < ActiveSupport::TestCase
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
12
|
-
block = CmsBlock.new(:label => 'test_block', :content => 'test_content', :type => 'CmsTag::PageText')
|
13
|
-
assert_equal 'CmsTag::PageText', block.class.name
|
14
|
-
assert_equal 'test_block', block.label
|
15
|
-
assert_equal 'test_content', block.content
|
16
|
-
|
17
|
-
assert_difference 'CmsBlock.count' do
|
18
|
-
block.cms_page = cms_pages(:default)
|
19
|
-
block.save!
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_new_with_cast_via_page_nested_attributes
|
11
|
+
def test_new_via_page_nested_attributes
|
24
12
|
assert_difference ['CmsPage.count', 'CmsBlock.count'] do
|
25
13
|
page = CmsPage.create!(
|
26
14
|
:cms_site => cms_sites(:default),
|
@@ -31,31 +19,25 @@ class CmsBlockTest < ActiveSupport::TestCase
|
|
31
19
|
:cms_blocks_attributes => [
|
32
20
|
{
|
33
21
|
:label => 'test_block',
|
34
|
-
:content => 'test_content'
|
35
|
-
:type => 'CmsTag::PageText'
|
22
|
+
:content => 'test_content'
|
36
23
|
}
|
37
24
|
]
|
38
25
|
)
|
39
26
|
assert_equal 1, page.cms_blocks.count
|
40
27
|
block = page.cms_blocks.first
|
41
|
-
assert_equal 'CmsTag::PageText', block.class.name
|
42
28
|
assert_equal 'test_block', block.label
|
43
29
|
assert_equal 'test_content', block.content
|
44
30
|
end
|
45
31
|
end
|
46
32
|
|
47
33
|
def test_initialize_or_find
|
48
|
-
|
49
|
-
|
50
|
-
assert_equal '
|
51
|
-
assert_equal 'CmsTag::FieldText', block.class.name
|
52
|
-
assert_equal 'default_field_text_content', block.content
|
34
|
+
tag = CmsTag::PageText.initialize_or_find(cms_pages(:default), :default_field_text)
|
35
|
+
assert_equal 'default_field_text', tag.label
|
36
|
+
assert_equal 'default_field_text_content', tag.content
|
53
37
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
assert_equal 'CmsTag::PageText', block.class.name
|
58
|
-
assert block.content.blank?
|
38
|
+
tag = CmsTag::PageText.initialize_or_find(cms_pages(:default), :new_block)
|
39
|
+
assert_equal 'new_block', tag.label
|
40
|
+
assert tag.content.blank?
|
59
41
|
end
|
60
42
|
|
61
43
|
end
|
data/test/unit/cms_page_test.rb
CHANGED
@@ -184,7 +184,6 @@ class CmsPageTest < ActiveSupport::TestCase
|
|
184
184
|
def test_cms_blocks_attributes_accessor
|
185
185
|
page = cms_pages(:default)
|
186
186
|
assert_equal page.cms_blocks.count, page.cms_blocks_attributes.size
|
187
|
-
assert_equal 'CmsTag::FieldText', page.cms_blocks_attributes.first[:type]
|
188
187
|
assert_equal 'default_field_text', page.cms_blocks_attributes.first[:label]
|
189
188
|
assert_equal 'default_field_text_content', page.cms_blocks_attributes.first[:content]
|
190
189
|
assert page.cms_blocks_attributes.first[:id]
|
data/test/unit/cms_tag_test.rb
CHANGED
@@ -203,29 +203,4 @@ class CmsTagTest < ActiveSupport::TestCase
|
|
203
203
|
assert_equal 6, page.cms_tags.size
|
204
204
|
end
|
205
205
|
|
206
|
-
def test_tag_initialization_for_existing_blocks_with_different_type
|
207
|
-
layout = cms_layouts(:default)
|
208
|
-
page = cms_pages(:default)
|
209
|
-
|
210
|
-
assert page.content
|
211
|
-
assert_equal 4, page.cms_tags.size
|
212
|
-
assert tag = page.cms_tags.first
|
213
|
-
assert !tag.new_record?
|
214
|
-
assert_equal 'CmsTag::FieldText', tag.class.name
|
215
|
-
assert_equal 'CmsTag::FieldText', tag.type
|
216
|
-
assert_equal 'default_field_text', tag.label
|
217
|
-
assert_equal 'default_field_text_content', tag.content
|
218
|
-
|
219
|
-
layout.update_attribute(:content, '{{cms:page:default_field_text:string}}')
|
220
|
-
page.reload
|
221
|
-
assert page.content
|
222
|
-
assert_equal 1, page.cms_tags.size
|
223
|
-
assert tag = page.cms_tags.first
|
224
|
-
assert !tag.new_record?
|
225
|
-
assert_equal 'CmsTag::FieldText', tag.class.name
|
226
|
-
assert_equal 'CmsTag::PageString', tag.type
|
227
|
-
assert_equal 'default_field_text', tag.label
|
228
|
-
assert_equal 'default_field_text_content', tag.content
|
229
|
-
end
|
230
|
-
|
231
206
|
end
|
@@ -27,8 +27,7 @@ class FieldIntegerTest < ActiveSupport::TestCase
|
|
27
27
|
tag = CmsTag::FieldInteger.initialize_tag(cms_pages(:default), '{{cms:field:content:integer}}')
|
28
28
|
assert tag.content.blank?
|
29
29
|
tag.content = '5'
|
30
|
-
assert_equal 5, tag.content
|
31
|
-
assert_equal 5, tag.read_attribute(:content_integer)
|
30
|
+
assert_equal '5', tag.content
|
32
31
|
assert_equal '', tag.render
|
33
32
|
end
|
34
33
|
|
@@ -27,8 +27,7 @@ class PageIntegerTest < ActiveSupport::TestCase
|
|
27
27
|
tag = CmsTag::PageInteger.initialize_tag(cms_pages(:default), '{{cms:page:content:integer}}')
|
28
28
|
assert tag.content.blank?
|
29
29
|
tag.content = '5'
|
30
|
-
assert_equal 5, tag.content
|
31
|
-
assert_equal 5, tag.read_attribute(:content_integer)
|
30
|
+
assert_equal '5', tag.content
|
32
31
|
assert_equal '5', tag.render
|
33
32
|
end
|
34
33
|
|
@@ -28,7 +28,6 @@ class PageStringTest < ActiveSupport::TestCase
|
|
28
28
|
assert tag.content.blank?
|
29
29
|
tag.content = 'test_content'
|
30
30
|
assert_equal 'test_content', tag.content
|
31
|
-
assert_equal 'test_content', tag.read_attribute(:content_string)
|
32
31
|
assert_equal 'test_content', tag.render
|
33
32
|
end
|
34
33
|
|
@@ -28,7 +28,6 @@ class PageTextTest < ActiveSupport::TestCase
|
|
28
28
|
assert tag.content.blank?
|
29
29
|
tag.content = 'test_content'
|
30
30
|
assert_equal 'test_content', tag.content
|
31
|
-
assert_equal 'test_content', tag.read_attribute(:content_text)
|
32
31
|
assert_equal 'test_content', tag.render
|
33
32
|
end
|
34
33
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comfortable_mexican_sofa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 51
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 18
|
10
|
+
version: 1.0.18
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Oleg Khabarov
|