dry_crud 1.2.6 → 1.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/generators/dry_crud/templates/app/helpers/standard_form_builder.rb +2 -2
- data/lib/generators/dry_crud/templates/public/stylesheets/crud.css +1 -0
- data/lib/generators/dry_crud/templates/test/unit/helpers/crud_helper_test.rb +3 -3
- data/lib/generators/dry_crud/templates/test/unit/helpers/standard_form_builder_test.rb +9 -2
- data/lib/generators/dry_crud/templates/test/unit/helpers/standard_helper_test.rb +3 -3
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.7
|
@@ -72,7 +72,7 @@ class StandardFormBuilder < ActionView::Helpers::FormBuilder
|
|
72
72
|
|
73
73
|
# Render a standard number field.
|
74
74
|
def number_field(attr, html_options = {})
|
75
|
-
|
75
|
+
super(attr, {:size => 15}.merge(html_options))
|
76
76
|
end
|
77
77
|
|
78
78
|
# Render an integer field.
|
@@ -115,7 +115,7 @@ class StandardFormBuilder < ActionView::Helpers::FormBuilder
|
|
115
115
|
|
116
116
|
# Renders a marker if the given attr has to be present.
|
117
117
|
def required_mark(attr)
|
118
|
-
|
118
|
+
required?(attr) ? REQUIRED_MARK : ''
|
119
119
|
end
|
120
120
|
|
121
121
|
# Render a label for the given attribute with the passed field html section.
|
@@ -82,9 +82,9 @@ class CrudHelperTest < ActionView::TestCase
|
|
82
82
|
assert_match /form .*?action="\/crud_test_models\/#{@entry.id}"/, f
|
83
83
|
assert_match /input .*?name="crud_test_model\[name\]" .*?type="text"/, f
|
84
84
|
assert_match /input .*?name="crud_test_model\[whatever\]" .*?type="text"/, f
|
85
|
-
assert_match /input .*?name="crud_test_model\[children\]" .*?type="
|
86
|
-
assert_match /input .*?name="crud_test_model\[rating\]" .*?type="
|
87
|
-
assert_match /input .*?name="crud_test_model\[income\]" .*?type="
|
85
|
+
assert_match /input .*?name="crud_test_model\[children\]" .*?type="number"/, f
|
86
|
+
assert_match /input .*?name="crud_test_model\[rating\]" .*?type="number"/, f
|
87
|
+
assert_match /input .*?name="crud_test_model\[income\]" .*?type="number"/, f
|
88
88
|
assert_match /select .*?name="crud_test_model\[birthdate\(1i\)\]"/, f
|
89
89
|
assert_match /input .*?name="crud_test_model\[human\]" .*?type="checkbox"/, f
|
90
90
|
assert_match /select .*?name="crud_test_model\[companion_id\]"/, f
|
@@ -61,6 +61,13 @@ class StandardFormBuilderTest < ActionView::TestCase
|
|
61
61
|
assert result.include?(form.input_field(:children))
|
62
62
|
end
|
63
63
|
|
64
|
+
test "labeld_input_field adds required mark" do
|
65
|
+
result = form.labeled_input_field(:name)
|
66
|
+
assert result.include?(StandardFormBuilder::REQUIRED_MARK)
|
67
|
+
result = form.labeled_input_field(:remarks)
|
68
|
+
assert !result.include?(StandardFormBuilder::REQUIRED_MARK)
|
69
|
+
end
|
70
|
+
|
64
71
|
test "belongs_to_field has all options by default" do
|
65
72
|
f = form.belongs_to_field(:companion_id)
|
66
73
|
assert_equal 7, f.scan('</option>').size
|
@@ -113,8 +120,8 @@ class StandardFormBuilderTest < ActionView::TestCase
|
|
113
120
|
|
114
121
|
test "required mark is shown" do
|
115
122
|
assert_equal StandardFormBuilder::REQUIRED_MARK, form.required_mark(:name)
|
116
|
-
|
117
|
-
|
123
|
+
assert_equal "", form.required_mark(:rating)
|
124
|
+
assert_equal "", form.required_mark(:anything)
|
118
125
|
end
|
119
126
|
|
120
127
|
test "method missing still works" do
|
@@ -175,7 +175,7 @@ class StandardHelperTest < ActionView::TestCase
|
|
175
175
|
assert_match /option selected="selected" value="1910">1910<\/option>/, f
|
176
176
|
assert_match /option selected="selected" value="1">January<\/option>/, f
|
177
177
|
assert_match /option selected="selected" value="1">1<\/option>/, f
|
178
|
-
assert_match /input .*?name="crud_test_model\[children\]" .*?type="
|
178
|
+
assert_match /input .*?name="crud_test_model\[children\]" .*?type="number" .*?value=\"9\"/, f
|
179
179
|
assert_match /input .*?name="crud_test_model\[human\]" .*?type="checkbox"/, f
|
180
180
|
assert_match /input .*?type="submit" .*?value="Save"/, f
|
181
181
|
end
|
@@ -190,7 +190,7 @@ class StandardHelperTest < ActionView::TestCase
|
|
190
190
|
assert_match /input .*?name="crud_test_model\[name\]" .*?type="text"/, f
|
191
191
|
assert_no_match /input .*?name="crud_test_model\[name\]" .*?type="text" .*?value=/, f
|
192
192
|
assert_match /select .*?name="crud_test_model\[birthdate\(1i\)\]"/, f
|
193
|
-
assert_match /input .*?name="crud_test_model\[children\]" .*?type="
|
193
|
+
assert_match /input .*?name="crud_test_model\[children\]" .*?type="number"/, f
|
194
194
|
assert_no_match /input .*?name="crud_test_model\[children\]" .*?type="text" .*?value=/, f
|
195
195
|
assert_match /input .*?type="submit" .*?value="Save"/, f
|
196
196
|
end
|
@@ -212,7 +212,7 @@ class StandardHelperTest < ActionView::TestCase
|
|
212
212
|
assert_match /option selected="selected" value="1910">1910<\/option>/, f
|
213
213
|
assert_match /option selected="selected" value="1">January<\/option>/, f
|
214
214
|
assert_match /option selected="selected" value="1">1<\/option>/, f
|
215
|
-
assert_match /input .*?name="crud_test_model\[children\]" .*?type="
|
215
|
+
assert_match /input .*?name="crud_test_model\[children\]" .*?type="number" .*?value=\"9\"/, f
|
216
216
|
assert_match /input .*?name="crud_test_model\[human\]" .*?type="checkbox"/, f
|
217
217
|
assert_match /input .*?type="submit" .*?value="Save"/, f
|
218
218
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dry_crud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 1.2.
|
9
|
+
- 7
|
10
|
+
version: 1.2.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Pascal Zumkehr
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-02-
|
18
|
+
date: 2011-02-10 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|