papermill 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
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 # 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
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 # 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
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
- 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
+ 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
- # copy static assets and generate a migration
46
- $ ./script/generate papermill PapermillMigration
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
@@ -1,2 +1,7 @@
1
1
  * non-regression tests
2
- * two migrations => assets & DB
2
+ * use aliases in form helpers
3
+ * doc&test about crop
4
+ * better CSS for edit
5
+ * reorganize edit with forms
6
+ * use Jcrop
7
+ * use Picnic API
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.11.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, raw_asset.url, :class => "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: "Double-click to edit '{{ressource}}'"
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: "Double-cliquer pour éditer '{{ressource}}'"
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,4 @@
1
+ script/generate papermill_assets
2
+
3
+ This will copy Papermill needed assets to public/papermill/
4
+ The old public/papermill directory will be deleted if present!
@@ -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
@@ -0,0 +1,3 @@
1
+ script/generate papermill_table PapermillMigration
2
+
3
+ This will create the Papermill table migration file!
@@ -1,4 +1,4 @@
1
- class PapermillGenerator < Rails::Generator::NamedBase
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
- FileUtils.rm_rf('../../public/papermill/')
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),
@@ -1,6 +1,7 @@
1
1
  gem 'papermill'
2
2
 
3
- generate :papermill, "PapermillMigration"
3
+ generate :papermill_table, "PapermillMigration"
4
+ generate :papermill_assets
4
5
  generate :scaffold, "article title:string"
5
6
  rake "db:migrate"
6
7
 
@@ -20,7 +20,7 @@ module StringExtensions
20
20
  end
21
21
  module StringToUrlNotFound
22
22
  def to_url
23
- gsub(/[^a-zA-Z0-9]/, "-").gsub(/-+/, "-").gsub(/^-|-$/, "")
23
+ gsub(/[^a-zA-Z0-9]/, "-").gsub(/-+/, "-").gsub(/^-|-$/, "").downcase
24
24
  end
25
25
  end
26
26
  module ObjectExtensions
@@ -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::Attachment.interpolations[:escaped_basename] = proc do |attachment, style|
12
- Paperclip::Attachment.interpolations[:basename].call(attachment, style).to_url
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.11.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-04}
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/papermill/USAGE",
33
- "generators/papermill/papermill_generator.rb",
34
- "generators/papermill/templates/migrate/papermill_migration.rb.erb",
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.11.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-04 00:00:00 +02:00
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/papermill/USAGE
68
- - generators/papermill/papermill_generator.rb
69
- - generators/papermill/templates/migrate/papermill_migration.rb.erb
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
@@ -1,3 +0,0 @@
1
- script/generate papermill MyMigrationName
2
-
3
- This will create the migration table, copy assets to public/papermill