BBenezech-papermill 0.5.2 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +14 -22
- data/VERSION +1 -1
- data/app/views/papermill/edit.html.erb +5 -0
- data/installation-template.txt +0 -5
- data/lib/papermill/papermill_asset.rb +5 -0
- data/papermill.gemspec +4 -3
- metadata +5 -3
data/README.rdoc
CHANGED
@@ -14,38 +14,31 @@ Asset management made easy.
|
|
14
14
|
$ cd papermill-example
|
15
15
|
$ ./script/server
|
16
16
|
$ GoTo localhost:3000 and try to create an article with assets but without title
|
17
|
-
$ profit
|
18
17
|
|
19
18
|
== Papermill comes in 2 flavors:
|
20
19
|
|
21
20
|
=== Generic catch-all declaration
|
22
21
|
|
23
|
-
papermill
|
24
|
-
assets_upload(:my_key,
|
25
|
-
@assetable.papermill_assets(:
|
22
|
+
papermill my_option_hash # in your papermilled assetable model
|
23
|
+
assets_upload(:my_key, my_option_hash) # form helper call
|
24
|
+
@assetable.papermill_assets(:my_key) # data access in your view
|
26
25
|
|
27
26
|
=== Association specific declaration
|
28
27
|
|
29
|
-
papermill :my_association,
|
30
|
-
assets_upload(:my_association,
|
31
|
-
@assetable.my_association
|
28
|
+
papermill :my_association, my_option_hash # in your papermilled assetable model
|
29
|
+
assets_upload(:my_association, my_option_hash) # form helper call
|
30
|
+
@assetable.my_association # data access in your view
|
31
|
+
|
32
32
|
|
33
33
|
In both case, you can specify a PapermillAsset subclass to use with :class_name => MyPapermillAssetSubclass in the option hash
|
34
34
|
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)
|
35
|
+
It's up to you. You can use the first one only, the second only or both.
|
35
36
|
|
36
37
|
See papermill_module.rb for the complete list of options.
|
37
38
|
|
38
39
|
== Installation
|
39
40
|
|
40
|
-
===
|
41
|
-
|
42
|
-
config.gem 'rsl-stringex', :lib => 'stringex'
|
43
|
-
config.gem 'paperclip'
|
44
|
-
config.gem 'mime-types', :lib => 'mime/types'
|
45
|
-
config.gem 'ryanb-acts-as-list', :lib => 'acts_as_list'
|
46
|
-
config.gem 'BBenezech-papermill', :lib => 'papermill'
|
47
|
-
|
48
|
-
=== Then you can generate a migration and copy a couple of static assets:
|
41
|
+
=== Once you've installed the gem, generate a migration and copy a couple of static assets:
|
49
42
|
|
50
43
|
$ ./script/generate papermill PapermillMigration
|
51
44
|
# will generate a migration named PapermillMigration and copy a couple of static assets
|
@@ -54,16 +47,15 @@ See papermill_module.rb for the complete list of options.
|
|
54
47
|
=== In your assetable model:
|
55
48
|
|
56
49
|
# You can set a catch-all papermill association :
|
57
|
-
papermill
|
50
|
+
papermill :class_name => Asset
|
58
51
|
|
59
52
|
# or create an association for the specific :my_gallery key
|
60
|
-
papermill :my_gallery,
|
53
|
+
papermill :my_gallery,
|
61
54
|
:class_name => GalleryAsset,
|
62
55
|
:thumbnail => {
|
63
56
|
:width => 90,
|
64
57
|
:height => 30
|
65
58
|
}
|
66
|
-
}
|
67
59
|
|
68
60
|
=== In your layout:
|
69
61
|
|
@@ -79,9 +71,9 @@ See papermill_module.rb for the complete list of options.
|
|
79
71
|
|
80
72
|
=== Access them with:
|
81
73
|
|
82
|
-
@assetable.my_gallery.each{ |image| image.url("100x100") }
|
83
|
-
@assetable.papermill_assets(:
|
84
|
-
@assetable.papermill_assets(:
|
74
|
+
@assetable.my_gallery.each{ |image| image_tag image.url("100x100") }
|
75
|
+
@assetable.papermill_assets(:my_assets).each{ |asset| asset.url }
|
76
|
+
@assetable.papermill_assets(:my_other_asset).first.url
|
85
77
|
|
86
78
|
Also see http://gist.github.com/177714.txt for more precises installation steps.
|
87
79
|
Have a look at the API here http://rdoc.info/projects/BBenezech/papermill
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.4
|
data/installation-template.txt
CHANGED
@@ -1,9 +1,4 @@
|
|
1
1
|
gem 'paperclip'
|
2
|
-
gem 'ryanb-acts-as-list', :lib => 'acts_as_list'
|
3
|
-
gem 'sqlite3-ruby', :lib => "sqlite3" # for the demo
|
4
|
-
gem 'mime-types', :lib => 'mime/types'
|
5
|
-
gem "rsl-stringex", :lib => "stringex"
|
6
|
-
gem 'BBenezech-papermill', :lib => 'papermill'
|
7
2
|
|
8
3
|
generate :papermill, "PapermillMigration"
|
9
4
|
generate :scaffold, "article title:string"
|
@@ -1,3 +1,8 @@
|
|
1
|
+
require 'stringex'
|
2
|
+
require 'paperclip'
|
3
|
+
require 'mime/types'
|
4
|
+
require 'acts_as_list'
|
5
|
+
|
1
6
|
class PapermillAsset < ActiveRecord::Base
|
2
7
|
acts_as_list :scope => 'assetable_key=\'#{assetable_key.to_s.simple_sql_sanitizer}\' AND assetable_id=#{assetable_id} AND assetable_type=\'#{assetable_type}\''
|
3
8
|
|
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.5.
|
8
|
+
s.version = "0.5.4"
|
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-
|
12
|
+
s.date = %q{2009-09-07}
|
13
13
|
s.description = %q{Paperclip Swfupload UploadHelper wrapper}
|
14
14
|
s.email = %q{benoit.benezech@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
|
|
25
25
|
"app/views/papermill/_asset.html.erb",
|
26
26
|
"app/views/papermill/_raw_asset.html.erb",
|
27
27
|
"app/views/papermill/_thumbnail_asset.html.erb",
|
28
|
+
"app/views/papermill/edit.html.erb",
|
28
29
|
"config/locales/papermill.yml",
|
29
30
|
"config/routes.rb",
|
30
31
|
"generators/papermill/USAGE",
|
@@ -60,7 +61,7 @@ Gem::Specification.new do |s|
|
|
60
61
|
s.homepage = %q{http://github.com/BBenezech/papermill}
|
61
62
|
s.rdoc_options = ["--charset=UTF-8"]
|
62
63
|
s.require_paths = ["lib"]
|
63
|
-
s.rubygems_version = %q{1.3.
|
64
|
+
s.rubygems_version = %q{1.3.4}
|
64
65
|
s.summary = %q{Paperclip Swfupload UploadHelper wrapper}
|
65
66
|
s.test_files = [
|
66
67
|
"test/papermill_test.rb",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: BBenezech-papermill
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
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-
|
12
|
+
date: 2009-09-07 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -70,6 +70,7 @@ files:
|
|
70
70
|
- app/views/papermill/_asset.html.erb
|
71
71
|
- app/views/papermill/_raw_asset.html.erb
|
72
72
|
- app/views/papermill/_thumbnail_asset.html.erb
|
73
|
+
- app/views/papermill/edit.html.erb
|
73
74
|
- config/locales/papermill.yml
|
74
75
|
- config/routes.rb
|
75
76
|
- generators/papermill/USAGE
|
@@ -103,6 +104,7 @@ files:
|
|
103
104
|
- uninstall.rb
|
104
105
|
has_rdoc: false
|
105
106
|
homepage: http://github.com/BBenezech/papermill
|
107
|
+
licenses:
|
106
108
|
post_install_message:
|
107
109
|
rdoc_options:
|
108
110
|
- --charset=UTF-8
|
@@ -123,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
125
|
requirements: []
|
124
126
|
|
125
127
|
rubyforge_project:
|
126
|
-
rubygems_version: 1.
|
128
|
+
rubygems_version: 1.3.5
|
127
129
|
signing_key:
|
128
130
|
specification_version: 3
|
129
131
|
summary: Paperclip Swfupload UploadHelper wrapper
|