papermill 2.0.2 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +12 -10
- data/Rakefile +1 -1
- data/TODO.txt +3 -3
- data/VERSION +1 -1
- data/app/views/papermill/edit.html.erb +0 -9
- data/config/locales/papermill.yml +2 -6
- data/lib/papermill.rb +4 -8
- data/lib/papermill/papermill_asset.rb +2 -2
- data/lib/papermill/papermill_helper.rb +2 -5
- data/lib/papermill/papermill_paperclip_processor.rb +2 -2
- data/public/papermill/papermill.js +0 -2
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -29,8 +29,8 @@ Check your audience.
|
|
29
29
|
|
30
30
|
=== Server requirements:
|
31
31
|
|
32
|
-
* Rails 2.3.4
|
33
|
-
* Paperclip 2.3
|
32
|
+
* Rails 2.3.[4~>8]
|
33
|
+
* Paperclip 2.3.1.1 (loaded with gem dependency)
|
34
34
|
* Front web server serving static assets if present, and forwarding demand to rails if not. Any classic installation will do that by default.
|
35
35
|
* NOT compatible with Heroku/S3
|
36
36
|
|
@@ -86,17 +86,13 @@ Inside <head></head>
|
|
86
86
|
<% end %>
|
87
87
|
|
88
88
|
Before </body>
|
89
|
-
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.
|
90
|
-
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.
|
89
|
+
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
|
90
|
+
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js" type="text/javascript"></script>
|
91
91
|
<% unless @content_for_papermill_inline_js.blank? %>
|
92
92
|
<%= stylesheet_link_tag("/facebox/facebox.css", "/jgrowl/jquery.jgrowl.css", "/Jcrop/jquery.Jcrop.css", "/papermill/papermill.css", :cache => "papermill") %>
|
93
93
|
<style type="text/css">
|
94
94
|
<%= yield :papermill_inline_css %>
|
95
95
|
</style>
|
96
|
-
<script type="text/javascript">
|
97
|
-
var SWFUPLOAD_PENDING = "Waiting...";
|
98
|
-
var SWFUPLOAD_LOADING = "Loading...";
|
99
|
-
</script>
|
100
96
|
<% end %>
|
101
97
|
|
102
98
|
== Security
|
@@ -114,9 +110,15 @@ Assetable is the class that has_many papermill_assets (i.e. the class with the p
|
|
114
110
|
|
115
111
|
=== Assetable declaration
|
116
112
|
|
117
|
-
You can have
|
113
|
+
You can have one :default association (his settings will be used for unfound associations) and as many other associations as you want in your model.
|
114
|
+
You can define a papermill relationship dynamically: just do smtg like Assetable.papermill(:dynamic_key, {}) when you need to. Perfect for CMS where associations are created by users. Then you'll be able to use assetable.dynamic_key to retrieve the associated assets. If you don't send the {}, default options from default association will be used, which may or may not be what you want.
|
115
|
+
|
116
|
+
Actually, the form helper leverages this when you use a :key that doesn't exist: it will create a new Papermill relationship whith :key as the name and options from the :default declaration if any found on the model.
|
117
|
+
|
118
|
+
If you don't need dynamic keys, just declare your associations in the model, like this :
|
118
119
|
|
119
120
|
class Article
|
121
|
+
papermill :default
|
120
122
|
papermill :images
|
121
123
|
papermill :pdf_version
|
122
124
|
papermill :cover_image
|
@@ -224,7 +226,7 @@ Consist of:
|
|
224
226
|
|
225
227
|
:geometry => "ImageMagick-geometry-string"
|
226
228
|
:copyright => true | "copyright" # If true, the asset copyright field will be used. Edit the asset.
|
227
|
-
:watermark =>
|
229
|
+
:watermark => true | URI # If true, will use options[:watemark]
|
228
230
|
|
229
231
|
Examples:
|
230
232
|
|
data/Rakefile
CHANGED
@@ -32,7 +32,7 @@ begin
|
|
32
32
|
gemspec.email = "benoit.benezech@gmail.com"
|
33
33
|
gemspec.homepage = "http://github.com/bbenezech/papermill"
|
34
34
|
gemspec.authors = ["Benoit Bénézech"]
|
35
|
-
gemspec.add_dependency('paperclip', '
|
35
|
+
gemspec.add_dependency('paperclip', '2.3.1.1')
|
36
36
|
gemspec.add_dependency('mime-types')
|
37
37
|
end
|
38
38
|
rescue LoadError
|
data/TODO.txt
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
#
|
2
|
-
# extend watermark/copyright possibilities
|
1
|
+
# extend watermark possibilities
|
3
2
|
# refresh images when cropped
|
4
3
|
# authorize images before edit/crop
|
5
4
|
# documentation for papermill_associations
|
6
5
|
# file search helper for papermill_associations
|
7
|
-
# tests, loads of them
|
6
|
+
# tests, loads of them
|
7
|
+
# rails3 branch when RC is out
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0
|
1
|
+
2.1.0
|
@@ -1,20 +1,11 @@
|
|
1
1
|
<div id="papermill-box">
|
2
2
|
<div id="left">
|
3
3
|
<% if @asset.image? %>
|
4
|
-
|
5
|
-
<%# image_tag(@asset.url("400x400>"), :onDblClick => %{$.facebox( $('<iframe src="#{crop_papermill_path(@asset, :target => "original", :targetted_size => params[:targetted_size])}" />')); return false;}, :title => I18n.t("papermill.crop", :resource => @asset.name)) %>
|
6
|
-
|
7
|
-
|
8
4
|
<%= image_tag(@asset.url("400x400>"), :onDblClick => "popup('#{crop_papermill_path(@asset, :target => "original", :targetted_size => params[:targetted_size])}'); return false;", :title => I18n.t("papermill.crop", :resource => @asset.name)) %>
|
9
|
-
|
10
|
-
|
11
|
-
<%# link_to I18n.t("papermill.edit-with-pixlr", :resource => @asset.name), "http://www.pixlr.com/editor/?image=http://#{@test || request.env["HTTP_HOST"] + @asset.url}&target=http://#{receive_from_pixlr_papermill_path(@asset)}&method=POST", :target => "_blank" %>
|
12
5
|
<div style="clear:both;"></div>
|
13
6
|
<% else %>
|
14
7
|
<%= link_to t("file_type", :type => @asset.content_type, :scope => 'papermill'), @asset.url, :popup => true %>
|
15
8
|
<% end -%>
|
16
|
-
|
17
|
-
|
18
9
|
</div>
|
19
10
|
<div id="right">
|
20
11
|
<div id="read-only">
|
@@ -2,7 +2,7 @@ en:
|
|
2
2
|
papermill:
|
3
3
|
not-processed: "Error/resource not processed"
|
4
4
|
updated: "'{{resource}}' updated"
|
5
|
-
not-found: "'
|
5
|
+
not-found: "'{{resource}}' not found"
|
6
6
|
edit-title: "Click to edit '{{resource}}'"
|
7
7
|
crop: "Double-click to crop '{{resource}}'"
|
8
8
|
edit-with-pixlr: "Edit '{{resource}}' online @ pixlr.com"
|
@@ -10,8 +10,6 @@ en:
|
|
10
10
|
upload-button-wording: "Upload..."
|
11
11
|
delete: "Remove {{resource}}"
|
12
12
|
delete-confirmation: "Delete '{{resource}}'?"
|
13
|
-
SWFUPLOAD_PENDING: "Pending..."
|
14
|
-
SWFUPLOAD_LOADING: "Loading..."
|
15
13
|
file_type: "{{type}} file"
|
16
14
|
name: "Name"
|
17
15
|
content_type: "Content-type"
|
@@ -35,7 +33,7 @@ en:
|
|
35
33
|
mass-thumbnail-reset-confirmation: "Are you sure?"
|
36
34
|
fr:
|
37
35
|
papermill:
|
38
|
-
not-processed: "Erreur/
|
36
|
+
not-processed: "Erreur/ressource non trouvée"
|
39
37
|
updated: "'{{resource}}' modifiés(s)"
|
40
38
|
not-found: "'{{resource}}' non trouvé"
|
41
39
|
edit-title: "Cliquer pour éditer '{{resource}}'"
|
@@ -45,8 +43,6 @@ fr:
|
|
45
43
|
upload-button-wording: "Charger.."
|
46
44
|
delete: "Supprimer {{resource}}"
|
47
45
|
delete-confirmation: "Êtes-vous sûr de vouloir supprimer '{{resource}}' ?"
|
48
|
-
SWFUPLOAD_PENDING: "En attente..."
|
49
|
-
SWFUPLOAD_LOADING: "Chargement..."
|
50
46
|
file_type: "Fichier {{type}}"
|
51
47
|
name: "Nom"
|
52
48
|
content_type: "Content-type"
|
data/lib/papermill.rb
CHANGED
@@ -1,11 +1,8 @@
|
|
1
1
|
require "rbconfig"
|
2
|
-
require "
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
rescue
|
7
|
-
MIME_TYPE_LOADED = false
|
8
|
-
end
|
2
|
+
require "mime/types"
|
3
|
+
require "rubygems"
|
4
|
+
gem "paperclip", "2.3.1.1"
|
5
|
+
require "paperclip"
|
9
6
|
|
10
7
|
I18n.load_path = [File.join(File.dirname(__FILE__), "../config/locales/papermill.yml")] + I18n.load_path
|
11
8
|
require 'papermill/extensions'
|
@@ -22,7 +19,6 @@ begin
|
|
22
19
|
require File.join(RAILS_ROOT, "config/initializers/papermill.rb")
|
23
20
|
rescue LoadError, MissingSourceFile
|
24
21
|
end
|
25
|
-
require 'paperclip' unless defined?(Paperclip)
|
26
22
|
require 'papermill/papermill_paperclip_processor'
|
27
23
|
require 'papermill/papermill'
|
28
24
|
require 'papermill/papermill_association'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class PapermillAsset < ActiveRecord::Base
|
2
2
|
before_destroy :destroy_files
|
3
|
-
|
3
|
+
|
4
4
|
has_attached_file :file,
|
5
5
|
:processors => [:papermill_paperclip_processor],
|
6
6
|
:url => "#{Papermill::options[:papermill_url_prefix]}/#{Papermill::compute_paperclip_path.gsub(':style', ':escape_style_in_url')}",
|
@@ -51,7 +51,7 @@ class PapermillAsset < ActiveRecord::Base
|
|
51
51
|
def Filedata=(data)
|
52
52
|
if !Papermill::MSWIN && !(mime = `file --mime -br #{data.path}`).blank? && !mime.starts_with?("cannot open")
|
53
53
|
data.content_type = mime.strip.split(";").first
|
54
|
-
elsif
|
54
|
+
elsif (mime = MIME::Types.type_for(data.original_filename))
|
55
55
|
data.content_type = mime.first.simplified
|
56
56
|
end
|
57
57
|
self.file = data
|
@@ -9,12 +9,9 @@ module PapermillHelper
|
|
9
9
|
|
10
10
|
def papermill_javascript_tag(options = {})
|
11
11
|
html = []
|
12
|
-
html << %{<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.
|
13
|
-
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.
|
12
|
+
html << %{<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>\
|
13
|
+
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js" type="text/javascript"></script>} if options[:with_jquery]
|
14
14
|
html << %{<script type="text/javascript">}
|
15
|
-
["SWFUPLOAD_PENDING", "SWFUPLOAD_LOADING"].each do |js_constant|
|
16
|
-
html << %{var #{escape_javascript js_constant} = "#{t("papermill.#{escape_javascript js_constant}")}";}
|
17
|
-
end
|
18
15
|
html << %{jQuery.noConflict();} if options[:with_jquery].to_s == "no_conflict"
|
19
16
|
html << %{</script>}
|
20
17
|
html << javascript_include_tag("/facebox/facebox.js", "/jgrowl/jquery.jgrowl_minimized.js", "/Jcrop/jquery.Jcrop.min.js", "/swfupload/swfupload.js", "/papermill/papermill.js", :cache => "papermill")
|
@@ -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 =
|
32
|
+
@watermark_path = "#{RAILS_ROOT}/public#{@watermark_path}" if @watermark_path.starts_with?("/")
|
33
33
|
end
|
34
34
|
|
35
35
|
|
@@ -60,7 +60,7 @@ module Paperclip
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def transformation_command
|
63
|
-
"#{(crop_command ? super.sub(/ -crop \S+/, crop_command) : super)} #{copyright_command} #{watermark_command}".sub(%{-resize "0x" }, "")
|
63
|
+
" -limit memory 1 -limit map 1 #{(crop_command ? super.sub(/ -crop \S+/, crop_command) : super)} #{copyright_command} #{watermark_command}".sub(%{-resize "0x" }, "")
|
64
64
|
end
|
65
65
|
|
66
66
|
def copyright_command
|
@@ -69,7 +69,6 @@ var Papermill = {
|
|
69
69
|
jQuery(this.sorted_queue).each( function(index, file) {
|
70
70
|
div = jQuery('<div></div>').attr({ 'id': file.id, 'class': 'swfupload asset' });
|
71
71
|
div.append(jQuery('<span></span>').attr('class', 'name').html(file.name.substring(0, 10) + '...'));
|
72
|
-
div.append(jQuery('<span></span>').attr('class', 'status').html(SWFUPLOAD_PENDING));
|
73
72
|
div.append(jQuery('<span></span>').attr('class', 'progress').append('<span></span>'));
|
74
73
|
if(self.settings.file_queue_limit == 1) {
|
75
74
|
old_asset = jQuery("#" + self.settings.upload_id).children()[0];
|
@@ -84,7 +83,6 @@ var Papermill = {
|
|
84
83
|
},
|
85
84
|
upload_start: function(file)
|
86
85
|
{
|
87
|
-
jQuery('#' + file.id + ' .status').html(SWFUPLOAD_LOADING);
|
88
86
|
this.addFileParam(file.id, "Fileid", file.id);
|
89
87
|
if(this.settings.file_queue_limit == 1) {
|
90
88
|
old_asset = jQuery("#" + this.settings.upload_id).children()[0];
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 2
|
7
|
+
- 1
|
7
8
|
- 0
|
8
|
-
|
9
|
-
version: 2.0.2
|
9
|
+
version: 2.1.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- "Benoit B\xC3\xA9n\xC3\xA9zech"
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-06-11 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
prerelease: false
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- - "
|
25
|
+
- - "="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
segments:
|
28
28
|
- 2
|