papermill 0.14.0 → 0.14.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/core_extensions.rb +10 -1
- data/lib/papermill.rb +7 -0
- data/lib/papermill/form_builder.rb +1 -10
- data/test/papermill_test.rb +47 -0
- metadata +5 -5
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.14.
|
1
|
+
0.14.1
|
data/lib/core_extensions.rb
CHANGED
@@ -38,4 +38,13 @@ module PapermillFileExtensions
|
|
38
38
|
`file --mime -br #{self.path}`.strip.split(";").first
|
39
39
|
end
|
40
40
|
end
|
41
|
-
end
|
41
|
+
end
|
42
|
+
|
43
|
+
module PapermillFormtasticExtensions
|
44
|
+
def method_missing(input_type, method, options)
|
45
|
+
return super unless input_type.to_s.match("_input")
|
46
|
+
input_type = input_type.to_s.split("_input").first
|
47
|
+
self.label(method, options_for_label(options)) +
|
48
|
+
self.send(input_type, method, options)
|
49
|
+
end
|
50
|
+
end
|
data/lib/papermill.rb
CHANGED
@@ -5,6 +5,13 @@ Hash.send :include, PapermillHashExtensions
|
|
5
5
|
File.send :include, PapermillFileExtensions
|
6
6
|
String.send :include, PapermillStringExtensions
|
7
7
|
String.send :include, PapermillStringToUrlNotFound unless String.instance_methods.include? "to_url"
|
8
|
+
begin
|
9
|
+
Formtastic::SemanticFormBuilder.send :include, PapermillFormtasticExtensions
|
10
|
+
puts "FORMTASTIC"
|
11
|
+
rescue LoadError
|
12
|
+
puts "NO FORMTASTIC"
|
13
|
+
end
|
14
|
+
puts "HEYYY"
|
8
15
|
require 'papermill/papermill_module'
|
9
16
|
require 'papermill/papermill_asset'
|
10
17
|
require 'papermill/form_builder'
|
@@ -137,13 +137,4 @@ class ActionView::Helpers::FormBuilder
|
|
137
137
|
def image_upload(key = nil, options = {})
|
138
138
|
papermill_upload_tag key, { :gallery => false }.update(options)
|
139
139
|
end
|
140
|
-
end
|
141
|
-
|
142
|
-
class Formtastic::SemanticFormBuilder
|
143
|
-
def method_missing(input_type, method, options)
|
144
|
-
return super unless input_type.to_s.match("_input")
|
145
|
-
input_type = input_type.to_s.split("_input").first
|
146
|
-
self.label(method, options_for_label(options)) +
|
147
|
-
self.send(input_type, method, options)
|
148
|
-
end
|
149
|
-
end
|
140
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
gem 'rails'
|
5
|
+
require 'active_record'
|
6
|
+
require 'action_view'
|
7
|
+
require File.join(File.dirname(__FILE__), '../init')
|
8
|
+
|
9
|
+
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => "test.sqlite3")
|
10
|
+
ActiveRecord::Schema.define(:version => 1) do
|
11
|
+
create_table :papermill_assets do |t|
|
12
|
+
t.string :title, :file_file_name, :file_content_type, :assetable_type, :assetable_key, :type
|
13
|
+
t.integer :file_file_size, :position, :assetable_id
|
14
|
+
t.timestamps
|
15
|
+
end
|
16
|
+
|
17
|
+
create_table :articles do |t|
|
18
|
+
t.string :title, :type
|
19
|
+
t.timestamps
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class MyAsset < PapermillAsset
|
24
|
+
end
|
25
|
+
|
26
|
+
class ArticleGenericAssociation < ActiveRecord::Base
|
27
|
+
def self.table_name
|
28
|
+
:articles
|
29
|
+
end
|
30
|
+
|
31
|
+
papermill :class_name => MyAsset
|
32
|
+
end
|
33
|
+
|
34
|
+
class ArticleSpecificAssociations < ActiveRecord::Base
|
35
|
+
def self.table_name
|
36
|
+
:articles
|
37
|
+
end
|
38
|
+
|
39
|
+
papermill :my_assets, :class_name => MyAsset
|
40
|
+
end
|
41
|
+
|
42
|
+
class PapermillTest < Test::Unit::TestCase
|
43
|
+
|
44
|
+
def test_truth
|
45
|
+
assert true
|
46
|
+
end
|
47
|
+
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.14.
|
4
|
+
version: 0.14.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-
|
12
|
+
date: 2009-11-01 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -96,9 +96,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
96
|
requirements: []
|
97
97
|
|
98
98
|
rubyforge_project:
|
99
|
-
rubygems_version: 1.3.
|
99
|
+
rubygems_version: 1.3.4
|
100
100
|
signing_key:
|
101
101
|
specification_version: 3
|
102
102
|
summary: Paperclip Swfupload UploadHelper wrapper
|
103
|
-
test_files:
|
104
|
-
|
103
|
+
test_files:
|
104
|
+
- test/papermill_test.rb
|