ui_bibz 3.0.0.beta10 → 3.0.0.beta11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -4
- data/lib/ui_bibz/infos.rb +1 -1
- data/lib/ui_bibz/ui/core/forms/choices/checkbox_field.rb +1 -0
- data/lib/ui_bibz/ui/core/forms/choices/components/choice.rb +2 -0
- data/lib/ui_bibz/ui/core/forms/choices/radio_field.rb +2 -1
- data/test/simple_form_test.rb +10 -0
- data/test/ui/core/forms/choices/choice_group_test.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5109c403d8f9d306f2f973b619ef117bd7e3df4bb036358e47744058fc553718
|
4
|
+
data.tar.gz: 3e1af30e67ffb1c68ae033110241da17a457aa7e1b0ebc797ca521f8d3d54991
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0bf93e9f8098b12c510c9aa3280506b893d54c6a05dad6338c4e5198ac23b9d27725403497db8171fbc7eb7e0b40358cdacc4238d1311ad2d0e02b19f6afc2b
|
7
|
+
data.tar.gz: dcb82ceeed6c63c19ecf35b95014ccf78f12a702507598a6b29e1ea5665d7767e8d0224630cc2eadf46f1699e7d6917533e391d02cd82b3452bdffabfb417557
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ui_bibz (3.0.0.
|
4
|
+
ui_bibz (3.0.0.beta11)
|
5
5
|
will-paginate-i18n
|
6
6
|
will_paginate (~> 3.3.0)
|
7
7
|
will_paginate-bootstrap4
|
@@ -182,9 +182,9 @@ GEM
|
|
182
182
|
ruby_parser (3.15.1)
|
183
183
|
sexp_processor (~> 4.9)
|
184
184
|
sexp_processor (4.15.2)
|
185
|
-
simple_form (5.0
|
186
|
-
actionpack (>= 5.
|
187
|
-
activemodel (>= 5.
|
185
|
+
simple_form (5.1.0)
|
186
|
+
actionpack (>= 5.2)
|
187
|
+
activemodel (>= 5.2)
|
188
188
|
simplecov (0.21.2)
|
189
189
|
docile (~> 1.1)
|
190
190
|
simplecov-html (~> 0.11)
|
data/lib/ui_bibz/infos.rb
CHANGED
@@ -68,6 +68,7 @@ module UiBibz::Ui::Core::Forms::Choices
|
|
68
68
|
def checkbox_html_options
|
69
69
|
{
|
70
70
|
disabled: disabled?,
|
71
|
+
checked: options[:state] == :active,
|
71
72
|
indeterminate: options[:indeterminate],
|
72
73
|
"data-action": options[:action],
|
73
74
|
class: UiBibz::Utils::Screwdriver.join_classes('form-check-input', input_status)
|
@@ -65,7 +65,8 @@ module UiBibz::Ui::Core::Forms::Choices
|
|
65
65
|
|
66
66
|
def checkbox_html_options
|
67
67
|
{
|
68
|
-
disabled:
|
68
|
+
disabled: disabled?,
|
69
|
+
checked: options[:state] == :active,
|
69
70
|
"data-action": options[:action],
|
70
71
|
class: UiBibz::Utils::Screwdriver.join_classes('form-check-input', input_status)
|
71
72
|
}
|
data/test/simple_form_test.rb
CHANGED
@@ -21,6 +21,16 @@ class SimpleFormTest < ActionView::TestCase
|
|
21
21
|
@user = @users.first
|
22
22
|
end
|
23
23
|
|
24
|
+
test 'simple form input' do
|
25
|
+
actual = simple_form_for @user do |f|
|
26
|
+
f.input :name_fr
|
27
|
+
end
|
28
|
+
|
29
|
+
expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"form-group string optional user_name_fr\"><label class=\"control-label string optional\" for=\"user_name_fr\">Name fr</label><input class=\"form-control string optional\" type=\"text\" value=\"test1\" name=\"user[name_fr]\" id=\"user_name_fr\" /></div></form>"
|
30
|
+
|
31
|
+
assert_equal expected, actual
|
32
|
+
end
|
33
|
+
|
24
34
|
test 'auto complete field input in simple form' do
|
25
35
|
actual = simple_form_for @user do |f|
|
26
36
|
f.input :name_fr, as: :ui_auto_complete_field, collection: @users, label_method: :name_fr
|
@@ -11,7 +11,7 @@ class ChoiceGroupTest < ActionView::TestCase
|
|
11
11
|
bc.choice 'Checkbox 2', state: :active
|
12
12
|
end
|
13
13
|
|
14
|
-
expected = "<div data-toggle=\"buttons\" class=\"btn-group button-choice btn-group-toggle\"><input type=\"checkbox\" autocomplete=\"off\" class=\"btn-check\" id=\"#{actual.items.first.input_options[:id]}\" /><label class=\"btn-secondary btn\" for=\"#{actual.items.first.input_options[:id]}\">Checkbox 1</label><input type=\"checkbox\" autocomplete=\"off\" class=\"btn-check\" checked=\"checked\" id=\"#{actual.items.last.input_options[:id]}\" /><label class=\"
|
14
|
+
expected = "<div data-toggle=\"buttons\" class=\"btn-group button-choice btn-group-toggle\"><input type=\"checkbox\" autocomplete=\"off\" class=\"btn-check\" id=\"#{actual.items.first.input_options[:id]}\" /><label class=\"btn-secondary btn\" for=\"#{actual.items.first.input_options[:id]}\">Checkbox 1</label><input type=\"checkbox\" autocomplete=\"off\" class=\"btn-check\" checked=\"checked\" id=\"#{actual.items.last.input_options[:id]}\" /><label class=\"btn-secondary btn\" aria-pressed=\"true\" for=\"#{actual.items.last.input_options[:id]}\">Checkbox 2</label></div>"
|
15
15
|
|
16
16
|
assert_equal expected, actual.render
|
17
17
|
end
|
@@ -22,7 +22,7 @@ class ChoiceGroupTest < ActionView::TestCase
|
|
22
22
|
bc.choice 'Radio 2', state: :active
|
23
23
|
end
|
24
24
|
|
25
|
-
expected = "<div data-toggle=\"buttons\" class=\"btn-group button-choice btn-group-toggle\"><input type=\"radio\" autocomplete=\"off\" class=\"btn-check\" name=\"#{actual.items.first.input_options[:name]}\" id=\"#{actual.items.first.input_options[:id]}\" /><label class=\"btn-secondary btn\" for=\"#{actual.items.first.input_options[:id]}\">Radio 1</label><input type=\"radio\" autocomplete=\"off\" class=\"btn-check\" checked=\"checked\" name=\"#{actual.items.last.input_options[:name]}\" id=\"#{actual.items.last.input_options[:id]}\" /><label class=\"
|
25
|
+
expected = "<div data-toggle=\"buttons\" class=\"btn-group button-choice btn-group-toggle\"><input type=\"radio\" autocomplete=\"off\" class=\"btn-check\" name=\"#{actual.items.first.input_options[:name]}\" id=\"#{actual.items.first.input_options[:id]}\" /><label class=\"btn-secondary btn\" for=\"#{actual.items.first.input_options[:id]}\">Radio 1</label><input type=\"radio\" autocomplete=\"off\" class=\"btn-check\" checked=\"checked\" name=\"#{actual.items.last.input_options[:name]}\" id=\"#{actual.items.last.input_options[:id]}\" /><label class=\"btn-secondary btn\" aria-pressed=\"true\" for=\"#{actual.items.last.input_options[:id]}\">Radio 2</label></div>"
|
26
26
|
|
27
27
|
assert_equal expected, actual.render
|
28
28
|
end
|
@@ -32,7 +32,7 @@ class ChoiceGroupTest < ActionView::TestCase
|
|
32
32
|
bc.choice 'Radio 1', glyph: 'diamond', status: :primary
|
33
33
|
bc.choice 'Radio 2', state: :active
|
34
34
|
end
|
35
|
-
expected = "<div data-toggle=\"buttons\" class=\"btn-group btn-group-lg button-choice btn-group-toggle\"><input type=\"radio\" autocomplete=\"off\" class=\"btn-check\" name=\"#{actual.items.first.input_options[:name]}\" id=\"#{actual.items.first.input_options[:id]}\" /><label class=\"btn-outline-primary btn btn-lg\" for=\"#{actual.items.first.input_options[:id]}\"><i class=\"glyph fas fa-diamond\"></i> Radio 1</label><input type=\"radio\" autocomplete=\"off\" class=\"btn-check\" checked=\"checked\" name=\"#{actual.items.last.input_options[:name]}\" id=\"#{actual.items.last.input_options[:id]}\" /><label class=\"
|
35
|
+
expected = "<div data-toggle=\"buttons\" class=\"btn-group btn-group-lg button-choice btn-group-toggle\"><input type=\"radio\" autocomplete=\"off\" class=\"btn-check\" name=\"#{actual.items.first.input_options[:name]}\" id=\"#{actual.items.first.input_options[:id]}\" /><label class=\"btn-outline-primary btn btn-lg\" for=\"#{actual.items.first.input_options[:id]}\"><i class=\"glyph fas fa-diamond\"></i> Radio 1</label><input type=\"radio\" autocomplete=\"off\" class=\"btn-check\" checked=\"checked\" name=\"#{actual.items.last.input_options[:name]}\" id=\"#{actual.items.last.input_options[:id]}\" /><label class=\"btn-outline-secondary btn btn-lg\" aria-pressed=\"true\" for=\"#{actual.items.last.input_options[:id]}\">Radio 2</label></div>"
|
36
36
|
|
37
37
|
assert_equal expected, actual.render
|
38
38
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ui_bibz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.
|
4
|
+
version: 3.0.0.beta11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thooams [Thomas HUMMEL]
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-02-
|
11
|
+
date: 2021-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|