sweet_portfolio 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.powrc +4 -0
- data/.ruby-version +1 -0
- data/.travis.yml +2 -0
- data/Gemfile +11 -0
- data/LICENSE +20 -0
- data/README.md +37 -0
- data/Rakefile +21 -0
- data/VERSION +1 -0
- data/app/assets/images/sweet_portfolio/blank.gif +0 -0
- data/app/assets/images/sweet_portfolio/border.png +0 -0
- data/app/assets/images/sweet_portfolio/controls.png +0 -0
- data/app/assets/images/sweet_portfolio/fancybox_loading.gif +0 -0
- data/app/assets/images/sweet_portfolio/fancybox_overlay.png +0 -0
- data/app/assets/images/sweet_portfolio/fancybox_sprite.png +0 -0
- data/app/assets/images/sweet_portfolio/jcrop.gif +0 -0
- data/app/assets/images/sweet_portfolio/loading.gif +0 -0
- data/app/assets/images/sweet_portfolio/loading_background.png +0 -0
- data/app/assets/images/sweet_portfolio/overlay.png +0 -0
- data/app/assets/javascripts/sweet_portfolio/jquery.colorbox.js +4 -0
- data/app/assets/javascripts/sweet_portfolio/jquery.fancybox-media.js +196 -0
- data/app/assets/javascripts/sweet_portfolio/jquery.fancybox-thumbs.js +162 -0
- data/app/assets/javascripts/sweet_portfolio/jquery.fancybox.pack.js +45 -0
- data/app/assets/javascripts/sweet_portfolio/jquery.jcrop.js +246 -0
- data/app/assets/stylesheets/sweet_portfolio/colorbox.css +61 -0
- data/app/assets/stylesheets/sweet_portfolio/jquery.fancybox-thumbs.css +54 -0
- data/app/assets/stylesheets/sweet_portfolio/jquery.fancybox.css +249 -0
- data/app/assets/stylesheets/sweet_portfolio/jquery.jcrop.css +32 -0
- data/app/controllers/admin/gallery/base_controller.rb +3 -0
- data/app/controllers/admin/gallery/galleries_controller.rb +72 -0
- data/app/controllers/admin/gallery/photos_controller.rb +90 -0
- data/app/controllers/application_controller.rb +7 -0
- data/app/helpers/gallery/application_helper.rb +12 -0
- data/app/models/gallery/gallery.rb +33 -0
- data/app/models/gallery/photo.rb +83 -0
- data/app/views/admin/gallery/_navigation.html.erb +1 -0
- data/app/views/admin/gallery/galleries/_form.html.haml +15 -0
- data/app/views/admin/gallery/galleries/edit.html.haml +5 -0
- data/app/views/admin/gallery/galleries/index.html.haml +28 -0
- data/app/views/admin/gallery/galleries/new.html.haml +5 -0
- data/app/views/admin/gallery/photos/_form.html.haml +12 -0
- data/app/views/admin/gallery/photos/crop.html.haml +50 -0
- data/app/views/admin/gallery/photos/edit.html.haml +5 -0
- data/app/views/admin/gallery/photos/index.html.haml +19 -0
- data/app/views/admin/gallery/photos/new.html.haml +5 -0
- data/app/views/layouts/gallery/application.html.haml +12 -0
- data/config.ru +4 -0
- data/config/application.rb +51 -0
- data/config/boot.rb +13 -0
- data/config/database.yml +16 -0
- data/config/environment.rb +5 -0
- data/config/environments/development.rb +25 -0
- data/config/environments/production.rb +52 -0
- data/config/environments/test.rb +39 -0
- data/config/initializers/paperclip.rb +3 -0
- data/config/initializers/sweet_portfolio.rb +12 -0
- data/config/routes.rb +3 -0
- data/db/migrate/01_create_sweet_portfolio.rb +37 -0
- data/lib/generators/sweet_portfolio/README +10 -0
- data/lib/generators/sweet_portfolio/sweet_portfolio.rb +37 -0
- data/lib/paperclip_processors/cropper.rb +31 -0
- data/lib/sweet_portfolio.rb +28 -0
- data/lib/sweet_portfolio/configuration.rb +26 -0
- data/lib/sweet_portfolio/engine.rb +21 -0
- data/lib/sweet_portfolio/form_builder.rb +50 -0
- data/lib/sweet_portfolio/routing.rb +21 -0
- data/lib/tasks/sweet_portfolio.rake +4 -0
- data/script/rails +6 -0
- data/sweet_portfolio.gemspec +134 -0
- data/test/fixtures/files/default.jpg +0 -0
- data/test/fixtures/files/default.txt +1 -0
- data/test/fixtures/files/default2.jpg +0 -0
- data/test/fixtures/gallery/galleries.yml +11 -0
- data/test/fixtures/gallery/photos.yml +8 -0
- data/test/functional/admin/gallery/galleries_controller_test.rb +107 -0
- data/test/functional/admin/gallery/photos_controller_test.rb +224 -0
- data/test/test_helper.rb +39 -0
- data/test/unit/configuration_test.rb +16 -0
- data/test/unit/gallery_test.rb +38 -0
- data/test/unit/photo_test.rb +40 -0
- metadata +228 -0
data/test/test_helper.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
2
|
+
require File.expand_path('../../config/environment', __FILE__)
|
3
|
+
require 'rails/test_help'
|
4
|
+
|
5
|
+
class ActiveSupport::TestCase
|
6
|
+
|
7
|
+
fixtures :all
|
8
|
+
include ActionDispatch::TestProcess
|
9
|
+
|
10
|
+
def setup
|
11
|
+
reset_config
|
12
|
+
end
|
13
|
+
|
14
|
+
# resetting default configuration
|
15
|
+
def reset_config
|
16
|
+
SweetPortfolio.configure do |config|
|
17
|
+
config.admin_route_prefix = 'admin'
|
18
|
+
config.upload_options = { }
|
19
|
+
config.admin_controller = 'ApplicationController'
|
20
|
+
config.form_builder = 'SweetPortfolio::FormBuilder'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Example usage:
|
25
|
+
# assert_has_errors_on( @record, [:field_1, :field_2] )
|
26
|
+
# assert_has_errors_on( @record, {:field_1 => 'Message1', :field_2 => 'Message 2'} )
|
27
|
+
def assert_has_errors_on(record, fields)
|
28
|
+
fields = [fields].flatten unless fields.is_a?(Hash)
|
29
|
+
fields.each do |field, message|
|
30
|
+
assert record.errors.to_hash.has_key?(field.to_sym), "#{record.class.name} should error on invalid #{field}"
|
31
|
+
if message && record.errors[field].is_a?(Array) && !message.is_a?(Array)
|
32
|
+
assert_not_nil record.errors[field].index(message)
|
33
|
+
elsif message
|
34
|
+
assert_equal message, record.errors[field]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require File.expand_path('../test_helper', File.dirname(__FILE__))
|
2
|
+
|
3
|
+
class ConfigurationTest < ActiveSupport::TestCase
|
4
|
+
|
5
|
+
def test_configuration_presense
|
6
|
+
assert config = SweetPortfolio.configuration
|
7
|
+
assert_equal 'ApplicationController', config.admin_controller
|
8
|
+
assert_equal 'SweetPortfolio::FormBuilder', config.form_builder
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_initialization_overrides
|
12
|
+
SweetPortfolio.configuration.admin_route_prefix = 'admin'
|
13
|
+
assert_equal 'admin', SweetPortfolio.configuration.admin_route_prefix
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require File.expand_path('../test_helper', File.dirname(__FILE__))
|
2
|
+
|
3
|
+
class GalleryTest < ActiveSupport::TestCase
|
4
|
+
|
5
|
+
def test_fixtures_validity
|
6
|
+
Gallery::Gallery.all.each do |gallery|
|
7
|
+
assert gallery.valid?, gallery.errors.full_messages.to_s
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_validations
|
12
|
+
gallery = Gallery::Gallery.new
|
13
|
+
assert gallery.invalid?
|
14
|
+
assert_has_errors_on gallery, [:title, :identifier]
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_creation
|
18
|
+
assert_difference 'Gallery::Gallery.count', 1 do
|
19
|
+
gallery = Gallery::Gallery.create!(
|
20
|
+
:title => 'Test Gallery',
|
21
|
+
:identifier => 'test-gallery',
|
22
|
+
:description => 'Test Description'
|
23
|
+
)
|
24
|
+
assert_equal 'Test Gallery', gallery.title
|
25
|
+
assert_equal 'test-gallery', gallery.identifier
|
26
|
+
assert_equal 'Test Description', gallery.description
|
27
|
+
assert_equal 1, gallery.position
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_destroy
|
32
|
+
gallery = gallery_galleries(:default)
|
33
|
+
assert_difference ['Gallery::Gallery.count', 'Gallery::Photo.count'], -1 do
|
34
|
+
gallery.destroy
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require File.expand_path('../test_helper', File.dirname(__FILE__))
|
2
|
+
|
3
|
+
class PhotoTest < ActiveSupport::TestCase
|
4
|
+
|
5
|
+
def test_fixtures_validity
|
6
|
+
Gallery::Photo.all.each do |photo|
|
7
|
+
assert photo.valid?, photo.errors.full_messages.to_s
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_validations
|
12
|
+
photo = Gallery::Photo.new
|
13
|
+
assert photo.invalid?
|
14
|
+
assert_has_errors_on photo, {
|
15
|
+
:gallery_id => ["can't be blank"],
|
16
|
+
:image => ["There was no file uploaded!"]
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_creation
|
21
|
+
gallery = gallery_galleries(:default)
|
22
|
+
assert_difference 'Gallery::Photo.count' do
|
23
|
+
upload = fixture_file_upload('/files/default.jpg', 'image/jpeg')
|
24
|
+
photo = Gallery::Photo.create!(
|
25
|
+
:gallery => gallery,
|
26
|
+
:title => 'Test Photo',
|
27
|
+
:image => upload
|
28
|
+
)
|
29
|
+
assert_equal 'default.jpg', photo.image_file_name
|
30
|
+
assert_equal 'image/jpeg', photo.image_content_type
|
31
|
+
assert_equal upload.size, photo.image_file_size
|
32
|
+
|
33
|
+
assert_equal gallery, photo.gallery
|
34
|
+
assert_equal 'Test Photo', photo.title
|
35
|
+
assert_equal 1, photo.position
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
metadata
ADDED
@@ -0,0 +1,228 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sweet_portfolio
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Stephen McLeod
|
9
|
+
- The Working Group Inc.
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2013-04-19 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rails
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 3.1.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 3.1.0
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: paperclip
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ! '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: 2.3.0
|
39
|
+
type: :runtime
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 2.3.0
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: jquery-rails
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.0.14
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 1.0.14
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: haml
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ~>
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 4.0.1
|
71
|
+
type: :runtime
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ~>
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 4.0.1
|
79
|
+
- !ruby/object:Gem::Dependency
|
80
|
+
name: sqlite3
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ! '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
type: :development
|
88
|
+
prerelease: false
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: jeweler
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ! '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
type: :development
|
104
|
+
prerelease: false
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: Sweet Portfolio is an image gallery engine with nice frontend capabilities
|
112
|
+
for Rails 3.1 apps (and ComfortableMexicanSofa)
|
113
|
+
email: work@stephenmmcleod.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files:
|
117
|
+
- LICENSE
|
118
|
+
- README.md
|
119
|
+
files:
|
120
|
+
- .document
|
121
|
+
- .powrc
|
122
|
+
- .ruby-version
|
123
|
+
- .travis.yml
|
124
|
+
- Gemfile
|
125
|
+
- LICENSE
|
126
|
+
- README.md
|
127
|
+
- Rakefile
|
128
|
+
- VERSION
|
129
|
+
- app/assets/images/sweet_portfolio/blank.gif
|
130
|
+
- app/assets/images/sweet_portfolio/border.png
|
131
|
+
- app/assets/images/sweet_portfolio/controls.png
|
132
|
+
- app/assets/images/sweet_portfolio/fancybox_loading.gif
|
133
|
+
- app/assets/images/sweet_portfolio/fancybox_overlay.png
|
134
|
+
- app/assets/images/sweet_portfolio/fancybox_sprite.png
|
135
|
+
- app/assets/images/sweet_portfolio/jcrop.gif
|
136
|
+
- app/assets/images/sweet_portfolio/loading.gif
|
137
|
+
- app/assets/images/sweet_portfolio/loading_background.png
|
138
|
+
- app/assets/images/sweet_portfolio/overlay.png
|
139
|
+
- app/assets/javascripts/sweet_portfolio/jquery.colorbox.js
|
140
|
+
- app/assets/javascripts/sweet_portfolio/jquery.fancybox-media.js
|
141
|
+
- app/assets/javascripts/sweet_portfolio/jquery.fancybox-thumbs.js
|
142
|
+
- app/assets/javascripts/sweet_portfolio/jquery.fancybox.pack.js
|
143
|
+
- app/assets/javascripts/sweet_portfolio/jquery.jcrop.js
|
144
|
+
- app/assets/stylesheets/sweet_portfolio/colorbox.css
|
145
|
+
- app/assets/stylesheets/sweet_portfolio/jquery.fancybox-thumbs.css
|
146
|
+
- app/assets/stylesheets/sweet_portfolio/jquery.fancybox.css
|
147
|
+
- app/assets/stylesheets/sweet_portfolio/jquery.jcrop.css
|
148
|
+
- app/controllers/admin/gallery/base_controller.rb
|
149
|
+
- app/controllers/admin/gallery/galleries_controller.rb
|
150
|
+
- app/controllers/admin/gallery/photos_controller.rb
|
151
|
+
- app/controllers/application_controller.rb
|
152
|
+
- app/helpers/gallery/application_helper.rb
|
153
|
+
- app/models/gallery/gallery.rb
|
154
|
+
- app/models/gallery/photo.rb
|
155
|
+
- app/views/admin/gallery/_navigation.html.erb
|
156
|
+
- app/views/admin/gallery/galleries/_form.html.haml
|
157
|
+
- app/views/admin/gallery/galleries/edit.html.haml
|
158
|
+
- app/views/admin/gallery/galleries/index.html.haml
|
159
|
+
- app/views/admin/gallery/galleries/new.html.haml
|
160
|
+
- app/views/admin/gallery/photos/_form.html.haml
|
161
|
+
- app/views/admin/gallery/photos/crop.html.haml
|
162
|
+
- app/views/admin/gallery/photos/edit.html.haml
|
163
|
+
- app/views/admin/gallery/photos/index.html.haml
|
164
|
+
- app/views/admin/gallery/photos/new.html.haml
|
165
|
+
- app/views/layouts/gallery/application.html.haml
|
166
|
+
- config.ru
|
167
|
+
- config/application.rb
|
168
|
+
- config/boot.rb
|
169
|
+
- config/database.yml
|
170
|
+
- config/environment.rb
|
171
|
+
- config/environments/development.rb
|
172
|
+
- config/environments/production.rb
|
173
|
+
- config/environments/test.rb
|
174
|
+
- config/initializers/paperclip.rb
|
175
|
+
- config/initializers/sweet_portfolio.rb
|
176
|
+
- config/routes.rb
|
177
|
+
- db/migrate/01_create_sweet_portfolio.rb
|
178
|
+
- lib/generators/sweet_portfolio/README
|
179
|
+
- lib/generators/sweet_portfolio/sweet_portfolio.rb
|
180
|
+
- lib/paperclip_processors/cropper.rb
|
181
|
+
- lib/sweet_portfolio.rb
|
182
|
+
- lib/sweet_portfolio/configuration.rb
|
183
|
+
- lib/sweet_portfolio/engine.rb
|
184
|
+
- lib/sweet_portfolio/form_builder.rb
|
185
|
+
- lib/sweet_portfolio/routing.rb
|
186
|
+
- lib/tasks/sweet_portfolio.rake
|
187
|
+
- script/rails
|
188
|
+
- sweet_portfolio.gemspec
|
189
|
+
- test/fixtures/files/default.jpg
|
190
|
+
- test/fixtures/files/default.txt
|
191
|
+
- test/fixtures/files/default2.jpg
|
192
|
+
- test/fixtures/gallery/galleries.yml
|
193
|
+
- test/fixtures/gallery/photos.yml
|
194
|
+
- test/functional/admin/gallery/galleries_controller_test.rb
|
195
|
+
- test/functional/admin/gallery/photos_controller_test.rb
|
196
|
+
- test/test_helper.rb
|
197
|
+
- test/unit/configuration_test.rb
|
198
|
+
- test/unit/gallery_test.rb
|
199
|
+
- test/unit/photo_test.rb
|
200
|
+
homepage: https://github.com/stephenmmcleod/sweet-portfolio
|
201
|
+
licenses:
|
202
|
+
- MIT
|
203
|
+
post_install_message:
|
204
|
+
rdoc_options: []
|
205
|
+
require_paths:
|
206
|
+
- lib
|
207
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
208
|
+
none: false
|
209
|
+
requirements:
|
210
|
+
- - ! '>='
|
211
|
+
- !ruby/object:Gem::Version
|
212
|
+
version: '0'
|
213
|
+
segments:
|
214
|
+
- 0
|
215
|
+
hash: -4576162744830405492
|
216
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
217
|
+
none: false
|
218
|
+
requirements:
|
219
|
+
- - ! '>='
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: '0'
|
222
|
+
requirements: []
|
223
|
+
rubyforge_project:
|
224
|
+
rubygems_version: 1.8.24
|
225
|
+
signing_key:
|
226
|
+
specification_version: 3
|
227
|
+
summary: ''
|
228
|
+
test_files: []
|