papermill 0.10.0 → 0.10.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.
@@ -45,42 +45,45 @@ See papermill_module.rb for the complete list of options.
45
45
 
46
46
  === Then in environment.rb:
47
47
 
48
- config.gem papermill
49
48
 
50
- === You can also modify a couple of default options that will be available application-wide :
51
-
52
- Papermill::OPTIONS = {
53
- :thumbnail => {
54
- :width => 150,
55
- :height => 100
56
- },
57
- :aliases => {
58
- :big => "500x500>"
59
- :small => "100x100>"
60
- },
61
- :public_root => ":rails_root/public", # already a default
62
- :papermill_prefix => "system/papermill" # already a default
63
- }
64
- # see lib/papermill/papermill_module.rb for more options.
49
+ ...
65
50
 
51
+ Rails::Initializer.run do |config|
52
+ ...
53
+ config.gem papermill
54
+
55
+ # You can set options that will be set application-wide :
56
+ module Papermill
57
+ OPTIONS = {
58
+ :thumbnail => {
59
+ :width => 150,
60
+ :height => 100
61
+ },
62
+ :aliases => {
63
+ :big => "500x500>"
64
+ :small => "100x100>"
65
+ },
66
+ :public_root => ":rails_root/public", # already a default
67
+ :papermill_prefix => "system/papermill" # already a default
68
+ }
69
+ end
70
+ # see lib/papermill/papermill_module.rb
71
+ ...
72
+ end
73
+
66
74
  === In your assetable model:
67
75
 
68
76
  # You can set a catch-all papermill association :
69
77
  papermill :class_name => MyAssetClass
70
78
 
71
79
  # or create an association for the specific :my_gallery key
72
- papermill :my_gallery_assets,
73
- :class_name => MyGalleryAsset,
74
- :thumbnail => {
75
- :width => 90,
76
- :height => 30
77
- }
80
+ papermill :my_gallery_assets, :class_name => MyGalleryAsset
78
81
 
79
82
  === In your layout:
80
83
 
81
84
  <%= papermill_stylesheet_tag %>
82
85
  <%= papermill_javascript_tag :with_jquery => "no_conflict" %>
83
- # you won't need :with_jquery if you have already loaded it.
86
+ # you won't need :with_jquery if you have it already.
84
87
 
85
88
  === In your edit form:
86
89
 
@@ -103,7 +106,7 @@ See papermill_module.rb for the complete list of options.
103
106
  # equivalent to:
104
107
  @assetable.assets(:my_other_asset).first.try(:url)
105
108
 
106
- Also see http://github.com/bbenezech/papermill/raw/master/installation-template.txt for more precises installation steps.
109
+ Also see http://github.com/bbenezech/papermill/raw/master/installation-template.txt
107
110
  Have a look at the API here http://rdoc.info/projects/BBenezech/papermill
108
111
 
109
112
  === Translations:
data/Rakefile CHANGED
@@ -33,7 +33,6 @@ begin
33
33
  gemspec.authors = ["Benoit Bénézech"]
34
34
  gemspec.add_dependency('paperclip', '>= 2.1.2')
35
35
  gemspec.add_dependency('mime-types', '>= 1.16')
36
- gemspec.add_dependency('stringex', '>= 1.0.0')
37
36
  gemspec.add_dependency('acts_as_list', '>= 0.1.2')
38
37
  end
39
38
  rescue LoadError
data/TODO.txt CHANGED
@@ -1,3 +1,2 @@
1
1
  * non-regression tests
2
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.10.0
1
+ 0.10.1
@@ -10,8 +10,8 @@
10
10
  <p><%= I18n.t("content_type", :scope => 'papermill') %><span><%= @asset.content_type.join('/') %></span></p>
11
11
  <p><%= I18n.t("size", :scope => 'papermill') %><span><%= number_to_human_size(@asset.size.to_i) %></span></p>
12
12
  <% if @asset.image? %>
13
- <p><%= I18n.t("width", :scope => 'papermill') %><span><%= @asset.width %>px</span></p>
14
- <p><%= I18n.t("height", :scope => 'papermill') %><span><%= @asset.height %>px</span></p>
13
+ <p><%= I18n.t("width", :scope => 'papermill') %><span><%= @asset.width.to_i %>px</span></p>
14
+ <p><%= I18n.t("height", :scope => 'papermill') %><span><%= @asset.height.to_i %>px</span></p>
15
15
  <% end %>
16
16
  <p><%= I18n.t("created_at", :scope => 'papermill') %><span><%= I18n.l(@asset.created_at) %></span></p>
17
17
  <p><%= I18n.t("updated_at", :scope => 'papermill') %><span><%= I18n.l(@asset.updated_at) %></span></p>
@@ -18,10 +18,14 @@ module StringExtensions
18
18
  gsub(/\\/, '\&\&').gsub(/'/, "''")
19
19
  end
20
20
  end
21
-
21
+ module StringToUrlNotFound
22
+ def to_url
23
+ gsub(/[^a-zA-Z0-9]/, "-").gsub(/-+/, "-").gsub(/^-|-$/, "")
24
+ end
25
+ end
22
26
  module ObjectExtensions
23
27
  # Nil if empty.
24
28
  def nie
25
29
  self.blank? ? nil : self
26
30
  end
27
- end
31
+ end
@@ -2,9 +2,7 @@ require 'core_extensions'
2
2
  Object.send :include, ObjectExtensions
3
3
  Hash.send :include, HashExtensions
4
4
  String.send :include, StringExtensions
5
-
6
- I18n.load_path = [File.join(File.dirname(__FILE__), "../config/locales/papermill.yml")] + I18n.load_path
7
-
5
+ String.send :include, StringToUrlNotFound unless String.instance_methods.include? "to_url"
8
6
  require 'papermill/papermill_module'
9
7
  require 'papermill/papermill_asset'
10
8
  require 'papermill/form_builder'
@@ -89,7 +89,7 @@ module ActionView::Helpers::FormTagHelper
89
89
  conditions.merge!({:assetable_key => key.to_s}) if key
90
90
  collection = asset_class.find(:all, :conditions => conditions, :order => "position")
91
91
 
92
- html << %{<div style="height: #{options[:swfupload][:button_height]}px;"><span id="browse_for_#{id}" class="swf_button"></span></div>}
92
+ html << %{<div id="#{id}-button-wrapper" class="papermill-button-wrapper" style="height: #{options[:swfupload][:button_height]}px;"><span id="browse_for_#{id}" class="swf_button"></span></div>}
93
93
  html << @template.content_tag(:ul, :id => id, :class => "papermill #{(options[:thumbnail] ? "papermill-thumb-container" : "papermill-asset-container")} #{(options[:gallery] ? "papermill-multiple-items" : "papermill-unique-item")}") {
94
94
  @template.render :partial => "papermill/asset", :collection => collection, :locals => { :thumbnail_style => (options[:thumbnail] && options[:thumbnail][:style]) }
95
95
  }
@@ -1,4 +1,3 @@
1
- require 'stringex'
2
1
  require 'paperclip'
3
2
  require 'mime/types'
4
3
  require 'acts_as_list'
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{papermill}
8
- s.version = "0.10.0"
8
+ s.version = "0.10.1"
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"]
12
- s.date = %q{2009-09-24}
12
+ s.date = %q{2009-09-29}
13
13
  s.description = %q{Paperclip Swfupload UploadHelper wrapper}
14
14
  s.email = %q{benoit.benezech@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -74,18 +74,15 @@ Gem::Specification.new do |s|
74
74
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
75
75
  s.add_runtime_dependency(%q<paperclip>, [">= 2.1.2"])
76
76
  s.add_runtime_dependency(%q<mime-types>, [">= 1.16"])
77
- s.add_runtime_dependency(%q<stringex>, [">= 1.0.0"])
78
77
  s.add_runtime_dependency(%q<acts_as_list>, [">= 0.1.2"])
79
78
  else
80
79
  s.add_dependency(%q<paperclip>, [">= 2.1.2"])
81
80
  s.add_dependency(%q<mime-types>, [">= 1.16"])
82
- s.add_dependency(%q<stringex>, [">= 1.0.0"])
83
81
  s.add_dependency(%q<acts_as_list>, [">= 0.1.2"])
84
82
  end
85
83
  else
86
84
  s.add_dependency(%q<paperclip>, [">= 2.1.2"])
87
85
  s.add_dependency(%q<mime-types>, [">= 1.16"])
88
- s.add_dependency(%q<stringex>, [">= 1.0.0"])
89
86
  s.add_dependency(%q<acts_as_list>, [">= 0.1.2"])
90
87
  end
91
88
  end
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.10.0
4
+ version: 0.10.1
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-09-24 00:00:00 +02:00
12
+ date: 2009-09-29 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -32,16 +32,6 @@ dependencies:
32
32
  - !ruby/object:Gem::Version
33
33
  version: "1.16"
34
34
  version:
35
- - !ruby/object:Gem::Dependency
36
- name: stringex
37
- type: :runtime
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: 1.0.0
44
- version:
45
35
  - !ruby/object:Gem::Dependency
46
36
  name: acts_as_list
47
37
  type: :runtime