papermill 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -17,7 +17,7 @@
17
17
  * Formtastic # use :as => :[image|asset](s)_upload
18
18
  * JGrowl # for notifications (included)
19
19
  * FaceBox # for popups (included)
20
- * Stringex # (or any String#to_url) for filename generation
20
+ * Stringex # (or any String#to_url) for asset filename/url generation
21
21
 
22
22
  === Navigator minimal requirements:
23
23
 
@@ -33,7 +33,7 @@ Check your audience.
33
33
  * Rails 2.3.4 min (rail's I18n, engine. older 2.3.x have issues with CRSF or try to check for CRSF stamp against AJAX request, useless with AJAX same origin policy, fixed with 2.3.4)
34
34
  * Paperclip 2.3 branch (installed by default as a gem dependency, will be loaded internally if needed => You can require your own version of Paperclip if you want to)
35
35
  * Front web server serving static assets if present, and forwarding demand to rails if not. (Usually a no-brainer on any classic installation. Works with Webrick)
36
-
36
+
37
37
  == Features
38
38
 
39
39
  === Ajax uploading form helpers through SWFUpload => [image|asset](s)_upload
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.2
1
+ 1.3.3
@@ -2,6 +2,8 @@ class PapermillController < ApplicationController
2
2
  prepend_before_filter :load_asset, :only => [ "show", "destroy", "update", "edit", "crop" ]
3
3
  prepend_before_filter :load_assets, :only => [ "sort", "mass_delete", "mass_edit", "mass_thumbnail_reset" ]
4
4
 
5
+ skip_before_filter :verify_authenticity_token, :only => [:create] # not needed (Flash same origin policy)
6
+
5
7
  def show
6
8
  # first escaping is done by rails prior to route recognition, need to do a second one on MSWIN systems to get original one.
7
9
  params[:style] = CGI::unescape(params[:style]) if RUBY_PLATFORM =~ /win/
@@ -43,8 +43,12 @@ module ActionView::Helpers::FormTagHelper
43
43
  end
44
44
 
45
45
  assetable = options[:assetable] || @template.instance_variable_get("@#{@object_name}")
46
+
47
+ raise PapermillException.new("Your form instance object is not @#{@object_name}, and therefor cannot be found. \nPlease provide your object name in your form_for initialization. \nform_for :my_object_name, @my_object_name, :url => { :action => 'create'/'update'}") if @object_name && !assetable
48
+
46
49
  assetable_id = assetable && (assetable.id || assetable.timestamp) || nil
47
50
  assetable_type = assetable && assetable.class.base_class.name || nil
51
+
48
52
  options = PapermillAsset.papermill_options(assetable && assetable.class.name, key).deep_merge(options)
49
53
  dom_id = "papermill_#{assetable_type}_#{assetable_id}_#{key}"
50
54
 
@@ -116,8 +120,7 @@ module ActionView::Helpers::FormTagHelper
116
120
  %{
117
121
  new SWFUpload({
118
122
  post_params: {
119
- "#{ ActionController::Base.session_options[:key] }": "#{ @template.cookies[ActionController::Base.session_options[:key]] }",
120
- "authenticity_token": "#{ @template.form_authenticity_token }"
123
+ "#{ ActionController::Base.session_options[:key] }": "#{ @template.cookies[ActionController::Base.session_options[:key]] }"
121
124
  },
122
125
  upload_id: "#{ dom_id }",
123
126
  upload_url: "#{ @template.escape_javascript create_url }",
@@ -123,8 +123,9 @@ class PapermillAsset < ActiveRecord::Base
123
123
  def create_thumb_file(style_name, style = nil)
124
124
  destroy_thumbnails if style_name.to_s == "original"
125
125
  style = self.class.compute_style(style_name) unless style.is_a?(Hash)
126
- FileUtils.mkdir_p File.dirname(file.path(style_name))
127
- FileUtils.cp((tmp_path = Paperclip::PapermillPaperclipProcessor.make(file, style).path), file.path(style_name))
126
+ FileUtils.mkdir_p File.dirname(new_path = file.path(style_name))
127
+ FileUtils.cp((tmp_path = Paperclip::PapermillPaperclipProcessor.make(file, style).path), new_path)
128
+ FileUtils.chmod(0644, new_path) unless Papermill::MSWIN
128
129
  File.delete(tmp_path)
129
130
  end
130
131
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: papermill
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Benoit B\xC3\xA9n\xC3\xA9zech"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-17 00:00:00 +01:00
12
+ date: 2010-01-19 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency