papermill 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.0
1
+ 2.1.1
data/demo.txt CHANGED
@@ -9,18 +9,13 @@ rake "db:migrate"
9
9
  file "app/models/article.rb", <<-END
10
10
  class Article < ActiveRecord::Base
11
11
  validates_presence_of :title
12
- papermill :image_gallery, :class_name => ImageAsset, :images_only => true, :thumbnail => {:width => 75, :height => 100}
13
- papermill :thumbnail, :class_name => ImageAsset, :images_only => true
12
+ papermill :image_gallery, :thumbnail => {:width => 75, :height => 100}, :images_only => true # only images, custom preview thumbnail size
13
+ papermill :thumbnail, :swfupload => { :file_types => "*.jpg;*.jpeg" } # jpg only, cherry picking
14
14
  papermill :my_assets
15
15
  papermill :my_other_asset
16
16
  end
17
17
  END
18
18
 
19
- file "app/models/image_asset.rb", <<-END
20
- class ImageAsset < PapermillAsset
21
- validates_attachment_content_type :file, :content_type => ['image/jpeg', 'image/pjpeg', 'image/jpg', 'image/png', 'image/gif']
22
- end
23
- END
24
19
 
25
20
  file "app/views/articles/edit.html.erb", <<-END
26
21
  <h1>Editing article</h1>
@@ -12,6 +12,7 @@ Object.send :include, PapermillObjectExtensions
12
12
  Hash.send :include, PapermillHashExtensions
13
13
  Array.send :include, PapermillArrayExtensions
14
14
  String.send :include, StringToUrlNotFound unless String.instance_methods.include? "to_url"
15
+ String.send :include, HtmlSafeBackwardCompatibilityFix unless String.instance_methods.include? "html_safe"
15
16
  Formtastic::SemanticFormBuilder.send(:include, PapermillFormtasticExtensions) rescue NameError
16
17
 
17
18
  require 'papermill/papermill_options.rb'
@@ -1,5 +1,11 @@
1
1
  class PapermillException < Exception; end
2
2
 
3
+ module HtmlSafeBackwardCompatibilityFix
4
+ def html_safe
5
+ self
6
+ end
7
+ end
8
+
3
9
  module PapermillHashExtensions
4
10
  def deep_merge(hash)
5
11
  target = dup
@@ -94,7 +94,7 @@ module ActionView::Helpers::FormTagHelper
94
94
  %{<div class="papermill">
95
95
  #{@template.hidden_field("#{assetable_name}[papermill_#{method}_ids]", nil)}
96
96
  #{html[:css].to_s + html[:js].to_s + options[:form_helper_elements].map{|element| html[element] || ""}.join("\n")}
97
- </div>}
97
+ </div>}.html_safe
98
98
  end
99
99
 
100
100
 
@@ -116,7 +116,7 @@ module ActionView::Helpers::FormTagHelper
116
116
  },
117
117
  upload_id: "#{ field_id }",
118
118
  upload_url: "#{ @template.escape_javascript create_url }",
119
- file_types: "#{ options[:images_only] ? '*.jpg;*.jpeg;*.png;*.gif' : '' }",
119
+ file_types: "#{ options[:swfupload].delete(:file_types) || (options[:images_only] ? '*.jpg;*.jpeg;*.png;*.gif' : '*.*') }",
120
120
  file_queue_limit: "#{ !options[:gallery] ? '1' : '0' }",
121
121
  file_queued_handler: Papermill.file_queued,
122
122
  file_dialog_complete_handler: Papermill.file_dialog_complete,
@@ -137,7 +137,7 @@ module ActionView::Helpers::FormTagHelper
137
137
  ""
138
138
  else
139
139
  %{<script type="text/javascript">
140
- $(function() {
140
+ jQuery(function() {
141
141
  #{outputed_js}
142
142
  });
143
143
  </script>}
@@ -29,7 +29,7 @@ module Paperclip
29
29
  if options[:watermark] || options[:geometry] =~ /\-wm/
30
30
  options[:geometry] = options[:geometry].chomp("-wm")
31
31
  @watermark_path = options[:watermark].is_a?(String) && options[:watermark] || file.instance.papermill_options[:watermark]
32
- @watermark_path = "#{RAILS_ROOT}/public#{@watermark_path}" if @watermark_path.starts_with?("/")
32
+ @watermark_path = "#{RAILS_ROOT}/public" + @watermark_path if @watermark_path.starts_with?("/")
33
33
  end
34
34
 
35
35
 
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: papermill
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 9
4
5
  prerelease: false
5
6
  segments:
6
7
  - 2
7
8
  - 1
8
- - 0
9
- version: 2.1.0
9
+ - 1
10
+ version: 2.1.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - "Benoit B\xC3\xA9n\xC3\xA9zech"
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-06-11 00:00:00 +02:00
18
+ date: 2010-06-22 00:00:00 +02:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: paperclip
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - "="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 113
27
30
  segments:
28
31
  - 2
29
32
  - 3
@@ -36,9 +39,11 @@ dependencies:
36
39
  name: mime-types
37
40
  prerelease: false
38
41
  requirement: &id002 !ruby/object:Gem::Requirement
42
+ none: false
39
43
  requirements:
40
44
  - - ">="
41
45
  - !ruby/object:Gem::Version
46
+ hash: 3
42
47
  segments:
43
48
  - 0
44
49
  version: "0"
@@ -142,23 +147,27 @@ rdoc_options:
142
147
  require_paths:
143
148
  - lib
144
149
  required_ruby_version: !ruby/object:Gem::Requirement
150
+ none: false
145
151
  requirements:
146
152
  - - ">="
147
153
  - !ruby/object:Gem::Version
154
+ hash: 3
148
155
  segments:
149
156
  - 0
150
157
  version: "0"
151
158
  required_rubygems_version: !ruby/object:Gem::Requirement
159
+ none: false
152
160
  requirements:
153
161
  - - ">="
154
162
  - !ruby/object:Gem::Version
163
+ hash: 3
155
164
  segments:
156
165
  - 0
157
166
  version: "0"
158
167
  requirements: []
159
168
 
160
169
  rubyforge_project:
161
- rubygems_version: 1.3.6
170
+ rubygems_version: 1.3.7
162
171
  signing_key:
163
172
  specification_version: 3
164
173
  summary: Paperclip Swfupload UploadHelper wrapper