property_sets 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -2
- data/Gemfile.lock +7 -2
- data/VERSION +1 -1
- data/lib/property_sets.rb +1 -1
- data/lib/property_sets/{property_set_helper.rb → action_view_extension.rb} +23 -3
- data/property_sets.gemspec +11 -9
- data/test/helper.rb +1 -1
- data/test/test_property_sets.rb +1 -1
- metadata +38 -23
- data/lib/property_sets/form_builder_proxy.rb +0 -22
data/Gemfile
CHANGED
@@ -2,8 +2,9 @@ source "http://rubygems.org"
|
|
2
2
|
# Add dependencies required to use your gem here.
|
3
3
|
# Example:
|
4
4
|
|
5
|
-
gem "activesupport", "
|
6
|
-
gem "activerecord", "
|
5
|
+
gem "activesupport", "2.3.10"
|
6
|
+
gem "activerecord", "2.3.10"
|
7
|
+
gem "actionpack", "2.3.10"
|
7
8
|
|
8
9
|
# Add dependencies to develop your gem here.
|
9
10
|
# Include everything needed to run rake, tests, features, etc.
|
data/Gemfile.lock
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
+
actionpack (2.3.10)
|
5
|
+
activesupport (= 2.3.10)
|
6
|
+
rack (~> 1.1.0)
|
4
7
|
activerecord (2.3.10)
|
5
8
|
activesupport (= 2.3.10)
|
6
9
|
activesupport (2.3.10)
|
@@ -11,6 +14,7 @@ GEM
|
|
11
14
|
git (>= 1.2.5)
|
12
15
|
rake
|
13
16
|
linecache (0.43)
|
17
|
+
rack (1.1.0)
|
14
18
|
rake (0.8.7)
|
15
19
|
ruby-debug (0.10.4)
|
16
20
|
columnize (>= 0.1)
|
@@ -23,8 +27,9 @@ PLATFORMS
|
|
23
27
|
ruby
|
24
28
|
|
25
29
|
DEPENDENCIES
|
26
|
-
|
27
|
-
|
30
|
+
actionpack (= 2.3.10)
|
31
|
+
activerecord (= 2.3.10)
|
32
|
+
activesupport (= 2.3.10)
|
28
33
|
bundler (~> 1.0.0)
|
29
34
|
jeweler (~> 1.5.1)
|
30
35
|
ruby-debug
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/lib/property_sets.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require 'property_sets/property_set_helper'
|
2
1
|
require 'property_sets/property_set_model'
|
3
2
|
require 'property_sets/active_record_extension'
|
3
|
+
require 'property_sets/action_view_extension'
|
4
4
|
|
5
5
|
module PropertySets
|
6
6
|
def self.ensure_property_set_class(association, owner_class)
|
@@ -1,4 +1,5 @@
|
|
1
|
-
require '
|
1
|
+
require 'action_view'
|
2
|
+
require 'delegate'
|
2
3
|
|
3
4
|
module ActionView
|
4
5
|
module Helpers
|
@@ -17,12 +18,31 @@ module ActionView
|
|
17
18
|
end
|
18
19
|
|
19
20
|
class FormBuilder
|
21
|
+
class PropertySetFormBuilderProxy < Delegator
|
22
|
+
attr_accessor :builder
|
23
|
+
attr_accessor :property_set
|
24
|
+
|
25
|
+
def initialize(property_set, builder)
|
26
|
+
self.property_set = property_set
|
27
|
+
self.builder = builder
|
28
|
+
end
|
29
|
+
|
30
|
+
def __getobj__
|
31
|
+
builder
|
32
|
+
end
|
33
|
+
|
34
|
+
def check_box(property, options = {}, checked_value = "1", unchecked_value = "0")
|
35
|
+
builder.property_set_check_box(property_set, property, options, checked_value, unchecked_value)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
20
39
|
def property_set(identifier)
|
21
|
-
|
40
|
+
PropertySetFormBuilderProxy.new(identifier, self)
|
22
41
|
end
|
23
42
|
|
24
43
|
def property_set_check_box(property_set, property, options, checked_value, unchecked_value)
|
25
44
|
@template.property_set_check_box(@object_name, property_set, property, objectify_options(options), checked_value, unchecked_value)
|
26
45
|
end
|
27
46
|
end
|
28
|
-
end
|
47
|
+
end
|
48
|
+
|
data/property_sets.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{property_sets}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Morten Primdahl"]
|
@@ -25,9 +25,8 @@ Gem::Specification.new do |s|
|
|
25
25
|
"Rakefile",
|
26
26
|
"VERSION",
|
27
27
|
"lib/property_sets.rb",
|
28
|
+
"lib/property_sets/action_view_extension.rb",
|
28
29
|
"lib/property_sets/active_record_extension.rb",
|
29
|
-
"lib/property_sets/form_builder_proxy.rb",
|
30
|
-
"lib/property_sets/property_set_helper.rb",
|
31
30
|
"lib/property_sets/property_set_model.rb",
|
32
31
|
"property_sets.gemspec",
|
33
32
|
"test/database.yml",
|
@@ -53,16 +52,18 @@ Gem::Specification.new do |s|
|
|
53
52
|
s.specification_version = 3
|
54
53
|
|
55
54
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
56
|
-
s.add_runtime_dependency(%q<activesupport>, ["
|
57
|
-
s.add_runtime_dependency(%q<activerecord>, ["
|
55
|
+
s.add_runtime_dependency(%q<activesupport>, ["= 2.3.10"])
|
56
|
+
s.add_runtime_dependency(%q<activerecord>, ["= 2.3.10"])
|
57
|
+
s.add_runtime_dependency(%q<actionpack>, ["= 2.3.10"])
|
58
58
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
59
59
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
60
60
|
s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
|
61
61
|
s.add_development_dependency(%q<ruby-debug>, [">= 0"])
|
62
62
|
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
63
63
|
else
|
64
|
-
s.add_dependency(%q<activesupport>, ["
|
65
|
-
s.add_dependency(%q<activerecord>, ["
|
64
|
+
s.add_dependency(%q<activesupport>, ["= 2.3.10"])
|
65
|
+
s.add_dependency(%q<activerecord>, ["= 2.3.10"])
|
66
|
+
s.add_dependency(%q<actionpack>, ["= 2.3.10"])
|
66
67
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
67
68
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
68
69
|
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
|
@@ -70,8 +71,9 @@ Gem::Specification.new do |s|
|
|
70
71
|
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
71
72
|
end
|
72
73
|
else
|
73
|
-
s.add_dependency(%q<activesupport>, ["
|
74
|
-
s.add_dependency(%q<activerecord>, ["
|
74
|
+
s.add_dependency(%q<activesupport>, ["= 2.3.10"])
|
75
|
+
s.add_dependency(%q<activerecord>, ["= 2.3.10"])
|
76
|
+
s.add_dependency(%q<actionpack>, ["= 2.3.10"])
|
75
77
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
76
78
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
77
79
|
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
|
data/test/helper.rb
CHANGED
data/test/test_property_sets.rb
CHANGED
@@ -172,7 +172,7 @@ class TestPropertySets < ActiveSupport::TestCase
|
|
172
172
|
context "view construction" do
|
173
173
|
should "provide a form builder proxy" do
|
174
174
|
proxy = ActionView::FormBuilder.new.property_set(:foo)
|
175
|
-
assert proxy.is_a?(
|
175
|
+
assert proxy.is_a?(ActionView::FormBuilder::PropertySetFormBuilderProxy)
|
176
176
|
assert_equal :foo, proxy.property_set
|
177
177
|
proxy.builder.expects(:property_set_check_box).once.with(:foo, :bar, {}, "1", "0")
|
178
178
|
proxy.check_box(:bar)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: property_sets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Morten Primdahl
|
@@ -25,14 +25,14 @@ dependencies:
|
|
25
25
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
26
26
|
none: false
|
27
27
|
requirements:
|
28
|
-
- -
|
28
|
+
- - "="
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
hash:
|
30
|
+
hash: 23
|
31
31
|
segments:
|
32
32
|
- 2
|
33
33
|
- 3
|
34
|
-
-
|
35
|
-
version: 2.3.
|
34
|
+
- 10
|
35
|
+
version: 2.3.10
|
36
36
|
requirement: *id001
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
prerelease: false
|
@@ -41,20 +41,36 @@ dependencies:
|
|
41
41
|
version_requirements: &id002 !ruby/object:Gem::Requirement
|
42
42
|
none: false
|
43
43
|
requirements:
|
44
|
-
- -
|
44
|
+
- - "="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
hash:
|
46
|
+
hash: 23
|
47
47
|
segments:
|
48
48
|
- 2
|
49
49
|
- 3
|
50
|
-
-
|
51
|
-
version: 2.3.
|
50
|
+
- 10
|
51
|
+
version: 2.3.10
|
52
52
|
requirement: *id002
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
prerelease: false
|
55
|
+
type: :runtime
|
56
|
+
name: actionpack
|
57
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - "="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
hash: 23
|
63
|
+
segments:
|
64
|
+
- 2
|
65
|
+
- 3
|
66
|
+
- 10
|
67
|
+
version: 2.3.10
|
68
|
+
requirement: *id003
|
53
69
|
- !ruby/object:Gem::Dependency
|
54
70
|
prerelease: false
|
55
71
|
type: :development
|
56
72
|
name: shoulda
|
57
|
-
version_requirements: &
|
73
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
58
74
|
none: false
|
59
75
|
requirements:
|
60
76
|
- - ">="
|
@@ -63,12 +79,12 @@ dependencies:
|
|
63
79
|
segments:
|
64
80
|
- 0
|
65
81
|
version: "0"
|
66
|
-
requirement: *
|
82
|
+
requirement: *id004
|
67
83
|
- !ruby/object:Gem::Dependency
|
68
84
|
prerelease: false
|
69
85
|
type: :development
|
70
86
|
name: bundler
|
71
|
-
version_requirements: &
|
87
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
72
88
|
none: false
|
73
89
|
requirements:
|
74
90
|
- - ~>
|
@@ -79,12 +95,12 @@ dependencies:
|
|
79
95
|
- 0
|
80
96
|
- 0
|
81
97
|
version: 1.0.0
|
82
|
-
requirement: *
|
98
|
+
requirement: *id005
|
83
99
|
- !ruby/object:Gem::Dependency
|
84
100
|
prerelease: false
|
85
101
|
type: :development
|
86
102
|
name: jeweler
|
87
|
-
version_requirements: &
|
103
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
88
104
|
none: false
|
89
105
|
requirements:
|
90
106
|
- - ~>
|
@@ -95,12 +111,12 @@ dependencies:
|
|
95
111
|
- 5
|
96
112
|
- 1
|
97
113
|
version: 1.5.1
|
98
|
-
requirement: *
|
114
|
+
requirement: *id006
|
99
115
|
- !ruby/object:Gem::Dependency
|
100
116
|
prerelease: false
|
101
117
|
type: :development
|
102
118
|
name: ruby-debug
|
103
|
-
version_requirements: &
|
119
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
104
120
|
none: false
|
105
121
|
requirements:
|
106
122
|
- - ">="
|
@@ -109,12 +125,12 @@ dependencies:
|
|
109
125
|
segments:
|
110
126
|
- 0
|
111
127
|
version: "0"
|
112
|
-
requirement: *
|
128
|
+
requirement: *id007
|
113
129
|
- !ruby/object:Gem::Dependency
|
114
130
|
prerelease: false
|
115
131
|
type: :development
|
116
132
|
name: thoughtbot-shoulda
|
117
|
-
version_requirements: &
|
133
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
118
134
|
none: false
|
119
135
|
requirements:
|
120
136
|
- - ">="
|
@@ -123,7 +139,7 @@ dependencies:
|
|
123
139
|
segments:
|
124
140
|
- 0
|
125
141
|
version: "0"
|
126
|
-
requirement: *
|
142
|
+
requirement: *id008
|
127
143
|
description: This gem is an ActiveRecord extension which provides a convenient interface for managing per row properties
|
128
144
|
email: morten@zendesk.com
|
129
145
|
executables: []
|
@@ -142,9 +158,8 @@ files:
|
|
142
158
|
- Rakefile
|
143
159
|
- VERSION
|
144
160
|
- lib/property_sets.rb
|
161
|
+
- lib/property_sets/action_view_extension.rb
|
145
162
|
- lib/property_sets/active_record_extension.rb
|
146
|
-
- lib/property_sets/form_builder_proxy.rb
|
147
|
-
- lib/property_sets/property_set_helper.rb
|
148
163
|
- lib/property_sets/property_set_model.rb
|
149
164
|
- property_sets.gemspec
|
150
165
|
- test/database.yml
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'delegate'
|
2
|
-
|
3
|
-
module PropertySets
|
4
|
-
class FormBuilderProxy < Delegator
|
5
|
-
attr_accessor :builder
|
6
|
-
attr_accessor :property_set
|
7
|
-
|
8
|
-
def initialize(property_set, builder)
|
9
|
-
self.property_set = property_set
|
10
|
-
self.builder = builder
|
11
|
-
end
|
12
|
-
|
13
|
-
def __getobj__
|
14
|
-
builder
|
15
|
-
end
|
16
|
-
|
17
|
-
def check_box(property, options = {}, checked_value = "1", unchecked_value = "0")
|
18
|
-
builder.property_set_check_box(property_set, property, options, checked_value, unchecked_value)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|