comfortable_mexican_sofa 1.4.22 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +2 -2
- data/Gemfile +3 -7
- data/VERSION +1 -1
- data/app/assets/stylesheets/comfortable_mexican_sofa/form.css +44 -1
- data/app/controllers/cms_admin/files_controller.rb +10 -1
- data/app/controllers/cms_admin/layouts_controller.rb +9 -0
- data/app/controllers/cms_admin/pages_controller.rb +1 -1
- data/app/controllers/cms_admin/snippets_controller.rb +10 -1
- data/app/models/cms/block.rb +29 -0
- data/app/models/cms/file.rb +9 -19
- data/app/models/cms/layout.rb +9 -0
- data/app/models/cms/page.rb +3 -4
- data/app/models/cms/snippet.rb +9 -0
- data/app/views/cms_admin/files/_file.html.erb +1 -1
- data/app/views/cms_admin/files/_index.html.erb +1 -12
- data/app/views/cms_admin/files/_page_form.html.erb +12 -0
- data/app/views/cms_admin/files/destroy.js.erb +1 -1
- data/app/views/cms_admin/files/index.html.erb +6 -2
- data/app/views/cms_admin/layouts/_index_branch.html.erb +5 -1
- data/app/views/cms_admin/layouts/index.html.erb +1 -1
- data/app/views/cms_admin/pages/_form_blocks.html.erb +2 -2
- data/app/views/cms_admin/pages/edit.html.erb +1 -1
- data/app/views/cms_admin/pages/new.html.erb +1 -1
- data/app/views/cms_admin/snippets/index.html.erb +6 -2
- data/comfortable_mexican_sofa.gemspec +16 -10
- data/config/initializers/comfortable_mexican_sofa.rb +0 -4
- data/config/initializers/paperclip.rb +25 -0
- data/config/locales/en.yml +2 -0
- data/config/locales/es.yml +2 -0
- data/config/routes.rb +8 -8
- data/db/migrate/01_create_cms.rb +6 -0
- data/db/migrate/upgrades/06_upgrade_to_1_5_0.rb +21 -0
- data/lib/comfortable_mexican_sofa/configuration.rb +14 -19
- data/lib/comfortable_mexican_sofa/form_builder.rb +48 -36
- data/lib/comfortable_mexican_sofa/tag.rb +2 -12
- data/lib/comfortable_mexican_sofa/tags/collection.rb +0 -4
- data/lib/comfortable_mexican_sofa/tags/field_datetime.rb +0 -4
- data/lib/comfortable_mexican_sofa/tags/field_integer.rb +0 -4
- data/lib/comfortable_mexican_sofa/tags/field_string.rb +0 -4
- data/lib/comfortable_mexican_sofa/tags/field_text.rb +0 -4
- data/lib/comfortable_mexican_sofa/tags/file.rb +5 -0
- data/lib/comfortable_mexican_sofa/tags/page_datetime.rb +0 -4
- data/lib/comfortable_mexican_sofa/tags/page_file.rb +44 -0
- data/lib/comfortable_mexican_sofa/tags/page_files.rb +44 -0
- data/lib/comfortable_mexican_sofa/tags/page_integer.rb +0 -4
- data/lib/comfortable_mexican_sofa/tags/page_rich_text.rb +0 -4
- data/lib/comfortable_mexican_sofa/tags/page_string.rb +0 -4
- data/lib/comfortable_mexican_sofa/tags/page_text.rb +0 -4
- data/lib/comfortable_mexican_sofa/tags/snippet.rb +5 -0
- data/lib/comfortable_mexican_sofa/view_methods.rb +6 -1
- data/test/fixtures/cms/files.yml +2 -1
- data/test/fixtures/cms/layouts.yml +4 -1
- data/test/fixtures/cms/snippets.yml +1 -0
- data/test/functional/cms_admin/files_controller_test.rb +17 -19
- data/test/functional/cms_admin/layouts_controller_test.rb +18 -1
- data/test/functional/cms_admin/pages_controller_test.rb +63 -22
- data/test/functional/cms_admin/snippets_controller_test.rb +18 -1
- data/test/gemfiles/Gemfile.rails-3.0.x +10 -0
- data/test/gemfiles/Gemfile.rails-3.1.x +10 -0
- data/test/test_helper.rb +13 -12
- data/test/unit/configuration_test.rb +1 -1
- data/test/unit/models/block_test.rb +112 -1
- data/test/unit/models/file_test.rb +1 -51
- data/test/unit/models/layout_test.rb +1 -0
- data/test/unit/models/snippet_test.rb +14 -0
- data/test/unit/tags/collection_test.rb +5 -5
- data/test/unit/tags/field_datetime_test.rb +2 -2
- data/test/unit/tags/field_integer_test.rb +2 -2
- data/test/unit/tags/field_string_test.rb +2 -2
- data/test/unit/tags/field_text_test.rb +2 -2
- data/test/unit/tags/page_datetime_test.rb +2 -2
- data/test/unit/tags/page_file_test.rb +79 -0
- data/test/unit/tags/page_files_test.rb +72 -0
- data/test/unit/tags/page_integer_test.rb +2 -2
- data/test/unit/tags/page_rich_text_test.rb +2 -2
- data/test/unit/tags/page_string_test.rb +2 -2
- data/test/unit/tags/page_text_test.rb +2 -2
- data/test/unit/view_methods_test.rb +2 -1
- metadata +20 -14
- data/gemfiles/Gemfile.rails-3.0.x +0 -14
- data/gemfiles/Gemfile.rails-3.1.x +0 -14
@@ -0,0 +1,72 @@
|
|
1
|
+
require File.expand_path('../../test_helper', File.dirname(__FILE__))
|
2
|
+
|
3
|
+
class PageFilesTagTest < ActiveSupport::TestCase
|
4
|
+
|
5
|
+
def test_initialize_tag
|
6
|
+
assert tag = ComfortableMexicanSofa::Tag::PageFiles.initialize_tag(
|
7
|
+
cms_pages(:default), '{{ cms:page_files:label }}'
|
8
|
+
)
|
9
|
+
assert 'url', tag.type
|
10
|
+
|
11
|
+
assert tag = ComfortableMexicanSofa::Tag::PageFiles.initialize_tag(
|
12
|
+
cms_pages(:default), '{{ cms:page_files:label:partial }}'
|
13
|
+
)
|
14
|
+
assert 'partial', tag.type
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_initialize_tag_failure
|
18
|
+
[
|
19
|
+
'{{cms:page_files}}',
|
20
|
+
'{{cms:not_page_files:label}}',
|
21
|
+
'{not_a_tag}'
|
22
|
+
].each do |tag_signature|
|
23
|
+
assert_nil ComfortableMexicanSofa::Tag::PageFiles.initialize_tag(
|
24
|
+
cms_pages(:default), tag_signature
|
25
|
+
)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_content_and_render
|
30
|
+
page = cms_pages(:default)
|
31
|
+
|
32
|
+
assert tag = ComfortableMexicanSofa::Tag::PageFiles.initialize_tag(page, '{{ cms:page_files:files:partial }}')
|
33
|
+
assert_equal "<%= render :partial => 'partials/page_files', :locals => {:identifier => []} %>", tag.render
|
34
|
+
|
35
|
+
assert tag = ComfortableMexicanSofa::Tag::PageFiles.initialize_tag(page, '{{ cms:page_files:files }}')
|
36
|
+
assert_equal [], tag.content
|
37
|
+
assert_equal '', tag.render
|
38
|
+
|
39
|
+
page.update_attributes!(
|
40
|
+
:blocks_attributes => [
|
41
|
+
{ :label => 'files',
|
42
|
+
:content => [fixture_file_upload('files/valid_image.jpg'), fixture_file_upload('files/invalid_file.gif')] }
|
43
|
+
]
|
44
|
+
)
|
45
|
+
files = tag.block.files
|
46
|
+
file_a, file_b = files
|
47
|
+
|
48
|
+
assert_equal files, tag.content
|
49
|
+
assert_equal "/system/files/#{file_a.id}/original/valid_image.jpg, /system/files/#{file_b.id}/original/invalid_file.gif", tag.render
|
50
|
+
|
51
|
+
assert tag = ComfortableMexicanSofa::Tag::PageFiles.initialize_tag(page, '{{ cms:page_files:files:link }}')
|
52
|
+
assert_equal "<a href='/system/files/#{file_a.id}/original/valid_image.jpg' target='_blank'>Valid Image</a> <a href='/system/files/#{file_b.id}/original/invalid_file.gif' target='_blank'>Invalid File</a>",
|
53
|
+
tag.render
|
54
|
+
|
55
|
+
assert tag = ComfortableMexicanSofa::Tag::PageFiles.initialize_tag(page, '{{ cms:page_files:files:image }}')
|
56
|
+
assert_equal "<img src='/system/files/#{file_a.id}/original/valid_image.jpg' alt='Valid Image' /> <img src='/system/files/#{file_b.id}/original/invalid_file.gif' alt='Invalid File' />",
|
57
|
+
tag.render
|
58
|
+
|
59
|
+
assert tag = ComfortableMexicanSofa::Tag::PageFiles.initialize_tag(page, '{{ cms:page_files:files:partial }}')
|
60
|
+
assert_equal "<%= render :partial => 'partials/page_files', :locals => {:identifier => [#{files.collect(&:id).join(',')}]} %>",
|
61
|
+
tag.render
|
62
|
+
|
63
|
+
assert tag = ComfortableMexicanSofa::Tag::PageFiles.initialize_tag(page, '{{ cms:page_files:files:partial:path/to/partial }}')
|
64
|
+
assert_equal "<%= render :partial => 'path/to/partial', :locals => {:identifier => [#{files.collect(&:id).join(',')}]} %>",
|
65
|
+
tag.render
|
66
|
+
|
67
|
+
assert tag = ComfortableMexicanSofa::Tag::PageFiles.initialize_tag(page, '{{ cms:page_files:files:partial:path/to/partial:a:b }}')
|
68
|
+
assert_equal "<%= render :partial => 'path/to/partial', :locals => {:identifier => [#{files.collect(&:id).join(',')}], :param_1 => 'a', :param_2 => 'b'} %>",
|
69
|
+
tag.render
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
@@ -34,8 +34,8 @@ class PageIntegerTagTest < ActiveSupport::TestCase
|
|
34
34
|
tag = ComfortableMexicanSofa::Tag::PageInteger.initialize_tag(
|
35
35
|
cms_pages(:default), '{{cms:page:content:integer}}'
|
36
36
|
)
|
37
|
-
assert tag.content.blank?
|
38
|
-
tag.content = '5'
|
37
|
+
assert tag.block.content.blank?
|
38
|
+
tag.block.content = '5'
|
39
39
|
assert_equal '5', tag.content
|
40
40
|
assert_equal '5', tag.render
|
41
41
|
end
|
@@ -34,8 +34,8 @@ class PageRichTextTagTest < ActiveSupport::TestCase
|
|
34
34
|
tag = ComfortableMexicanSofa::Tag::PageRichText.initialize_tag(
|
35
35
|
cms_pages(:default), '{{cms:page:content:rich_text}}'
|
36
36
|
)
|
37
|
-
assert tag.content.blank?
|
38
|
-
tag.content = 'test_content'
|
37
|
+
assert tag.block.content.blank?
|
38
|
+
tag.block.content = 'test_content'
|
39
39
|
assert_equal 'test_content', tag.content
|
40
40
|
assert_equal 'test_content', tag.render
|
41
41
|
end
|
@@ -34,8 +34,8 @@ class PageStringTagTest < ActiveSupport::TestCase
|
|
34
34
|
tag = ComfortableMexicanSofa::Tag::PageString.initialize_tag(
|
35
35
|
cms_pages(:default), '{{cms:page:content:string}}'
|
36
36
|
)
|
37
|
-
assert tag.content.blank?
|
38
|
-
tag.content = 'test_content'
|
37
|
+
assert tag.block.content.blank?
|
38
|
+
tag.block.content = 'test_content'
|
39
39
|
assert_equal 'test_content', tag.content
|
40
40
|
assert_equal 'test_content', tag.render
|
41
41
|
end
|
@@ -37,8 +37,8 @@ class PageTextTagTest < ActiveSupport::TestCase
|
|
37
37
|
tag = ComfortableMexicanSofa::Tag::PageText.initialize_tag(
|
38
38
|
cms_pages(:default), '{{cms:page:content}}'
|
39
39
|
)
|
40
|
-
assert tag.content.blank?
|
41
|
-
tag.content = 'test_content'
|
40
|
+
assert tag.block.content.blank?
|
41
|
+
tag.block.content = 'test_content'
|
42
42
|
assert_equal 'test_content', tag.content
|
43
43
|
assert_equal 'test_content', tag.render
|
44
44
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require File.expand_path('../test_helper', File.dirname(__FILE__))
|
2
2
|
|
3
|
-
class ViewMethodsTest <
|
3
|
+
class ViewMethodsTest < ActionView::TestCase
|
4
|
+
include ComfortableMexicanSofa::ViewMethods
|
4
5
|
|
5
6
|
class HelpersTestController < ActionController::Base
|
6
7
|
helper { def hello; 'hello' 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.
|
4
|
+
version: 1.5.0
|
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-09-
|
13
|
+
date: 2011-09-28 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
17
|
-
requirement: &
|
17
|
+
requirement: &70317417314480 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,29 +22,29 @@ dependencies:
|
|
22
22
|
version: 3.0.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70317417314480
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: active_link_to
|
28
|
-
requirement: &
|
28
|
+
requirement: &70317417312680 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 1.0.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70317417312680
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: paperclip
|
39
|
-
requirement: &
|
39
|
+
requirement: &70317417309920 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
|
-
- -
|
42
|
+
- - ~>
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
version: 2.
|
44
|
+
version: 2.4.2
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70317417309920
|
48
48
|
description: ''
|
49
49
|
email: oleg@theworkinggroup.ca
|
50
50
|
executables: []
|
@@ -165,6 +165,7 @@ files:
|
|
165
165
|
- app/views/cms_admin/files/_file.html.erb
|
166
166
|
- app/views/cms_admin/files/_form.html.erb
|
167
167
|
- app/views/cms_admin/files/_index.html.erb
|
168
|
+
- app/views/cms_admin/files/_page_form.html.erb
|
168
169
|
- app/views/cms_admin/files/create.js.erb
|
169
170
|
- app/views/cms_admin/files/destroy.js.erb
|
170
171
|
- app/views/cms_admin/files/edit.html.erb
|
@@ -233,11 +234,10 @@ files:
|
|
233
234
|
- db/migrate/upgrades/03_upgrade_to_1_2_0.rb
|
234
235
|
- db/migrate/upgrades/04_upgrade_to_1_3_0.rb
|
235
236
|
- db/migrate/upgrades/05_upgrade_to_1_4_0.rb
|
237
|
+
- db/migrate/upgrades/06_upgrade_to_1_5_0.rb
|
236
238
|
- db/seeds.rb
|
237
239
|
- doc/preview.png
|
238
240
|
- doc/sofa.png
|
239
|
-
- gemfiles/Gemfile.rails-3.0.x
|
240
|
-
- gemfiles/Gemfile.rails-3.1.x
|
241
241
|
- lib/comfortable_mexican_sofa.rb
|
242
242
|
- lib/comfortable_mexican_sofa/authentication/dummy_auth.rb
|
243
243
|
- lib/comfortable_mexican_sofa/authentication/http_auth.rb
|
@@ -262,6 +262,8 @@ files:
|
|
262
262
|
- lib/comfortable_mexican_sofa/tags/file.rb
|
263
263
|
- lib/comfortable_mexican_sofa/tags/helper.rb
|
264
264
|
- lib/comfortable_mexican_sofa/tags/page_datetime.rb
|
265
|
+
- lib/comfortable_mexican_sofa/tags/page_file.rb
|
266
|
+
- lib/comfortable_mexican_sofa/tags/page_files.rb
|
265
267
|
- lib/comfortable_mexican_sofa/tags/page_integer.rb
|
266
268
|
- lib/comfortable_mexican_sofa/tags/page_rich_text.rb
|
267
269
|
- lib/comfortable_mexican_sofa/tags/page_string.rb
|
@@ -297,6 +299,8 @@ files:
|
|
297
299
|
- test/functional/cms_admin/sites_controller_test.rb
|
298
300
|
- test/functional/cms_admin/snippets_controller_test.rb
|
299
301
|
- test/functional/cms_content_controller_test.rb
|
302
|
+
- test/gemfiles/Gemfile.rails-3.0.x
|
303
|
+
- test/gemfiles/Gemfile.rails-3.1.x
|
300
304
|
- test/integration/authentication_test.rb
|
301
305
|
- test/integration/fixtures_test.rb
|
302
306
|
- test/integration/mirrors_test.rb
|
@@ -328,6 +332,8 @@ files:
|
|
328
332
|
- test/unit/tags/file_test.rb
|
329
333
|
- test/unit/tags/helper_test.rb
|
330
334
|
- test/unit/tags/page_datetime_test.rb
|
335
|
+
- test/unit/tags/page_file_test.rb
|
336
|
+
- test/unit/tags/page_files_test.rb
|
331
337
|
- test/unit/tags/page_integer_test.rb
|
332
338
|
- test/unit/tags/page_rich_text_test.rb
|
333
339
|
- test/unit/tags/page_string_test.rb
|
@@ -349,7 +355,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
349
355
|
version: '0'
|
350
356
|
segments:
|
351
357
|
- 0
|
352
|
-
hash:
|
358
|
+
hash: -1963305696869515669
|
353
359
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
354
360
|
none: false
|
355
361
|
requirements:
|