radiant-images-extension 0.3.4 → 0.4.0

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/Rakefile CHANGED
@@ -6,7 +6,7 @@ begin
6
6
  gem.description = 'Image Radiant Extension management tool, meant only to be useful to pages and extensions that need to require images.'
7
7
  gem.email = "info@squaretalent.com"
8
8
  gem.homepage = "http://github.com/squaretalent/radiant-images-extension"
9
- gem.authors = ['squaretalent']
9
+ gem.authors = ['Dirk Kelly', 'Mario Visic']
10
10
  gem.add_dependency 'radiant', '>= 0.9.1'
11
11
  gem.add_dependency 'paperclip', '~> 2.3.5'
12
12
  gem.add_dependency 'aws-s3', '>= 0.6.2'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.4
1
+ 0.4.0
@@ -41,7 +41,7 @@ module Images
41
41
  }
42
42
  tag 'images:each' do |tag|
43
43
  context = ''
44
- tag.locals.images.each do |image|
44
+ Helpers.all_images_with_options(tag).each do |image|
45
45
  tag.locals.image = image
46
46
  context << tag.expand
47
47
  end
@@ -6,6 +6,10 @@ module Images
6
6
 
7
7
  class << self
8
8
 
9
+ def all_images_with_options(tag)
10
+ Image.all image_options(tag)
11
+ end
12
+
9
13
  def current_images(tag)
10
14
  result = nil
11
15
 
@@ -5,10 +5,10 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{radiant-images-extension}
8
- s.version = "0.3.4"
8
+ s.version = "0.4.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["squaretalent"]
11
+ s.authors = ["Dirk Kelly", "Mario Visic"]
12
12
  s.date = %q{2010-11-02}
13
13
  s.description = %q{Image Radiant Extension management tool, meant only to be useful to pages and extensions that need to require images.}
14
14
  s.email = %q{info@squaretalent.com}
@@ -71,7 +71,8 @@ describe Images::Tags::Core do
71
71
  end
72
72
 
73
73
  it 'should not expand its contents if there are no images available' do
74
- mock(Image).all { [] }
74
+ mock(Image).all() { [] }
75
+ mock(Image).all(anything) { [] }
75
76
  input = '<r:images:each>test </r:images:each>'
76
77
  expected = ''
77
78
  pages(:home).should render(input).as(expected)
@@ -91,18 +92,18 @@ describe Images::Tags::Core do
91
92
 
92
93
  it 'should order the results based by the key passed' do
93
94
  input = '<r:images:each by="title"><r:image:title /> </r:images:each>'
94
- expected = 'third fifth first fourth second sixth '
95
+ expected = 'fifth first fourth second sixth third '
95
96
  pages(:home).should render(input).as(expected)
96
97
  end
97
98
 
98
99
  it 'should order the results by ascending order when asc is passed for the order' do
99
- input = '<r:images:each by="id" order="asc" ><r:image:title /> </r:images:each>'
100
+ input = '<r:images:each by="position" order="asc" ><r:image:title /> </r:images:each>'
100
101
  expected = 'first second third fourth fifth sixth '
101
102
  pages(:home).should render(input).as(expected)
102
103
  end
103
104
 
104
105
  it 'should order the results by descending order when desc is passed for the order' do
105
- input = '<r:images:each by="id" order="desc" ><r:image:title /> </r:images:each>'
106
+ input = '<r:images:each by="position" order="desc" ><r:image:title /> </r:images:each>'
106
107
  expected = 'sixth fifth fourth third second first '
107
108
  pages(:home).should render(input).as(expected)
108
109
  end
@@ -152,25 +153,59 @@ describe Images::Tags::Core do
152
153
 
153
154
  describe '<r:image:url>' do
154
155
 
155
- it 'should render a valid url given a valid image context'
156
-
157
- it 'should not render a valid url if there is no current image'
156
+ before :each do
157
+ asset = Paperclip::Attachment.new('asset', @images[0], { :url => Radiant::Config['images.url'] })
158
+ stub(Image).find_by_title('first') { @images[0] }
159
+ stub.proxy(Image).find_by_title('invalid')
160
+ stub(@images[0]).asset { asset }
161
+ end
162
+
163
+ it 'should not render a valid url if there is no current image' do
164
+ input = '<r:image title="invalid"><r:url /></r:image>'
165
+ expected = ''
166
+ pages(:home).should render(input).as(expected)
167
+ end
158
168
 
159
- it 'should render the url with the default style if not specified'
169
+ it 'should render the url with the default style if not specified' do
170
+ input = '<r:image title="first"><r:url /></r:image>'
171
+ expected = '/images/first-original.png'
172
+ pages(:home).should render(input).as(expected)
173
+ end
160
174
 
161
- it 'should render the url with the style specified by the user'
175
+ it 'should render the url with the style specified by the user' do
176
+ input = '<r:image title="first"><r:url style="icon" /></r:image>'
177
+ expected = '/images/first-icon.png'
178
+ pages(:home).should render(input).as(expected)
179
+ end
162
180
 
163
181
  end
164
182
 
165
183
  describe '<r:image:tag>' do
166
184
 
167
- it 'should render a valid img tag given a valid image context'
168
-
169
- it 'should not render a valid img tag if there is no current image'
185
+ before :each do
186
+ asset = Paperclip::Attachment.new('asset', @images[0], { :url => Radiant::Config['images.url'] })
187
+ stub(Image).find_by_title('first') { @images[0] }
188
+ stub.proxy(Image).find_by_title('invalid')
189
+ stub(@images[0]).asset { asset }
190
+ end
191
+
192
+ it 'should not render a valid img tag if there is no current image' do
193
+ input = '<r:image title="invalid"><r:tag /></r:image>'
194
+ expected = ''
195
+ pages(:home).should render(input).as(expected)
196
+ end
170
197
 
171
- it 'should render the img tag with the default style if not specified'
198
+ it 'should render the img tag with the default style if not specified' do
199
+ input = '<r:image title="first"><r:tag /></r:image>'
200
+ expected = '<img src="/images/first-original.png" />'
201
+ pages(:home).should render(input).as(expected)
202
+ end
172
203
 
173
- it 'should render the img tag with the style specified by the user'
204
+ it 'should render the img tag with the style specified by the user' do
205
+ input = '<r:image title="first"><r:tag style="icon"/></r:image>'
206
+ expected = '<img src="/images/first-icon.png" />'
207
+ pages(:home).should render(input).as(expected)
208
+ end
174
209
 
175
210
  end
176
211
 
metadata CHANGED
@@ -1,16 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radiant-images-extension
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 3
9
8
  - 4
10
- version: 0.3.4
9
+ - 0
10
+ version: 0.4.0
11
11
  platform: ruby
12
12
  authors:
13
- - squaretalent
13
+ - Dirk Kelly
14
+ - Mario Visic
14
15
  autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
@@ -19,9 +20,9 @@ date: 2010-11-02 00:00:00 +08:00
19
20
  default_executable:
20
21
  dependencies:
21
22
  - !ruby/object:Gem::Dependency
22
- type: :runtime
23
+ name: radiant
23
24
  prerelease: false
24
- version_requirements: &id001 !ruby/object:Gem::Requirement
25
+ requirement: &id001 !ruby/object:Gem::Requirement
25
26
  none: false
26
27
  requirements:
27
28
  - - ">="
@@ -32,12 +33,12 @@ dependencies:
32
33
  - 9
33
34
  - 1
34
35
  version: 0.9.1
35
- name: radiant
36
- requirement: *id001
37
- - !ruby/object:Gem::Dependency
38
36
  type: :runtime
37
+ version_requirements: *id001
38
+ - !ruby/object:Gem::Dependency
39
+ name: paperclip
39
40
  prerelease: false
40
- version_requirements: &id002 !ruby/object:Gem::Requirement
41
+ requirement: &id002 !ruby/object:Gem::Requirement
41
42
  none: false
42
43
  requirements:
43
44
  - - ~>
@@ -48,12 +49,12 @@ dependencies:
48
49
  - 3
49
50
  - 5
50
51
  version: 2.3.5
51
- name: paperclip
52
- requirement: *id002
53
- - !ruby/object:Gem::Dependency
54
52
  type: :runtime
53
+ version_requirements: *id002
54
+ - !ruby/object:Gem::Dependency
55
+ name: aws-s3
55
56
  prerelease: false
56
- version_requirements: &id003 !ruby/object:Gem::Requirement
57
+ requirement: &id003 !ruby/object:Gem::Requirement
57
58
  none: false
58
59
  requirements:
59
60
  - - ">="
@@ -64,12 +65,12 @@ dependencies:
64
65
  - 6
65
66
  - 2
66
67
  version: 0.6.2
67
- name: aws-s3
68
- requirement: *id003
69
- - !ruby/object:Gem::Dependency
70
68
  type: :runtime
69
+ version_requirements: *id003
70
+ - !ruby/object:Gem::Dependency
71
+ name: acts_as_list
71
72
  prerelease: false
72
- version_requirements: &id004 !ruby/object:Gem::Requirement
73
+ requirement: &id004 !ruby/object:Gem::Requirement
73
74
  none: false
74
75
  requirements:
75
76
  - - ">="
@@ -80,12 +81,12 @@ dependencies:
80
81
  - 1
81
82
  - 2
82
83
  version: 0.1.2
83
- name: acts_as_list
84
- requirement: *id004
84
+ type: :runtime
85
+ version_requirements: *id004
85
86
  - !ruby/object:Gem::Dependency
86
- type: :development
87
+ name: rspec
87
88
  prerelease: false
88
- version_requirements: &id005 !ruby/object:Gem::Requirement
89
+ requirement: &id005 !ruby/object:Gem::Requirement
89
90
  none: false
90
91
  requirements:
91
92
  - - ">="
@@ -96,12 +97,12 @@ dependencies:
96
97
  - 3
97
98
  - 0
98
99
  version: 1.3.0
99
- name: rspec
100
- requirement: *id005
101
- - !ruby/object:Gem::Dependency
102
100
  type: :development
101
+ version_requirements: *id005
102
+ - !ruby/object:Gem::Dependency
103
+ name: rr
103
104
  prerelease: false
104
- version_requirements: &id006 !ruby/object:Gem::Requirement
105
+ requirement: &id006 !ruby/object:Gem::Requirement
105
106
  none: false
106
107
  requirements:
107
108
  - - ">="
@@ -112,8 +113,8 @@ dependencies:
112
113
  - 0
113
114
  - 0
114
115
  version: 1.0.0
115
- name: rr
116
- requirement: *id006
116
+ type: :development
117
+ version_requirements: *id006
117
118
  description: Image Radiant Extension management tool, meant only to be useful to pages and extensions that need to require images.
118
119
  email: info@squaretalent.com
119
120
  executables: []