ui_bibz 2.5.3 → 3.0.0.alpha5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +2 -2
- data/.gitignore +3 -2
- data/.rubocop.yml +107 -1
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +102 -111
- data/README.md +9 -52
- data/Rakefile +3 -2
- data/bin/test +7 -0
- data/config/initializers/will_paginate.rb +2 -1
- data/lib/ui_bibz.rb +17 -3
- data/lib/ui_bibz/concerns/models/searchable.rb +3 -3
- data/lib/ui_bibz/helpers/ui/core/boxes_helper.rb +9 -1
- data/lib/ui_bibz/helpers/ui/core/forms_helper.rb +20 -1
- data/lib/ui_bibz/helpers/ui/core/layouts_helper.rb +10 -2
- data/lib/ui_bibz/helpers/ui/core/lists_helper.rb +1 -1
- data/lib/ui_bibz/helpers/ui/core/notifications_helper.rb +9 -5
- data/lib/ui_bibz/helpers/ui/ux_helper.rb +2 -6
- data/lib/ui_bibz/infos.rb +11 -5
- data/lib/ui_bibz/inputs/ui_bibz_form/ui_bibz_form_builder.rb +15 -2
- data/lib/ui_bibz/inputs/ui_bibz_inputs/base_input.rb +4 -7
- data/lib/ui_bibz/inputs/ui_bibz_inputs/collection_input.rb +6 -9
- data/lib/ui_bibz/inputs/ui_bibz_inputs/ui_checkbox_field_input.rb +5 -1
- data/lib/ui_bibz/inputs/ui_bibz_inputs/ui_choice_field_input.rb +23 -0
- 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 +12 -0
- data/lib/ui_bibz/rails/engine.rb +1 -16
- data/lib/ui_bibz/railtie.rb +6 -0
- data/lib/ui_bibz/ui/concerns/card_itemable_concern.rb +67 -0
- data/lib/ui_bibz/ui/concerns/html_concern.rb +16 -0
- data/lib/ui_bibz/ui/core/boxes/card.rb +5 -50
- data/lib/ui_bibz/ui/core/boxes/card_accordion.rb +2 -0
- data/lib/ui_bibz/ui/core/boxes/card_column.rb +3 -1
- data/lib/ui_bibz/ui/core/boxes/card_deck.rb +3 -1
- data/lib/ui_bibz/ui/core/boxes/card_grid.rb +60 -0
- data/lib/ui_bibz/ui/core/boxes/card_group.rb +3 -1
- data/lib/ui_bibz/ui/core/boxes/components/body/card_body_link.rb +0 -3
- data/lib/ui_bibz/ui/core/boxes/components/body/card_body_subtitle.rb +47 -0
- data/lib/ui_bibz/ui/core/boxes/components/body/card_body_text.rb +0 -3
- data/lib/ui_bibz/ui/core/boxes/components/body/card_body_title.rb +1 -4
- data/lib/ui_bibz/ui/core/boxes/components/card_body.rb +15 -0
- data/lib/ui_bibz/ui/core/boxes/components/card_col.rb +65 -0
- data/lib/ui_bibz/ui/core/boxes/components/card_footer.rb +0 -3
- data/lib/ui_bibz/ui/core/boxes/components/card_header.rb +2 -4
- data/lib/ui_bibz/ui/core/boxes/components/card_image.rb +1 -4
- data/lib/ui_bibz/ui/core/boxes/components/card_row.rb +65 -0
- data/lib/ui_bibz/ui/core/boxes/components/card_tab_group.rb +0 -4
- data/lib/ui_bibz/ui/core/boxes/jumbotron.rb +1 -4
- data/lib/ui_bibz/ui/core/component.rb +16 -9
- data/lib/ui_bibz/ui/core/forms/buttons/button.rb +1 -1
- data/lib/ui_bibz/ui/core/forms/buttons/button_group.rb +9 -11
- data/lib/ui_bibz/ui/core/forms/buttons/button_refresh.rb +0 -3
- data/lib/ui_bibz/ui/core/forms/buttons/components/button_group_dropdown.rb +0 -3
- data/lib/ui_bibz/ui/core/forms/buttons/components/button_group_split_dropdown.rb +0 -3
- data/lib/ui_bibz/ui/core/forms/choices/box_switch_field.rb +7 -10
- data/lib/ui_bibz/ui/core/forms/choices/checkbox_field.rb +14 -10
- data/lib/ui_bibz/ui/core/forms/choices/choice_group.rb +22 -2
- data/lib/ui_bibz/ui/core/forms/choices/components/choice.rb +24 -12
- data/lib/ui_bibz/ui/core/forms/choices/radio_field.rb +11 -6
- data/lib/ui_bibz/ui/core/forms/choices/switch_field.rb +1 -5
- data/lib/ui_bibz/ui/core/forms/dates/date_picker_field.rb +12 -15
- data/lib/ui_bibz/ui/core/forms/dropdowns/components/dropdown_divider.rb +0 -1
- data/lib/ui_bibz/ui/core/forms/dropdowns/components/dropdown_header.rb +0 -3
- data/lib/ui_bibz/ui/core/forms/dropdowns/dropdown.rb +19 -20
- data/lib/ui_bibz/ui/core/forms/dropdowns/split_dropdown.rb +7 -5
- data/lib/ui_bibz/ui/core/forms/files/file_field.rb +20 -10
- data/lib/ui_bibz/ui/core/forms/numbers/formula_field.rb +16 -8
- data/lib/ui_bibz/ui/core/forms/numbers/number_field.rb +20 -3
- data/lib/ui_bibz/ui/core/forms/numbers/range_field.rb +33 -5
- data/lib/ui_bibz/ui/core/forms/numbers/slider_field.rb +132 -0
- data/lib/ui_bibz/ui/core/forms/numbers/slider_header.rb +71 -0
- data/lib/ui_bibz/ui/core/forms/selects/abstract_select.rb +0 -3
- data/lib/ui_bibz/ui/core/forms/selects/dropdown_select_field.rb +41 -62
- data/lib/ui_bibz/ui/core/forms/selects/multi_column_field.rb +0 -3
- data/lib/ui_bibz/ui/core/forms/selects/select_field.rb +2 -5
- data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_addon.rb +1 -4
- data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button.rb +0 -3
- data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button_group.rb +0 -3
- data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button_link.rb +0 -3
- data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button_refresh.rb +1 -12
- data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_checkbox_field.rb +9 -4
- data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_dropdown.rb +0 -3
- data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_radio_field.rb +9 -4
- data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_switch_field.rb +0 -3
- data/lib/ui_bibz/ui/core/forms/surrounds/surround_field.rb +1 -4
- data/lib/ui_bibz/ui/core/forms/textareas/markdown_editor_field.rb +4 -7
- data/lib/ui_bibz/ui/core/forms/texts/auto_complete_field.rb +2 -5
- data/lib/ui_bibz/ui/core/forms/texts/text_field.rb +0 -3
- data/lib/ui_bibz/ui/core/icons/components/glyph_counter.rb +0 -3
- data/lib/ui_bibz/ui/core/icons/components/glyph_text.rb +1 -4
- data/lib/ui_bibz/ui/core/icons/glyph.rb +1 -4
- data/lib/ui_bibz/ui/core/icons/star.rb +0 -3
- data/lib/ui_bibz/ui/core/layouts/col.rb +5 -42
- data/lib/ui_bibz/ui/core/layouts/container.rb +9 -6
- data/lib/ui_bibz/ui/core/layouts/row.rb +32 -2
- data/lib/ui_bibz/ui/core/lists/components/list.rb +6 -8
- data/lib/ui_bibz/ui/core/lists/components/list/list_body.rb +0 -3
- data/lib/ui_bibz/ui/core/lists/components/list/list_header.rb +0 -3
- data/lib/ui_bibz/ui/core/lists/list_group.rb +9 -6
- data/lib/ui_bibz/ui/core/navigations/breadcrumb.rb +3 -2
- data/lib/ui_bibz/ui/core/navigations/components/breadcrumb_link.rb +0 -3
- data/lib/ui_bibz/ui/core/navigations/components/nav_dropdown.rb +2 -5
- data/lib/ui_bibz/ui/core/navigations/components/nav_link.rb +3 -1
- data/lib/ui_bibz/ui/core/navigations/components/nav_link_link.rb +15 -6
- data/lib/ui_bibz/ui/core/navigations/components/nav_link_list.rb +0 -4
- data/lib/ui_bibz/ui/core/navigations/components/nav_link_span.rb +1 -4
- data/lib/ui_bibz/ui/core/navigations/components/nav_text.rb +0 -3
- data/lib/ui_bibz/ui/core/navigations/components/navbar_brand.rb +0 -3
- data/lib/ui_bibz/ui/core/navigations/components/navbar_form.rb +4 -4
- data/lib/ui_bibz/ui/core/navigations/components/navbar_nav.rb +1 -4
- data/lib/ui_bibz/ui/core/navigations/components/navbar_text.rb +0 -3
- data/lib/ui_bibz/ui/core/navigations/components/pagination_link.rb +0 -3
- data/lib/ui_bibz/ui/core/navigations/components/toolbar_form.rb +3 -3
- data/lib/ui_bibz/ui/core/navigations/link.rb +0 -3
- data/lib/ui_bibz/ui/core/navigations/nav.rb +37 -10
- data/lib/ui_bibz/ui/core/navigations/navbar.rb +28 -7
- data/lib/ui_bibz/ui/core/navigations/pagination.rb +3 -1
- data/lib/ui_bibz/ui/core/navigations/tab_group.rb +10 -5
- data/lib/ui_bibz/ui/core/navigations/toolbar.rb +2 -0
- data/lib/ui_bibz/ui/core/notifications/alert.rb +2 -2
- data/lib/ui_bibz/ui/core/notifications/badge.rb +2 -5
- data/lib/ui_bibz/ui/core/notifications/components/alert_body.rb +0 -3
- data/lib/ui_bibz/ui/core/notifications/components/alert_header.rb +4 -10
- data/lib/ui_bibz/ui/core/notifications/components/bar.rb +0 -3
- data/lib/ui_bibz/ui/core/notifications/components/toast_body.rb +0 -3
- data/lib/ui_bibz/ui/core/notifications/components/toast_header.rb +1 -6
- data/lib/ui_bibz/ui/core/notifications/progress_bar.rb +7 -5
- data/lib/ui_bibz/ui/core/notifications/spinner.rb +0 -3
- data/lib/ui_bibz/ui/core/notifications/toast.rb +14 -3
- data/lib/ui_bibz/ui/core/windows/components/modal_body.rb +0 -3
- data/lib/ui_bibz/ui/core/windows/components/modal_footer.rb +0 -3
- data/lib/ui_bibz/ui/core/windows/components/modal_header.rb +1 -7
- data/lib/ui_bibz/ui/core/windows/modal.rb +61 -14
- data/lib/ui_bibz/ui/extensions/core/component/glyph_extension.rb +4 -2
- data/lib/ui_bibz/ui/extensions/core/component/popover_extension.rb +9 -9
- data/lib/ui_bibz/ui/extensions/core/forms/connect_extension.rb +2 -2
- data/lib/ui_bibz/ui/ux/containers/components/panel_body.rb +0 -3
- data/lib/ui_bibz/ui/ux/containers/components/panel_column.rb +2 -0
- data/lib/ui_bibz/ui/ux/containers/components/panel_deck.rb +2 -0
- data/lib/ui_bibz/ui/ux/containers/components/panel_footer.rb +0 -3
- data/lib/ui_bibz/ui/ux/containers/components/panel_group.rb +2 -0
- data/lib/ui_bibz/ui/ux/containers/components/panel_header.rb +1 -4
- data/lib/ui_bibz/ui/ux/containers/components/panel_tab_group.rb +0 -4
- data/lib/ui_bibz/ui/ux/containers/components/panel_toolbar.rb +0 -3
- data/lib/ui_bibz/ui/ux/containers/panel.rb +4 -2
- data/lib/ui_bibz/ui/ux/tables/components/thead.rb +0 -3
- data/lib/ui_bibz/ui/ux/tables/table.rb +2 -4
- data/lib/ui_bibz/ui/ux/tables/table_card.rb +4 -3
- data/lib/ui_bibz/ui/ux/tables/table_search_field.rb +5 -5
- data/lib/ui_bibz/utils/breakdown_class_name_generator.rb +74 -0
- data/lib/ui_bibz/utils/internationalization.rb +1 -1
- data/lib/ui_bibz/utils/screwdriver.rb +16 -10
- data/test/dummy/Rakefile +1 -1
- data/test/dummy/app/javascripts/packs/index.js +3 -0
- data/test/dummy/app/models/user.rb +1 -0
- data/test/dummy/app/views/layouts/application.html.erb +4 -1
- data/{app/ui/.keep → test/dummy/app/views/users/index.html.erb} +0 -0
- data/test/dummy/bin/setup +17 -13
- data/test/dummy/config.ru +2 -1
- data/test/dummy/config/application.rb +1 -0
- data/test/dummy/config/cable.yml +10 -0
- data/test/dummy/config/database.yml +1 -1
- data/test/dummy/config/environment.rb +1 -1
- data/test/dummy/config/environments/development.rb +33 -12
- data/test/dummy/config/environments/production.rb +52 -19
- data/test/dummy/config/environments/test.rb +18 -12
- data/test/dummy/config/initializers/application_controller_renderer.rb +9 -0
- data/test/dummy/config/initializers/assets.rb +4 -3
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -1
- data/test/dummy/config/initializers/content_security_policy.rb +29 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +2 -0
- data/test/dummy/config/initializers/inflections.rb +0 -1
- data/test/dummy/config/initializers/mime_types.rb +0 -1
- data/test/dummy/config/initializers/wrap_parameters.rb +2 -2
- data/test/dummy/config/puma.rb +40 -0
- data/test/dummy/config/routes.rb +3 -0
- data/test/dummy/config/spring.rb +8 -0
- data/test/dummy/config/storage.yml +34 -0
- data/test/dummy/db/migrate/20150123191805_create_users.rb +1 -1
- data/test/dummy/db/schema.rb +24 -24
- data/test/dummy/public/404.html +6 -6
- data/test/dummy/public/422.html +6 -6
- data/test/dummy/public/500.html +6 -6
- data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/test/dummy/public/apple-touch-icon.png +0 -0
- data/test/dummy/storage/.keep +0 -0
- data/test/simple_form_test.rb +45 -44
- data/test/store_test.rb +5 -5
- data/test/test_helper.rb +18 -9
- data/test/ui/core/boxes/card_grid_test.rb +17 -0
- data/test/ui/core/boxes/card_test.rb +46 -12
- data/test/ui/core/boxes/jumbotron_test.rb +2 -2
- data/test/ui/core/component_test.rb +1 -1
- data/test/ui/core/forms/buttons/button_group_test.rb +1 -1
- data/test/ui/core/forms/buttons/button_link_test.rb +1 -1
- data/test/ui/core/forms/buttons/button_test.rb +2 -2
- data/test/ui/core/forms/choices/checkbox_field_test.rb +8 -1
- data/test/ui/core/forms/choices/choice_group_test.rb +11 -9
- data/test/ui/core/forms/choices/radio_field_test.rb +1 -1
- data/test/ui/core/forms/dates/date_picker_field_test.rb +1 -1
- data/test/ui/core/forms/dropdowns/dropdown_test.rb +2 -2
- data/test/ui/core/forms/files/file_field_test.rb +12 -0
- data/test/ui/core/forms/numbers/formula_field_test.rb +1 -1
- data/test/ui/core/forms/numbers/range_field_test.rb +23 -2
- data/test/ui/core/forms/numbers/slider_field_test.rb +26 -0
- data/test/ui/core/forms/selects/multi_column_field_test.rb +1 -1
- data/test/ui/core/forms/selects/multi_select_field_test.rb +7 -7
- data/test/ui/core/forms/selects/select_field_test.rb +3 -3
- data/test/ui/core/forms/surrounds/surround_field_test.rb +15 -3
- data/test/ui/core/forms/textareas/markdown_editor_field_test.rb +1 -1
- data/test/ui/core/forms/texts/auto_complete_field_test.rb +8 -8
- data/test/ui/core/forms/texts/text_field_test.rb +2 -2
- data/test/ui/core/layouts/col_test.rb +11 -2
- data/test/ui/core/layouts/container_test.rb +15 -1
- data/test/ui/core/layouts/row_test.rb +68 -3
- data/test/ui/core/lists/list_group_test.rb +1 -1
- 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 +17 -5
- data/test/ui/core/navigations/navbar_test.rb +5 -4
- data/test/ui/core/navigations/tab_group_test.rb +4 -4
- data/test/ui/core/notifications/alert_test.rb +2 -2
- data/test/ui/core/notifications/badge_test.rb +3 -3
- data/test/ui/core/notifications/progress_bar_test.rb +1 -1
- data/test/ui/core/notifications/toast_test.rb +10 -1
- data/test/ui/core/windows/modal_test.rb +15 -1
- data/test/ui/utils/breakdown_class_name_generator_test.rb +60 -0
- data/test/ui/ux/containers/panel_test.rb +5 -5
- data/test/ui/ux/tables/table_test.rb +6 -6
- data/test/ui_bibz_test.rb +1 -1
- data/ui_bibz.gemspec +16 -16
- metadata +99 -109
- data/.rubocop_todo.yml +0 -25
- data/app/assets/javascripts/fix_bootstrap.coffee +0 -7
- data/app/assets/javascripts/form.coffee +0 -83
- data/app/assets/javascripts/formula.coffee +0 -69
- data/app/assets/javascripts/input-connected.coffee +0 -101
- data/app/assets/javascripts/interface.coffee +0 -55
- data/app/assets/javascripts/jquery.multi-select-extend.coffee +0 -38
- data/app/assets/javascripts/table.coffee +0 -36
- data/app/assets/javascripts/ui_bibz.coffee.erb +0 -75
- data/app/assets/stylesheets/_custom_variables.sass +0 -20
- data/app/assets/stylesheets/_panel.scss +0 -315
- data/app/assets/stylesheets/bootstrap-switch.sass +0 -159
- data/app/assets/stylesheets/boxes.sass +0 -5
- data/app/assets/stylesheets/containers.sass +0 -2
- data/app/assets/stylesheets/fix-bootstrap-4.sass +0 -19
- data/app/assets/stylesheets/fix_addon.sass +0 -216
- data/app/assets/stylesheets/forms.sass +0 -91
- data/app/assets/stylesheets/navigations.sass +0 -17
- data/app/assets/stylesheets/notifications.sass +0 -42
- data/app/assets/stylesheets/tables.sass +0 -66
- data/app/assets/stylesheets/ui_bibz.sass.erb +0 -55
- data/lib/generators/ui_bibz/install_generator.rb +0 -17
- data/lib/generators/ui_bibz/templates/ui_bibz_initializer.rb +0 -5
- data/lib/ui_bibz/ui/core/forms/selects/multi_select_field.rb +0 -125
- data/lib/ui_bibz/ui/core/icons/glyph_group.rb +0 -101
- data/test/dummy/bin/bundle +0 -5
- data/test/ui/core/forms/files/text_field_test.rb +0 -12
- data/test/ui/core/forms/selects/dropdown_select_field_test.rb +0 -84
- data/test/ui/core/icons/glyph_group_test.rb +0 -37
data/test/dummy/public/422.html
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
<title>The change you wanted was rejected (422)</title>
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
6
|
<style>
|
7
|
-
|
7
|
+
.rails-default-error-page {
|
8
8
|
background-color: #EFEFEF;
|
9
9
|
color: #2E2F30;
|
10
10
|
text-align: center;
|
@@ -12,13 +12,13 @@
|
|
12
12
|
margin: 0;
|
13
13
|
}
|
14
14
|
|
15
|
-
div.dialog {
|
15
|
+
.rails-default-error-page div.dialog {
|
16
16
|
width: 95%;
|
17
17
|
max-width: 33em;
|
18
18
|
margin: 4em auto 0;
|
19
19
|
}
|
20
20
|
|
21
|
-
div.dialog > div {
|
21
|
+
.rails-default-error-page div.dialog > div {
|
22
22
|
border: 1px solid #CCC;
|
23
23
|
border-right-color: #999;
|
24
24
|
border-left-color: #999;
|
@@ -31,13 +31,13 @@
|
|
31
31
|
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
32
|
}
|
33
33
|
|
34
|
-
h1 {
|
34
|
+
.rails-default-error-page h1 {
|
35
35
|
font-size: 100%;
|
36
36
|
color: #730E15;
|
37
37
|
line-height: 1.5em;
|
38
38
|
}
|
39
39
|
|
40
|
-
div.dialog > p {
|
40
|
+
.rails-default-error-page div.dialog > p {
|
41
41
|
margin: 0 0 1em;
|
42
42
|
padding: 1em;
|
43
43
|
background-color: #F7F7F7;
|
@@ -54,7 +54,7 @@
|
|
54
54
|
</style>
|
55
55
|
</head>
|
56
56
|
|
57
|
-
<body>
|
57
|
+
<body class="rails-default-error-page">
|
58
58
|
<!-- This file lives in public/422.html -->
|
59
59
|
<div class="dialog">
|
60
60
|
<div>
|
data/test/dummy/public/500.html
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
<title>We're sorry, but something went wrong (500)</title>
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
6
|
<style>
|
7
|
-
|
7
|
+
.rails-default-error-page {
|
8
8
|
background-color: #EFEFEF;
|
9
9
|
color: #2E2F30;
|
10
10
|
text-align: center;
|
@@ -12,13 +12,13 @@
|
|
12
12
|
margin: 0;
|
13
13
|
}
|
14
14
|
|
15
|
-
div.dialog {
|
15
|
+
.rails-default-error-page div.dialog {
|
16
16
|
width: 95%;
|
17
17
|
max-width: 33em;
|
18
18
|
margin: 4em auto 0;
|
19
19
|
}
|
20
20
|
|
21
|
-
div.dialog > div {
|
21
|
+
.rails-default-error-page div.dialog > div {
|
22
22
|
border: 1px solid #CCC;
|
23
23
|
border-right-color: #999;
|
24
24
|
border-left-color: #999;
|
@@ -31,13 +31,13 @@
|
|
31
31
|
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
32
|
}
|
33
33
|
|
34
|
-
h1 {
|
34
|
+
.rails-default-error-page h1 {
|
35
35
|
font-size: 100%;
|
36
36
|
color: #730E15;
|
37
37
|
line-height: 1.5em;
|
38
38
|
}
|
39
39
|
|
40
|
-
div.dialog > p {
|
40
|
+
.rails-default-error-page div.dialog > p {
|
41
41
|
margin: 0 0 1em;
|
42
42
|
padding: 1em;
|
43
43
|
background-color: #F7F7F7;
|
@@ -54,7 +54,7 @@
|
|
54
54
|
</style>
|
55
55
|
</head>
|
56
56
|
|
57
|
-
<body>
|
57
|
+
<body class="rails-default-error-page">
|
58
58
|
<!-- This file lives in public/500.html -->
|
59
59
|
<div class="dialog">
|
60
60
|
<div>
|
File without changes
|
File without changes
|
File without changes
|
data/test/simple_form_test.rb
CHANGED
@@ -26,7 +26,7 @@ class SimpleFormTest < ActionView::TestCase
|
|
26
26
|
f.input :name_fr, as: :ui_auto_complete_field, collection: @users, label_method: :name_fr
|
27
27
|
end
|
28
28
|
|
29
|
-
expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input
|
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 ui_auto_complete_field optional user_name_fr\"><label class=\"control-label ui_auto_complete_field optional\" for=\"user_name_fr\">Name fr</label><input type=\"text\" name=\"user[name_fr]\" id=\"user_name_fr\" value=\"test1\" class=\"form-control auto-complete-field\" autocomplete=\"true\" list=\"user_name_fr-datalist\" /><datalist id=\"user_name_fr-datalist\"><option value=\"1\">test1</option>
|
30
30
|
<option value=\"2\">test2</option></datalist></div></form>"
|
31
31
|
|
32
32
|
assert_equal expected, actual
|
@@ -37,29 +37,7 @@ class SimpleFormTest < ActionView::TestCase
|
|
37
37
|
f.input :created_at, as: :ui_date_picker_field
|
38
38
|
end
|
39
39
|
|
40
|
-
expected = '<form class="simple_form edit_user" id="edit_user_1" action="/users/1" accept-charset="UTF-8" method="post"><input
|
41
|
-
|
42
|
-
assert_equal expected, actual
|
43
|
-
end
|
44
|
-
|
45
|
-
test 'dropdown field select input in simple form' do
|
46
|
-
actual = simple_form_for @user do |f|
|
47
|
-
f.input :name_fr, as: :ui_dropdown_select_field, collection: @users, label_method: :name_fr
|
48
|
-
end
|
49
|
-
|
50
|
-
expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"✓\" /><input type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"form-group ui_dropdown_select_field optional user_name_fr\"><label class=\"control-label ui_dropdown_select_field optional\" for=\"user_name_fr\">Name fr</label><select name=\"user[name_fr]\" id=\"user_name_fr\" class=\"dropdown-select-field\" data-style=\"btn-secondary\"><option value=\"1\">test1</option>
|
51
|
-
<option value=\"2\">test2</option></select></div></form>"
|
52
|
-
|
53
|
-
assert_equal expected, actual
|
54
|
-
end
|
55
|
-
|
56
|
-
test 'dropdown field select input with grouped option in simple form' do
|
57
|
-
actual = simple_form_for @user do |f|
|
58
|
-
f.input :name_fr, as: :ui_dropdown_select_field, collection: @continents, toto: 'lala', grouped: true, group_method: :countries
|
59
|
-
end
|
60
|
-
|
61
|
-
expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"✓\" /><input type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"form-group ui_dropdown_select_field optional user_name_fr\"><label class=\"control-label ui_dropdown_select_field optional\" for=\"user_name_fr\">Name fr</label><select name=\"user[name_fr]\" id=\"user_name_fr\" class=\"dropdown-select-field\" data-style=\"btn-secondary\"><optgroup label=\"Europe\"><option value=\"1\">France</option>
|
62
|
-
<option value=\"2\">Deutchland</option></optgroup></select></div></form>"
|
40
|
+
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 ui_date_picker_field optional user_created_at"><label class="control-label ui_date_picker_field optional" for="user_created_at">Created at</label><input type="text" name="user[created_at]" id="user_created_at" value="2017-04-26 14:48:43 UTC" class="ui_date_picker_field optional date_picker form-control" data-date-locale="en" data-provide="datepicker" data-date-format="yyyy-mm-dd" data-date-today-btn="linked" data-date-toggle-active="true" /></div></form>'
|
63
41
|
|
64
42
|
assert_equal expected, actual
|
65
43
|
end
|
@@ -72,7 +50,7 @@ class SimpleFormTest < ActionView::TestCase
|
|
72
50
|
f.input :price, as: :ui_formula_field
|
73
51
|
end
|
74
52
|
|
75
|
-
expected = '<form class="simple_form edit_user" id="edit_user_1" action="/users/1" accept-charset="UTF-8" method="post"><input
|
53
|
+
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 ui_formula_field optional user_price"><label class="control-label ui_formula_field optional" for="user_price">Price</label><div class="formula_field input-group ui_surround_field"><input type="text" name="user[price_formula]" id="user_price_formula" value="1+2" class="ui_formula_field optional formula-field form-control" formula_field_value="1+2" /><span class="formula-field-sign input-group-text">=</span><input type="text" name="user[price]" id="user_price" value="3.0" class="formula-field-result form-control" readonly="readonly" /><span data-toggle="tooltip" class="formula-field-alert input-group-text"><i class="glyph-danger glyph fas fa-exclamation-triangle"></i></span></div></div></form>'
|
76
54
|
|
77
55
|
assert_equal expected, actual
|
78
56
|
end
|
@@ -82,7 +60,7 @@ class SimpleFormTest < ActionView::TestCase
|
|
82
60
|
f.input :name_fr, as: :ui_markdown_editor_field
|
83
61
|
end
|
84
62
|
|
85
|
-
expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input
|
63
|
+
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 ui_markdown_editor_field optional user_name_fr\"><label class=\"control-label ui_markdown_editor_field optional\" for=\"user_name_fr\">Name fr</label><textarea name=\"user[name_fr]\" id=\"user_name_fr\" class=\"ui_markdown_editor_field optional\" data-provide=\"markdown\" data-iconlibrary=\"fa\">
|
86
64
|
test1</textarea></div></form>"
|
87
65
|
|
88
66
|
assert_equal expected, actual
|
@@ -93,7 +71,7 @@ test1</textarea></div></form>"
|
|
93
71
|
f.input :name_fr, as: :ui_multi_column_field, collection: @users, label_method: :name_fr
|
94
72
|
end
|
95
73
|
|
96
|
-
expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input
|
74
|
+
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 ui_multi_column_field optional user_name_fr\"><label class=\"control-label ui_multi_column_field optional\" for=\"user_name_fr\">Name fr</label><select name=\"name_fr[]\" id=\"name_fr\" class=\"multi-column-field\" multiple=\"multiple\"><option value=\"1\">test1</option>
|
97
75
|
<option value=\"2\">test2</option></select></div></form>"
|
98
76
|
|
99
77
|
assert_equal expected, actual
|
@@ -101,10 +79,10 @@ test1</textarea></div></form>"
|
|
101
79
|
|
102
80
|
test 'multi select field input in simple form' do
|
103
81
|
actual = simple_form_for @user do |f|
|
104
|
-
f.input :name_fr, as: :
|
82
|
+
f.input :name_fr, as: :ui_dropdown_select_field, multiple: true, collection: @users, label_method: :name_fr
|
105
83
|
end
|
106
84
|
|
107
|
-
expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input
|
85
|
+
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 ui_dropdown_select_field optional user_name_fr\"><label class=\"control-label ui_dropdown_select_field optional\" for=\"user_name_fr\">Name fr</label><select name=\"user[name_fr][]\" id=\"user_name_fr\" class=\"btn-secondary multi-select-field\" multiple=\"multiple\"><option value=\"1\">test1</option>
|
108
86
|
<option value=\"2\">test2</option></select></div></form>"
|
109
87
|
|
110
88
|
assert_equal expected, actual
|
@@ -112,10 +90,10 @@ test1</textarea></div></form>"
|
|
112
90
|
|
113
91
|
test 'multi select input with grouped option in simple form' do
|
114
92
|
actual = simple_form_for @user do |f|
|
115
|
-
f.input :name_fr, as: :
|
93
|
+
f.input :name_fr, as: :ui_dropdown_select_field, multiple: true, collection: @continents, toto: 'lala', grouped: true, group_method: :countries
|
116
94
|
end
|
117
95
|
|
118
|
-
expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input
|
96
|
+
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 ui_dropdown_select_field optional user_name_fr\"><label class=\"control-label ui_dropdown_select_field optional\" for=\"user_name_fr\">Name fr</label><select name=\"user[name_fr][]\" id=\"user_name_fr\" class=\"btn-secondary multi-select-field\" multiple=\"multiple\"><optgroup label=\"Europe\"><option value=\"1\">France</option>
|
119
97
|
<option value=\"2\">Deutchland</option></optgroup></select></div></form>"
|
120
98
|
|
121
99
|
assert_equal expected, actual
|
@@ -126,7 +104,7 @@ test1</textarea></div></form>"
|
|
126
104
|
f.input :name_fr, as: :ui_text_field
|
127
105
|
end
|
128
106
|
|
129
|
-
expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input
|
107
|
+
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 ui_text_field optional user_name_fr\"><label class=\"control-label ui_text_field optional\" for=\"user_name_fr\">Name fr</label><input type=\"ui_text_field\" name=\"user[name_fr]\" id=\"user_name_fr\" value=\"test1\" class=\"form-control string ui_text_field optional\" /></div></form>"
|
130
108
|
|
131
109
|
assert_equal expected, actual
|
132
110
|
end
|
@@ -137,7 +115,7 @@ test1</textarea></div></form>"
|
|
137
115
|
f.input :active, as: :ui_box_switch_field, collection: @users, label_method: :name_fr
|
138
116
|
end
|
139
117
|
|
140
|
-
expected = '<form class="simple_form edit_user" id="edit_user_1" action="/users/1" accept-charset="UTF-8" method="post"><input
|
118
|
+
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 ui_box_switch_field optional user_active"><label class="control-label ui_box_switch_field optional" for="user_active">Active</label><div class="switch-field-container"><input type="hidden" name="user[active]" id="user_active" value="0" /><input type="checkbox" name="user[active]" id="user_active" value="1" class="ui_box_switch_field optional switch-field" checked="checked" /></div></div></form>'
|
141
119
|
|
142
120
|
assert_equal expected, actual
|
143
121
|
end
|
@@ -147,7 +125,7 @@ test1</textarea></div></form>"
|
|
147
125
|
f.input :name_fr, as: :ui_radio_field, collection: @users, label_method: :name_fr
|
148
126
|
end
|
149
127
|
|
150
|
-
expected =
|
128
|
+
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 ui_radio_field optional user_name_fr\"><label class=\"control-label ui_radio_field optional\">Name fr</label><input type=\"hidden\" name=\"user[name_fr]\" value=\"\" /><div class=\"radio ui_radio_field optional form-check\"><input class=\"ui_radio_field optional form-check\" type=\"radio\" value=\"1\" name=\"user[name_fr]\" id=\"user_name_fr_1\" /><label class=\"collection_radio_buttons\" for=\"user_name_fr_1\">test1</label></div><div class=\"radio ui_radio_field optional form-check\"><input class=\"ui_radio_field optional form-check\" type=\"radio\" value=\"2\" name=\"user[name_fr]\" id=\"user_name_fr_2\" /><label class=\"collection_radio_buttons\" for=\"user_name_fr_2\">test2</label></div></div></form>"
|
151
129
|
|
152
130
|
assert_equal expected, actual
|
153
131
|
end
|
@@ -157,7 +135,7 @@ test1</textarea></div></form>"
|
|
157
135
|
f.input :name_fr, as: :ui_select_field, collection: @users, label_method: :name_fr
|
158
136
|
end
|
159
137
|
|
160
|
-
expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input
|
138
|
+
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 ui_select_field optional user_name_fr\"><label class=\"control-label ui_select_field optional\" for=\"user_name_fr\">Name fr</label><select name=\"user[name_fr]\" id=\"user_name_fr\" class=\"form-control select-field form-select\"><option value=\"1\">test1</option>
|
161
139
|
<option value=\"2\">test2</option></select></div></form>"
|
162
140
|
|
163
141
|
assert_equal expected, actual
|
@@ -168,8 +146,8 @@ test1</textarea></div></form>"
|
|
168
146
|
f.input :name_fr, as: :ui_select_field, refresh: { target: { data: [] } }, collection: @users, label_method: :name_fr
|
169
147
|
end
|
170
148
|
|
171
|
-
expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input
|
172
|
-
<option value=\"2\">test2</option></select><
|
149
|
+
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 ui_select_field optional user_name_fr\"><label class=\"control-label ui_select_field optional\" for=\"user_name_fr\">Name fr</label><div class=\"field-refresh input-group ui_surround_field\"><select name=\"user[name_fr]\" id=\"user_name_fr\" class=\"form-control select-field form-select\"><option value=\"1\">test1</option>
|
150
|
+
<option value=\"2\">test2</option></select><span data-connect=\"{"events":"click","mode":"remote","target":{"selector":"#user_name_fr","url":"","data":[]}}\" class=\"btn-secondary ui-bibz-connect btn input-refresh-button\"><i class=\"glyph fas fa-sync-alt\"></i> </span></div></div></form>"
|
173
151
|
|
174
152
|
assert_equal expected, actual
|
175
153
|
end
|
@@ -179,7 +157,7 @@ test1</textarea></div></form>"
|
|
179
157
|
f.input :name_fr, as: :ui_select_field, collection: @continents, toto: 'lala', grouped: true, group_method: :countries
|
180
158
|
end
|
181
159
|
|
182
|
-
expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input
|
160
|
+
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 ui_select_field optional user_name_fr\"><label class=\"control-label ui_select_field optional\" for=\"user_name_fr\">Name fr</label><select name=\"user[name_fr]\" id=\"user_name_fr\" class=\"form-control select-field form-select\"><optgroup label=\"Europe\"><option value=\"1\">France</option>
|
183
161
|
<option value=\"2\">Deutchland</option></optgroup></select></div></form>"
|
184
162
|
|
185
163
|
assert_equal expected, actual
|
@@ -191,7 +169,7 @@ test1</textarea></div></form>"
|
|
191
169
|
f.input :name_fr, as: :ui_select_field, collection: @countries
|
192
170
|
end
|
193
171
|
|
194
|
-
expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input
|
172
|
+
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 ui_select_field optional user_name_fr\"><label class=\"control-label ui_select_field optional\" for=\"user_name_fr\">Name fr</label><select name=\"user[name_fr]\" id=\"user_name_fr\" class=\"form-control select-field form-select\"><option selected=\"selected\" value=\"1\">France</option>
|
195
173
|
<option value=\"2\">Deutchland</option></select></div></form>"
|
196
174
|
|
197
175
|
assert_equal expected, actual
|
@@ -203,7 +181,7 @@ test1</textarea></div></form>"
|
|
203
181
|
f.input :name_fr, as: :ui_select_field, collection: @continents, toto: 'lala', grouped: true, group_method: :countries
|
204
182
|
end
|
205
183
|
|
206
|
-
expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input
|
184
|
+
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 ui_select_field optional user_name_fr\"><label class=\"control-label ui_select_field optional\" for=\"user_name_fr\">Name fr</label><select name=\"user[name_fr]\" id=\"user_name_fr\" class=\"form-control select-field form-select\"><optgroup label=\"Europe\"><option selected=\"selected\" value=\"1\">France</option>
|
207
185
|
<option value=\"2\">Deutchland</option></optgroup></select></div></form>"
|
208
186
|
|
209
187
|
assert_equal expected, actual
|
@@ -214,7 +192,7 @@ test1</textarea></div></form>"
|
|
214
192
|
f.input :name_fr, as: :ui_number_field
|
215
193
|
end
|
216
194
|
|
217
|
-
expected = '<form class="simple_form edit_user" id="edit_user_1" action="/users/1" accept-charset="UTF-8" method="post"><input
|
195
|
+
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 ui_number_field optional user_name_fr"><label class="control-label ui_number_field optional" for="user_name_fr">Name fr</label><input type="number" name="user[name_fr]" id="user_name_fr" value="test1" class="form-control ui_number_field optional" /></div></form>'
|
218
196
|
|
219
197
|
assert_equal expected, actual
|
220
198
|
end
|
@@ -224,7 +202,7 @@ test1</textarea></div></form>"
|
|
224
202
|
f.input :name_fr, as: :ui_file_field
|
225
203
|
end
|
226
204
|
|
227
|
-
expected =
|
205
|
+
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 ui_file_field optional user_name_fr\"><label class=\"control-label ui_file_field optional\" for=\"user_name_fr\">Name fr</label><div class=\"ui_file_field optional form-file\"><input type=\"file\" name=\"user[name_fr]\" id=\"user_name_fr\" class=\"form-file-input\" /><label class=\"form-file-label\" for=\"user_name_fr\"><span class=\"form-file-text\">test1</span><span class=\"form-file-button\">Browse</span></label></div></div></form>"
|
228
206
|
|
229
207
|
assert_equal expected, actual
|
230
208
|
end
|
@@ -234,11 +212,34 @@ test1</textarea></div></form>"
|
|
234
212
|
f.input :name_fr, as: :ui_range_field
|
235
213
|
end
|
236
214
|
|
237
|
-
expected = '<form class="simple_form edit_user" id="edit_user_1" action="/users/1" accept-charset="UTF-8" method="post"><input
|
215
|
+
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 ui_range_field optional user_name_fr"><label class="control-label ui_range_field optional" for="user_name_fr">Name fr</label><input type="range" name="user[name_fr]" id="user_name_fr" value="test1" class="ui_range_field optional form-range" /></div></form>'
|
216
|
+
|
217
|
+
assert_equal expected, actual
|
218
|
+
end
|
219
|
+
|
220
|
+
test 'slider field' do
|
221
|
+
actual = simple_form_for @user do |f|
|
222
|
+
f.input :name_en, as: :ui_slider_field
|
223
|
+
end
|
224
|
+
|
225
|
+
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 ui_slider_field optional user_name_en\"><label class=\"control-label ui_slider_field optional\" for=\"user_name_en\">Name en</label><div class=\"ui_slider_field optional slider\" id=\"user_name_en_slider\"><div><div class=\"slider-inverse-left\" style=\"width: 100%\"></div><div class=\"slider-inverse-right\" style=\"width: 100%\"></div><div class=\"slider-range\" style=\"left: 0%; right: 0%\"></div><div class=\"slider-thumb slider-thumb-left\" style=\"left: 0%\"></div><div class=\"slider-thumb slider-thumb-right\" style=\"left: 100%\"></div></div><input type=\"range\" name=\"user[name_en_min]\" id=\"user_name_en_min\" value=\"0\" max=\"100\" min=\"0\" step=\"1\" /><input type=\"range\" name=\"user[name_en_max]\" id=\"user_name_en_max\" value=\"100\" max=\"100\" min=\"0\" step=\"1\" /></div></div></form>"
|
238
226
|
|
239
227
|
assert_equal expected, actual
|
240
228
|
end
|
241
229
|
|
230
|
+
# test 'choice field' do
|
231
|
+
# actual = ui_form_for @user do |f|
|
232
|
+
# f.ui_choice_group do |cg|
|
233
|
+
# cg.input :name_fr, as: :ui_choice_field
|
234
|
+
# cg.input :name_fr, as: :ui_choice_field
|
235
|
+
# end
|
236
|
+
# end
|
237
|
+
#
|
238
|
+
# expected = "<form class=\"simple_form\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"button_group\"><div data-toggle=\"buttons\" class=\"btn-group button-choice btn-group-toggle\"><input type=\"checkbox\" autocomplete=\"off\" class=\"btn-check\" id=\"choice-21472\" /><label class=\"btn-secondary btn checkbox\" checked=\"checked\" for=\"choice-21472\">Name Fr</label><input type=\"checkbox\" autocomplete=\"off\" class=\"btn-check\" id=\"choice-13741\" /><label class=\"btn-secondary btn checkbox\" checked=\"checked\" for=\"choice-13741\">Name Fr</label></div></div></form>"
|
239
|
+
#
|
240
|
+
# assert_equal expected, actual
|
241
|
+
# end
|
242
|
+
|
242
243
|
# test 'test surround field into simple form' do
|
243
244
|
# actual = ui_form_for @user do |f|
|
244
245
|
# concat(f.ui_surround_field do |sf|
|
@@ -248,7 +249,7 @@ test1</textarea></div></form>"
|
|
248
249
|
# concat f.input(:name_fr, as: :ui_auto_complete_field, collection: @users, label_method: :name_fr)
|
249
250
|
# end
|
250
251
|
#
|
251
|
-
# expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input
|
252
|
+
# 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><div class=\"input-group\"><input type=\"text\" name=\"user[name_en]\" id=\"user_name_en\" value=\"test1 en\" class=\"text_field optional form-control\" /><span class=\"input-group-text\">€</span></div></div><div class=\"form-group ui_auto_complete_field optional user_name_fr\"><label class=\"control-label ui_auto_complete_field optional\" for=\"user_name_fr\">Name fr</label><input type=\"text\" name=\"user[name_fr]\" id=\"user_name_fr\" value=\"test1\" class=\"ui_auto_complete_field optional form-control auto-complete-field\" autocomplete=\"true\" list=\"user_name_fr-datalist\" /><datalist id=\"user_name_fr-datalist\"><option value=\"1\">test1</option>
|
252
253
|
# <option value=\"2\">test2</option></datalist></div></form>"
|
253
254
|
#
|
254
255
|
# assert_equal expected, actual
|
data/test/store_test.rb
CHANGED
@@ -22,15 +22,15 @@ class StoreTest < ActionView::TestCase
|
|
22
22
|
end
|
23
23
|
|
24
24
|
test 'total pages' do
|
25
|
-
assert_equal @store.total_pages
|
25
|
+
assert_equal(3, @store.total_pages)
|
26
26
|
end
|
27
27
|
|
28
28
|
test 'current page' do
|
29
|
-
assert_equal @store.current_page
|
29
|
+
assert_equal(1, @store.current_page)
|
30
30
|
end
|
31
31
|
|
32
32
|
test 'limit value' do
|
33
|
-
assert_equal @store.limit_value
|
33
|
+
assert_equal(10, @store.limit_value)
|
34
34
|
end
|
35
35
|
|
36
36
|
test 'model' do
|
@@ -38,10 +38,10 @@ class StoreTest < ActionView::TestCase
|
|
38
38
|
end
|
39
39
|
|
40
40
|
test 'records' do
|
41
|
-
assert_equal @store.records.count
|
41
|
+
assert_equal(25, @store.records.count)
|
42
42
|
end
|
43
43
|
|
44
44
|
test 'controller' do
|
45
|
-
assert_equal @store.controller
|
45
|
+
assert_equal('users', @store.controller)
|
46
46
|
end
|
47
47
|
end
|
data/test/test_helper.rb
CHANGED
@@ -5,18 +5,27 @@ require 'simplecov'
|
|
5
5
|
SimpleCov.start 'rails'
|
6
6
|
|
7
7
|
# Configure Rails Environment
|
8
|
-
ENV[
|
8
|
+
ENV["RAILS_ENV"] = "test"
|
9
9
|
|
10
|
-
|
11
|
-
ActiveRecord::Migrator.migrations_paths = [File.expand_path(
|
12
|
-
require
|
10
|
+
require_relative "../test/dummy/config/environment"
|
11
|
+
ActiveRecord::Migrator.migrations_paths = [File.expand_path("../test/dummy/db/migrate", __dir__)]
|
12
|
+
require "rails/test_help"
|
13
|
+
require "factory_bot_rails"
|
13
14
|
|
14
|
-
# Filter out
|
15
|
-
# to be shown.
|
15
|
+
# Filter out the backtrace from minitest while preserving the one from other libraries.
|
16
16
|
Minitest.backtrace_filter = Minitest::BacktraceFilter.new
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
require "rails/test_unit/reporter"
|
19
|
+
Rails::TestUnitReporter.executable = 'bin/test'
|
20
20
|
|
21
21
|
# Load fixtures from the engine
|
22
|
-
|
22
|
+
if ActiveSupport::TestCase.respond_to?(:fixture_path=)
|
23
|
+
ActiveSupport::TestCase.fixture_path = File.expand_path("fixtures", __dir__)
|
24
|
+
ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path
|
25
|
+
ActiveSupport::TestCase.file_fixture_path = "#{ActiveSupport::TestCase.fixture_path}/files"
|
26
|
+
ActiveSupport::TestCase.fixtures :all
|
27
|
+
end
|
28
|
+
|
29
|
+
class ActiveSupport::TestCase
|
30
|
+
include FactoryBot::Syntax::Methods
|
31
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
class CardGridTest < ActionView::TestCase
|
6
|
+
include UiBibz::Helpers::Ui::CoreHelper
|
7
|
+
|
8
|
+
test 'create card' do
|
9
|
+
actual = ui_card_grid do |cg|
|
10
|
+
cg.card "card 1"
|
11
|
+
cg.card "card 2"
|
12
|
+
end
|
13
|
+
expected = "<div class=\"row card-grid\"><div class=\"col\"><div class=\"card\"><div class=\"card-body\">card 1</div></div></div><div class=\"col\"><div class=\"card\"><div class=\"card-body\">card 2</div></div></div></div>"
|
14
|
+
|
15
|
+
assert_equal expected, actual
|
16
|
+
end
|
17
|
+
end
|
@@ -22,7 +22,7 @@ class CardTest < ActionView::TestCase
|
|
22
22
|
end
|
23
23
|
|
24
24
|
test 'card outline' do
|
25
|
-
actual = ui_card 'test', status: :success, outline: true
|
25
|
+
actual = ui_card 'test', status: :success, outline: true do |c|
|
26
26
|
c.header 'header'
|
27
27
|
c.body 'header'
|
28
28
|
c.footer 'header'
|
@@ -65,14 +65,15 @@ class CardTest < ActionView::TestCase
|
|
65
65
|
end
|
66
66
|
|
67
67
|
test 'position' do
|
68
|
-
actual = ui_card
|
69
|
-
p.body
|
68
|
+
actual = ui_card text: { position: :right, size: :md } do |p|
|
69
|
+
p.body do |b|
|
70
70
|
b.title 'Special title treatment'
|
71
|
+
b.subtitle 'The subtitle'
|
71
72
|
b.text 'With supporting text below as a natural lead-in to additional content.'
|
72
73
|
b.link 'Go somewhere', url: '#go-somewhere', class: 'btn btn-primary'
|
73
74
|
end
|
74
75
|
end
|
75
|
-
expected =
|
76
|
+
expected = "<div class=\"card text-md-right\"><div class=\"card-body\"><h5 class=\"card-title\">Special title treatment</h5><h6 class=\"card-subtitle mb-2 text-muted\">The subtitle</h6><p class=\"card-text\">With supporting text below as a natural lead-in to additional content.</p><a class=\"btn btn-primary card-link\" href=\"#go-somewhere\">Go somewhere</a></div></div>"
|
76
77
|
|
77
78
|
assert_equal expected, actual
|
78
79
|
end
|
@@ -110,7 +111,7 @@ class CardTest < ActionView::TestCase
|
|
110
111
|
end
|
111
112
|
|
112
113
|
test 'card list group' do
|
113
|
-
actual = ui_card
|
114
|
+
actual = ui_card do |c|
|
114
115
|
c.list_group do |lg|
|
115
116
|
lg.list 'list 1'
|
116
117
|
lg.list 'list 2'
|
@@ -123,28 +124,61 @@ class CardTest < ActionView::TestCase
|
|
123
124
|
end
|
124
125
|
|
125
126
|
test 'card body parameters' do
|
126
|
-
actual = ui_card
|
127
|
-
c.body
|
127
|
+
actual = ui_card do |c|
|
128
|
+
c.body do |b|
|
128
129
|
b.title 'title'
|
129
130
|
b.text 'text'
|
130
131
|
b.link 'link', url: '#'
|
131
132
|
end
|
132
133
|
end
|
133
|
-
expected = '<div class="card"><div class="card-body"><
|
134
|
+
expected = '<div class="card"><div class="card-body"><h5 class="card-title">title</h5><p class="card-text">text</p><a class="card-link" href="#">link</a></div></div>'
|
134
135
|
|
135
136
|
assert_equal expected, actual
|
136
137
|
end
|
137
138
|
|
138
139
|
test 'card header tab group' do
|
139
|
-
actual = ui_card
|
140
|
-
c.header
|
141
|
-
h.tab_group
|
140
|
+
actual = ui_card do |c|
|
141
|
+
c.header do |h|
|
142
|
+
h.tab_group do |cg|
|
142
143
|
cg.tab 'link1', url: '#link1'
|
143
144
|
cg.tab 'link2', url: '#link2'
|
144
145
|
end
|
145
146
|
end
|
146
147
|
end
|
147
|
-
expected =
|
148
|
+
expected = "<div class=\"card\"><div class=\"card-header\"><ul class=\"nav nav-tabs card-header-tabs\"><li class=\"nav-item\"><a href=\"#link1\" class=\"nav-link\" data-toggle=\"tab\" role=\"tab\">link1</a></li><li class=\"nav-item\"><a href=\"#link2\" class=\"nav-link\" data-toggle=\"tab\" role=\"tab\">link2</a></li></ul></div></div>"
|
149
|
+
|
150
|
+
assert_equal expected, actual
|
151
|
+
end
|
152
|
+
|
153
|
+
test 'card row' do
|
154
|
+
actual = ui_card do |c|
|
155
|
+
c.row class: "g-0" do |r|
|
156
|
+
r.col num: 4 do |col|
|
157
|
+
col.image "https://picsum.photos/700/200", position: :left
|
158
|
+
end
|
159
|
+
r.col num: 8 do |col|
|
160
|
+
col.body do |b|
|
161
|
+
b.title "card title"
|
162
|
+
b.subtitle "card subtitle"
|
163
|
+
b.text "some quick example text to build on the card title and make up the bulk of the card's content."
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
expected = "<div class=\"card\"><div class=\"g-0 row\"><div class=\"col-4\"><img class=\"card-img-left\" src=\"https://picsum.photos/700/200\" /></div><div class=\"col-8\"><div class=\"card-body\"><h5 class=\"card-title\">card title</h5><h6 class=\"card-subtitle mb-2 text-muted\">card subtitle</h6><p class=\"card-text\">some quick example text to build on the card title and make up the bulk of the card's content.</p></div></div></div></div>"
|
169
|
+
|
170
|
+
assert_equal expected, actual
|
171
|
+
end
|
172
|
+
|
173
|
+
test "card with html" do
|
174
|
+
actual = ui_card do |c|
|
175
|
+
c.html "content"
|
176
|
+
c.html do
|
177
|
+
" content 2"
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
expected = "<div class=\"card\">content content 2</div>"
|
148
182
|
|
149
183
|
assert_equal expected, actual
|
150
184
|
end
|