comfortable_mexican_sofa 1.5.6 → 1.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +1 -1
- data/VERSION +1 -1
- data/app/models/cms/block.rb +2 -2
- data/app/models/cms/file.rb +8 -1
- data/comfortable_mexican_sofa.gemspec +5 -4
- data/config/initializers/paperclip.rb +1 -1
- data/lib/comfortable_mexican_sofa/tags/page_file.rb +6 -1
- data/lib/comfortable_mexican_sofa/tags/page_files.rb +7 -1
- data/test/fixtures/files/document.pdf +0 -0
- data/test/fixtures/files/image.gif +0 -0
- data/test/fixtures/files/image.jpg +0 -0
- data/test/functional/cms_admin/files_controller_test.rb +11 -9
- data/test/unit/models/block_test.rb +8 -8
- data/test/unit/models/file_test.rb +19 -2
- data/test/unit/tags/page_file_test.rb +33 -6
- data/test/unit/tags/page_files_test.rb +31 -4
- metadata +12 -11
- data/test/fixtures/files/invalid_file.gif +0 -9
- data/test/fixtures/files/valid_image.jpg +0 -0
data/.travis.yml
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.5.
|
|
1
|
+
1.5.7
|
data/app/models/cms/block.rb
CHANGED
|
@@ -21,7 +21,7 @@ class Cms::Block < ActiveRecord::Base
|
|
|
21
21
|
# -- Instance Methods -----------------------------------------------------
|
|
22
22
|
# Tag object that is using this block
|
|
23
23
|
def tag
|
|
24
|
-
page.tags(true).detect{|t| t.is_cms_block? && t.label == label}
|
|
24
|
+
@tag ||= page.tags(true).detect{|t| t.is_cms_block? && t.label == label}
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
protected
|
|
@@ -37,7 +37,7 @@ protected
|
|
|
37
37
|
|
|
38
38
|
temp_files.each do |file|
|
|
39
39
|
self.files.collect{|f| f.mark_for_destruction } if single_file
|
|
40
|
-
self.files.build(:site => self.page.site, :file => file)
|
|
40
|
+
self.files.build(:site => self.page.site, :dimensions => self.tag.try(:dimensions), :file => file)
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
self.content = nil unless self.content.is_a?(String)
|
data/app/models/cms/file.rb
CHANGED
|
@@ -8,8 +8,15 @@ class Cms::File < ActiveRecord::Base
|
|
|
8
8
|
|
|
9
9
|
cms_is_categorized
|
|
10
10
|
|
|
11
|
+
attr_accessor :dimensions
|
|
12
|
+
|
|
11
13
|
# -- AR Extensions --------------------------------------------------------
|
|
12
|
-
has_attached_file :file, ComfortableMexicanSofa.config.upload_file_options
|
|
14
|
+
has_attached_file :file, ComfortableMexicanSofa.config.upload_file_options.merge(
|
|
15
|
+
# dimensions accessor needs to be set before file assignment for this to work
|
|
16
|
+
:styles => lambda { |f|
|
|
17
|
+
f.instance.dimensions.blank?? { } : { :original => f.instance.dimensions }
|
|
18
|
+
}
|
|
19
|
+
)
|
|
13
20
|
|
|
14
21
|
# -- Relationships --------------------------------------------------------
|
|
15
22
|
belongs_to :site
|
|
@@ -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.7"
|
|
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-05"
|
|
13
13
|
s.description = ""
|
|
14
14
|
s.email = "oleg@theworkinggroup.ca"
|
|
15
15
|
s.extra_rdoc_files = [
|
|
@@ -250,8 +250,9 @@ Gem::Specification.new do |s|
|
|
|
250
250
|
"test/fixtures/cms/revisions.yml",
|
|
251
251
|
"test/fixtures/cms/sites.yml",
|
|
252
252
|
"test/fixtures/cms/snippets.yml",
|
|
253
|
-
"test/fixtures/files/
|
|
254
|
-
"test/fixtures/files/
|
|
253
|
+
"test/fixtures/files/document.pdf",
|
|
254
|
+
"test/fixtures/files/image.gif",
|
|
255
|
+
"test/fixtures/files/image.jpg",
|
|
255
256
|
"test/fixtures/views/_nav_hook.html.erb",
|
|
256
257
|
"test/fixtures/views/_nav_hook_2.html.erb",
|
|
257
258
|
"test/fixtures/views/render_test/_test.html.erb",
|
|
@@ -12,7 +12,12 @@ class ComfortableMexicanSofa::Tag::PageFile
|
|
|
12
12
|
|
|
13
13
|
# Type of the tag controls how file is rendered
|
|
14
14
|
def type
|
|
15
|
-
|
|
15
|
+
s = params[0].to_s.gsub(/\[.*?\]/, '')
|
|
16
|
+
%w(partial url image link).member?(s) ? s : 'url'
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def dimensions
|
|
20
|
+
params[0].to_s.match(/\[(.*?)\]/)[1] rescue nil
|
|
16
21
|
end
|
|
17
22
|
|
|
18
23
|
def content
|
|
@@ -6,8 +6,14 @@ class ComfortableMexicanSofa::Tag::PageFiles
|
|
|
6
6
|
/\{\{\s*cms:page_files:(#{label}):?(.*?)\s*\}\}/
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
+
# Type of the tag controls how file is rendered
|
|
9
10
|
def type
|
|
10
|
-
|
|
11
|
+
s = params[0].to_s.gsub(/\[.*?\]/, '')
|
|
12
|
+
%w(partial url image link).member?(s) ? s : 'url'
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def dimensions
|
|
16
|
+
params[0].to_s.match(/\[(.*?)\]/)[1] rescue nil
|
|
11
17
|
end
|
|
12
18
|
|
|
13
19
|
def content
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -61,7 +61,7 @@ class CmsAdmin::FilesControllerTest < ActionController::TestCase
|
|
|
61
61
|
post :create, :site_id => cms_sites(:default), :file => {
|
|
62
62
|
:label => 'Test File',
|
|
63
63
|
:description => 'Test Description',
|
|
64
|
-
:file => [fixture_file_upload('files/
|
|
64
|
+
:file => [fixture_file_upload('files/image.jpg')]
|
|
65
65
|
}
|
|
66
66
|
assert_response :redirect
|
|
67
67
|
file = Cms::File.last
|
|
@@ -90,16 +90,16 @@ class CmsAdmin::FilesControllerTest < ActionController::TestCase
|
|
|
90
90
|
:label => 'Test File',
|
|
91
91
|
:description => 'Test Description',
|
|
92
92
|
:file => [
|
|
93
|
-
fixture_file_upload('files/
|
|
94
|
-
fixture_file_upload('files/
|
|
93
|
+
fixture_file_upload('files/image.jpg'),
|
|
94
|
+
fixture_file_upload('files/image.gif')
|
|
95
95
|
]
|
|
96
96
|
}
|
|
97
97
|
assert_response :redirect
|
|
98
98
|
file_a, file_b = Cms::File.all
|
|
99
99
|
assert_equal cms_sites(:default), file_a.site
|
|
100
100
|
|
|
101
|
-
assert_equal '
|
|
102
|
-
assert_equal '
|
|
101
|
+
assert_equal 'image.jpg', file_a.file_file_name
|
|
102
|
+
assert_equal 'image.gif', file_b.file_file_name
|
|
103
103
|
assert_equal 'Test File 1', file_a.label
|
|
104
104
|
assert_equal 'Test File 2', file_b.label
|
|
105
105
|
assert_equal 'Test Description', file_a.description
|
|
@@ -111,15 +111,17 @@ class CmsAdmin::FilesControllerTest < ActionController::TestCase
|
|
|
111
111
|
end
|
|
112
112
|
|
|
113
113
|
def test_create_as_xhr
|
|
114
|
-
request.env['HTTP_X_FILE_NAME'] = '
|
|
115
|
-
request.env['CONTENT_TYPE'] = '
|
|
114
|
+
request.env['HTTP_X_FILE_NAME'] = 'image.jpg'
|
|
115
|
+
request.env['CONTENT_TYPE'] = 'image/jpeg'
|
|
116
|
+
request.env['RAW_POST_DATA'] = File.open(File.expand_path('../../fixtures/files/image.jpg', File.dirname(__FILE__))).read
|
|
116
117
|
|
|
117
118
|
assert_difference 'Cms::File.count' do
|
|
118
119
|
xhr :post, :create, :site_id => cms_sites(:default)
|
|
119
120
|
assert_response :success
|
|
120
121
|
|
|
121
122
|
file = Cms::File.last
|
|
122
|
-
assert_equal '
|
|
123
|
+
assert_equal 'image.jpg', file.file_file_name
|
|
124
|
+
assert_equal 'image/jpeg', file.file_content_type
|
|
123
125
|
end
|
|
124
126
|
end
|
|
125
127
|
|
|
@@ -168,7 +170,7 @@ class CmsAdmin::FilesControllerTest < ActionController::TestCase
|
|
|
168
170
|
def test_reorder
|
|
169
171
|
file_one = cms_files(:default)
|
|
170
172
|
file_two = cms_sites(:default).files.create(
|
|
171
|
-
:file => fixture_file_upload('files/
|
|
173
|
+
:file => fixture_file_upload('files/image.jpg')
|
|
172
174
|
)
|
|
173
175
|
assert_equal 0, file_one.position
|
|
174
176
|
assert_equal 1, file_two.position
|
|
@@ -72,7 +72,7 @@ class CmsBlockTest < ActiveSupport::TestCase
|
|
|
72
72
|
:parent_id => cms_pages(:default).id,
|
|
73
73
|
:blocks_attributes => [
|
|
74
74
|
{ :label => 'file',
|
|
75
|
-
:content => [fixture_file_upload('files/
|
|
75
|
+
:content => [fixture_file_upload('files/image.jpg'), fixture_file_upload('files/document.pdf')] }
|
|
76
76
|
]
|
|
77
77
|
)
|
|
78
78
|
assert_equal 1, page.blocks.count
|
|
@@ -80,7 +80,7 @@ class CmsBlockTest < ActiveSupport::TestCase
|
|
|
80
80
|
assert_equal 'file', block.label
|
|
81
81
|
assert_equal nil, block.content
|
|
82
82
|
assert_equal 1, block.files.count
|
|
83
|
-
assert_equal '
|
|
83
|
+
assert_equal 'image.jpg', block.files.first.file_file_name
|
|
84
84
|
|
|
85
85
|
page.reload
|
|
86
86
|
assert_equal block.files.first.file.url, page.content
|
|
@@ -90,13 +90,13 @@ class CmsBlockTest < ActiveSupport::TestCase
|
|
|
90
90
|
page.update_attributes!(
|
|
91
91
|
:blocks_attributes => [
|
|
92
92
|
{ :label => 'file',
|
|
93
|
-
:content => fixture_file_upload('files/
|
|
93
|
+
:content => fixture_file_upload('files/document.pdf') }
|
|
94
94
|
]
|
|
95
95
|
)
|
|
96
96
|
page.reload
|
|
97
97
|
block = page.blocks.first
|
|
98
98
|
assert_equal 1, block.files.count
|
|
99
|
-
assert_equal '
|
|
99
|
+
assert_equal 'document.pdf', block.files.first.file_file_name
|
|
100
100
|
assert_equal block.files.first.file.url, page.content
|
|
101
101
|
end
|
|
102
102
|
end
|
|
@@ -116,7 +116,7 @@ class CmsBlockTest < ActiveSupport::TestCase
|
|
|
116
116
|
:parent_id => cms_pages(:default).id,
|
|
117
117
|
:blocks_attributes => [
|
|
118
118
|
{ :label => 'files',
|
|
119
|
-
:content => [fixture_file_upload('files/
|
|
119
|
+
:content => [fixture_file_upload('files/image.jpg'), fixture_file_upload('files/image.gif')] }
|
|
120
120
|
]
|
|
121
121
|
)
|
|
122
122
|
assert_equal 1, page.blocks.count
|
|
@@ -124,7 +124,7 @@ class CmsBlockTest < ActiveSupport::TestCase
|
|
|
124
124
|
assert_equal 'files', block.label
|
|
125
125
|
assert_equal nil, block.content
|
|
126
126
|
assert_equal 2, block.files.count
|
|
127
|
-
assert_equal ['
|
|
127
|
+
assert_equal ['image.jpg', 'image.gif'], block.files.collect(&:file_file_name)
|
|
128
128
|
end
|
|
129
129
|
end
|
|
130
130
|
|
|
@@ -133,13 +133,13 @@ class CmsBlockTest < ActiveSupport::TestCase
|
|
|
133
133
|
page.update_attributes!(
|
|
134
134
|
:blocks_attributes => [
|
|
135
135
|
{ :label => 'files',
|
|
136
|
-
:content => [fixture_file_upload('files/
|
|
136
|
+
:content => [fixture_file_upload('files/document.pdf'), fixture_file_upload('files/image.gif')] }
|
|
137
137
|
]
|
|
138
138
|
)
|
|
139
139
|
page.reload
|
|
140
140
|
block = page.blocks.first
|
|
141
141
|
assert_equal 4, block.files.count
|
|
142
|
-
assert_equal ['
|
|
142
|
+
assert_equal ['image.jpg', 'image.gif', 'document.pdf', 'image.gif'],
|
|
143
143
|
block.files.collect(&:file_file_name)
|
|
144
144
|
end
|
|
145
145
|
end
|
|
@@ -19,9 +19,26 @@ class CmsFileTest < ActiveSupport::TestCase
|
|
|
19
19
|
def test_create
|
|
20
20
|
assert_difference 'Cms::File.count' do
|
|
21
21
|
file = cms_sites(:default).files.create(
|
|
22
|
-
:file => fixture_file_upload('files/
|
|
22
|
+
:file => fixture_file_upload('files/image.jpg', 'image/jpeg')
|
|
23
23
|
)
|
|
24
|
-
assert_equal '
|
|
24
|
+
assert_equal 'Image', file.label
|
|
25
|
+
assert_equal 'image.jpg', file.file_file_name
|
|
26
|
+
assert_equal 'image/jpeg', file.file_content_type
|
|
27
|
+
assert file.file_file_size > 6000
|
|
28
|
+
assert_equal 1, file.position
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def test_create_with_dimensions
|
|
33
|
+
assert_difference 'Cms::File.count' do
|
|
34
|
+
file = cms_sites(:default).files.create!(
|
|
35
|
+
:dimensions => '10x10#',
|
|
36
|
+
:file => fixture_file_upload('files/image.jpg', 'image/jpeg')
|
|
37
|
+
)
|
|
38
|
+
assert_equal 'Image', file.label
|
|
39
|
+
assert_equal 'image.jpg', file.file_file_name
|
|
40
|
+
assert_equal 'image/jpeg', file.file_content_type
|
|
41
|
+
assert file.file_file_size < 6000
|
|
25
42
|
assert_equal 1, file.position
|
|
26
43
|
end
|
|
27
44
|
end
|
|
@@ -7,6 +7,7 @@ class PageFileTagTest < ActiveSupport::TestCase
|
|
|
7
7
|
cms_pages(:default), '{{ cms:page_file:label }}'
|
|
8
8
|
)
|
|
9
9
|
assert 'url', tag.type
|
|
10
|
+
assert_equal nil, tag.dimensions
|
|
10
11
|
|
|
11
12
|
assert tag = ComfortableMexicanSofa::Tag::PageFile.initialize_tag(
|
|
12
13
|
cms_pages(:default), '{{ cms:page_file:label:partial }}'
|
|
@@ -14,6 +15,14 @@ class PageFileTagTest < ActiveSupport::TestCase
|
|
|
14
15
|
assert 'partial', tag.type
|
|
15
16
|
end
|
|
16
17
|
|
|
18
|
+
def test_initialize_tag_with_dimentions
|
|
19
|
+
assert tag = ComfortableMexicanSofa::Tag::PageFile.initialize_tag(
|
|
20
|
+
cms_pages(:default), '{{ cms:page_file:label:image[100x100#] }}'
|
|
21
|
+
)
|
|
22
|
+
assert_equal 'image', tag.type
|
|
23
|
+
assert_equal '100x100#', tag.dimensions
|
|
24
|
+
end
|
|
25
|
+
|
|
17
26
|
def test_initialize_tag_failure
|
|
18
27
|
[
|
|
19
28
|
'{{cms:page_file}}',
|
|
@@ -39,28 +48,28 @@ class PageFileTagTest < ActiveSupport::TestCase
|
|
|
39
48
|
page.update_attributes!(
|
|
40
49
|
:blocks_attributes => [
|
|
41
50
|
{ :label => 'file',
|
|
42
|
-
:content => fixture_file_upload('files/
|
|
51
|
+
:content => fixture_file_upload('files/image.jpg') }
|
|
43
52
|
]
|
|
44
53
|
)
|
|
45
54
|
file = tag.block.files.first
|
|
46
55
|
|
|
47
56
|
assert_equal file, tag.content
|
|
48
|
-
assert_equal "/system/files/#{file.id}/original/
|
|
57
|
+
assert_equal "/system/files/#{file.id}/original/image.jpg", tag.render
|
|
49
58
|
|
|
50
59
|
assert tag = ComfortableMexicanSofa::Tag::PageFile.initialize_tag(page, '{{ cms:page_file:file:link }}')
|
|
51
|
-
assert_equal "<a href='/system/files/#{file.id}/original/
|
|
60
|
+
assert_equal "<a href='/system/files/#{file.id}/original/image.jpg' target='_blank'>file</a>",
|
|
52
61
|
tag.render
|
|
53
62
|
|
|
54
63
|
assert tag = ComfortableMexicanSofa::Tag::PageFile.initialize_tag(page, '{{ cms:page_file:file:link:link label }}')
|
|
55
|
-
assert_equal "<a href='/system/files/#{file.id}/original/
|
|
64
|
+
assert_equal "<a href='/system/files/#{file.id}/original/image.jpg' target='_blank'>link label</a>",
|
|
56
65
|
tag.render
|
|
57
66
|
|
|
58
67
|
assert tag = ComfortableMexicanSofa::Tag::PageFile.initialize_tag(page, '{{ cms:page_file:file:image }}')
|
|
59
|
-
assert_equal "<img src='/system/files/#{file.id}/original/
|
|
68
|
+
assert_equal "<img src='/system/files/#{file.id}/original/image.jpg' alt='file' />",
|
|
60
69
|
tag.render
|
|
61
70
|
|
|
62
71
|
assert tag = ComfortableMexicanSofa::Tag::PageFile.initialize_tag(page, '{{ cms:page_file:file:image:image alt }}')
|
|
63
|
-
assert_equal "<img src='/system/files/#{file.id}/original/
|
|
72
|
+
assert_equal "<img src='/system/files/#{file.id}/original/image.jpg' alt='image alt' />",
|
|
64
73
|
tag.render
|
|
65
74
|
|
|
66
75
|
assert tag = ComfortableMexicanSofa::Tag::PageFile.initialize_tag(page, '{{ cms:page_file:file:partial }}')
|
|
@@ -76,4 +85,22 @@ class PageFileTagTest < ActiveSupport::TestCase
|
|
|
76
85
|
tag.render
|
|
77
86
|
end
|
|
78
87
|
|
|
88
|
+
def test_content_and_render_with_dimentions
|
|
89
|
+
layout = cms_layouts(:default)
|
|
90
|
+
layout.update_attribute(:content, '{{ cms:page_file:file:image[10x10#] }}')
|
|
91
|
+
page = cms_pages(:default)
|
|
92
|
+
|
|
93
|
+
assert_difference 'Cms::File.count' do
|
|
94
|
+
page.update_attributes!(
|
|
95
|
+
:blocks_attributes => [
|
|
96
|
+
{ :label => 'file',
|
|
97
|
+
:content => fixture_file_upload('files/image.jpg') }
|
|
98
|
+
]
|
|
99
|
+
)
|
|
100
|
+
file = Cms::File.last
|
|
101
|
+
assert_equal 'image.jpg', file.file_file_name
|
|
102
|
+
assert file.file_file_size < 6000
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
79
106
|
end
|
|
@@ -7,6 +7,7 @@ class PageFilesTagTest < ActiveSupport::TestCase
|
|
|
7
7
|
cms_pages(:default), '{{ cms:page_files:label }}'
|
|
8
8
|
)
|
|
9
9
|
assert 'url', tag.type
|
|
10
|
+
assert_equal nil, tag.dimensions
|
|
10
11
|
|
|
11
12
|
assert tag = ComfortableMexicanSofa::Tag::PageFiles.initialize_tag(
|
|
12
13
|
cms_pages(:default), '{{ cms:page_files:label:partial }}'
|
|
@@ -14,6 +15,14 @@ class PageFilesTagTest < ActiveSupport::TestCase
|
|
|
14
15
|
assert 'partial', tag.type
|
|
15
16
|
end
|
|
16
17
|
|
|
18
|
+
def test_initialize_tag_with_dimentions
|
|
19
|
+
assert tag = ComfortableMexicanSofa::Tag::PageFiles.initialize_tag(
|
|
20
|
+
cms_pages(:default), '{{ cms:page_files:label:image[100x100#] }}'
|
|
21
|
+
)
|
|
22
|
+
assert_equal 'image', tag.type
|
|
23
|
+
assert_equal '100x100#', tag.dimensions
|
|
24
|
+
end
|
|
25
|
+
|
|
17
26
|
def test_initialize_tag_failure
|
|
18
27
|
[
|
|
19
28
|
'{{cms:page_files}}',
|
|
@@ -39,21 +48,21 @@ class PageFilesTagTest < ActiveSupport::TestCase
|
|
|
39
48
|
page.update_attributes!(
|
|
40
49
|
:blocks_attributes => [
|
|
41
50
|
{ :label => 'files',
|
|
42
|
-
:content => [fixture_file_upload('files/
|
|
51
|
+
:content => [fixture_file_upload('files/image.jpg'), fixture_file_upload('files/image.gif')] }
|
|
43
52
|
]
|
|
44
53
|
)
|
|
45
54
|
files = tag.block.files
|
|
46
55
|
file_a, file_b = files
|
|
47
56
|
|
|
48
57
|
assert_equal files, tag.content
|
|
49
|
-
assert_equal "/system/files/#{file_a.id}/original/
|
|
58
|
+
assert_equal "/system/files/#{file_a.id}/original/image.jpg, /system/files/#{file_b.id}/original/image.gif", tag.render
|
|
50
59
|
|
|
51
60
|
assert tag = ComfortableMexicanSofa::Tag::PageFiles.initialize_tag(page, '{{ cms:page_files:files:link }}')
|
|
52
|
-
assert_equal "<a href='/system/files/#{file_a.id}/original/
|
|
61
|
+
assert_equal "<a href='/system/files/#{file_a.id}/original/image.jpg' target='_blank'>Image</a> <a href='/system/files/#{file_b.id}/original/image.gif' target='_blank'>Image</a>",
|
|
53
62
|
tag.render
|
|
54
63
|
|
|
55
64
|
assert tag = ComfortableMexicanSofa::Tag::PageFiles.initialize_tag(page, '{{ cms:page_files:files:image }}')
|
|
56
|
-
assert_equal "<img src='/system/files/#{file_a.id}/original/
|
|
65
|
+
assert_equal "<img src='/system/files/#{file_a.id}/original/image.jpg' alt='Image' /> <img src='/system/files/#{file_b.id}/original/image.gif' alt='Image' />",
|
|
57
66
|
tag.render
|
|
58
67
|
|
|
59
68
|
assert tag = ComfortableMexicanSofa::Tag::PageFiles.initialize_tag(page, '{{ cms:page_files:files:partial }}')
|
|
@@ -69,4 +78,22 @@ class PageFilesTagTest < ActiveSupport::TestCase
|
|
|
69
78
|
tag.render
|
|
70
79
|
end
|
|
71
80
|
|
|
81
|
+
def test_content_and_render_with_dimentions
|
|
82
|
+
layout = cms_layouts(:default)
|
|
83
|
+
layout.update_attribute(:content, '{{ cms:page_files:file:image[10x10#] }}')
|
|
84
|
+
page = cms_pages(:default)
|
|
85
|
+
|
|
86
|
+
assert_difference 'Cms::File.count' do
|
|
87
|
+
page.update_attributes!(
|
|
88
|
+
:blocks_attributes => [
|
|
89
|
+
{ :label => 'file',
|
|
90
|
+
:content => fixture_file_upload('files/image.jpg') }
|
|
91
|
+
]
|
|
92
|
+
)
|
|
93
|
+
file = Cms::File.last
|
|
94
|
+
assert_equal 'image.jpg', file.file_file_name
|
|
95
|
+
assert file.file_file_size < 6000
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
72
99
|
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.7
|
|
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-05 00:00:00.000000000Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: rails
|
|
17
|
-
requirement: &
|
|
17
|
+
requirement: &70320595035360 !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: *70320595035360
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: active_link_to
|
|
28
|
-
requirement: &
|
|
28
|
+
requirement: &70320595034880 !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: *70320595034880
|
|
37
37
|
- !ruby/object:Gem::Dependency
|
|
38
38
|
name: paperclip
|
|
39
|
-
requirement: &
|
|
39
|
+
requirement: &70320595034400 !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: *70320595034400
|
|
48
48
|
description: ''
|
|
49
49
|
email: oleg@theworkinggroup.ca
|
|
50
50
|
executables: []
|
|
@@ -286,8 +286,9 @@ files:
|
|
|
286
286
|
- test/fixtures/cms/revisions.yml
|
|
287
287
|
- test/fixtures/cms/sites.yml
|
|
288
288
|
- test/fixtures/cms/snippets.yml
|
|
289
|
-
- test/fixtures/files/
|
|
290
|
-
- test/fixtures/files/
|
|
289
|
+
- test/fixtures/files/document.pdf
|
|
290
|
+
- test/fixtures/files/image.gif
|
|
291
|
+
- test/fixtures/files/image.jpg
|
|
291
292
|
- test/fixtures/views/_nav_hook.html.erb
|
|
292
293
|
- test/fixtures/views/_nav_hook_2.html.erb
|
|
293
294
|
- test/fixtures/views/render_test/_test.html.erb
|
|
@@ -358,7 +359,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
358
359
|
version: '0'
|
|
359
360
|
segments:
|
|
360
361
|
- 0
|
|
361
|
-
hash:
|
|
362
|
+
hash: -1509635901179194295
|
|
362
363
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
363
364
|
none: false
|
|
364
365
|
requirements:
|
|
Binary file
|