papermill 1.4.1 → 1.4.2
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 +1 -1
- data/app/controllers/papermill_controller.rb +1 -1
- data/app/views/papermill/_asset.html.erb +1 -1
- data/app/views/papermill/crop.html.erb +2 -2
- data/app/views/papermill/edit.html.erb +2 -2
- data/generators/papermill_initializer/papermill_initializer.rb +2 -2
- data/lib/papermill/form_builder.rb +4 -4
- data/lib/papermill/papermill_options.rb +1 -1
- data/public/papermill/images/upload-blank.png +0 -0
- metadata +27 -13
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.4.
|
1
|
+
1.4.2
|
@@ -36,7 +36,7 @@ class PapermillController < ApplicationController
|
|
36
36
|
@asset = params[:asset_class].constantize.new(params.reject{|k, v| !(PapermillAsset.columns.map(&:name)+["Filedata", "Filename"]).include?(k)})
|
37
37
|
if @asset.save
|
38
38
|
@old_asset.destroy if @old_asset
|
39
|
-
output = render_to_string(:partial => "papermill/asset", :object => @asset, :locals => { :gallery => params[:gallery], :thumbnail_style => params[:thumbnail_style], :
|
39
|
+
output = render_to_string(:partial => "papermill/asset", :object => @asset, :locals => { :gallery => params[:gallery], :thumbnail_style => params[:thumbnail_style], :targetted_size => params[:targetted_size] })
|
40
40
|
render :update do |page|
|
41
41
|
page << %{ jQuery('##{params[:Fileid]}').replaceWith('#{escape_javascript output}'); }
|
42
42
|
page << %{ jQuery('#papermill_asset_#{@old_asset.id}').remove() } if @old_asset
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<%- dom_id = "papermill_asset_#{asset.id}" -%>
|
2
2
|
<%- delete_link = %{<a onclick="if(confirm('#{escape_javascript t("papermill.delete-confirmation", :resource => asset.name)}')){ jQuery.ajax({async:true, dataType:'script', type:'delete', url:'#{papermill_url(asset)}'})}; return false;" href="#" class="delete"><img title="#{escape_javascript t("papermill.delete", :resource => asset.name)}" src="/papermill/images/delete.png" alt="delete"/></a>} %>
|
3
3
|
|
4
|
-
<div id="<%= dom_id %>" class="asset" title="<%= t("papermill.#{(thumbnail_style) ? "thumbnail-" : ""}edit-title", :resource => asset.name) %>" onDblClick="popup(jQuery(this).attr('rel')); return false;" rel="<%= edit_papermill_url(asset, :
|
4
|
+
<div id="<%= dom_id %>" class="asset" title="<%= t("papermill.#{(thumbnail_style) ? "thumbnail-" : ""}edit-title", :resource => asset.name) %>" onDblClick="popup(jQuery(this).attr('rel')); return false;" rel="<%= edit_papermill_url(asset, :targetted_size => targetted_size) %>">
|
5
5
|
<%= delete_link %>
|
6
6
|
<%- if thumbnail_style -%>
|
7
7
|
<%= render :partial => "papermill/thumbnail_asset", :object => asset, :locals => {:thumbnail_style => thumbnail_style} %>
|
@@ -23,7 +23,7 @@
|
|
23
23
|
</style>
|
24
24
|
|
25
25
|
<%
|
26
|
-
unless (@size = params[:
|
26
|
+
unless (@size = params[:targetted_size]).blank?
|
27
27
|
@target_w, @target_h = @size.split("x").map(&:to_i)
|
28
28
|
@init_x = (@asset.width - @target_w.to_i) / 2
|
29
29
|
@init_y = (@asset.height - @target_h.to_i) / 2
|
@@ -41,7 +41,7 @@
|
|
41
41
|
<%= f.hidden_field :crop_x, :id => :crop_x %>
|
42
42
|
<%= f.hidden_field :crop_y, :id => :crop_y %>
|
43
43
|
<%= f.submit I18n.t('papermill.save'), :class => "submit" %>
|
44
|
-
<%= link_to_function I18n.t("papermill.back"), "popup('#{edit_papermill_path(@asset, :
|
44
|
+
<%= link_to_function I18n.t("papermill.back"), "popup('#{edit_papermill_path(@asset, :targetted_size => params[:targetted_size])}')" %>
|
45
45
|
<% end -%>
|
46
46
|
</form>
|
47
47
|
</div>
|
@@ -2,10 +2,10 @@
|
|
2
2
|
<div id="left">
|
3
3
|
<% if @asset.image? %>
|
4
4
|
|
5
|
-
<%# image_tag(@asset.url("400x400>"), :onDblClick => %{$.facebox( $('<iframe src="#{crop_papermill_path(@asset, :target => "original", :
|
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
6
|
|
7
7
|
|
8
|
-
<%= image_tag(@asset.url("400x400>"), :onDblClick => "popup('#{crop_papermill_path(@asset, :target => "original", :
|
8
|
+
<%= 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
9
|
|
10
10
|
|
11
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" %>
|
@@ -101,11 +101,11 @@ module Papermill
|
|
101
101
|
# :style => nil
|
102
102
|
},
|
103
103
|
|
104
|
-
# If you plan to use the original images in one place in one specific size, you can pass
|
104
|
+
# If you plan to use the original images in one place in one specific size, you can pass targetted_size,
|
105
105
|
# to incitate the user to crop the image himself (double-click on the image when editing) with the right parameters,
|
106
106
|
# instead of letting ImageMagick do his magick bluntly at render-time.
|
107
107
|
|
108
|
-
# :
|
108
|
+
# :targetted_size => nil,
|
109
109
|
|
110
110
|
# Options passed on to SWFUpload.
|
111
111
|
# To remove an option when overriding, set it to nil.
|
@@ -41,8 +41,8 @@ module ActionView::Helpers::FormTagHelper
|
|
41
41
|
key = options[:assetable].to_s
|
42
42
|
options[:assetable] = nil
|
43
43
|
end
|
44
|
-
|
45
|
-
assetable = options[:assetable] || @template.instance_variable_get("@#{@object_name}")
|
44
|
+
|
45
|
+
assetable = @object || options[:object] || options[:assetable] || @template.instance_variable_get("@#{@object_name}")
|
46
46
|
|
47
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
48
|
|
@@ -68,7 +68,7 @@ module ActionView::Helpers::FormTagHelper
|
|
68
68
|
html[:container] = @template.content_tag(:div, :id => dom_id, :class => "papermill-#{key.to_s} #{(options[:thumbnail] ? "papermill-thumb-container" : "papermill-asset-container")} #{(options[:gallery] ? "papermill-multiple-items" : "papermill-unique-item")}") do
|
69
69
|
conditions = {:assetable_type => assetable_type, :assetable_id => assetable_id}
|
70
70
|
conditions.merge!({:assetable_key => key.to_s}) if key
|
71
|
-
@template.render :partial => "papermill/asset", :collection => PapermillAsset.all(:conditions => conditions), :locals => { :thumbnail_style => computed_style, :
|
71
|
+
@template.render :partial => "papermill/asset", :collection => PapermillAsset.all(:conditions => conditions), :locals => { :thumbnail_style => computed_style, :targetted_size => options[:targetted_size] }
|
72
72
|
end
|
73
73
|
|
74
74
|
if options[:gallery]
|
@@ -94,7 +94,7 @@ module ActionView::Helpers::FormTagHelper
|
|
94
94
|
create_url_options = {
|
95
95
|
:escape => false, :controller => "/papermill", :action => "create",
|
96
96
|
:asset_class => (options[:class_name] || PapermillAsset).to_s,
|
97
|
-
:gallery => !!options[:gallery], :thumbnail_style => computed_style, :
|
97
|
+
:gallery => !!options[:gallery], :thumbnail_style => computed_style, :targetted_size => options[:targetted_size]
|
98
98
|
}
|
99
99
|
create_url_options.merge!({ :assetable_id => assetable_id, :assetable_type => assetable_type }) if assetable_id
|
100
100
|
create_url_options.merge!({ :assetable_key => key }) if key
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: papermill
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 4
|
8
|
+
- 2
|
9
|
+
version: 1.4.2
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- "Benoit B\xC3\xA9n\xC3\xA9zech"
|
@@ -9,29 +14,36 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date: 2010-
|
17
|
+
date: 2010-03-01 00:00:00 +01:00
|
13
18
|
default_executable:
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: paperclip
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
24
|
requirements:
|
21
25
|
- - ">="
|
22
26
|
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 2
|
29
|
+
- 3
|
30
|
+
- 1
|
31
|
+
- 1
|
23
32
|
version: 2.3.1.1
|
24
|
-
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
25
35
|
- !ruby/object:Gem::Dependency
|
26
36
|
name: mime-types
|
27
|
-
|
28
|
-
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
39
|
requirements:
|
31
40
|
- - ">="
|
32
41
|
- !ruby/object:Gem::Version
|
42
|
+
segments:
|
43
|
+
- 0
|
33
44
|
version: "0"
|
34
|
-
|
45
|
+
type: :runtime
|
46
|
+
version_requirements: *id002
|
35
47
|
description: Paperclip Swfupload UploadHelper wrapper
|
36
48
|
email: benoit.benezech@gmail.com
|
37
49
|
executables: []
|
@@ -131,18 +143,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
131
143
|
requirements:
|
132
144
|
- - ">="
|
133
145
|
- !ruby/object:Gem::Version
|
146
|
+
segments:
|
147
|
+
- 0
|
134
148
|
version: "0"
|
135
|
-
version:
|
136
149
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
150
|
requirements:
|
138
151
|
- - ">="
|
139
152
|
- !ruby/object:Gem::Version
|
153
|
+
segments:
|
154
|
+
- 0
|
140
155
|
version: "0"
|
141
|
-
version:
|
142
156
|
requirements: []
|
143
157
|
|
144
158
|
rubyforge_project:
|
145
|
-
rubygems_version: 1.3.
|
159
|
+
rubygems_version: 1.3.6
|
146
160
|
signing_key:
|
147
161
|
specification_version: 3
|
148
162
|
summary: Paperclip Swfupload UploadHelper wrapper
|