papermill 0.9.0 → 0.10.0

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/TODO.txt CHANGED
@@ -1 +1,3 @@
1
1
  * non-regression tests
2
+ * two migrations => assets & DB
3
+ * auto-download of last release of JS dependencies (swfupload.js, his flash, and jQuery)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.0
1
+ 0.10.0
@@ -58,7 +58,7 @@ class PapermillController < ApplicationController
58
58
  params[:assetable_key] = params[:assetable_key].try :to_s
59
59
  params[:swfupload_file] = params.delete(:Filedata)
60
60
  unless params[:gallery]
61
- @old_asset = asset_class.find(:first, :conditions => params.reject{|k, v| ![:assetable_key, :assetable_type, :assetable_id].include?(k)})
61
+ @old_asset = asset_class.find(:first, :conditions => params.reject{|k, v| !["assetable_key", "assetable_type", "assetable_id"].include?(k)})
62
62
  end
63
63
  @asset = asset_class.new(params.reject{|k, v| !(PapermillAsset.columns.map(&:name)+["swfupload_file"]).include?(k)})
64
64
 
@@ -1,5 +1,5 @@
1
1
  <%- dom_id = "papermill_asset_#{asset.id}" -%>
2
- <%- delete_link = %{<a onclick="if(confirm('#{escape_javascript I18n.t("delete-confirmation", :scope => :papermill, :resource => asset.name)}')){ $.ajax({async:true, beforeSend:function(request){$('##{dom_id}').hide();}, dataType:'script', error:function(request){$('##{dom_id}').show();}, type:'delete', url:'#{papermill_url(asset)}'})}; return false;" href="#" class="delete"><img title="#{escape_javascript t("delete", :scope => "papermill", :ressource => asset.name)}" src="/images/papermill/delete.png" alt="delete"/></a>} %>
2
+ <%- delete_link = %{<a onclick="if(confirm('#{escape_javascript I18n.t("delete-confirmation", :scope => :papermill, :resource => asset.name)}')){ $.ajax({async:true, beforeSend:function(request){$('##{dom_id}').hide();}, dataType:'script', error:function(request){$('##{dom_id}').show();}, type:'delete', url:'#{papermill_url(asset)}'})}; return false;" href="#" class="delete"><img title="#{escape_javascript t("delete", :scope => "papermill", :ressource => asset.name)}" src="/papermill/images/delete.png" alt="delete"/></a>} %>
3
3
 
4
4
  <li id="<%= dom_id %>" onDblClick="popup(jQuery(this).attr('rel')); return false;" rel="<%= edit_papermill_url(asset) %>" title="<%= t("#{thumbnail_style ? "thumbnail-" : ""}edit-title", :scope => "papermill", :ressource => asset.name) %>">
5
5
  <%= delete_link %>
@@ -2,5 +2,5 @@
2
2
  <span class="image"><%= image_tag(thumbnail_asset.url(thumbnail_style)) %></span>
3
3
  <% else %>
4
4
  <span class="name" title="<%= thumbnail_asset.name %>"><%= truncate(thumbnail_asset.name, :length => 15) %></span>
5
- <span class="infos"><%= thumbnail_asset.content_type[1] %></span>
5
+ <span class="infos"><%= thumbnail_asset.content_type.join('/') %></span>
6
6
  <% end %>
@@ -1,7 +1,7 @@
1
1
  <link href="/stylesheets/papermill.css" media="screen" rel="stylesheet" type="text/css" />
2
2
  <div id="papermill-box">
3
3
  <div id="left">
4
- <%= link_to(@asset.image? ? image_tag(@asset.url("400x>")) : I18n.t("file_type", :type => @asset.content_type.join("/"), :scope => 'papermill'), @asset.url, :popup => true) %>
4
+ <%= link_to(@asset.image? ? image_tag(@asset.url("400x#{Papermill::PAPERMILL_DEFAULTS[:max_height]}>")) : I18n.t("file_type", :type => @asset.content_type.join("/"), :scope => 'papermill'), @asset.url, :popup => true) %>
5
5
  </div>
6
6
  <div id="right">
7
7
  <div id="read-only">
@@ -1,3 +1,3 @@
1
1
  script/generate papermill MyMigrationName
2
2
 
3
- This will create the migration table.
3
+ This will create the migration table, copy assets to public/papermill
@@ -8,6 +8,7 @@ class PapermillGenerator < Rails::Generator::NamedBase
8
8
 
9
9
  def manifest
10
10
  @migration_name = file_name.camelize
11
+ FileUtils.rm_rf('../../public/papermill/')
11
12
  FileUtils.cp_r(
12
13
  Dir[File.join(File.dirname(__FILE__), '../../public')],
13
14
  File.join(RAILS_ROOT),
@@ -18,7 +18,6 @@ module ActionView::Helpers::FormTagHelper
18
18
 
19
19
  private
20
20
  def papermill_upload_tag(key, options)
21
- # asset_upload_tag(:my_key)
22
21
  if key.nil? && (options[:assetable].is_a?(Symbol) || options[:assetable].is_a?(String))
23
22
  key = options[:assetable]
24
23
  options[:assetable] = nil
@@ -5,10 +5,8 @@ module PapermillHelper
5
5
  # If you don't use jQuery or use some other library, call papermill_javascript_tag(:with_jquery => "no_conflict")
6
6
  # If you want to rely on this helper to load jQuery/jQueryUI and use it, call papermill_javascript_tag(:with_jquery => true)
7
7
  # If you loaded jQuery and need to load only jQueryUI, call papermill_javascript_tag(:with_jqueryui_only => true)
8
- # If you changed the location of papermill.js, you'll need to set :root_folder (defaults to "javascripts")
9
8
  def papermill_javascript_tag(options = {})
10
9
  html = []
11
- root_folder = options[:path] || "javascripts"
12
10
  if options[:with_jquery] || options[:with_jqueryui]
13
11
  html << %{<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"</script>} if options[:with_jquery]
14
12
  html << %{<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"</script>} if options[:with_jquery] || options[:with_jqueryui_only]
@@ -20,7 +18,7 @@ module PapermillHelper
20
18
  html << %{var #{js_constant} = "#{I18n.t(js_constant, :scope => "papermill")}";}
21
19
  end
22
20
  html << %{</script>}
23
- html << javascript_include_tag("/#{root_folder}/papermill", :cache => "swfupload-papermill")
21
+ html << javascript_include_tag("/papermill/papermill")
24
22
  unless @content_for_papermill_inline_js.blank?
25
23
  html << '<script type="text/javascript">jQuery(document).ready(function() {'
26
24
  html << @content_for_papermill_inline_js
@@ -30,11 +28,9 @@ module PapermillHelper
30
28
  end
31
29
 
32
30
  # Sets the css tags needed for papermill.
33
- # If you changed the location of papermill.css, you'll need to set :root_folder (defaults to "stylesheets")
34
31
  def papermill_stylesheet_tag(options = {})
35
32
  html = []
36
- root_folder = options[:path] || "stylesheets"
37
- html << stylesheet_link_tag("/#{root_folder}/papermill")
33
+ html << stylesheet_link_tag("/papermill/papermill")
38
34
  unless @content_for_papermill_inline_css.blank?
39
35
  html << %{<style type="text/css">}
40
36
  html << @content_for_papermill_inline_css
@@ -15,8 +15,6 @@ module Papermill
15
15
  :height => 100, # Recommended if :gallery[:height] is nil
16
16
  # set :width OR :height to nil to use aspect_ratio value. Remember that 4/3 == 1 => Use : 4.0/3
17
17
  :aspect_ratio => nil,
18
- :max_width => 1000,
19
- :max_height => 1000,
20
18
  # You can override computed ImageMagick transformation strings that defaults to "#{:width}x#{:height}>"
21
19
  # Note that this is required if PAPERMILL_DEFAULTS[:alias_only] is true
22
20
  :style => nil,
@@ -40,9 +38,9 @@ module Papermill
40
38
  # options passed on to SWFUpload. To remove an option when overriding, set it to nil.
41
39
  :swfupload => {
42
40
  # !!! Will only work if the swf file comes from the server to where the files are sent. (Flash same origin security policy)
43
- :flash_url => '/flashs/swfupload.swf',
41
+ :flash_url => '/papermill/swfupload.swf',
44
42
  # You can use upload-blank.png with your own wording or upload.png with default "upload" wording (looks nicer)
45
- :button_image_url => '/images/papermill/upload-blank.png',
43
+ :button_image_url => '/papermill/images/upload-blank.png',
46
44
  :button_width => 61,
47
45
  :button_height => 22,
48
46
  # Wording and CSS processed through an Adobe Flash styler. Result is terrible. Feel free to put a CSS button overlayed directly on the SWF button. See swfupload website.
@@ -60,6 +58,7 @@ module Papermill
60
58
  :button_after_container => false, # set to true to move the upload button below the container
61
59
 
62
60
  # DO NOT CHANGE THESE IN YOUR CLASSES. Only application wide (routes or associations may depend on it)
61
+
63
62
  :base_association_name => 'assets',
64
63
  :alias_only => false, # set to true so that only aliases are authorized in url/path
65
64
  :aliases => {
@@ -68,7 +67,9 @@ module Papermill
68
67
  # path to the root of your public directory
69
68
  :public_root => ":rails_root/public",
70
69
  # added to :public_root as the root folder for all papermill items
71
- :papermill_prefix => "system/papermill"
70
+ :papermill_prefix => "system/papermill",
71
+ :max_width => 1000,
72
+ :max_height => 1000
72
73
  }.deep_merge( Papermill.const_defined?("OPTIONS") ? Papermill::OPTIONS : {} )
73
74
 
74
75
  PAPERCLIP_INTERPOLATION_STRING = ":id_partition/:style/:escaped_basename.:extension"
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.9.0"
8
+ s.version = "0.10.0"
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"]
@@ -43,16 +43,14 @@ Gem::Specification.new do |s|
43
43
  "lib/papermill/papermill_module.rb",
44
44
  "papermill.gemspec",
45
45
  "public/.DS_Store",
46
- "public/flashs/swfupload.swf",
47
- "public/images/.DS_Store",
48
- "public/images/papermill/.DS_Store",
49
- "public/images/papermill/background.png",
50
- "public/images/papermill/container-background.jpg",
51
- "public/images/papermill/delete.png",
52
- "public/images/papermill/upload-blank.png",
53
- "public/images/papermill/upload.png",
54
- "public/javascripts/papermill.js",
55
- "public/stylesheets/papermill.css",
46
+ "public/papermill/images/background.png",
47
+ "public/papermill/images/container-background.jpg",
48
+ "public/papermill/images/delete.png",
49
+ "public/papermill/images/upload-blank.png",
50
+ "public/papermill/images/upload.png",
51
+ "public/papermill/papermill.css",
52
+ "public/papermill/papermill.js",
53
+ "public/papermill/swfupload.swf",
56
54
  "rails/init.rb",
57
55
  "tasks/papermill_tasks.rake",
58
56
  "test/papermill_test.rb",
@@ -42,6 +42,6 @@
42
42
  .papermill-asset-container.papermill-unique-item { padding-left:5px; min-height:22px; }
43
43
 
44
44
  /* Need some backgrounds?
45
- .papermill li { background:transparent url(/images/papermill/background.png) repeat top left; }
46
- .papermill-thumb-container { background:transparent url(/images/papermill/container-background.jpg) repeat top left; }
45
+ .papermill li { background:transparent url(images/background.png) repeat top left; }
46
+ .papermill-thumb-container { background:transparent url(images/container-background.jpg) repeat top left; }
47
47
  */
File without changes
File without changes
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: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Benoit B\xC3\xA9n\xC3\xA9zech"
@@ -88,16 +88,14 @@ files:
88
88
  - lib/papermill/papermill_module.rb
89
89
  - papermill.gemspec
90
90
  - public/.DS_Store
91
- - public/flashs/swfupload.swf
92
- - public/images/.DS_Store
93
- - public/images/papermill/.DS_Store
94
- - public/images/papermill/background.png
95
- - public/images/papermill/container-background.jpg
96
- - public/images/papermill/delete.png
97
- - public/images/papermill/upload-blank.png
98
- - public/images/papermill/upload.png
99
- - public/javascripts/papermill.js
100
- - public/stylesheets/papermill.css
91
+ - public/papermill/images/background.png
92
+ - public/papermill/images/container-background.jpg
93
+ - public/papermill/images/delete.png
94
+ - public/papermill/images/upload-blank.png
95
+ - public/papermill/images/upload.png
96
+ - public/papermill/papermill.css
97
+ - public/papermill/papermill.js
98
+ - public/papermill/swfupload.swf
101
99
  - rails/init.rb
102
100
  - tasks/papermill_tasks.rake
103
101
  - test/papermill_test.rb