BBenezech-papermill 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
@@ -4,18 +4,20 @@ class PapermillController < ApplicationController
4
4
 
5
5
  def show
6
6
  begin
7
- if Papermill::PAPERMILL_DEFAULTS[:alias_only]
8
- style = Papermill::PAPERMILL_DEFAULTS[:aliases][params[:style]]
7
+ asset = PapermillAsset.find(params[:id])
8
+ raise if asset.nil? || params[:style] == "original"
9
+ style = Papermill::PAPERMILL_DEFAULTS[:aliases][params[:style]] || !Papermill::PAPERMILL_DEFAULTS[:alias_only] && params[:style]
10
+ raise unless style
11
+
12
+ if asset.image?
13
+ temp_thumbnail = Paperclip::Thumbnail.make(asset_file = asset.file, style)
14
+ new_parent_folder_path = File.dirname(new_image_path = asset_file.path(params[:style]))
15
+ FileUtils.mkdir_p new_parent_folder_path unless File.exists? new_parent_folder_path
16
+ FileUtils.cp temp_thumbnail.path, new_image_path
17
+ redirect_to asset.url(params[:style])
9
18
  else
10
- style = Papermill::PAPERMILL_DEFAULTS[:aliases][params[:style]] || params[:style]
19
+ redirect_to asset.url
11
20
  end
12
- raise unless style
13
- asset = PapermillAsset.find(params[:id])
14
- temp_thumbnail = Paperclip::Thumbnail.make(asset_file = asset.file, style)
15
- new_parent_folder_path = File.dirname(new_image_path = asset_file.path(params[:style]))
16
- FileUtils.mkdir_p new_parent_folder_path unless File.exists? new_parent_folder_path
17
- FileUtils.cp temp_thumbnail.path, new_image_path
18
- redirect_to asset.url(params[:style])
19
21
  rescue
20
22
  render :text => t("not-processed", :scope => "papermill"), :status => "500"
21
23
  end
data/papermill.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{papermill}
8
- s.version = "0.2.0"
8
+ s.version = "0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Benoit B\303\251n\303\251zech"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: BBenezech-papermill
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Benoit B\xC3\xA9n\xC3\xA9zech"
@@ -63,7 +63,6 @@ files:
63
63
  - uninstall.rb
64
64
  has_rdoc: false
65
65
  homepage: http://github.com/BBenezech/papermill
66
- licenses:
67
66
  post_install_message:
68
67
  rdoc_options:
69
68
  - --charset=UTF-8
@@ -84,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
83
  requirements: []
85
84
 
86
85
  rubyforge_project:
87
- rubygems_version: 1.3.5
86
+ rubygems_version: 1.2.0
88
87
  signing_key:
89
88
  specification_version: 3
90
89
  summary: Paperclip wrapper