ui_bibz 3.0.0.alpha3 → 3.0.0.alpha10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +11 -11
- data/README.md +5 -1
- data/lib/ui_bibz.rb +0 -1
- data/lib/ui_bibz/helpers/ui/core/forms_helper.rb +2 -1
- data/lib/ui_bibz/infos.rb +4 -4
- data/lib/ui_bibz/inputs/ui_bibz_inputs/ui_checkbox_field_input.rb +5 -1
- data/lib/ui_bibz/inputs/ui_bibz_inputs/ui_multi_select_field_input.rb +3 -3
- data/lib/ui_bibz/inputs/ui_bibz_inputs/ui_slider_field_input.rb +1 -1
- data/lib/ui_bibz/rails/engine.rb +0 -4
- data/lib/ui_bibz/ui/concerns/card_itemable_concern.rb +2 -0
- data/lib/ui_bibz/ui/concerns/html_concern.rb +3 -3
- data/lib/ui_bibz/ui/core/boxes/components/card_body.rb +8 -0
- data/lib/ui_bibz/ui/core/boxes/components/card_image.rb +6 -2
- data/lib/ui_bibz/ui/core/forms/buttons/button.rb +3 -12
- data/lib/ui_bibz/ui/core/forms/buttons/button_link.rb +1 -2
- data/lib/ui_bibz/ui/core/forms/buttons/button_refresh.rb +0 -1
- data/lib/ui_bibz/ui/core/forms/choices/checkbox_field.rb +13 -4
- data/lib/ui_bibz/ui/core/forms/choices/radio_field.rb +7 -1
- data/lib/ui_bibz/ui/core/forms/choices/switch_field.rb +4 -0
- data/lib/ui_bibz/ui/core/forms/dropdowns/dropdown.rb +13 -9
- data/lib/ui_bibz/ui/core/forms/dropdowns/split_dropdown.rb +7 -2
- data/lib/ui_bibz/ui/core/forms/numbers/formula_field.rb +2 -0
- data/lib/ui_bibz/ui/core/forms/numbers/range_field.rb +19 -1
- data/lib/ui_bibz/ui/core/forms/numbers/slider_field.rb +13 -1
- data/lib/ui_bibz/ui/core/forms/numbers/slider_header.rb +4 -4
- data/lib/ui_bibz/ui/core/forms/selects/dropdown_select_field.rb +41 -59
- data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button.rb +1 -9
- data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button_link.rb +1 -9
- data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_dropdown.rb +5 -4
- data/lib/ui_bibz/ui/core/forms/surrounds/surround_field.rb +3 -8
- data/lib/ui_bibz/ui/core/icons/glyph.rb +9 -1
- data/lib/ui_bibz/ui/core/navigations/components/nav_dropdown.rb +2 -2
- data/lib/ui_bibz/ui/core/navigations/components/nav_link_link.rb +2 -2
- data/lib/ui_bibz/ui/core/navigations/nav.rb +3 -3
- data/lib/ui_bibz/ui/core/navigations/navbar.rb +6 -4
- data/lib/ui_bibz/ui/core/navigations/tab_group.rb +5 -1
- data/lib/ui_bibz/ui/core/notifications/components/toast_header.rb +15 -1
- data/lib/ui_bibz/ui/core/windows/modal.rb +6 -2
- data/lib/ui_bibz/ui/extensions/core/component/glyph_extension.rb +11 -24
- data/lib/ui_bibz/ui/extensions/core/component/popover_extension.rb +1 -1
- data/lib/ui_bibz/ui/extensions/core/forms/surround_extension.rb +1 -1
- data/lib/ui_bibz/ui/ux/containers/components/panel_header.rb +3 -2
- data/lib/ui_bibz/ui/ux/containers/components/panel_header_title.rb +47 -0
- data/lib/ui_bibz/ui/ux/tables/table_pagination_per_page.rb +3 -3
- data/lib/ui_bibz/ui/ux/tables/table_search_field.rb +4 -4
- data/lib/ui_bibz/utils/breakdown_class_name_generator.rb +20 -7
- data/lib/ui_bibz/utils/internationalization.rb +1 -1
- data/test/simple_form_test.rb +6 -28
- data/test/ui/core/boxes/card_test.rb +2 -2
- data/test/ui/core/component_test.rb +2 -2
- data/test/ui/core/forms/buttons/button_group_test.rb +2 -2
- data/test/ui/core/forms/buttons/button_link_test.rb +1 -8
- data/test/ui/core/forms/buttons/button_refresh_test.rb +1 -1
- data/test/ui/core/forms/buttons/button_test.rb +2 -9
- data/test/ui/core/forms/choices/checkbox_field_test.rb +8 -1
- data/test/ui/core/forms/choices/choice_group_test.rb +3 -3
- data/test/ui/core/forms/choices/radio_field_test.rb +1 -1
- data/test/ui/core/forms/dropdowns/dropdown_test.rb +2 -2
- data/test/ui/core/forms/numbers/range_field_test.rb +14 -0
- data/test/ui/core/forms/numbers/slider_field_test.rb +2 -2
- data/test/ui/core/forms/selects/multi_select_field_test.rb +6 -6
- data/test/ui/core/forms/selects/select_field_test.rb +1 -1
- data/test/ui/core/forms/surrounds/surround_field_test.rb +27 -3
- data/test/ui/core/forms/texts/auto_complete_field_test.rb +2 -2
- data/test/ui/core/navigations/breadcrumb_test.rb +1 -1
- data/test/ui/core/navigations/link_test.rb +1 -1
- data/test/ui/core/navigations/nav_test.rb +7 -6
- data/test/ui/core/navigations/navbar_test.rb +5 -6
- data/test/ui/core/navigations/tab_group_test.rb +5 -5
- data/test/ui/core/notifications/alert_test.rb +1 -1
- data/test/ui/core/notifications/badge_test.rb +2 -2
- data/test/ui/utils/breakdown_class_name_generator_test.rb +14 -0
- data/test/ui/ux/containers/panel_test.rb +1 -1
- data/test/ui/ux/tables/table_test.rb +2 -2
- data/ui_bibz.gemspec +1 -1
- metadata +7 -10
- data/lib/ui_bibz/ui/core/forms/selects/multi_select_field.rb +0 -122
- data/package.json +0 -5
- data/test/ui/core/forms/selects/dropdown_select_field_test.rb +0 -84
@@ -16,7 +16,7 @@ class AlertTest < ActionView::TestCase
|
|
16
16
|
a.header 'Information'
|
17
17
|
a.body 'Body text'
|
18
18
|
end
|
19
|
-
expected = "<div class=\"alert-success alert alert-dismissible\" role=\"alert\"><h4 class=\"alert-header\"><i class=\"glyph fas fa-thumbs-o-up\"></i>
|
19
|
+
expected = "<div class=\"alert-success alert alert-dismissible\" role=\"alert\"><h4 class=\"alert-header\"><i class=\"glyph fas fa-thumbs-o-up\"></i> Information<button type=\"button\" class=\"btn-close\" data-dismiss=\"alert\" aria-label=\"Close\"></button></h4><hr /><p class=\"alert-body mb-0\">Body text</p></div>"
|
20
20
|
|
21
21
|
assert_equal expected, actual
|
22
22
|
end
|
@@ -6,7 +6,7 @@ class BadgeTest < ActionView::TestCase
|
|
6
6
|
|
7
7
|
test 'badge' do
|
8
8
|
actual = ui_badge 'state', status: :success, glyph: 'pencil'
|
9
|
-
expected =
|
9
|
+
expected = "<span class=\"bg-success badge\"><i class=\"glyph fas fa-pencil\"></i> state</span>"
|
10
10
|
|
11
11
|
assert_equal expected, actual
|
12
12
|
end
|
@@ -20,7 +20,7 @@ class BadgeTest < ActionView::TestCase
|
|
20
20
|
|
21
21
|
test 'badge pill' do
|
22
22
|
actual = ui_badge 'state', status: :success, type: :pill, glyph: 'pencil'
|
23
|
-
expected =
|
23
|
+
expected = "<span class=\"bg-success badge rounded-pill\"><i class=\"glyph fas fa-pencil\"></i> state</span>"
|
24
24
|
|
25
25
|
assert_equal expected, actual
|
26
26
|
end
|
@@ -57,4 +57,18 @@ class BreakdownClassNameGeneratorTest < ActionView::TestCase
|
|
57
57
|
|
58
58
|
assert_equal expected, actual
|
59
59
|
end
|
60
|
+
|
61
|
+
test "name generator with order" do
|
62
|
+
actual = UiBibz::Utils::BreakdownClassNameGenerator.new(md: { num: 2 }, order: 2).class_names
|
63
|
+
expected = %w[col-md-2 order-2]
|
64
|
+
|
65
|
+
assert_equal expected, actual
|
66
|
+
end
|
67
|
+
|
68
|
+
test "name generator with md: 8" do
|
69
|
+
actual = UiBibz::Utils::BreakdownClassNameGenerator.new(md: 8).class_names
|
70
|
+
expected = ["col-md-8"]
|
71
|
+
|
72
|
+
assert_equal expected, actual
|
73
|
+
end
|
60
74
|
end
|
@@ -35,7 +35,7 @@ class CardTest < ActionView::TestCase
|
|
35
35
|
end
|
36
36
|
p.footer 'Footer'
|
37
37
|
end
|
38
|
-
expected = "<div class=\"panel\"><div class=\"panel-header justify-content-between\"><div class=\"panel-title\">My header</div><div class=\"btn-group btn-group-sm\" role=\"group\"><button class=\"btn-outline-secondary btn btn-sm
|
38
|
+
expected = "<div class=\"panel\"><div class=\"panel-header justify-content-between\"><div class=\"panel-title\">My header</div><div class=\"btn-group btn-group-sm\" role=\"group\"><button class=\"btn-outline-secondary btn btn-sm\"><i class=\"glyph fas fa-caret-up\"></i> <span class=\"visually-hidden\">Minimize</span></button><button class=\"btn-outline-secondary btn btn-sm\"><i class=\"glyph fas fa-cog\"></i> <span class=\"visually-hidden\">Options</span></button><button class=\"btn-outline-secondary btn btn-sm\"><i class=\"glyph fas fa-Close\"></i> <span class=\"visually-hidden\">Close</span></button></div></div><div class=\"btn-toolbar justify-content-between panel-toolbar\" role=\"toolbar\"><div role=\"group\" class=\"btn-group btn-group-sm mr-2\"><button class=\"btn-secondary btn btn-sm\">Copy</button><button class=\"btn-secondary btn btn-sm\">Cut</button><button class=\"btn-secondary btn btn-sm\">Paste</button></div><div class=\"btn-group btn-group-sm\" role=\"group\"><button class=\"btn-secondary btn btn-sm\">Delete</button></div></div><div class=\"panel-body\">Body</div><div class=\"btn-toolbar panel-toolbar\" role=\"toolbar\"><div class=\"btn-group btn-group-sm\" role=\"group\"><button class=\"btn-success btn btn-sm\"><i class=\"glyph fas fa-plus-circle\"></i> <span class=\"visually-hidden\">Add</span></button><button class=\"btn-danger btn btn-sm\"><i class=\"glyph fas fa-minus-circle\"></i> <span class=\"visually-hidden\">Remove</span></button></div></div><div class=\"panel-footer\">Footer</div></div>"
|
39
39
|
|
40
40
|
assert_equal expected, actual
|
41
41
|
end
|
@@ -26,7 +26,7 @@ class TableTest < ActionView::TestCase
|
|
26
26
|
|
27
27
|
test 'table search field' do
|
28
28
|
actual = UiBibz::Ui::Ux::Tables::TableSearchField.new({ store: @users }).render
|
29
|
-
expected = "<form class=\"form-table-search-field\" action=\"/users?direction=asc&page=1&per_page=2&search=Name+fr&sort=users.name_fr\" accept-charset=\"UTF-8\" method=\"get\"><div class=\"input-group input-group-sm table-search-field\"><span class=\"input-group-text\"><i class=\"glyph fas fa-search\"></i></span><input type=\"hidden\" name=\"sort\" value=\"users.name_fr\" /><input type=\"hidden\" name=\"direction\" value=\"asc\" /><input type=\"hidden\" name=\"per_page\" value=\"2\" /><input type=\"hidden\" name=\"page\" value=\"1\" /><input type=\"hidden\" name=\"only_path\" value=\"true\" /><input type=\"hidden\" name=\"link_type\" value=\"search\" /><input type=\"search\" value=\"Name fr\" name=\"search\" class=\"form-control\" placeholder=\"Search by Name fr and Name en...\" /><button type=\"button\" class=\"btn btn-secondary input-group-btn clear-search-btn\"><i class=\"glyph fas fa-times-circle\"></i></button></div></form>"
|
29
|
+
expected = "<form class=\"form-table-search-field\" action=\"/users?direction=asc&page=1&per_page=2&search=Name+fr&sort=users.name_fr\" accept-charset=\"UTF-8\" method=\"get\"><div class=\"input-group input-group-sm table-search-field\"><span class=\"input-group-text\"><i class=\"glyph fas fa-search\"></i></span><input type=\"hidden\" name=\"sort\" value=\"users.name_fr\" /><input type=\"hidden\" name=\"direction\" value=\"asc\" /><input type=\"hidden\" name=\"per_page\" value=\"2\" /><input type=\"hidden\" name=\"page\" value=\"1\" /><input type=\"hidden\" name=\"only_path\" value=\"true\" /><input type=\"hidden\" name=\"link_type\" value=\"search\" /><input type=\"search\" value=\"Name fr\" name=\"search\" class=\"form-control\" placeholder=\"Search by Name fr and Name en...\" /><button type=\"button\" class=\"btn btn-secondary input-group-btn clear-search-btn\"><i class=\"glyph fas fa-times-circle\"></i> <span class=\"visually-hidden\">Clear Search</span></button></div></form>"
|
30
30
|
|
31
31
|
assert_equal expected, actual
|
32
32
|
end
|
@@ -97,7 +97,7 @@ class TableTest < ActionView::TestCase
|
|
97
97
|
test 'table searchable' do
|
98
98
|
options = { searchable: true }
|
99
99
|
actual = UiBibz::Ui::Ux::Tables::Searchable.new(@store, options).render
|
100
|
-
expected = "<div><div class=\"title\">Users list</div><form class=\"form-table-search-field\" action=\"/users?direction=asc&page=1&per_page=2&search=Name+fr&sort=users.name_fr\" accept-charset=\"UTF-8\" method=\"get\"><div class=\"input-group input-group-sm table-search-field\"><span class=\"input-group-text\"><i class=\"glyph fas fa-search\"></i></span><input type=\"hidden\" name=\"sort\" value=\"users.name_fr\" /><input type=\"hidden\" name=\"direction\" value=\"asc\" /><input type=\"hidden\" name=\"per_page\" value=\"2\" /><input type=\"hidden\" name=\"page\" value=\"1\" /><input type=\"hidden\" name=\"only_path\" value=\"true\" /><input type=\"hidden\" name=\"link_type\" value=\"search\" /><input type=\"search\" value=\"Name fr\" name=\"search\" class=\"form-control\" placeholder=\"Search by Name fr and Name en...\" /><button type=\"button\" class=\"btn btn-secondary input-group-btn clear-search-btn\"><i class=\"glyph fas fa-times-circle\"></i></button></div></form><br class=\"ui-bibz-clear\" /></div>"
|
100
|
+
expected = "<div><div class=\"title\">Users list</div><form class=\"form-table-search-field\" action=\"/users?direction=asc&page=1&per_page=2&search=Name+fr&sort=users.name_fr\" accept-charset=\"UTF-8\" method=\"get\"><div class=\"input-group input-group-sm table-search-field\"><span class=\"input-group-text\"><i class=\"glyph fas fa-search\"></i></span><input type=\"hidden\" name=\"sort\" value=\"users.name_fr\" /><input type=\"hidden\" name=\"direction\" value=\"asc\" /><input type=\"hidden\" name=\"per_page\" value=\"2\" /><input type=\"hidden\" name=\"page\" value=\"1\" /><input type=\"hidden\" name=\"only_path\" value=\"true\" /><input type=\"hidden\" name=\"link_type\" value=\"search\" /><input type=\"search\" value=\"Name fr\" name=\"search\" class=\"form-control\" placeholder=\"Search by Name fr and Name en...\" /><button type=\"button\" class=\"btn btn-secondary input-group-btn clear-search-btn\"><i class=\"glyph fas fa-times-circle\"></i> <span class=\"visually-hidden\">Clear Search</span></button></div></form><br class=\"ui-bibz-clear\" /></div>"
|
101
101
|
|
102
102
|
assert_equal expected, actual
|
103
103
|
end
|
data/ui_bibz.gemspec
CHANGED
@@ -12,7 +12,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
12
12
|
Gem::Specification.new do |s|
|
13
13
|
s.name = UiBibz::SLUG
|
14
14
|
s.version = UiBibz::VERSION
|
15
|
-
s.
|
15
|
+
s.author = UiBibz::AUTHOR
|
16
16
|
s.email = UiBibz::EMAIL
|
17
17
|
s.homepage = UiBibz::HOMEPAGE
|
18
18
|
s.summary = UiBibz::SUMMARY
|
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.alpha10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Thooams
|
7
|
+
- Thooams [Thomas HUMMEL]
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -240,7 +240,7 @@ dependencies:
|
|
240
240
|
- - ">="
|
241
241
|
- !ruby/object:Gem::Version
|
242
242
|
version: '0'
|
243
|
-
description: A Rails Interface Framework using Bootstrap 5.0.0.
|
243
|
+
description: A Rails Interface Framework using Bootstrap 5.0.0.alpha3.
|
244
244
|
email: thomas@hummel.link
|
245
245
|
executables:
|
246
246
|
- test
|
@@ -357,7 +357,6 @@ files:
|
|
357
357
|
- lib/ui_bibz/ui/core/forms/selects/abstract_select.rb
|
358
358
|
- lib/ui_bibz/ui/core/forms/selects/dropdown_select_field.rb
|
359
359
|
- lib/ui_bibz/ui/core/forms/selects/multi_column_field.rb
|
360
|
-
- lib/ui_bibz/ui/core/forms/selects/multi_select_field.rb
|
361
360
|
- lib/ui_bibz/ui/core/forms/selects/select_field.rb
|
362
361
|
- lib/ui_bibz/ui/core/forms/surrounds/components/surround_addon.rb
|
363
362
|
- lib/ui_bibz/ui/core/forms/surrounds/components/surround_button.rb
|
@@ -428,6 +427,7 @@ files:
|
|
428
427
|
- lib/ui_bibz/ui/ux/containers/components/panel_footer.rb
|
429
428
|
- lib/ui_bibz/ui/ux/containers/components/panel_group.rb
|
430
429
|
- lib/ui_bibz/ui/ux/containers/components/panel_header.rb
|
430
|
+
- lib/ui_bibz/ui/ux/containers/components/panel_header_title.rb
|
431
431
|
- lib/ui_bibz/ui/ux/containers/components/panel_tab_group.rb
|
432
432
|
- lib/ui_bibz/ui/ux/containers/components/panel_toolbar.rb
|
433
433
|
- lib/ui_bibz/ui/ux/containers/panel.rb
|
@@ -450,7 +450,6 @@ files:
|
|
450
450
|
- lib/ui_bibz/utils/glyph_changer.rb
|
451
451
|
- lib/ui_bibz/utils/internationalization.rb
|
452
452
|
- lib/ui_bibz/utils/screwdriver.rb
|
453
|
-
- package.json
|
454
453
|
- structure.md
|
455
454
|
- test/dummy/README.rdoc
|
456
455
|
- test/dummy/Rakefile
|
@@ -541,7 +540,6 @@ files:
|
|
541
540
|
- test/ui/core/forms/numbers/number_field_test.rb
|
542
541
|
- test/ui/core/forms/numbers/range_field_test.rb
|
543
542
|
- test/ui/core/forms/numbers/slider_field_test.rb
|
544
|
-
- test/ui/core/forms/selects/dropdown_select_field_test.rb
|
545
543
|
- test/ui/core/forms/selects/multi_column_field_test.rb
|
546
544
|
- test/ui/core/forms/selects/multi_select_field_test.rb
|
547
545
|
- test/ui/core/forms/selects/select_field_test.rb
|
@@ -637,7 +635,7 @@ files:
|
|
637
635
|
- vendor/assets/stylesheets/jquery.multi-select.min.css
|
638
636
|
- vendor/assets/stylesheets/svg-with-js.css
|
639
637
|
- vendor/assets/stylesheets/tether.min.css
|
640
|
-
homepage:
|
638
|
+
homepage: https://hummel.link/ui-bibz/
|
641
639
|
licenses:
|
642
640
|
- MIT
|
643
641
|
metadata: {}
|
@@ -661,7 +659,7 @@ rubygems_version: 3.1.2
|
|
661
659
|
signing_key:
|
662
660
|
specification_version: 4
|
663
661
|
summary: Ui Bibz is an Ui Framework that allows you to build an interface very quickly
|
664
|
-
and simply using Bootstrap 5.0.0.
|
662
|
+
and simply using Bootstrap 5.0.0.alpha3.
|
665
663
|
test_files:
|
666
664
|
- test/dummy/README.rdoc
|
667
665
|
- test/dummy/Rakefile
|
@@ -752,7 +750,6 @@ test_files:
|
|
752
750
|
- test/ui/core/forms/numbers/number_field_test.rb
|
753
751
|
- test/ui/core/forms/numbers/range_field_test.rb
|
754
752
|
- test/ui/core/forms/numbers/slider_field_test.rb
|
755
|
-
- test/ui/core/forms/selects/dropdown_select_field_test.rb
|
756
753
|
- test/ui/core/forms/selects/multi_column_field_test.rb
|
757
754
|
- test/ui/core/forms/selects/multi_select_field_test.rb
|
758
755
|
- test/ui/core/forms/selects/select_field_test.rb
|
@@ -1,122 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module UiBibz::Ui::Core::Forms::Selects
|
4
|
-
# Create a MultiSelectField
|
5
|
-
#
|
6
|
-
# This element is an extend of UiBibz::Ui::Core::Forms::Buttons::Button
|
7
|
-
# source : http://loudev.com/
|
8
|
-
#
|
9
|
-
# ==== Attributes
|
10
|
-
#
|
11
|
-
# * +content+ - Content of element
|
12
|
-
# * +options+ - Options of element
|
13
|
-
# * +html_options+ - Html Options of element
|
14
|
-
#
|
15
|
-
# ==== Options
|
16
|
-
#
|
17
|
-
# You can add HTML attributes using the +html_options+.
|
18
|
-
# You can pass arguments in options attribute:
|
19
|
-
# * +option_tags+ - Array, Object [required]
|
20
|
-
# * +clickable_opt_group+ - Boolean
|
21
|
-
# * +collapsible_opt_group+ - Boolean
|
22
|
-
# * +searchable+ - Boolean
|
23
|
-
# * +select_all_option+ - Boolean
|
24
|
-
# * +append+ - String, Html
|
25
|
-
# * +prepend+ - String, Html
|
26
|
-
# * +connect+ - Hash
|
27
|
-
# * +event+ - String
|
28
|
-
# * +mode+ - String
|
29
|
-
# * +target+ - Hash
|
30
|
-
# * +selector+ - String
|
31
|
-
# * +data+ - Array
|
32
|
-
# * +url+ - String
|
33
|
-
#
|
34
|
-
# ==== Signatures
|
35
|
-
#
|
36
|
-
# UiBibz::Ui::Core::Forms::Selects::MultiSelectField.new(content, options = {}, html_options = {}).render
|
37
|
-
#
|
38
|
-
# UiBibz::Ui::Core::Forms::Selects::MultiSelectField.new(options = {}, html_options = {}) do
|
39
|
-
# content
|
40
|
-
# end.render
|
41
|
-
#
|
42
|
-
# ==== Examples
|
43
|
-
#
|
44
|
-
# UiBibz::Ui::Core::Forms::Selects::MultiSelectField.new('fruits', { option_tags: list_of_fruits, searchable: true }, { class: 'test' })
|
45
|
-
#
|
46
|
-
# UiBibz::Ui::Core::Forms::Selects::MultiSelectField.new({ option_tags: list_of_fruits, select_all_option: true }, { class: 'test' }) do
|
47
|
-
# 'fruits'
|
48
|
-
# end
|
49
|
-
#
|
50
|
-
# ==== Helper
|
51
|
-
#
|
52
|
-
# multi_select_field(content, options = {}, html_options = {})
|
53
|
-
#
|
54
|
-
class MultiSelectField < UiBibz::Ui::Core::Forms::Selects::AbstractSelect
|
55
|
-
# See UiBibz::Ui::Core::Forms::Buttons::Button.initialize
|
56
|
-
|
57
|
-
private
|
58
|
-
|
59
|
-
def component_html_options
|
60
|
-
super.merge({
|
61
|
-
multiple: true,
|
62
|
-
disabled: options[:state] == :disabled,
|
63
|
-
include_blank: false,
|
64
|
-
prompt: false
|
65
|
-
})
|
66
|
-
end
|
67
|
-
|
68
|
-
def component_html_classes
|
69
|
-
super << [size, type, status, button_outline, 'multi-select-field']
|
70
|
-
end
|
71
|
-
|
72
|
-
def component_html_data
|
73
|
-
super
|
74
|
-
clickable_opt_group
|
75
|
-
collapsible_opt_group
|
76
|
-
searchable
|
77
|
-
select_all_options
|
78
|
-
number_displayed
|
79
|
-
end
|
80
|
-
|
81
|
-
def clickable_opt_group
|
82
|
-
add_html_data('enable_clickable_opt_groups') if options[:clickable_opt_group]
|
83
|
-
end
|
84
|
-
|
85
|
-
def collapsible_opt_group
|
86
|
-
add_html_data('enable_collapsible_opt_groups') if options[:collapsible_opt_group]
|
87
|
-
end
|
88
|
-
|
89
|
-
def searchable
|
90
|
-
add_html_data('enable_filtering') if options[:searchable]
|
91
|
-
end
|
92
|
-
|
93
|
-
def number_displayed
|
94
|
-
add_html_data('number_displayed') if options[:number_displayed]
|
95
|
-
end
|
96
|
-
|
97
|
-
def select_all_options
|
98
|
-
add_html_data('include_select_all_option') if options[:select_all_options]
|
99
|
-
end
|
100
|
-
|
101
|
-
def status
|
102
|
-
options[:status].nil? ? 'btn-secondary' : "btn-#{options[:status]}"
|
103
|
-
end
|
104
|
-
|
105
|
-
def type
|
106
|
-
'btn-block' if options[:type] == :block
|
107
|
-
end
|
108
|
-
|
109
|
-
# :lg, :sm or :xs
|
110
|
-
def size
|
111
|
-
"btn-#{options[:size]}" if options[:size]
|
112
|
-
end
|
113
|
-
|
114
|
-
def button_outline
|
115
|
-
['btn', outline, @status || :secondary].compact.join('-')
|
116
|
-
end
|
117
|
-
|
118
|
-
def outline
|
119
|
-
'outline' if @options[:outline]
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
data/package.json
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'test_helper'
|
4
|
-
|
5
|
-
class DropdownSelectFieldTest < ActionView::TestCase
|
6
|
-
test 'dropdown_select_field' do
|
7
|
-
options = options_for_select(Array.new(2) { |i| "option #{i}" })
|
8
|
-
actual = UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new('test', options_tags: options).render
|
9
|
-
expected = '<select name="test" id="test" data-style="btn-secondary" class="dropdown-select-field"></select>'
|
10
|
-
|
11
|
-
assert_equal expected, actual
|
12
|
-
end
|
13
|
-
|
14
|
-
test 'dropdown_select_field searchable' do
|
15
|
-
options = options_for_select(Array.new(2) { |i| "option #{i}" })
|
16
|
-
actual = UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new('test', { options_tags: options, searchable: true }).render
|
17
|
-
expected = '<select name="test" id="test" data-live-search="true" data-style="btn-secondary" class="dropdown-select-field"></select>'
|
18
|
-
|
19
|
-
assert_equal expected, actual
|
20
|
-
end
|
21
|
-
|
22
|
-
test 'dropdown_select_field max_options' do
|
23
|
-
options = options_for_select(Array.new(2) { |i| "option #{i}" })
|
24
|
-
actual = UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new('test', { options_tags: options, max_options: 2 }).render
|
25
|
-
expected = '<select name="test" id="test" data-max-options="2" data-style="btn-secondary" class="dropdown-select-field"></select>'
|
26
|
-
|
27
|
-
assert_equal expected, actual
|
28
|
-
end
|
29
|
-
|
30
|
-
test 'dropdown_select_field selected_text_format' do
|
31
|
-
options = options_for_select(Array.new(2) { |i| "option #{i}" })
|
32
|
-
actual = UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new('test', { options_tags: options, selected_text_format: 'count > x' }).render
|
33
|
-
expected = '<select name="test" id="test" data-selected-text-format="count > x" data-style="btn-secondary" class="dropdown-select-field"></select>'
|
34
|
-
|
35
|
-
assert_equal expected, actual
|
36
|
-
end
|
37
|
-
|
38
|
-
test 'dropdown_select_field menu_size' do
|
39
|
-
options = options_for_select(Array.new(2) { |i| "option #{i}" })
|
40
|
-
actual = UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new('test', { options_tags: options, menu_size: 2 }).render
|
41
|
-
expected = '<select name="test" id="test" data-size="2" data-style="btn-secondary" class="dropdown-select-field"></select>'
|
42
|
-
|
43
|
-
assert_equal expected, actual
|
44
|
-
end
|
45
|
-
|
46
|
-
test 'dropdown_select_field actions_box' do
|
47
|
-
options = options_for_select(Array.new(2) { |i| "option #{i}" })
|
48
|
-
actual = UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new('test', { options_tags: options, actions_box: true }).render
|
49
|
-
expected = '<select name="test" id="test" data-style="btn-secondary" data-actions-box="true" class="dropdown-select-field"></select>'
|
50
|
-
|
51
|
-
assert_equal expected, actual
|
52
|
-
end
|
53
|
-
|
54
|
-
test 'dropdown_select_field show_tick' do
|
55
|
-
options = options_for_select(Array.new(2) { |i| "option #{i}" })
|
56
|
-
actual = UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new('test', { options_tags: options, show_tick: true }).render
|
57
|
-
expected = '<select name="test" id="test" data-style="btn-secondary" class="dropdown-select-field show-tick"></select>'
|
58
|
-
|
59
|
-
assert_equal expected, actual
|
60
|
-
end
|
61
|
-
|
62
|
-
test 'dropdown_select_field show_menu_arrow' do
|
63
|
-
options = options_for_select(Array.new(2) { |i| "option #{i}" })
|
64
|
-
actual = UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new('test', { options_tags: options, show_menu_arrow: true }).render
|
65
|
-
expected = '<select name="test" id="test" data-style="btn-secondary" class="dropdown-select-field"></select>'
|
66
|
-
|
67
|
-
assert_equal expected, actual
|
68
|
-
end
|
69
|
-
|
70
|
-
test 'dropdown_select_field dropup' do
|
71
|
-
options = options_for_select(Array.new(2) { |i| "option #{i}" })
|
72
|
-
actual = UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new('test', { options_tags: options, dropup: true }).render
|
73
|
-
expected = '<select name="test" id="test" data-style="btn-secondary" class="dropdown-select-field dropup"></select>'
|
74
|
-
|
75
|
-
assert_equal expected, actual
|
76
|
-
end
|
77
|
-
|
78
|
-
test 'dropdown_select_field refresh' do
|
79
|
-
actual = UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new('test', { refresh: { mode: 'local', target: { data: [] } } }).render
|
80
|
-
expected = '<div class="field-refresh input-group ui_surround_field"><select name="test" id="test" data-style="btn-secondary" class="dropdown-select-field"></select><span data-connect="{"events":"click","mode":"local","target":{"selector":"#test","url":"","data":[]}}" class="btn-secondary ui-bibz-connect btn input-refresh-button"><i class="glyph fas fa-sync-alt"></i> </span></div>'
|
81
|
-
|
82
|
-
assert_equal expected, actual
|
83
|
-
end
|
84
|
-
end
|