comfortable_mexican_sofa 1.0.51 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +8 -18
- data/Rakefile +1 -4
- data/VERSION +1 -1
- data/app/controllers/cms_admin/base_controller.rb +8 -9
- data/app/controllers/cms_admin/layouts_controller.rb +5 -5
- data/app/controllers/cms_admin/pages_controller.rb +14 -14
- data/app/controllers/cms_admin/sites_controller.rb +4 -4
- data/app/controllers/cms_admin/snippets_controller.rb +4 -4
- data/app/controllers/cms_admin/uploads_controller.rb +2 -2
- data/app/controllers/cms_content_controller.rb +21 -8
- data/app/models/cms/block.rb +13 -0
- data/app/models/{cms_layout.rb → cms/layout.rb} +16 -44
- data/app/models/{cms_page.rb → cms/page.rb} +26 -57
- data/app/models/{cms_site.rb → cms/site.rb} +8 -6
- data/app/models/cms/snippet.rb +36 -0
- data/app/models/{cms_upload.rb → cms/upload.rb} +5 -3
- data/app/views/cms_admin/layouts/_form.html.erb +2 -2
- data/app/views/cms_admin/pages/_form.html.erb +5 -5
- data/app/views/cms_admin/pages/_form_blocks.html.erb +3 -3
- data/app/views/cms_admin/uploads/_index.html.erb +1 -1
- data/app/views/layouts/cms_admin.html.erb +2 -38
- data/app/views/layouts/cms_admin/_body.html.erb +17 -0
- data/app/views/layouts/cms_admin/_center.html.erb +6 -0
- data/app/views/layouts/cms_admin/_head.html.erb +11 -0
- data/app/views/layouts/cms_admin/_left.html.erb +7 -0
- data/app/views/layouts/cms_admin/_right.html.erb +1 -0
- data/comfortable_mexican_sofa.gemspec +94 -96
- data/config/environments/development.rb +1 -1
- data/config/environments/production.rb +1 -1
- data/config/environments/test.rb +1 -1
- data/config/initializers/comfortable_mexican_sofa.rb +10 -12
- data/db/cms_fixtures/example.com/layouts/default/_default.yml +1 -0
- data/db/cms_fixtures/example.com/layouts/default/content.html +5 -0
- data/db/cms_fixtures/example.com/layouts/default/css.css +1 -0
- data/db/cms_fixtures/example.com/layouts/default/js.js +1 -0
- data/db/cms_fixtures/example.com/layouts/default/nested/_nested.yml +1 -0
- data/db/cms_fixtures/example.com/layouts/default/nested/content.html +2 -0
- data/db/cms_fixtures/example.com/layouts/default/nested/css.css +1 -0
- data/db/cms_fixtures/example.com/layouts/default/nested/js.js +1 -0
- data/db/cms_fixtures/example.com/pages/index/_index.yml +2 -0
- data/db/cms_fixtures/example.com/pages/index/child/_child.yml +2 -0
- data/db/cms_fixtures/example.com/pages/index/child/left.html +1 -0
- data/db/cms_fixtures/example.com/pages/index/child/right.html +1 -0
- data/db/cms_fixtures/example.com/pages/index/content.html +2 -0
- data/db/cms_fixtures/example.com/snippets/default/_default.yml +1 -0
- data/db/cms_fixtures/example.com/snippets/default/content.html +1 -0
- data/db/migrate/01_create_cms.rb +11 -11
- data/db/migrate/upgrades/02_upgrade_to_1_1_0.rb +19 -0
- data/lib/comfortable_mexican_sofa.rb +6 -13
- data/lib/comfortable_mexican_sofa/configuration.rb +21 -20
- data/lib/comfortable_mexican_sofa/controller_methods.rb +3 -4
- data/lib/comfortable_mexican_sofa/engine.rb +1 -1
- data/lib/comfortable_mexican_sofa/fixtures.rb +155 -0
- data/lib/comfortable_mexican_sofa/form_builder.rb +7 -15
- data/lib/comfortable_mexican_sofa/{cms_tag.rb → tag.rb} +42 -23
- data/lib/comfortable_mexican_sofa/{cms_tag → tags}/field_datetime.rb +4 -5
- data/lib/comfortable_mexican_sofa/{cms_tag → tags}/field_integer.rb +4 -5
- data/lib/comfortable_mexican_sofa/{cms_tag → tags}/field_string.rb +4 -5
- data/lib/comfortable_mexican_sofa/{cms_tag → tags}/field_text.rb +4 -5
- data/lib/comfortable_mexican_sofa/{cms_tag → tags}/helper.rb +2 -5
- data/lib/comfortable_mexican_sofa/{cms_tag → tags}/page_datetime.rb +4 -5
- data/lib/comfortable_mexican_sofa/{cms_tag → tags}/page_integer.rb +4 -5
- data/lib/comfortable_mexican_sofa/{cms_tag → tags}/page_rich_text.rb +4 -5
- data/lib/comfortable_mexican_sofa/{cms_tag → tags}/page_string.rb +4 -5
- data/lib/comfortable_mexican_sofa/{cms_tag → tags}/page_text.rb +4 -5
- data/lib/comfortable_mexican_sofa/{cms_tag → tags}/partial.rb +2 -5
- data/lib/comfortable_mexican_sofa/tags/snippet.rb +13 -0
- data/lib/comfortable_mexican_sofa/view_methods.rb +4 -3
- data/lib/generators/cms_generator.rb +1 -1
- data/lib/tasks/comfortable_mexican_sofa.rake +12 -272
- data/public/javascripts/comfortable_mexican_sofa/cms.js +1 -1
- data/test/fixtures/{cms_blocks.yml → cms/blocks.yml} +2 -2
- data/test/fixtures/{cms_layouts.yml → cms/layouts.yml} +3 -3
- data/test/fixtures/{cms_pages.yml → cms/pages.yml} +4 -4
- data/test/fixtures/{cms_sites.yml → cms/sites.yml} +0 -0
- data/test/fixtures/{cms_snippets.yml → cms/snippets.yml} +1 -1
- data/test/fixtures/{cms_uploads.yml → cms/uploads.yml} +1 -1
- data/test/functional/cms_admin/layouts_controller_test.rb +6 -6
- data/test/functional/cms_admin/pages_controller_test.rb +64 -64
- data/test/functional/cms_admin/sites_controller_test.rb +5 -5
- data/test/functional/cms_admin/snippets_controller_test.rb +6 -6
- data/test/functional/cms_admin/uploads_controller_test.rb +4 -4
- data/test/functional/cms_content_controller_test.rb +27 -11
- data/test/integration/fixtures_test.rb +43 -0
- data/test/integration/sites_test.rb +23 -13
- data/test/test_helper.rb +9 -8
- data/test/unit/{cms_configuration_test.rb → configuration_test.rb} +5 -3
- data/test/unit/fixtures_test.rb +198 -0
- data/test/unit/models/block_test.rb +33 -0
- data/test/unit/models/layout_test.rb +129 -0
- data/test/unit/models/page_test.rb +199 -0
- data/test/unit/models/site_test.rb +41 -0
- data/test/unit/models/snippet_test.rb +32 -0
- data/test/unit/models/upload_test.rb +32 -0
- data/test/unit/{cms_tag_test.rb → tag_test.rb} +61 -44
- data/test/unit/tags/field_datetime_test.rb +44 -0
- data/test/unit/tags/field_integer_test.rb +43 -0
- data/test/unit/tags/field_string_test.rb +46 -0
- data/test/unit/tags/field_text_test.rb +42 -0
- data/test/unit/{cms_tags → tags}/helper_test.rb +18 -6
- data/test/unit/tags/page_datetime_test.rb +44 -0
- data/test/unit/tags/page_integer_test.rb +43 -0
- data/test/unit/tags/page_rich_text.rb +43 -0
- data/test/unit/{cms_tags → tags}/page_string_test.rb +15 -5
- data/test/unit/tags/page_text_test.rb +46 -0
- data/test/unit/{cms_tags → tags}/partial_test.rb +24 -8
- data/test/unit/tags/snippet_test.rb +45 -0
- data/test/unit/view_methods_test.rb +2 -2
- metadata +95 -121
- data/app/models/cms_block.rb +0 -28
- data/app/models/cms_snippet.rb +0 -69
- data/db/cms_seeds/example.local/layouts/default.yml +0 -8
- data/db/cms_seeds/example.local/layouts/nested.yml +0 -6
- data/db/cms_seeds/example.local/pages/child.yml +0 -10
- data/db/cms_seeds/example.local/pages/child/subchild.yml +0 -14
- data/db/cms_seeds/example.local/pages/index.yml +0 -11
- data/db/cms_seeds/example.local/snippets/example.yml +0 -4
- data/lib/comfortable_mexican_sofa/cms_tag/snippet.rb +0 -18
- data/test/cms_seeds/test.host/layouts/broken.yml +0 -1
- data/test/cms_seeds/test.host/layouts/default.yml +0 -3
- data/test/cms_seeds/test.host/layouts/nested.yml +0 -4
- data/test/cms_seeds/test.host/pages/broken.yml +0 -1
- data/test/cms_seeds/test.host/pages/child.yml +0 -10
- data/test/cms_seeds/test.host/pages/child/subchild.yml +0 -10
- data/test/cms_seeds/test.host/pages/index.yml +0 -10
- data/test/cms_seeds/test.host/snippets/broken.yml +0 -1
- data/test/cms_seeds/test.host/snippets/default.yml +0 -3
- data/test/integration/rake_tasks_test.rb +0 -65
- data/test/integration/render_cms_seed_test.rb +0 -34
- data/test/unit/cms_block_test.rb +0 -43
- data/test/unit/cms_layout_test.rb +0 -179
- data/test/unit/cms_page_test.rb +0 -257
- data/test/unit/cms_site_test.rb +0 -41
- data/test/unit/cms_snippet_test.rb +0 -77
- data/test/unit/cms_tags/field_datetime_test.rb +0 -34
- data/test/unit/cms_tags/field_integer_test.rb +0 -33
- data/test/unit/cms_tags/field_string_test.rb +0 -34
- data/test/unit/cms_tags/field_text_test.rb +0 -32
- data/test/unit/cms_tags/page_datetime_test.rb +0 -34
- data/test/unit/cms_tags/page_integer_test.rb +0 -33
- data/test/unit/cms_tags/page_rich_text.rb +0 -33
- data/test/unit/cms_tags/page_text_test.rb +0 -34
- data/test/unit/cms_tags/snippet_test.rb +0 -33
- data/test/unit/cms_upload_test.rb +0 -26
@@ -1,32 +0,0 @@
|
|
1
|
-
require File.expand_path('../../test_helper', File.dirname(__FILE__))
|
2
|
-
|
3
|
-
class FieldTextTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def test_initialize_tag
|
6
|
-
assert tag = CmsTag::FieldText.initialize_tag(cms_pages(:default), '{{ cms:field:content:text }}')
|
7
|
-
assert_equal 'content', tag.label
|
8
|
-
assert tag = CmsTag::FieldText.initialize_tag(cms_pages(:default), '{{cms:field:content:text}}')
|
9
|
-
assert_equal 'content', tag.label
|
10
|
-
assert tag = CmsTag::FieldText.initialize_tag(cms_pages(:default), '{{cms:field:dash-content:text}}')
|
11
|
-
assert_equal 'dash-content', tag.label
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_initialize_tag_failure
|
15
|
-
[
|
16
|
-
'{{cms:field:content:not_text}}',
|
17
|
-
'{{cms:not_field:content:text}}',
|
18
|
-
'{not_a_tag}'
|
19
|
-
].each do |tag_signature|
|
20
|
-
assert_nil CmsTag::FieldText.initialize_tag(cms_pages(:default), tag_signature)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_content_and_render
|
25
|
-
tag = CmsTag::FieldText.initialize_tag(cms_pages(:default), '{{cms:field:content:text}}')
|
26
|
-
assert tag.content.blank?
|
27
|
-
tag.content = 'test_content'
|
28
|
-
assert_equal 'test_content', tag.content
|
29
|
-
assert_equal '', tag.render
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require File.expand_path('../../test_helper', File.dirname(__FILE__))
|
2
|
-
|
3
|
-
class PageDateTimeTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def test_initialize_tag
|
6
|
-
assert tag = CmsTag::PageDateTime.initialize_tag(cms_pages(:default), '{{ cms:page:content:datetime }}')
|
7
|
-
assert_equal 'content', tag.label
|
8
|
-
assert tag = CmsTag::PageDateTime.initialize_tag(cms_pages(:default), '{{cms:page:content:datetime}}')
|
9
|
-
assert_equal 'content', tag.label
|
10
|
-
assert tag = CmsTag::PageDateTime.initialize_tag(cms_pages(:default), '{{cms:page:dash-content:datetime}}')
|
11
|
-
assert_equal 'dash-content', tag.label
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_initialize_tag_failure
|
15
|
-
[
|
16
|
-
'{{cms:page:content:not_datetime}}',
|
17
|
-
'{{cms:page:content}}',
|
18
|
-
'{{cms:not_page:content}}',
|
19
|
-
'{not_a_tag}'
|
20
|
-
].each do |tag_signature|
|
21
|
-
assert_nil CmsTag::PageDateTime.initialize_tag(cms_pages(:default), tag_signature)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_content_and_render
|
26
|
-
tag = CmsTag::PageDateTime.initialize_tag(cms_pages(:default), '{{cms:page:content:datetime}}')
|
27
|
-
assert tag.content.blank?
|
28
|
-
time = 2.days.ago
|
29
|
-
tag.content = time
|
30
|
-
assert_equal time, tag.content
|
31
|
-
assert_equal time.to_s, tag.render
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
require File.expand_path('../../test_helper', File.dirname(__FILE__))
|
2
|
-
|
3
|
-
class PageIntegerTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def test_initialize_tag
|
6
|
-
assert tag = CmsTag::PageInteger.initialize_tag(cms_pages(:default), '{{ cms:page:content:integer }}')
|
7
|
-
assert_equal 'content', tag.label
|
8
|
-
assert tag = CmsTag::PageInteger.initialize_tag(cms_pages(:default), '{{cms:page:content:integer}}')
|
9
|
-
assert_equal 'content', tag.label
|
10
|
-
assert tag = CmsTag::PageInteger.initialize_tag(cms_pages(:default), '{{cms:page:dash-content:integer}}')
|
11
|
-
assert_equal 'dash-content', tag.label
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_initialize_tag_failure
|
15
|
-
[
|
16
|
-
'{{cms:page:content:not_integer}}',
|
17
|
-
'{{cms:page:content}}',
|
18
|
-
'{{cms:not_page:content}}',
|
19
|
-
'{not_a_tag}'
|
20
|
-
].each do |tag_signature|
|
21
|
-
assert_nil CmsTag::PageInteger.initialize_tag(cms_pages(:default), tag_signature)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_content_and_render
|
26
|
-
tag = CmsTag::PageInteger.initialize_tag(cms_pages(:default), '{{cms:page:content:integer}}')
|
27
|
-
assert tag.content.blank?
|
28
|
-
tag.content = '5'
|
29
|
-
assert_equal '5', tag.content
|
30
|
-
assert_equal '5', tag.render
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
require File.expand_path('../../test_helper', File.dirname(__FILE__))
|
2
|
-
|
3
|
-
class PageRichTextTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def test_initialize_tag
|
6
|
-
assert tag = CmsTag::PageRichText.initialize_tag(cms_pages(:default), '{{ cms:page:content:rich_text }}')
|
7
|
-
assert_equal 'content', tag.label
|
8
|
-
assert tag = CmsTag::PageRichText.initialize_tag(cms_pages(:default), '{{cms:page:content:rich_text}}')
|
9
|
-
assert_equal 'content', tag.label
|
10
|
-
assert tag = CmsTag::PageRichText.initialize_tag(cms_pages(:default), '{{cms:page:dash-content:rich_text}}')
|
11
|
-
assert_equal 'dash-content', tag.label
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_initialize_tag_failure
|
15
|
-
[
|
16
|
-
'{{cms:page:content:not_rich_text}}',
|
17
|
-
'{{cms:page:content}}',
|
18
|
-
'{{cms:not_page:content}}',
|
19
|
-
'{not_a_tag}'
|
20
|
-
].each do |tag_signature|
|
21
|
-
assert_nil CmsTag::PageRichText.initialize_tag(cms_pages(:default), tag_signature)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_content_and_render
|
26
|
-
tag = CmsTag::PageRichText.initialize_tag(cms_pages(:default), '{{cms:page:content:rich_text}}')
|
27
|
-
assert tag.content.blank?
|
28
|
-
tag.content = 'test_content'
|
29
|
-
assert_equal 'test_content', tag.content
|
30
|
-
assert_equal 'test_content', tag.render
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require File.expand_path('../../test_helper', File.dirname(__FILE__))
|
2
|
-
|
3
|
-
class PageTextTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def test_initialize_tag
|
6
|
-
assert tag = CmsTag::PageText.initialize_tag(cms_pages(:default), '{{ cms:page:content:text }}')
|
7
|
-
assert_equal 'content', tag.label
|
8
|
-
assert tag = CmsTag::PageText.initialize_tag(cms_pages(:default), '{{cms:page:content}}')
|
9
|
-
assert_equal 'content', tag.label
|
10
|
-
assert tag = CmsTag::PageText.initialize_tag(cms_pages(:default), '{{cms:page:content:text}}')
|
11
|
-
assert_equal 'content', tag.label
|
12
|
-
assert tag = CmsTag::PageText.initialize_tag(cms_pages(:default), '{{cms:page:dash-content}}')
|
13
|
-
assert_equal 'dash-content', tag.label
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_initialize_tag_failure
|
17
|
-
[
|
18
|
-
'{{cms:page:content:not_text}}',
|
19
|
-
'{{cms:not_page:content}}',
|
20
|
-
'{not_a_tag}'
|
21
|
-
].each do |tag_signature|
|
22
|
-
assert_nil CmsTag::PageText.initialize_tag(cms_pages(:default), tag_signature)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_content_and_render
|
27
|
-
tag = CmsTag::PageText.initialize_tag(cms_pages(:default), '{{cms:page:content}}')
|
28
|
-
assert tag.content.blank?
|
29
|
-
tag.content = 'test_content'
|
30
|
-
assert_equal 'test_content', tag.content
|
31
|
-
assert_equal 'test_content', tag.render
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
require File.expand_path('../../test_helper', File.dirname(__FILE__))
|
2
|
-
|
3
|
-
class SnippetTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def test_initialize_tag
|
6
|
-
assert tag = CmsTag::Snippet.initialize_tag(cms_pages(:default), '{{ cms:snippet:label }}')
|
7
|
-
assert_equal 'label', tag.slug
|
8
|
-
assert tag = CmsTag::Snippet.initialize_tag(cms_pages(:default), '{{cms:snippet:label}}')
|
9
|
-
assert_equal 'label', tag.slug
|
10
|
-
assert tag = CmsTag::Snippet.initialize_tag(cms_pages(:default), '{{cms:snippet:dash-label}}')
|
11
|
-
assert_equal 'dash-label', tag.slug
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_initialize_tag_failure
|
15
|
-
[
|
16
|
-
'{{cms:snippet}}',
|
17
|
-
'{{cms:not_snippet:label}}',
|
18
|
-
'{not_a_tag}'
|
19
|
-
].each do |tag_signature|
|
20
|
-
assert_nil CmsTag::Snippet.initialize_tag(cms_pages(:default), tag_signature)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_content_and_render
|
25
|
-
tag = CmsTag::Snippet.initialize_tag(cms_pages(:default), '{{cms:snippet:default}}')
|
26
|
-
assert_equal 'default_snippet_content', tag.content
|
27
|
-
assert_equal 'default_snippet_content', tag.render
|
28
|
-
|
29
|
-
tag = CmsTag::Snippet.initialize_tag(cms_pages(:default), "{{cms:snippet:doesnot_exist}}")
|
30
|
-
assert_equal nil, tag.content
|
31
|
-
assert_equal '', tag.render
|
32
|
-
end
|
33
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require File.expand_path('../test_helper', File.dirname(__FILE__))
|
2
|
-
|
3
|
-
class CmsUploadTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def test_validations
|
6
|
-
assert_no_difference 'CmsUpload.count' do
|
7
|
-
upload = CmsUpload.create
|
8
|
-
assert upload.errors.present?
|
9
|
-
assert_has_errors_on upload, [:file_file_name]
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_create
|
14
|
-
assert_difference 'CmsUpload.count' do
|
15
|
-
cms_sites(:default).cms_uploads.create(
|
16
|
-
:file => fixture_file_upload('files/valid_image.jpg')
|
17
|
-
)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_create_failure
|
22
|
-
assert_no_difference 'CmsUpload.count' do
|
23
|
-
cms_sites(:default).cms_uploads.create(:file => '')
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|