attachment_magick 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +18 -16
- data/app/models/attachment_magick/active_record_image.rb +26 -19
- data/lib/attachment_magick/test/attachment_magick_test_helper.rb +7 -7
- data/lib/attachment_magick/version.rb +1 -1
- data/test/attachment_magick/controllers/images_controller_test.rb +7 -7
- data/test/attachment_magick/helpers/attachment_magick_test.rb +3 -3
- data/test/attachment_magick/units/artist_test.rb +2 -2
- data/test/attachment_magick/units/place_test.rb +2 -2
- metadata +12 -12
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
attachment_magick (0.3.
|
4
|
+
attachment_magick (0.3.3)
|
5
5
|
dragonfly (>= 0.9.5)
|
6
6
|
jquery-rails (>= 0.2.7)
|
7
7
|
marcosinger-auto_html (>= 1.3.6)
|
@@ -41,8 +41,8 @@ GEM
|
|
41
41
|
activesupport (3.0.10)
|
42
42
|
archive-tar-minitar (0.5.2)
|
43
43
|
arel (2.0.10)
|
44
|
-
bson (1.4.
|
45
|
-
bson_ext (1.4.
|
44
|
+
bson (1.4.1)
|
45
|
+
bson_ext (1.4.1)
|
46
46
|
builder (2.1.2)
|
47
47
|
capybara (1.1.1)
|
48
48
|
mime-types (>= 1.16)
|
@@ -53,8 +53,8 @@ GEM
|
|
53
53
|
xpath (~> 0.1.4)
|
54
54
|
childprocess (0.2.2)
|
55
55
|
ffi (~> 1.0.6)
|
56
|
-
colorific (1.0.
|
57
|
-
minitest (~> 2.
|
56
|
+
colorific (1.0.1)
|
57
|
+
minitest (~> 2.6.2)
|
58
58
|
ruby-progressbar (~> 0.0.10)
|
59
59
|
columnize (0.3.4)
|
60
60
|
dragonfly (0.9.8)
|
@@ -64,9 +64,10 @@ GEM
|
|
64
64
|
ffi (1.0.9)
|
65
65
|
hpricot (0.8.4)
|
66
66
|
i18n (0.5.0)
|
67
|
-
jquery-rails (1.0.
|
67
|
+
jquery-rails (1.0.16)
|
68
68
|
railties (~> 3.0)
|
69
69
|
thor (~> 0.14)
|
70
|
+
json (1.6.1)
|
70
71
|
json_pure (1.6.1)
|
71
72
|
linecache19 (0.5.12)
|
72
73
|
ruby_core_source (>= 0.1.4)
|
@@ -82,11 +83,11 @@ GEM
|
|
82
83
|
rinku
|
83
84
|
tag_helper
|
84
85
|
marcosinger-css_parser (1.3.0)
|
85
|
-
mime-types (1.
|
86
|
-
minitest (2.
|
87
|
-
mongo (1.4.
|
88
|
-
bson (= 1.4.
|
89
|
-
mongoid (2.2.
|
86
|
+
mime-types (1.17.2)
|
87
|
+
minitest (2.6.2)
|
88
|
+
mongo (1.4.1)
|
89
|
+
bson (= 1.4.1)
|
90
|
+
mongoid (2.2.3)
|
90
91
|
activemodel (~> 3.0)
|
91
92
|
mongo (~> 1.3)
|
92
93
|
tzinfo (~> 0.3.22)
|
@@ -114,8 +115,9 @@ GEM
|
|
114
115
|
rake (>= 0.8.7)
|
115
116
|
rdoc (~> 3.4)
|
116
117
|
thor (~> 0.14.4)
|
117
|
-
rake (0.9.2)
|
118
|
-
rdoc (3.
|
118
|
+
rake (0.9.2.2)
|
119
|
+
rdoc (3.11)
|
120
|
+
json (~> 1.4)
|
119
121
|
redcarpet (1.17.2)
|
120
122
|
rinku (1.2.2)
|
121
123
|
ruby-debug-base19 (0.11.25)
|
@@ -130,12 +132,12 @@ GEM
|
|
130
132
|
ruby_core_source (0.1.5)
|
131
133
|
archive-tar-minitar (>= 0.5.2)
|
132
134
|
rubyzip (0.9.4)
|
133
|
-
selenium-webdriver (2.
|
135
|
+
selenium-webdriver (2.9.1)
|
134
136
|
childprocess (>= 0.2.1)
|
135
|
-
ffi (
|
137
|
+
ffi (= 1.0.9)
|
136
138
|
json_pure
|
137
139
|
rubyzip
|
138
|
-
simplecov (0.5.
|
140
|
+
simplecov (0.5.4)
|
139
141
|
multi_json (~> 1.0.3)
|
140
142
|
simplecov-html (~> 0.5.3)
|
141
143
|
simplecov-html (0.5.3)
|
@@ -1,26 +1,33 @@
|
|
1
1
|
module AttachmentMagick
|
2
|
-
|
3
|
-
|
2
|
+
if AttachmentMagick.configuration.orms.include?("ActiveRecord")
|
3
|
+
class ActiveRecordImage < ActiveRecord::Base
|
4
|
+
set_table_name "amagick_images"
|
4
5
|
|
5
|
-
|
6
|
-
|
6
|
+
belongs_to :imageable, :polymorphic => true
|
7
|
+
image_accessor :photo
|
7
8
|
|
8
|
-
|
9
|
+
attr_accessor :file_name #not implemented yet
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
auto_html_for :source => "_to_html" do
|
12
|
+
youtube(:width => 620, :height => 465)
|
13
|
+
vimeo(:width => 620, :height => 465)
|
14
|
+
end
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
auto_html_for :source => "_to_image" do
|
17
|
+
youtube_image
|
18
|
+
vimeo_image(:size => :large)
|
19
|
+
end
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
|
21
|
+
#not implemented yet
|
22
|
+
def is_flash?
|
23
|
+
false
|
24
|
+
end
|
23
25
|
end
|
24
|
-
|
25
|
-
|
26
|
-
|
26
|
+
else
|
27
|
+
#mongoid hack
|
28
|
+
#mongoid v2.3 tries to read all the models =/
|
29
|
+
class ActiveRecordImage
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -21,7 +21,7 @@ module AttachmentMagickTestHelper
|
|
21
21
|
default_options.merge!(options)
|
22
22
|
|
23
23
|
@artist = Artist.create(default_options)
|
24
|
-
@artist.images.create(:photo =>
|
24
|
+
@artist.images.create(:photo => example_file)
|
25
25
|
return @artist
|
26
26
|
end
|
27
27
|
|
@@ -30,29 +30,29 @@ module AttachmentMagickTestHelper
|
|
30
30
|
default_options.merge!(options)
|
31
31
|
|
32
32
|
@place = Place.create(default_options)
|
33
|
-
@place.images.create(:photo =>
|
33
|
+
@place.images.create(:photo => example_file)
|
34
34
|
return @place
|
35
35
|
end
|
36
36
|
|
37
37
|
def create_work(artist)
|
38
38
|
default_options = {:name => "movie", :local => "Hollywood"}
|
39
39
|
artist.works.create(default_options)
|
40
|
-
artist.works.last.images.create(:photo =>
|
40
|
+
artist.works.last.images.create(:photo => example_file)
|
41
41
|
end
|
42
42
|
|
43
|
-
def
|
43
|
+
def example_file
|
44
44
|
Tempfile.new('little_girl.jpg')
|
45
45
|
end
|
46
46
|
|
47
|
-
def
|
47
|
+
def example_youtube
|
48
48
|
'http://www.youtube.com/watch?v=FUe83k3t_0s'
|
49
49
|
end
|
50
50
|
|
51
|
-
def
|
51
|
+
def example_vimeo
|
52
52
|
'http://vimeo.com/14051767'
|
53
53
|
end
|
54
54
|
|
55
|
-
def
|
55
|
+
def example_partial
|
56
56
|
"layouts/custom_images_list"
|
57
57
|
end
|
58
58
|
end
|
@@ -9,37 +9,37 @@ class AttachmentMagick::ImagesControllerTest < ActionController::TestCase
|
|
9
9
|
end
|
10
10
|
|
11
11
|
test "should create artist image" do
|
12
|
-
post :create, artist_hash.merge({ :Filedata =>
|
12
|
+
post :create, artist_hash.merge({ :Filedata => example_file })
|
13
13
|
assert_response :success
|
14
14
|
assert assert_element_in(response.body, "img")
|
15
15
|
end
|
16
16
|
|
17
17
|
test "should create artist vimeo video" do
|
18
|
-
post :create, artist_hash.merge({ :source =>
|
18
|
+
post :create, artist_hash.merge({ :source => example_vimeo })
|
19
19
|
assert_response :success
|
20
20
|
assert assert_element_in(response.body, "img")
|
21
21
|
end
|
22
22
|
|
23
23
|
test "should create artist youtube video" do
|
24
|
-
post :create, artist_hash.merge({ :source =>
|
24
|
+
post :create, artist_hash.merge({ :source => example_youtube })
|
25
25
|
assert_response :success
|
26
26
|
assert assert_element_in(response.body, "img")
|
27
27
|
end
|
28
28
|
|
29
29
|
test "should create work image" do
|
30
|
-
post :create, work_hash.merge({ :Filedata =>
|
30
|
+
post :create, work_hash.merge({ :Filedata => example_file })
|
31
31
|
assert_response :success
|
32
32
|
assert assert_element_in(response.body, "img")
|
33
33
|
end
|
34
34
|
|
35
35
|
test "should create place image" do
|
36
|
-
post :create, place_hash.merge({ :Filedata =>
|
36
|
+
post :create, place_hash.merge({ :Filedata => example_file })
|
37
37
|
assert_response :success
|
38
38
|
assert assert_element_in(response.body, "img")
|
39
39
|
end
|
40
40
|
|
41
41
|
test "should update priority order" do
|
42
|
-
4.times{ @artist.images.create(:photo =>
|
42
|
+
4.times{ @artist.images.create(:photo => example_file) }
|
43
43
|
@artist.save
|
44
44
|
@artist.reload
|
45
45
|
|
@@ -70,7 +70,7 @@ class AttachmentMagick::ImagesControllerTest < ActionController::TestCase
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def work_hash
|
73
|
-
{:data_attachment => "#{@artist.class.name}_#{@artist.id}_works_#{@artist.works.last.id}", :data_partial =>
|
73
|
+
{:data_attachment => "#{@artist.class.name}_#{@artist.id}_works_#{@artist.works.last.id}", :data_partial => example_partial}
|
74
74
|
end
|
75
75
|
|
76
76
|
def place_hash
|
@@ -32,7 +32,7 @@ class AttachmentMagick::AttachmentMagickHelperTest < ActionView::TestCase
|
|
32
32
|
assert assert_element_in(html, "a[@class='remove_image']")
|
33
33
|
assert assert_element_in(html, "input[@id='image_id']")
|
34
34
|
|
35
|
-
html = attachment_for_view(@artist,
|
35
|
+
html = attachment_for_view(@artist, example_partial)
|
36
36
|
assert assert_element_in(html, "div[@class='image_caption']")
|
37
37
|
assert assert_element_in(html, "div[@class='image_thumb']")
|
38
38
|
assert assert_element_in(html, "img")
|
@@ -41,7 +41,7 @@ class AttachmentMagick::AttachmentMagickHelperTest < ActionView::TestCase
|
|
41
41
|
assert assert_element_in(html, "a[@class='remove_image']")
|
42
42
|
assert assert_element_in(html, "input[@id='image_id']")
|
43
43
|
|
44
|
-
html = attachment_for_view(@place,
|
44
|
+
html = attachment_for_view(@place, example_partial)
|
45
45
|
assert assert_element_in(html, "div[@class='image_caption']")
|
46
46
|
assert assert_element_in(html, "div[@class='image_thumb']")
|
47
47
|
assert assert_element_in(html, "img")
|
@@ -55,7 +55,7 @@ class AttachmentMagick::AttachmentMagickHelperTest < ActionView::TestCase
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def test_attachment_for_flash
|
58
|
-
@artist.images.create(:photo =>
|
58
|
+
@artist.images.create(:photo => example_file)
|
59
59
|
|
60
60
|
html = attachment_for_flash(@artist.images.first.photo.url)
|
61
61
|
assert assert_element_in(html, "object")
|
@@ -12,8 +12,8 @@ class ArtistTest < ActiveSupport::TestCase
|
|
12
12
|
|
13
13
|
def test_image_cover
|
14
14
|
@artist = Artist.create(:name => "Busk")
|
15
|
-
@image = @artist.images.create(:photo =>
|
16
|
-
@artist.images.create(:photo =>
|
15
|
+
@image = @artist.images.create(:photo => example_file, :priority => 0)
|
16
|
+
@artist.images.create(:photo => example_file, :priority => 1)
|
17
17
|
|
18
18
|
assert_equal @artist.image_cover, @image
|
19
19
|
end
|
@@ -8,8 +8,8 @@ class PlaceTest < ActiveSupport::TestCase
|
|
8
8
|
|
9
9
|
def test_image_cover
|
10
10
|
@place = Place.create(:name => "Busk")
|
11
|
-
@image = @place.images.create(:photo =>
|
12
|
-
@place.images.create(:photo =>
|
11
|
+
@image = @place.images.create(:photo => example_file, :priority => 0)
|
12
|
+
@place.images.create(:photo => example_file, :priority => 1)
|
13
13
|
|
14
14
|
assert_equal @place.image_cover, @image
|
15
15
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attachment_magick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,12 +11,12 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2011-10-
|
14
|
+
date: 2011-10-27 00:00:00.000000000 -02:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: dragonfly
|
19
|
-
requirement: &
|
19
|
+
requirement: &2165303660 !ruby/object:Gem::Requirement
|
20
20
|
none: false
|
21
21
|
requirements:
|
22
22
|
- - ! '>='
|
@@ -24,10 +24,10 @@ dependencies:
|
|
24
24
|
version: 0.9.5
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
|
-
version_requirements: *
|
27
|
+
version_requirements: *2165303660
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rack-cache
|
30
|
-
requirement: &
|
30
|
+
requirement: &2165303160 !ruby/object:Gem::Requirement
|
31
31
|
none: false
|
32
32
|
requirements:
|
33
33
|
- - ! '>='
|
@@ -35,10 +35,10 @@ dependencies:
|
|
35
35
|
version: '1.0'
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
|
-
version_requirements: *
|
38
|
+
version_requirements: *2165303160
|
39
39
|
- !ruby/object:Gem::Dependency
|
40
40
|
name: jquery-rails
|
41
|
-
requirement: &
|
41
|
+
requirement: &2165302700 !ruby/object:Gem::Requirement
|
42
42
|
none: false
|
43
43
|
requirements:
|
44
44
|
- - ! '>='
|
@@ -46,10 +46,10 @@ dependencies:
|
|
46
46
|
version: 0.2.7
|
47
47
|
type: :runtime
|
48
48
|
prerelease: false
|
49
|
-
version_requirements: *
|
49
|
+
version_requirements: *2165302700
|
50
50
|
- !ruby/object:Gem::Dependency
|
51
51
|
name: marcosinger-auto_html
|
52
|
-
requirement: &
|
52
|
+
requirement: &2165302240 !ruby/object:Gem::Requirement
|
53
53
|
none: false
|
54
54
|
requirements:
|
55
55
|
- - ! '>='
|
@@ -57,10 +57,10 @@ dependencies:
|
|
57
57
|
version: 1.3.6
|
58
58
|
type: :runtime
|
59
59
|
prerelease: false
|
60
|
-
version_requirements: *
|
60
|
+
version_requirements: *2165302240
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: marcosinger-css_parser
|
63
|
-
requirement: &
|
63
|
+
requirement: &2165301780 !ruby/object:Gem::Requirement
|
64
64
|
none: false
|
65
65
|
requirements:
|
66
66
|
- - ! '>='
|
@@ -68,7 +68,7 @@ dependencies:
|
|
68
68
|
version: 1.3.0
|
69
69
|
type: :runtime
|
70
70
|
prerelease: false
|
71
|
-
version_requirements: *
|
71
|
+
version_requirements: *2165301780
|
72
72
|
description:
|
73
73
|
email:
|
74
74
|
- markaum@gmail.com
|