property_sets 0.1.1 → 0.1.2
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/VERSION +1 -1
- data/lib/property_sets/action_view_extension.rb +20 -21
- data/property_sets.gemspec +1 -1
- data/test/test_property_sets.rb +2 -2
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
@@ -15,34 +15,33 @@ module ActionView
|
|
15
15
|
options[:name] = "#{model_name}[property_sets][#{property_set}][#{method}]"
|
16
16
|
@template.check_box(model_name, "property_sets_#{property_set}_#{method}", options, checked_value, unchecked_value)
|
17
17
|
end
|
18
|
-
end
|
19
18
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
class FormBuilder
|
20
|
+
class PropertySetFormBuilderProxy < Delegator
|
21
|
+
attr_accessor :builder
|
22
|
+
attr_accessor :property_set
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
def initialize(property_set, builder)
|
25
|
+
self.property_set = property_set
|
26
|
+
self.builder = builder
|
27
|
+
end
|
29
28
|
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
def __getobj__
|
30
|
+
builder
|
31
|
+
end
|
33
32
|
|
34
|
-
|
35
|
-
|
33
|
+
def check_box(property, options = {}, checked_value = "1", unchecked_value = "0")
|
34
|
+
builder.property_set_check_box(property_set, property, options, checked_value, unchecked_value)
|
35
|
+
end
|
36
36
|
end
|
37
|
-
end
|
38
37
|
|
39
|
-
|
40
|
-
|
41
|
-
|
38
|
+
def property_set(identifier)
|
39
|
+
PropertySetFormBuilderProxy.new(identifier, self)
|
40
|
+
end
|
42
41
|
|
43
|
-
|
44
|
-
|
42
|
+
def property_set_check_box(property_set, property, options, checked_value, unchecked_value)
|
43
|
+
@template.property_set_check_box(@object_name, property_set, property, objectify_options(options), checked_value, unchecked_value)
|
44
|
+
end
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
48
|
-
|
data/property_sets.gemspec
CHANGED
data/test/test_property_sets.rb
CHANGED
@@ -171,8 +171,8 @@ class TestPropertySets < ActiveSupport::TestCase
|
|
171
171
|
|
172
172
|
context "view construction" do
|
173
173
|
should "provide a form builder proxy" do
|
174
|
-
proxy = ActionView::FormBuilder.new.property_set(:foo)
|
175
|
-
assert proxy.is_a?(ActionView::FormBuilder::PropertySetFormBuilderProxy)
|
174
|
+
proxy = ActionView::Helpers::FormBuilder.new("hi", "hi", "hi", nil, nil).property_set(:foo)
|
175
|
+
assert proxy.is_a?(ActionView::Helpers::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: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Morten Primdahl
|