simple_showcase_admin 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
|
|
1
1
|
module SimpleShowcaseAdmin
|
2
2
|
class Photo < ActiveRecord::Base
|
3
3
|
attr_accessible :image, :featured, :landscape
|
4
|
-
mount_uploader :image, ImageUploader
|
4
|
+
mount_uploader :image, SimpleShowcaseAdmin::ImageUploader
|
5
5
|
before_save :reset_featured_post, :if => :featured_changed?
|
6
6
|
|
7
7
|
def reset_featured_post
|
@@ -1,22 +1,24 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
module SimpleShowcaseAdmin
|
4
|
+
class ImageUploader < CarrierWave::Uploader::Base
|
5
|
+
include CarrierWave::RMagick
|
6
|
+
storage :file
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
8
|
+
def store_dir
|
9
|
+
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
def extension_white_list
|
13
|
+
%w(jpg jpeg gif png bmp tiff)
|
14
|
+
end
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
16
|
+
def filename
|
17
|
+
!super.nil? ? super.chomp(File.extname(super)) + '.png' : super
|
18
|
+
end
|
18
19
|
|
19
|
-
|
20
|
-
|
20
|
+
process :resize_to_fit => [750, 502]
|
21
|
+
process :convert => 'png'
|
21
22
|
|
23
|
+
end
|
22
24
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module SimpleShowcaseAdmin
|
4
|
+
class ImageUploader < CarrierWave::Uploader::Base
|
5
|
+
include CarrierWave::RMagick
|
6
|
+
storage :file
|
7
|
+
|
8
|
+
def store_dir
|
9
|
+
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
10
|
+
end
|
11
|
+
|
12
|
+
def extension_white_list
|
13
|
+
%w(jpg jpeg gif png bmp tiff)
|
14
|
+
end
|
15
|
+
|
16
|
+
def filename
|
17
|
+
!super.nil? ? super.chomp(File.extname(super)) + '.png' : super
|
18
|
+
end
|
19
|
+
|
20
|
+
process :resize_to_fit => [750, 502]
|
21
|
+
process :convert => 'png'
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_showcase_admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-12-
|
12
|
+
date: 2013-12-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -238,17 +238,17 @@ dependencies:
|
|
238
238
|
requirement: !ruby/object:Gem::Requirement
|
239
239
|
none: false
|
240
240
|
requirements:
|
241
|
-
- -
|
241
|
+
- - '='
|
242
242
|
- !ruby/object:Gem::Version
|
243
|
-
version:
|
243
|
+
version: 2.13.2
|
244
244
|
type: :runtime
|
245
245
|
prerelease: false
|
246
246
|
version_requirements: !ruby/object:Gem::Requirement
|
247
247
|
none: false
|
248
248
|
requirements:
|
249
|
-
- -
|
249
|
+
- - '='
|
250
250
|
- !ruby/object:Gem::Version
|
251
|
-
version:
|
251
|
+
version: 2.13.2
|
252
252
|
- !ruby/object:Gem::Dependency
|
253
253
|
name: compass-rails
|
254
254
|
requirement: !ruby/object:Gem::Requirement
|
@@ -393,6 +393,7 @@ files:
|
|
393
393
|
- app/models/simple_showcase_admin/setting.rb
|
394
394
|
- app/models/simple_showcase_admin/user.rb
|
395
395
|
- app/uploaders/image_uploader.rb
|
396
|
+
- app/uploaders/simple_showcase_admin/image_uploader.rb
|
396
397
|
- app/views/layouts/simple_showcase_admin/application.html.haml
|
397
398
|
- app/views/simple_showcase_admin/categories/edit.html.haml
|
398
399
|
- app/views/simple_showcase_admin/categories/index.html.haml
|