sofa_gallery 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +4 -2
- data/Gemfile.lock +67 -61
- data/VERSION +1 -1
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/btnNext.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/btnPrevious.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/contentPattern.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/default_thumbnail.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/loader.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/sprite.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_square/btnNext.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_square/btnPrevious.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_square/contentPattern.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_square/default_thumbnail.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_square/loader.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_square/sprite.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/default/default_thumb.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/default/loader.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/default/sprite.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/default/sprite_next.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/default/sprite_prev.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/default/sprite_x.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/default/sprite_y.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/facebook/btnNext.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/facebook/btnPrevious.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternBottom.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternLeft.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternRight.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternTop.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/facebook/default_thumbnail.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/facebook/loader.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/facebook/sprite.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/light_rounded/btnNext.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/light_rounded/btnPrevious.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/light_rounded/default_thumbnail.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/light_rounded/loader.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/light_rounded/sprite.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/light_square/btnNext.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/light_square/btnPrevious.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/light_square/default_thumbnail.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/light_square/loader.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/light_square/sprite.png +0 -0
- data/app/assets/javascripts/sofa_gallery/admin.js +72 -0
- data/app/assets/javascripts/sofa_gallery/carousel.js +44 -0
- data/app/assets/javascripts/sofa_gallery/thumbnails.js +85 -0
- data/app/assets/stylesheets/sofa_gallery/admin.css +13 -0
- data/app/assets/stylesheets/sofa_gallery/application.css +0 -1
- data/app/assets/stylesheets/sofa_gallery/carousel.css +186 -0
- data/app/assets/stylesheets/sofa_gallery/tango/credits.txt +1 -0
- data/app/assets/stylesheets/sofa_gallery/tango/next-horizontal.png +0 -0
- data/app/assets/stylesheets/sofa_gallery/tango/next-vertical.png +0 -0
- data/app/assets/stylesheets/sofa_gallery/tango/prev-horizontal.png +0 -0
- data/app/assets/stylesheets/sofa_gallery/tango/prev-vertical.png +0 -0
- data/app/assets/stylesheets/sofa_gallery/thumbnails.css.scss +182 -0
- data/app/controllers/application_controller.rb +1 -0
- data/app/controllers/sofa_gallery/admin/base_controller.rb +3 -0
- data/app/controllers/{gallery_admin → sofa_gallery/admin}/galleries_controller.rb +4 -4
- data/app/controllers/{gallery_admin → sofa_gallery/admin}/photos_controller.rb +6 -6
- data/app/controllers/sofa_gallery/galleries_controller.rb +9 -0
- data/app/helpers/sofa_gallery_helper.rb +11 -1
- data/app/models/{sofa → sofa_gallery}/gallery.rb +2 -2
- data/app/models/{sofa → sofa_gallery}/photo.rb +18 -9
- data/app/views/layouts/gallery_admin/application.html.erb +2 -2
- data/app/views/sofa_gallery/_carousel.html.erb +17 -0
- data/app/views/sofa_gallery/_thumbnails.html.erb +19 -0
- data/app/views/sofa_gallery/admin/_html_head.html.erb +1 -0
- data/app/views/sofa_gallery/admin/_navigation.html.erb +5 -0
- data/app/views/sofa_gallery/admin/galleries/_form.html.erb +17 -0
- data/app/views/sofa_gallery/admin/galleries/edit.html.erb +5 -0
- data/app/views/sofa_gallery/admin/galleries/index.html.erb +48 -0
- data/app/views/sofa_gallery/admin/galleries/new.html.erb +5 -0
- data/app/views/sofa_gallery/admin/photos/_form.html.erb +16 -0
- data/app/views/sofa_gallery/admin/photos/crop.html.erb +64 -0
- data/app/views/sofa_gallery/admin/photos/edit.html.erb +5 -0
- data/app/views/{gallery_admin → sofa_gallery/admin}/photos/index.html.erb +4 -4
- data/app/views/sofa_gallery/admin/photos/new.html.erb +5 -0
- data/app/views/sofa_gallery/galleries/show.html.erb +1 -0
- data/config/routes.rb +12 -7
- data/db/migrate/01_create_sofa_gallery.rb +15 -12
- data/lib/paperclip_processors/cropper.rb +16 -3
- data/lib/sofa_gallery/configuration.rb +4 -4
- data/lib/sofa_gallery/engine.rb +2 -1
- data/sofa_gallery.gemspec +89 -30
- data/test/fixtures/files/default2.jpg +0 -0
- data/test/fixtures/{sofa → sofa_gallery}/galleries.yml +4 -2
- data/test/fixtures/{sofa → sofa_gallery}/photos.yml +0 -0
- data/test/functional/admin/galleries_controller_test.rb +87 -0
- data/test/functional/admin/photos_controller_test.rb +177 -0
- data/test/functional/galleries_controller_test.rb +8 -78
- data/test/test_helper.rb +4 -1
- data/test/unit/configuration_test.rb +1 -1
- data/test/unit/gallery_test.rb +6 -6
- data/test/unit/photo_test.rb +5 -5
- metadata +150 -79
- data/app/assets/javascripts/sofa_gallery/jquery.js +0 -18
- data/app/assets/javascripts/sofa_gallery/jquery_ui.js +0 -248
- data/app/assets/javascripts/sofa_gallery/rails.js +0 -315
- data/app/controllers/gallery_admin/base_controller.rb +0 -3
- data/app/views/gallery_admin/_navigation.html.erb +0 -1
- data/app/views/gallery_admin/galleries/_form.html.erb +0 -11
- data/app/views/gallery_admin/galleries/edit.html.erb +0 -5
- data/app/views/gallery_admin/galleries/index.html.erb +0 -28
- data/app/views/gallery_admin/galleries/new.html.erb +0 -5
- data/app/views/gallery_admin/photos/_form.html.erb +0 -13
- data/app/views/gallery_admin/photos/crop.html.erb +0 -32
- data/app/views/gallery_admin/photos/edit.html.erb +0 -5
- data/app/views/gallery_admin/photos/new.html.erb +0 -5
- data/test/functional/photos_controller_test.rb +0 -123
@@ -0,0 +1,177 @@
|
|
1
|
+
require File.expand_path('../../test_helper', File.dirname(__FILE__))
|
2
|
+
|
3
|
+
class SofaGallery::Admin::PhotosControllerTest < ActionController::TestCase
|
4
|
+
|
5
|
+
def test_get_index
|
6
|
+
get :index, :gallery_id => sofa_gallery_galleries(:default)
|
7
|
+
assert_response :success
|
8
|
+
assert_template 'index'
|
9
|
+
assert assigns(:photos)
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_get_index_failure
|
13
|
+
get :index, :gallery_id => 'invalid'
|
14
|
+
assert_response :redirect
|
15
|
+
assert_redirected_to sofa_gallery_admin_galleries_path
|
16
|
+
assert_equal 'Gallery not found', flash[:error]
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_new
|
20
|
+
gallery = sofa_gallery_galleries(:default)
|
21
|
+
get :new, :gallery_id => gallery
|
22
|
+
assert_response :success
|
23
|
+
assert_template 'new'
|
24
|
+
assert assigns(:photo)
|
25
|
+
assert_select "form[action='/admin/galleries/#{gallery.id}/photos']"
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_creation
|
29
|
+
assert_difference 'SofaGallery::Photo.count' do
|
30
|
+
post :create, :gallery_id => sofa_gallery_galleries(:default), :photo => {
|
31
|
+
:title => 'Test Photo',
|
32
|
+
:slug => 'test-photo',
|
33
|
+
:image => fixture_file_upload('/files/default.jpg', 'image/jpeg')
|
34
|
+
}
|
35
|
+
assert_response :redirect
|
36
|
+
assert_redirected_to :action => :index
|
37
|
+
assert_equal 'Photo created', flash[:notice]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_creation_fail
|
42
|
+
assert_no_difference 'SofaGallery::Photo.count' do
|
43
|
+
post :create, :gallery_id => sofa_gallery_galleries(:default), :photo => { }
|
44
|
+
assert_response :success
|
45
|
+
assert_template 'new'
|
46
|
+
assert_equal 'Failed to create Photo', flash[:error]
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_get_edit
|
51
|
+
photo = sofa_gallery_photos(:default)
|
52
|
+
get :edit, :gallery_id => photo.gallery, :id => photo
|
53
|
+
assert_response :success
|
54
|
+
assert_template 'edit'
|
55
|
+
assert_select "form[action='/admin/galleries/#{photo.gallery.id}/photos/#{photo.id}']"
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_get_edit_failure
|
59
|
+
get :edit, :gallery_id => sofa_gallery_galleries(:default), :id => 'invalid'
|
60
|
+
assert_response :redirect
|
61
|
+
assert_redirected_to :action => :index
|
62
|
+
assert_equal 'Photo not found', flash[:error]
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_update
|
66
|
+
photo = sofa_gallery_photos(:default)
|
67
|
+
put :update, :gallery_id => photo.gallery, :id => photo, :photo => {
|
68
|
+
:title => 'Updated Title'
|
69
|
+
}
|
70
|
+
assert_response :redirect
|
71
|
+
assert_redirected_to :action => :index
|
72
|
+
assert_equal 'Photo updated', flash[:notice]
|
73
|
+
|
74
|
+
photo.reload
|
75
|
+
assert_equal 'Updated Title', photo.title
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_update_failure
|
79
|
+
photo = sofa_gallery_photos(:default)
|
80
|
+
put :update, :gallery_id => photo.gallery, :id => photo, :photo => {
|
81
|
+
:title => 'Updated Title',
|
82
|
+
:image => fixture_file_upload('/files/default.txt', 'text/plain')
|
83
|
+
}
|
84
|
+
assert_response :success
|
85
|
+
assert_template :edit
|
86
|
+
assert_equal 'Failed to updated Photo', flash[:error]
|
87
|
+
|
88
|
+
photo.reload
|
89
|
+
assert_not_equal 'Updated Title', photo.description
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_destroy
|
93
|
+
photo = sofa_gallery_photos(:default)
|
94
|
+
assert_difference 'SofaGallery::Photo.count', -1 do
|
95
|
+
delete :destroy, :gallery_id => photo.gallery, :id => photo
|
96
|
+
assert_response :redirect
|
97
|
+
assert_redirected_to :action => :index
|
98
|
+
assert_equal 'Photo deleted', flash[:notice]
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def test_reorder
|
103
|
+
gallery = sofa_gallery_galleries(:default)
|
104
|
+
photo_one = sofa_gallery_photos(:default)
|
105
|
+
photo_two = SofaGallery::Photo.create!(
|
106
|
+
:gallery => gallery,
|
107
|
+
:title => 'Test Photo',
|
108
|
+
:slug => 'test-photo',
|
109
|
+
:image => fixture_file_upload('/files/default.jpg', 'image/jpeg')
|
110
|
+
)
|
111
|
+
assert_equal 0, photo_one.position
|
112
|
+
assert_equal 1, photo_two.position
|
113
|
+
|
114
|
+
post :reorder, :gallery_id => photo_one.gallery, :sofa_gallery_photo => [photo_two.id, photo_one.id]
|
115
|
+
assert_response :success
|
116
|
+
photo_one.reload
|
117
|
+
photo_two.reload
|
118
|
+
|
119
|
+
assert_equal 1, photo_one.position
|
120
|
+
assert_equal 0, photo_two.position
|
121
|
+
end
|
122
|
+
|
123
|
+
def test_get_crop
|
124
|
+
photo = sofa_gallery_photos(:default)
|
125
|
+
photo.image = fixture_file_upload('/files/default.jpg', 'image/jpeg')
|
126
|
+
photo.save!
|
127
|
+
|
128
|
+
get :crop, :gallery_id => photo.gallery, :id => photo
|
129
|
+
assert_response :success
|
130
|
+
assert_template 'crop'
|
131
|
+
assert assigns(:photo)
|
132
|
+
end
|
133
|
+
|
134
|
+
def test_crop_thumbnail
|
135
|
+
photo = sofa_gallery_photos(:default)
|
136
|
+
put :update, :gallery_id => photo.gallery, :id => photo, :photo => {
|
137
|
+
:thumb_crop_x => '0',
|
138
|
+
:thumb_crop_y => '0',
|
139
|
+
:thumb_crop_w => '100',
|
140
|
+
:thumb_crop_h => '100'
|
141
|
+
}
|
142
|
+
|
143
|
+
assert_response :redirect
|
144
|
+
assert_redirected_to :action => :index
|
145
|
+
assert_equal 'Photo updated', flash[:notice]
|
146
|
+
end
|
147
|
+
|
148
|
+
|
149
|
+
def test_crop_thumbnail_and_full
|
150
|
+
gallery = SofaGallery::Gallery.create!(
|
151
|
+
:title => "Title",
|
152
|
+
:slug => "title",
|
153
|
+
:force_ratio_full => true
|
154
|
+
)
|
155
|
+
photo = SofaGallery::Photo.create!(
|
156
|
+
:gallery => gallery,
|
157
|
+
:title => 'Test Photo',
|
158
|
+
:slug => 'test-photo',
|
159
|
+
:image => fixture_file_upload('/files/default.jpg', 'image/jpeg')
|
160
|
+
)
|
161
|
+
put :update, :gallery_id => gallery, :id => photo, :photo => {
|
162
|
+
:thumb_crop_x => '0',
|
163
|
+
:thumb_crop_y => '0',
|
164
|
+
:thumb_crop_w => '100',
|
165
|
+
:thumb_crop_h => '100',
|
166
|
+
:full_crop_x => '0',
|
167
|
+
:full_crop_y => '0',
|
168
|
+
:full_crop_w => '100',
|
169
|
+
:full_crop_h => '100'
|
170
|
+
}
|
171
|
+
|
172
|
+
assert_response :redirect
|
173
|
+
assert_redirected_to :action => :index
|
174
|
+
assert_equal 'Photo updated', flash[:notice]
|
175
|
+
end
|
176
|
+
|
177
|
+
end
|
@@ -1,87 +1,17 @@
|
|
1
1
|
require File.expand_path('../test_helper', File.dirname(__FILE__))
|
2
2
|
|
3
|
-
class
|
3
|
+
class SofaGallery::GalleriesControllerTest < ActionController::TestCase
|
4
4
|
|
5
|
-
def
|
6
|
-
get :
|
5
|
+
def test_get_show
|
6
|
+
get :show, :id => sofa_gallery_galleries(:default)
|
7
7
|
assert_response :success
|
8
|
-
assert_template
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_get_new
|
12
|
-
get :new
|
13
|
-
assert_response :success
|
14
|
-
assert_template 'new'
|
8
|
+
assert_template :show
|
15
9
|
assert assigns(:gallery)
|
16
|
-
assert_select "form[action='/cms-admin/galleries']"
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_creation
|
20
|
-
assert_difference 'Sofa::Gallery.count', 1 do
|
21
|
-
post :create, :gallery => {
|
22
|
-
:title => 'Test Gallery',
|
23
|
-
:slug => 'test-gallery',
|
24
|
-
:description => 'Test Description'
|
25
|
-
}
|
26
|
-
end
|
27
|
-
assert_equal 'Gallery created', flash[:notice]
|
28
|
-
assert_redirected_to :action => :index
|
29
10
|
end
|
30
11
|
|
31
|
-
def
|
32
|
-
|
33
|
-
|
34
|
-
end
|
35
|
-
assert_response :success
|
36
|
-
assert_template 'new'
|
37
|
-
assert_equal 'Failed to create Gallery', flash[:error]
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_get_edit
|
41
|
-
gallery = sofa_galleries(:default)
|
42
|
-
get :edit, :id => gallery
|
43
|
-
assert_response :success
|
44
|
-
assert_template 'edit'
|
45
|
-
assert assigns(:gallery)
|
46
|
-
assert_select "form[action='/cms-admin/galleries/#{gallery.id}']"
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_get_edit_failure
|
50
|
-
get :edit, :id => 'invalid'
|
51
|
-
assert_response :redirect
|
52
|
-
assert_redirected_to :action => :index
|
53
|
-
assert_equal 'Gallery not found', flash[:error]
|
54
|
-
end
|
55
|
-
|
56
|
-
def test_update
|
57
|
-
gallery = sofa_galleries(:default)
|
58
|
-
put :update, :id => gallery, :gallery => {
|
59
|
-
:title => 'New Title'
|
60
|
-
}
|
61
|
-
gallery.reload
|
62
|
-
assert_equal 'New Title', gallery.title
|
63
|
-
assert_equal 'Gallery updated', flash[:notice]
|
64
|
-
assert_redirected_to :action => :index
|
65
|
-
end
|
66
|
-
|
67
|
-
def test_update_failure
|
68
|
-
gallery = sofa_galleries(:default)
|
69
|
-
put :update, :id => gallery, :gallery => {
|
70
|
-
:title => ''
|
71
|
-
}
|
72
|
-
assert_response :success
|
73
|
-
assert_template 'edit'
|
74
|
-
assert_equal 'Failed to update Gallery', flash[:error]
|
75
|
-
gallery.reload
|
76
|
-
assert_not_equal '', gallery.title
|
77
|
-
end
|
78
|
-
|
79
|
-
def test_destroy
|
80
|
-
assert_difference 'Sofa::Gallery.count', -1 do
|
81
|
-
delete :destroy, :id => sofa_galleries(:default)
|
82
|
-
end
|
83
|
-
assert_equal 'Gallery deleted', flash[:notice]
|
84
|
-
assert_redirected_to :action => :index
|
12
|
+
def test_get_show_failure
|
13
|
+
get :show, :id => 'invalid'
|
14
|
+
assert_response 404
|
85
15
|
end
|
86
16
|
|
87
|
-
end
|
17
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -14,7 +14,10 @@ class ActiveSupport::TestCase
|
|
14
14
|
# resetting default configuration
|
15
15
|
def reset_config
|
16
16
|
SofaGallery.configure do |config|
|
17
|
-
config.admin_route_prefix = '
|
17
|
+
config.admin_route_prefix = 'admin'
|
18
|
+
config.upload_options = { }
|
19
|
+
config.admin_controller = 'ApplicationController'
|
20
|
+
config.form_builder = 'SofaGallery::FormBuilder'
|
18
21
|
end
|
19
22
|
end
|
20
23
|
|
@@ -4,7 +4,7 @@ class ConfigurationTest < ActiveSupport::TestCase
|
|
4
4
|
|
5
5
|
def test_configuration_presense
|
6
6
|
assert config = SofaGallery.configuration
|
7
|
-
assert_equal
|
7
|
+
assert_equal ({}), config.upload_options
|
8
8
|
assert_equal 'admin', config.admin_route_prefix
|
9
9
|
assert_equal 'ApplicationController', config.admin_controller
|
10
10
|
assert_equal 'SofaGallery::FormBuilder', config.form_builder
|
data/test/unit/gallery_test.rb
CHANGED
@@ -3,20 +3,20 @@ require File.expand_path('../test_helper', File.dirname(__FILE__))
|
|
3
3
|
class GalleryTest < ActiveSupport::TestCase
|
4
4
|
|
5
5
|
def test_fixtures_validity
|
6
|
-
|
6
|
+
SofaGallery::Gallery.all.each do |gallery|
|
7
7
|
assert gallery.valid?, gallery.errors.full_messages.to_s
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
def test_validations
|
12
|
-
gallery =
|
12
|
+
gallery = SofaGallery::Gallery.new
|
13
13
|
assert gallery.invalid?
|
14
14
|
assert_has_errors_on gallery, [:title, :slug]
|
15
15
|
end
|
16
16
|
|
17
17
|
def test_creation
|
18
|
-
assert_difference '
|
19
|
-
|
18
|
+
assert_difference 'SofaGallery::Gallery.count' do
|
19
|
+
SofaGallery::Gallery.create!(
|
20
20
|
:title => 'Test Gallery',
|
21
21
|
:slug => 'test-gallery'
|
22
22
|
)
|
@@ -24,8 +24,8 @@ class GalleryTest < ActiveSupport::TestCase
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def test_destoy
|
27
|
-
gallery =
|
28
|
-
assert_difference ['
|
27
|
+
gallery = sofa_gallery_galleries(:default)
|
28
|
+
assert_difference ['SofaGallery::Gallery.count', 'SofaGallery::Photo.count'], -1 do
|
29
29
|
gallery.destroy
|
30
30
|
end
|
31
31
|
end
|
data/test/unit/photo_test.rb
CHANGED
@@ -3,21 +3,21 @@ require File.expand_path('../test_helper', File.dirname(__FILE__))
|
|
3
3
|
class PhotoTest < ActiveSupport::TestCase
|
4
4
|
|
5
5
|
def test_fixtures_validity
|
6
|
-
|
6
|
+
SofaGallery::Photo.all.each do |photo|
|
7
7
|
assert photo.valid?, photo.errors.full_messages.to_s
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
def test_validations
|
12
|
-
photo =
|
12
|
+
photo = SofaGallery::Photo.new
|
13
13
|
assert photo.invalid?
|
14
14
|
assert_has_errors_on photo, :image_file_name
|
15
15
|
end
|
16
16
|
|
17
17
|
def test_creation
|
18
|
-
gallery =
|
19
|
-
assert_difference '
|
20
|
-
|
18
|
+
gallery = sofa_gallery_galleries(:default)
|
19
|
+
assert_difference 'SofaGallery::Photo.count' do
|
20
|
+
SofaGallery::Photo.create!(
|
21
21
|
:gallery => gallery,
|
22
22
|
:title => 'Test Photo',
|
23
23
|
:slug => 'test-photo',
|
metadata
CHANGED
@@ -1,73 +1,93 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: sofa_gallery
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
4
5
|
prerelease:
|
5
|
-
version: 0.0.0
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Oleg Khabarov
|
9
9
|
- Stephen McLeod
|
10
10
|
- The Working Group Inc.
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
|
15
|
-
|
16
|
-
dependencies:
|
17
|
-
- !ruby/object:Gem::Dependency
|
14
|
+
date: 2011-09-20 00:00:00.000000000 -04:00
|
15
|
+
default_executable:
|
16
|
+
dependencies:
|
17
|
+
- !ruby/object:Gem::Dependency
|
18
18
|
name: rails
|
19
|
-
requirement: &
|
19
|
+
requirement: &70269053084160 !ruby/object:Gem::Requirement
|
20
20
|
none: false
|
21
|
-
requirements:
|
22
|
-
- -
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version: 3.1.0
|
21
|
+
requirements:
|
22
|
+
- - ! '>='
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 3.1.0
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
|
-
version_requirements: *
|
28
|
-
- !ruby/object:Gem::Dependency
|
27
|
+
version_requirements: *70269053084160
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
29
|
name: paperclip
|
30
|
-
requirement: &
|
30
|
+
requirement: &70269053082840 !ruby/object:Gem::Requirement
|
31
31
|
none: false
|
32
|
-
requirements:
|
33
|
-
- -
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version:
|
32
|
+
requirements:
|
33
|
+
- - ! '>='
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 2.3.14
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
|
-
version_requirements: *
|
39
|
-
- !ruby/object:Gem::Dependency
|
38
|
+
version_requirements: *70269053082840
|
39
|
+
- !ruby/object:Gem::Dependency
|
40
|
+
name: jquery-rails
|
41
|
+
requirement: &70269053081920 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - =
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 1.0.14
|
47
|
+
type: :runtime
|
48
|
+
prerelease: false
|
49
|
+
version_requirements: *70269053081920
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: sass-rails
|
52
|
+
requirement: &70269053081020 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ! '>='
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
type: :runtime
|
59
|
+
prerelease: false
|
60
|
+
version_requirements: *70269053081020
|
61
|
+
- !ruby/object:Gem::Dependency
|
40
62
|
name: sqlite3
|
41
|
-
requirement: &
|
63
|
+
requirement: &70269053080140 !ruby/object:Gem::Requirement
|
42
64
|
none: false
|
43
|
-
requirements:
|
44
|
-
- -
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version:
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
47
69
|
type: :development
|
48
70
|
prerelease: false
|
49
|
-
version_requirements: *
|
50
|
-
- !ruby/object:Gem::Dependency
|
71
|
+
version_requirements: *70269053080140
|
72
|
+
- !ruby/object:Gem::Dependency
|
51
73
|
name: jeweler
|
52
|
-
requirement: &
|
74
|
+
requirement: &70269053073700 !ruby/object:Gem::Requirement
|
53
75
|
none: false
|
54
|
-
requirements:
|
55
|
-
- -
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version:
|
76
|
+
requirements:
|
77
|
+
- - ! '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
58
80
|
type: :development
|
59
81
|
prerelease: false
|
60
|
-
version_requirements: *
|
61
|
-
description:
|
82
|
+
version_requirements: *70269053073700
|
83
|
+
description: ''
|
62
84
|
email: stephen@theworkinggroup.ca
|
63
85
|
executables: []
|
64
|
-
|
65
86
|
extensions: []
|
66
|
-
|
67
|
-
extra_rdoc_files:
|
87
|
+
extra_rdoc_files:
|
68
88
|
- LICENSE
|
69
89
|
- README.md
|
70
|
-
files:
|
90
|
+
files:
|
71
91
|
- .document
|
72
92
|
- Gemfile
|
73
93
|
- Gemfile.lock
|
@@ -76,32 +96,83 @@ files:
|
|
76
96
|
- Rakefile
|
77
97
|
- VERSION
|
78
98
|
- app/assets/images/sofa_gallery/jcrop.gif
|
99
|
+
- app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/btnNext.png
|
100
|
+
- app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/btnPrevious.png
|
101
|
+
- app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/contentPattern.png
|
102
|
+
- app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/default_thumbnail.gif
|
103
|
+
- app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/loader.gif
|
104
|
+
- app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/sprite.png
|
105
|
+
- app/assets/images/sofa_gallery/prettyPhoto/dark_square/btnNext.png
|
106
|
+
- app/assets/images/sofa_gallery/prettyPhoto/dark_square/btnPrevious.png
|
107
|
+
- app/assets/images/sofa_gallery/prettyPhoto/dark_square/contentPattern.png
|
108
|
+
- app/assets/images/sofa_gallery/prettyPhoto/dark_square/default_thumbnail.gif
|
109
|
+
- app/assets/images/sofa_gallery/prettyPhoto/dark_square/loader.gif
|
110
|
+
- app/assets/images/sofa_gallery/prettyPhoto/dark_square/sprite.png
|
111
|
+
- app/assets/images/sofa_gallery/prettyPhoto/default/default_thumb.png
|
112
|
+
- app/assets/images/sofa_gallery/prettyPhoto/default/loader.gif
|
113
|
+
- app/assets/images/sofa_gallery/prettyPhoto/default/sprite.png
|
114
|
+
- app/assets/images/sofa_gallery/prettyPhoto/default/sprite_next.png
|
115
|
+
- app/assets/images/sofa_gallery/prettyPhoto/default/sprite_prev.png
|
116
|
+
- app/assets/images/sofa_gallery/prettyPhoto/default/sprite_x.png
|
117
|
+
- app/assets/images/sofa_gallery/prettyPhoto/default/sprite_y.png
|
118
|
+
- app/assets/images/sofa_gallery/prettyPhoto/facebook/btnNext.png
|
119
|
+
- app/assets/images/sofa_gallery/prettyPhoto/facebook/btnPrevious.png
|
120
|
+
- app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternBottom.png
|
121
|
+
- app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternLeft.png
|
122
|
+
- app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternRight.png
|
123
|
+
- app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternTop.png
|
124
|
+
- app/assets/images/sofa_gallery/prettyPhoto/facebook/default_thumbnail.gif
|
125
|
+
- app/assets/images/sofa_gallery/prettyPhoto/facebook/loader.gif
|
126
|
+
- app/assets/images/sofa_gallery/prettyPhoto/facebook/sprite.png
|
127
|
+
- app/assets/images/sofa_gallery/prettyPhoto/light_rounded/btnNext.png
|
128
|
+
- app/assets/images/sofa_gallery/prettyPhoto/light_rounded/btnPrevious.png
|
129
|
+
- app/assets/images/sofa_gallery/prettyPhoto/light_rounded/default_thumbnail.gif
|
130
|
+
- app/assets/images/sofa_gallery/prettyPhoto/light_rounded/loader.gif
|
131
|
+
- app/assets/images/sofa_gallery/prettyPhoto/light_rounded/sprite.png
|
132
|
+
- app/assets/images/sofa_gallery/prettyPhoto/light_square/btnNext.png
|
133
|
+
- app/assets/images/sofa_gallery/prettyPhoto/light_square/btnPrevious.png
|
134
|
+
- app/assets/images/sofa_gallery/prettyPhoto/light_square/default_thumbnail.gif
|
135
|
+
- app/assets/images/sofa_gallery/prettyPhoto/light_square/loader.gif
|
136
|
+
- app/assets/images/sofa_gallery/prettyPhoto/light_square/sprite.png
|
137
|
+
- app/assets/javascripts/sofa_gallery/admin.js
|
79
138
|
- app/assets/javascripts/sofa_gallery/application.js
|
139
|
+
- app/assets/javascripts/sofa_gallery/carousel.js
|
80
140
|
- app/assets/javascripts/sofa_gallery/jquery.jcrop.js
|
81
|
-
- app/assets/javascripts/sofa_gallery/
|
82
|
-
- app/assets/
|
83
|
-
- app/assets/javascripts/sofa_gallery/rails.js
|
141
|
+
- app/assets/javascripts/sofa_gallery/thumbnails.js
|
142
|
+
- app/assets/stylesheets/sofa_gallery/admin.css
|
84
143
|
- app/assets/stylesheets/sofa_gallery/application.css
|
144
|
+
- app/assets/stylesheets/sofa_gallery/carousel.css
|
85
145
|
- app/assets/stylesheets/sofa_gallery/jquery.jcrop.css
|
86
146
|
- app/assets/stylesheets/sofa_gallery/reset.css
|
147
|
+
- app/assets/stylesheets/sofa_gallery/tango/credits.txt
|
148
|
+
- app/assets/stylesheets/sofa_gallery/tango/next-horizontal.png
|
149
|
+
- app/assets/stylesheets/sofa_gallery/tango/next-vertical.png
|
150
|
+
- app/assets/stylesheets/sofa_gallery/tango/prev-horizontal.png
|
151
|
+
- app/assets/stylesheets/sofa_gallery/tango/prev-vertical.png
|
152
|
+
- app/assets/stylesheets/sofa_gallery/thumbnails.css.scss
|
87
153
|
- app/controllers/application_controller.rb
|
88
|
-
- app/controllers/
|
89
|
-
- app/controllers/
|
90
|
-
- app/controllers/
|
154
|
+
- app/controllers/sofa_gallery/admin/base_controller.rb
|
155
|
+
- app/controllers/sofa_gallery/admin/galleries_controller.rb
|
156
|
+
- app/controllers/sofa_gallery/admin/photos_controller.rb
|
157
|
+
- app/controllers/sofa_gallery/galleries_controller.rb
|
91
158
|
- app/helpers/sofa_gallery_helper.rb
|
92
|
-
- app/models/
|
93
|
-
- app/models/
|
94
|
-
- app/views/gallery_admin/_navigation.html.erb
|
95
|
-
- app/views/gallery_admin/galleries/_form.html.erb
|
96
|
-
- app/views/gallery_admin/galleries/edit.html.erb
|
97
|
-
- app/views/gallery_admin/galleries/index.html.erb
|
98
|
-
- app/views/gallery_admin/galleries/new.html.erb
|
99
|
-
- app/views/gallery_admin/photos/_form.html.erb
|
100
|
-
- app/views/gallery_admin/photos/crop.html.erb
|
101
|
-
- app/views/gallery_admin/photos/edit.html.erb
|
102
|
-
- app/views/gallery_admin/photos/index.html.erb
|
103
|
-
- app/views/gallery_admin/photos/new.html.erb
|
159
|
+
- app/models/sofa_gallery/gallery.rb
|
160
|
+
- app/models/sofa_gallery/photo.rb
|
104
161
|
- app/views/layouts/gallery_admin/application.html.erb
|
162
|
+
- app/views/sofa_gallery/_carousel.html.erb
|
163
|
+
- app/views/sofa_gallery/_thumbnails.html.erb
|
164
|
+
- app/views/sofa_gallery/admin/_html_head.html.erb
|
165
|
+
- app/views/sofa_gallery/admin/_navigation.html.erb
|
166
|
+
- app/views/sofa_gallery/admin/galleries/_form.html.erb
|
167
|
+
- app/views/sofa_gallery/admin/galleries/edit.html.erb
|
168
|
+
- app/views/sofa_gallery/admin/galleries/index.html.erb
|
169
|
+
- app/views/sofa_gallery/admin/galleries/new.html.erb
|
170
|
+
- app/views/sofa_gallery/admin/photos/_form.html.erb
|
171
|
+
- app/views/sofa_gallery/admin/photos/crop.html.erb
|
172
|
+
- app/views/sofa_gallery/admin/photos/edit.html.erb
|
173
|
+
- app/views/sofa_gallery/admin/photos/index.html.erb
|
174
|
+
- app/views/sofa_gallery/admin/photos/new.html.erb
|
175
|
+
- app/views/sofa_gallery/galleries/show.html.erb
|
105
176
|
- config.ru
|
106
177
|
- config/application.rb
|
107
178
|
- config/boot.rb
|
@@ -125,43 +196,43 @@ files:
|
|
125
196
|
- sofa_gallery.gemspec
|
126
197
|
- test/fixtures/files/default.jpg
|
127
198
|
- test/fixtures/files/default.txt
|
128
|
-
- test/fixtures/
|
129
|
-
- test/fixtures/
|
199
|
+
- test/fixtures/files/default2.jpg
|
200
|
+
- test/fixtures/sofa_gallery/galleries.yml
|
201
|
+
- test/fixtures/sofa_gallery/photos.yml
|
202
|
+
- test/functional/admin/galleries_controller_test.rb
|
203
|
+
- test/functional/admin/photos_controller_test.rb
|
130
204
|
- test/functional/galleries_controller_test.rb
|
131
|
-
- test/functional/photos_controller_test.rb
|
132
205
|
- test/test_helper.rb
|
133
206
|
- test/unit/configuration_test.rb
|
134
207
|
- test/unit/gallery_test.rb
|
135
208
|
- test/unit/photo_test.rb
|
209
|
+
has_rdoc: true
|
136
210
|
homepage: http://github.com/twg/sofa-gallery
|
137
|
-
licenses:
|
211
|
+
licenses:
|
138
212
|
- MIT
|
139
213
|
post_install_message:
|
140
214
|
rdoc_options: []
|
141
|
-
|
142
|
-
require_paths:
|
215
|
+
require_paths:
|
143
216
|
- lib
|
144
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
217
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
145
218
|
none: false
|
146
|
-
requirements:
|
147
|
-
- -
|
148
|
-
- !ruby/object:Gem::Version
|
149
|
-
|
150
|
-
segments:
|
219
|
+
requirements:
|
220
|
+
- - ! '>='
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: '0'
|
223
|
+
segments:
|
151
224
|
- 0
|
152
|
-
|
153
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
225
|
+
hash: 2738246894113913333
|
226
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
227
|
none: false
|
155
|
-
requirements:
|
156
|
-
- -
|
157
|
-
- !ruby/object:Gem::Version
|
158
|
-
version:
|
228
|
+
requirements:
|
229
|
+
- - ! '>='
|
230
|
+
- !ruby/object:Gem::Version
|
231
|
+
version: '0'
|
159
232
|
requirements: []
|
160
|
-
|
161
233
|
rubyforge_project:
|
162
|
-
rubygems_version: 1.
|
234
|
+
rubygems_version: 1.6.2
|
163
235
|
signing_key:
|
164
236
|
specification_version: 3
|
165
237
|
summary: SofaGallery is an image gallery engine for Rails 3.1 apps (and ComfortableMexicanSofa)
|
166
238
|
test_files: []
|
167
|
-
|