papermill 0.11.0 → 0.12.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/README.rdoc +15 -12
- data/TODO.txt +6 -1
- data/VERSION +1 -1
- data/app/controllers/papermill_controller.rb +0 -4
- data/app/views/papermill/_raw_asset.html.erb +1 -1
- data/config/locales/papermill.yml +2 -2
- data/generators/papermill_assets/USAGE +4 -0
- data/generators/papermill_assets/papermill_assets_generator.rb +15 -0
- data/generators/papermill_table/USAGE +3 -0
- data/generators/{papermill/papermill_generator.rb → papermill_table/papermill_table_generator.rb} +3 -2
- data/generators/{papermill → papermill_table}/templates/migrate/papermill_migration.rb.erb +0 -0
- data/installation-template.txt +2 -1
- data/lib/core_extensions.rb +1 -1
- data/lib/papermill/papermill_asset.rb +2 -2
- data/papermill.gemspec +7 -5
- metadata +7 -5
- data/generators/papermill/USAGE +0 -3
data/README.rdoc
CHANGED
@@ -21,19 +21,21 @@ Asset management made easy.
|
|
21
21
|
|
22
22
|
=== Generic catch-all declaration
|
23
23
|
|
24
|
-
papermill my_option_hash
|
25
|
-
assets_upload(:my_key, my_option_hash)
|
26
|
-
@assetable.assets(:my_key)
|
24
|
+
papermill my_option_hash # in your papermilled assetable model
|
25
|
+
assets_upload(:my_key, my_option_hash) # form helper call
|
26
|
+
@assetable.assets(:my_key) # data access in your view
|
27
27
|
|
28
28
|
=== Association specific declaration
|
29
29
|
|
30
|
-
papermill :my_association, my_option_hash
|
31
|
-
assets_upload(:my_association, my_option_hash)
|
32
|
-
@assetable.my_association
|
30
|
+
papermill :my_association, my_option_hash # in your papermilled assetable model
|
31
|
+
assets_upload(:my_association, my_option_hash) # form helper call
|
32
|
+
@assetable.my_association # data access in your view
|
33
33
|
|
34
34
|
|
35
|
-
In both case, you can specify a PapermillAsset subclass to use with :class_name => MyPapermillAssetSubclass in the option hash
|
36
|
-
|
35
|
+
In both case, you can specify a PapermillAsset subclass to use with :class_name => MyPapermillAssetSubclass in the option hash.
|
36
|
+
|
37
|
+
You can have a catch-all declaration and as many specific association as you want in your model (as long as they use different keys).
|
38
|
+
|
37
39
|
It's up to you. You can use the first one only, the second only or both.
|
38
40
|
|
39
41
|
See papermill_module.rb for the complete list of options.
|
@@ -42,12 +44,13 @@ See papermill_module.rb for the complete list of options.
|
|
42
44
|
|
43
45
|
=== Once you've installed the gem, generate a migration and copy a couple of static assets:
|
44
46
|
|
45
|
-
#
|
46
|
-
$ ./script/generate
|
47
|
+
# Generate the migration and migrate:
|
48
|
+
$ ./script/generate papermill_table PapermillMigration
|
47
49
|
$ rake db:migrate
|
48
|
-
|
50
|
+
# copy some needed static assets to your public directory:
|
51
|
+
$ ./script/generate papermill_assets
|
52
|
+
|
49
53
|
=== Then in environment.rb:
|
50
|
-
|
51
54
|
|
52
55
|
...
|
53
56
|
|
data/TODO.txt
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.12.0
|
@@ -3,7 +3,6 @@ class PapermillController < ApplicationController
|
|
3
3
|
skip_before_filter :verify_authenticity_token
|
4
4
|
|
5
5
|
def show
|
6
|
-
begin
|
7
6
|
complete_id = (params[:id0] + params[:id1] + params[:id2]).to_i
|
8
7
|
asset = PapermillAsset.find(complete_id)
|
9
8
|
raise if asset.nil? || params[:style] == "original"
|
@@ -20,9 +19,6 @@ class PapermillController < ApplicationController
|
|
20
19
|
else
|
21
20
|
redirect_to asset.url
|
22
21
|
end
|
23
|
-
rescue
|
24
|
-
render :text => t("not-processed", :scope => "papermill"), :status => "500"
|
25
|
-
end
|
26
22
|
end
|
27
23
|
|
28
24
|
def destroy
|
@@ -1 +1 @@
|
|
1
|
-
<%= link_to(raw_asset.name,
|
1
|
+
<%= link_to(raw_asset.name, edit_papermill_url(asset), :class => "name") -%>
|
@@ -5,7 +5,7 @@ en:
|
|
5
5
|
not-deleted: "'{{ressource}}' could not be deleted"
|
6
6
|
not-found: "Asset #{{ressource}} not found"
|
7
7
|
edit-title: "Double-click to edit '{{ressource}}'"
|
8
|
-
thumbnail-edit-title: "
|
8
|
+
thumbnail-edit-title: "Click to edit '{{ressource}}'"
|
9
9
|
upload-button-wording: "Upload..."
|
10
10
|
delete: "Remove {{ressource}}"
|
11
11
|
delete-confirmation: "Delete '{{resource}}'?"
|
@@ -36,7 +36,7 @@ fr:
|
|
36
36
|
not-deleted: "{{ressource}} n'a pas pu être supprimée"
|
37
37
|
not-found: "Asset #{{ressource}} non trouvé"
|
38
38
|
edit-title: "Double-cliquer pour éditer '{{ressource}}'"
|
39
|
-
thumbnail-edit-title: "
|
39
|
+
thumbnail-edit-title: "Cliquer pour éditer '{{ressource}}'"
|
40
40
|
upload-button-wording: "Charger.."
|
41
41
|
delete: "Supprimer {{ressource}}"
|
42
42
|
delete-confirmation: "Êtes-vous sûr de vouloir supprimer '{{resource}}' ?"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class PapermillAssetsGenerator < Rails::Generator::Base
|
2
|
+
def initialize(args, options = {})
|
3
|
+
end
|
4
|
+
|
5
|
+
def manifest
|
6
|
+
puts "Moving papermill assets to your public directory..."
|
7
|
+
FileUtils.rm_rf("#{File.join(RAILS_ROOT)}/public/papermill/")
|
8
|
+
FileUtils.cp_r(
|
9
|
+
Dir[File.join(File.dirname(__FILE__), '../../public')],
|
10
|
+
File.join(RAILS_ROOT)
|
11
|
+
)
|
12
|
+
puts "Done! Check public/papermill/ for result."
|
13
|
+
exit
|
14
|
+
end
|
15
|
+
end
|
data/generators/{papermill/papermill_generator.rb → papermill_table/papermill_table_generator.rb}
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class PapermillTableGenerator < Rails::Generator::NamedBase
|
2
2
|
attr_accessor :class_name, :migration_name
|
3
3
|
|
4
4
|
def initialize(args, options = {})
|
@@ -8,7 +8,8 @@ class PapermillGenerator < Rails::Generator::NamedBase
|
|
8
8
|
|
9
9
|
def manifest
|
10
10
|
@migration_name = file_name.camelize
|
11
|
-
|
11
|
+
|
12
|
+
FileUtils.rm_rf("#{File.join(RAILS_ROOT)}/public/papermill/")
|
12
13
|
FileUtils.cp_r(
|
13
14
|
Dir[File.join(File.dirname(__FILE__), '../../public')],
|
14
15
|
File.join(RAILS_ROOT),
|
File without changes
|
data/installation-template.txt
CHANGED
data/lib/core_extensions.rb
CHANGED
@@ -8,8 +8,8 @@ class PapermillAsset < ActiveRecord::Base
|
|
8
8
|
belongs_to :assetable, :polymorphic => true
|
9
9
|
before_destroy :destroy_files
|
10
10
|
|
11
|
-
Paperclip
|
12
|
-
Paperclip
|
11
|
+
Paperclip.interpolates[:escaped_basename] = proc do |attachment, style|
|
12
|
+
Paperclip.interpolates[:basename].call(attachment, style).to_url
|
13
13
|
end
|
14
14
|
|
15
15
|
has_attached_file :file,
|
data/papermill.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{papermill}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.12.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"]
|
12
|
-
s.date = %q{2009-10-
|
12
|
+
s.date = %q{2009-10-06}
|
13
13
|
s.description = %q{Paperclip Swfupload UploadHelper wrapper}
|
14
14
|
s.email = %q{benoit.benezech@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -29,9 +29,11 @@ Gem::Specification.new do |s|
|
|
29
29
|
"app/views/papermill/edit.html.erb",
|
30
30
|
"config/locales/papermill.yml",
|
31
31
|
"config/routes.rb",
|
32
|
-
"generators/
|
33
|
-
"generators/
|
34
|
-
"generators/
|
32
|
+
"generators/papermill_assets/USAGE",
|
33
|
+
"generators/papermill_assets/papermill_assets_generator.rb",
|
34
|
+
"generators/papermill_table/USAGE",
|
35
|
+
"generators/papermill_table/papermill_table_generator.rb",
|
36
|
+
"generators/papermill_table/templates/migrate/papermill_migration.rb.erb",
|
35
37
|
"init.rb",
|
36
38
|
"install.rb",
|
37
39
|
"installation-template.txt",
|
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.
|
4
|
+
version: 0.12.0
|
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-10-
|
12
|
+
date: 2009-10-06 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -64,9 +64,11 @@ files:
|
|
64
64
|
- app/views/papermill/edit.html.erb
|
65
65
|
- config/locales/papermill.yml
|
66
66
|
- config/routes.rb
|
67
|
-
- generators/
|
68
|
-
- generators/
|
69
|
-
- generators/
|
67
|
+
- generators/papermill_assets/USAGE
|
68
|
+
- generators/papermill_assets/papermill_assets_generator.rb
|
69
|
+
- generators/papermill_table/USAGE
|
70
|
+
- generators/papermill_table/papermill_table_generator.rb
|
71
|
+
- generators/papermill_table/templates/migrate/papermill_migration.rb.erb
|
70
72
|
- init.rb
|
71
73
|
- install.rb
|
72
74
|
- installation-template.txt
|
data/generators/papermill/USAGE
DELETED