ui_bibz 3.0.0.alpha2 → 3.0.0.alpha9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +9 -9
- data/README.md +1 -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 +3 -3
- data/lib/ui_bibz/inputs/ui_bibz_inputs/base_input.rb +4 -3
- 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 -0
- 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 +0 -1
- 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 +12 -8
- 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 +14 -2
- data/lib/ui_bibz/ui/core/forms/numbers/slider_header.rb +3 -3
- 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 -3
- data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button_link.rb +1 -3
- 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 +1 -1
- data/lib/ui_bibz/ui/core/navigations/navbar.rb +6 -4
- data/lib/ui_bibz/ui/core/navigations/tab_group.rb +4 -0
- data/lib/ui_bibz/ui/core/windows/modal.rb +6 -2
- data/lib/ui_bibz/ui/extensions/core/component/glyph_extension.rb +12 -24
- 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
- metadata +5 -8
- 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
@@ -88,7 +88,7 @@ module UiBibz::Ui::Core::Windows
|
|
88
88
|
private
|
89
89
|
|
90
90
|
def modal_dialog_classes
|
91
|
-
UiBibz::Utils::Screwdriver.join_classes('modal-dialog', size, position, scrollable)
|
91
|
+
UiBibz::Utils::Screwdriver.join_classes('modal-dialog', fullscreen_size, size, position, scrollable)
|
92
92
|
end
|
93
93
|
|
94
94
|
def component_html_classes
|
@@ -105,10 +105,14 @@ module UiBibz::Ui::Core::Windows
|
|
105
105
|
end
|
106
106
|
|
107
107
|
# :xl, :lg, :sm or :xs
|
108
|
-
def
|
108
|
+
def fullscreen_size
|
109
109
|
[modal, fullscreen, @options[:size], down].compact.join('-')
|
110
110
|
end
|
111
111
|
|
112
|
+
def size
|
113
|
+
[modal, @options[:size]].compact.join('-') if @options[:size]
|
114
|
+
end
|
115
|
+
|
112
116
|
def fullscreen
|
113
117
|
'fullscreen' if @options[:fullscreen]
|
114
118
|
end
|
@@ -3,39 +3,27 @@
|
|
3
3
|
module GlyphExtension
|
4
4
|
# Render glyph and content html
|
5
5
|
def glyph_and_content_html(content_html = nil)
|
6
|
-
[
|
7
|
-
end
|
8
|
-
|
9
|
-
def ct_html(content_html)
|
10
|
-
content_html || content if options[:text].nil? || options[:text] == true
|
11
|
-
end
|
12
|
-
|
13
|
-
# Render glyph with space html
|
14
|
-
def glyph_with_space
|
15
|
-
out = [glyph]
|
16
|
-
out << ' ' if options[:text] != false
|
17
|
-
out << content_tag(:span, ' ', class: 'empty-space') if options[:text] == false
|
18
|
-
out.join unless glyph.nil?
|
6
|
+
options[:glyph] ? generate_glyph(content_html) : content_html || content
|
19
7
|
end
|
20
8
|
|
21
9
|
# Render glyph html
|
22
|
-
def
|
23
|
-
|
24
|
-
|
25
|
-
glyph_options = case options[:glyph]
|
26
|
-
when Hash
|
10
|
+
def generate_glyph(content_html)
|
11
|
+
glyph_options = if options[:glyph].is_a?(Hash)
|
27
12
|
options[:glyph]
|
28
|
-
|
13
|
+
elsif options[:glyph]
|
29
14
|
{ name: options[:glyph] }
|
30
15
|
else
|
31
16
|
{}
|
32
17
|
end
|
33
18
|
|
34
|
-
glyph_options
|
35
|
-
|
36
|
-
|
37
|
-
|
19
|
+
glyph_options = glyph_options.tap do |h|
|
20
|
+
h[:text] = options[:text]
|
21
|
+
h[:label] = options[:label] || content_html || content
|
22
|
+
h[:shortcut] = options[:shortcut] unless options[:shortcut].nil?
|
23
|
+
h[:html_options] = options[:html_options] unless options[:html_options].nil?
|
24
|
+
end
|
38
25
|
|
39
|
-
UiBibz::Utils::GlyphChanger.new(glyph_options[:name], glyph_options).render unless glyph_options[:name].nil?
|
26
|
+
# UiBibz::Utils::GlyphChanger.new(glyph_options[:name], glyph_options).render unless glyph_options[:name].nil?
|
27
|
+
UiBibz::Ui::Core::Icons::Glyph.new(glyph_options[:name], glyph_options).render if glyph_options[:name].present?
|
40
28
|
end
|
41
29
|
end
|
@@ -7,7 +7,7 @@ module SurroundExtension
|
|
7
7
|
private
|
8
8
|
|
9
9
|
def surrounded?
|
10
|
-
|
10
|
+
options[:append].present? || options[:prepend].present? || options[:refresh].present? || options[:surrounded].present?
|
11
11
|
end
|
12
12
|
|
13
13
|
def surround_wrapper_tag(ct_tag)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'ui_bibz/ui/ux/containers/components/panel_tab_group'
|
4
|
+
require 'ui_bibz/ui/ux/containers/components/panel_header_title'
|
4
5
|
module UiBibz::Ui::Ux::Containers::Components
|
5
6
|
# Create a panel header
|
6
7
|
#
|
@@ -42,8 +43,8 @@ module UiBibz::Ui::Ux::Containers::Components
|
|
42
43
|
end
|
43
44
|
end
|
44
45
|
|
45
|
-
def title(
|
46
|
-
@content =
|
46
|
+
def title(content = nil, options = nil, html_options = nil, &block)
|
47
|
+
@content = PanelHeaderTitle.new(content, options, html_options, &block).render
|
47
48
|
end
|
48
49
|
|
49
50
|
def actions(content = nil, options = nil, html_options = nil, &block)
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module UiBibz::Ui::Ux::Containers::Components
|
4
|
+
# Create a panel header
|
5
|
+
#
|
6
|
+
# ==== Attributes
|
7
|
+
#
|
8
|
+
# * +content+ - Content of element
|
9
|
+
# * +options+ - Options of element
|
10
|
+
# * +html_options+ - Html Options of element
|
11
|
+
#
|
12
|
+
# ==== Options
|
13
|
+
#
|
14
|
+
# You can add HTML attributes using the +html_options+.
|
15
|
+
# You can pass arguments in options attribute:
|
16
|
+
#
|
17
|
+
# ==== Signatures
|
18
|
+
#
|
19
|
+
# UiBibz::Ui::Core::Boxes::PanelHeader.new(content, options = nil, html_options = nil)
|
20
|
+
#
|
21
|
+
# UiBibz::Ui::Core::Boxes::CarHeader.new(options = nil, html_options = nil) do
|
22
|
+
# content
|
23
|
+
# end
|
24
|
+
#
|
25
|
+
# ==== Examples
|
26
|
+
#
|
27
|
+
# UiBibz::Ui::Core::Boxes::PanelHeader.new.render
|
28
|
+
#
|
29
|
+
# UiBibz::Ui::Core::Boxes::PanelHeader.new do
|
30
|
+
# 'Exemple'
|
31
|
+
# end.render
|
32
|
+
#
|
33
|
+
class PanelHeaderTitle < UiBibz::Ui::Core::Component
|
34
|
+
# See UiBibz::Ui::Core::Component.initialize
|
35
|
+
|
36
|
+
# Render html tag
|
37
|
+
def pre_render
|
38
|
+
content_tag :div, @content, html_options
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def component_html_classes
|
44
|
+
'panel-title'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -34,12 +34,12 @@ module UiBibz::Ui::Ux::Tables
|
|
34
34
|
|
35
35
|
# Render html tag
|
36
36
|
def render
|
37
|
-
if @per_page_field.options[:wrap_form]
|
37
|
+
if @per_page_field.options[:wrap_form] == false
|
38
|
+
per_page_html
|
39
|
+
else
|
38
40
|
form_tag(url_for(url_parameters), method: :get) do
|
39
41
|
per_page_html_in_wrap
|
40
42
|
end
|
41
|
-
else
|
42
|
-
per_page_html
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
@@ -13,12 +13,12 @@ module UiBibz::Ui::Ux::Tables
|
|
13
13
|
|
14
14
|
# Render html tag
|
15
15
|
def pre_render
|
16
|
-
if options[:wrap_form]
|
16
|
+
if options[:wrap_form] == false
|
17
|
+
search_field_html
|
18
|
+
else
|
17
19
|
form_tag(url_for(url_parameters), method: :get, class: 'form-table-search-field') do
|
18
20
|
search_field_html_in_wrap
|
19
21
|
end
|
20
|
-
else
|
21
|
-
search_field_html
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -69,7 +69,7 @@ module UiBibz::Ui::Ux::Tables
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def clear_button
|
72
|
-
content_tag :button, UiBibz::Ui::Core::Icons::Glyph.new('times-circle').render, type: :button, class: 'btn btn-secondary input-group-btn clear-search-btn'
|
72
|
+
content_tag :button, UiBibz::Ui::Core::Icons::Glyph.new('times-circle', text: false, label: 'Clear Search').render, type: :button, class: 'btn btn-secondary input-group-btn clear-search-btn'
|
73
73
|
end
|
74
74
|
|
75
75
|
def component_html_classes
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module UiBibz::Utils
|
4
4
|
# Generate the col class name
|
5
5
|
class BreakdownClassNameGenerator
|
6
|
-
POSITIONING = %i[num offset push pull].freeze
|
6
|
+
POSITIONING = %i[num offset push pull order].freeze
|
7
7
|
BREAKPOINTS = UiBibz::Ui::Core::Component::BREAKPOINTS
|
8
8
|
PARAMETERS = BREAKPOINTS + POSITIONING + [:position]
|
9
9
|
|
@@ -12,6 +12,8 @@ module UiBibz::Utils
|
|
12
12
|
@klass_name = klass_name
|
13
13
|
end
|
14
14
|
|
15
|
+
# Possible options
|
16
|
+
# 3 or md: 3 or md: { num: 3 }, xs: { num: 4 }
|
15
17
|
def class_names
|
16
18
|
return @klass_name unless col_options?
|
17
19
|
|
@@ -19,9 +21,9 @@ module UiBibz::Utils
|
|
19
21
|
@options.each do |key, value|
|
20
22
|
kl << write_classes(key.to_sym, value) if BREAKPOINTS.include?(key.to_sym)
|
21
23
|
end
|
22
|
-
kl << write_classes(nil, @options)
|
24
|
+
kl << write_classes(nil, @options)
|
23
25
|
|
24
|
-
kl
|
26
|
+
kl.delete_if(&:blank?)
|
25
27
|
end
|
26
28
|
|
27
29
|
private
|
@@ -30,11 +32,17 @@ module UiBibz::Utils
|
|
30
32
|
(@options.keys.map(&:to_sym) & PARAMETERS).present?
|
31
33
|
end
|
32
34
|
|
35
|
+
# md: 8 or md: { num: 3}, xs: { num: 4 }
|
33
36
|
def write_classes(size, opts)
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
37
|
+
if opts.is_a?(Hash)
|
38
|
+
@position = opts[:position]
|
39
|
+
|
40
|
+
opts.map do |k, v|
|
41
|
+
send(k, size, v) if POSITIONING.include?(k.to_sym)
|
42
|
+
end.compact.join(' ')
|
43
|
+
else
|
44
|
+
send('num', size, opts)
|
45
|
+
end
|
38
46
|
end
|
39
47
|
|
40
48
|
# col-md-9
|
@@ -52,6 +60,11 @@ module UiBibz::Utils
|
|
52
60
|
[@klass_name, size, 'push', number].compact.join('-')
|
53
61
|
end
|
54
62
|
|
63
|
+
# order-md-9
|
64
|
+
def order(size, number)
|
65
|
+
['order', size, number].compact.join('-')
|
66
|
+
end
|
67
|
+
|
55
68
|
# col-md-pull-9
|
56
69
|
def pull(size, number)
|
57
70
|
[@klass_name, size, 'pull', number].compact.join('-')
|
data/test/simple_form_test.rb
CHANGED
@@ -42,28 +42,6 @@ class SimpleFormTest < ActionView::TestCase
|
|
42
42
|
assert_equal expected, actual
|
43
43
|
end
|
44
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 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 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>"
|
63
|
-
|
64
|
-
assert_equal expected, actual
|
65
|
-
end
|
66
|
-
|
67
45
|
test 'formula field input in simple form' do
|
68
46
|
@user.price = 3.0
|
69
47
|
@user.price_formula = '1+2'
|
@@ -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 type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"form-group
|
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 type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"form-group
|
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
|
@@ -169,7 +147,7 @@ test1</textarea></div></form>"
|
|
169
147
|
end
|
170
148
|
|
171
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>
|
172
|
-
<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
|
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
|
@@ -244,7 +222,7 @@ test1</textarea></div></form>"
|
|
244
222
|
f.input :name_en, as: :ui_slider_field
|
245
223
|
end
|
246
224
|
|
247
|
-
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\"><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>"
|
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>"
|
248
226
|
|
249
227
|
assert_equal expected, actual
|
250
228
|
end
|
@@ -59,7 +59,7 @@ class CardTest < ActionView::TestCase
|
|
59
59
|
p.body 'state'
|
60
60
|
p.footer 'state'
|
61
61
|
end
|
62
|
-
expected =
|
62
|
+
expected = "<div class=\"state card\"><div class=\"card-header\"><i class=\"glyph fas fa-eye\"></i> state</div><div class=\"card-body\">state</div><div class=\"card-footer\">state</div></div>"
|
63
63
|
|
64
64
|
assert_equal expected, actual
|
65
65
|
end
|
@@ -145,7 +145,7 @@ class CardTest < ActionView::TestCase
|
|
145
145
|
end
|
146
146
|
end
|
147
147
|
end
|
148
|
-
expected =
|
148
|
+
expected = "<div class=\"card\"><div class=\"card-header\"><ul class=\"nav nav-tabs card-header-tabs\" role=\"tablist\"><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
149
|
|
150
150
|
assert_equal expected, actual
|
151
151
|
end
|
@@ -5,7 +5,7 @@ require 'test_helper'
|
|
5
5
|
class ComponentTest < ActionView::TestCase
|
6
6
|
test 'create complex component' do
|
7
7
|
actual = UiBibz::Ui::Core::Component.new('New component', { state: :active, glyph: 'add' }, { class: 'new-class' }).render
|
8
|
-
expected =
|
8
|
+
expected = "<i class=\"glyph fas fa-add\"></i> New component"
|
9
9
|
|
10
10
|
assert_equal expected, actual
|
11
11
|
end
|
@@ -21,7 +21,7 @@ class ComponentTest < ActionView::TestCase
|
|
21
21
|
|
22
22
|
test 'create component without text and glyph' do
|
23
23
|
actual = UiBibz::Ui::Core::Component.new('My text', { glyph: 'diamond', text: false }).render
|
24
|
-
expected =
|
24
|
+
expected = "<i class=\"glyph fas fa-diamond\"></i> <span class=\"visually-hidden\">My text</span>"
|
25
25
|
|
26
26
|
assert_equal expected, actual
|
27
27
|
end
|
@@ -43,11 +43,11 @@ class ButtonGroupTest < ActionView::TestCase
|
|
43
43
|
|
44
44
|
test 'button group with dropdown' do
|
45
45
|
actual = ui_button_group do |bg|
|
46
|
-
bg.dropdown('Dropdown', {
|
46
|
+
bg.dropdown('Dropdown', { position: :up, status: :success }, { id: 'dropdown-test' }) do |d|
|
47
47
|
d.link 'Link 1', url: '#link1', glyph: 'eye'
|
48
48
|
end
|
49
49
|
end
|
50
|
-
expected =
|
50
|
+
expected = "<div class=\"btn-group\" role=\"group\"><div id=\"dropdown-test\" class=\"dropup btn-group\"><button class=\"btn btn-success dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\" id=\"dropdown-test\">Dropdown</button><div class=\"dropdown-menu\" arial-labelledby=\"dropdown-test\"><a class=\"dropdown-item\" href=\"#link1\"><i class=\"glyph fas fa-eye\"></i> Link 1</a></div></div></div>"
|
51
51
|
|
52
52
|
assert_equal expected, actual
|
53
53
|
end
|
@@ -54,13 +54,6 @@ class ButtonLinkTest < ActionView::TestCase
|
|
54
54
|
assert_equal expected, actual
|
55
55
|
end
|
56
56
|
|
57
|
-
test 'button_link block' do
|
58
|
-
actual = ui_button_link('state', type: :block)
|
59
|
-
expected = '<a class="btn-secondary btn btn-block" role="button" href="#">state</a>'
|
60
|
-
|
61
|
-
assert_equal expected, actual
|
62
|
-
end
|
63
|
-
|
64
57
|
test 'button_link size' do
|
65
58
|
actual = ui_button_link('state', size: :sm)
|
66
59
|
expected = '<a class="btn-secondary btn btn-sm" role="button" href="#">state</a>'
|
@@ -77,7 +70,7 @@ class ButtonLinkTest < ActionView::TestCase
|
|
77
70
|
|
78
71
|
test 'button_link glyph' do
|
79
72
|
actual = ui_button_link('state', glyph: 'diamond')
|
80
|
-
expected = '<a class="btn-secondary btn" role="button" href="#"><i class="glyph fas fa-diamond"></i>
|
73
|
+
expected = '<a class="btn-secondary btn" role="button" href="#"><i class="glyph fas fa-diamond"></i> state</a>'
|
81
74
|
|
82
75
|
assert_equal expected, actual
|
83
76
|
end
|
@@ -5,7 +5,7 @@ require 'test_helper'
|
|
5
5
|
class ButtonRefreshTest < ActionView::TestCase
|
6
6
|
test 'button' do
|
7
7
|
actual = UiBibz::Ui::Core::Forms::Buttons::ButtonRefresh.new('state', status: :success, connect: { target: { url: '/' } }).render
|
8
|
-
expected =
|
8
|
+
expected = "<span data-connect=\"{"events":"click","mode":"remote","target":{"selector":"","url":"/","data":[]}}\" class=\"btn-success ui-bibz-connect btn input-refresh-button\"><i class=\"glyph fas fa-sync-alt\"></i> state</span>"
|
9
9
|
|
10
10
|
assert_equal expected, actual
|
11
11
|
end
|
@@ -47,13 +47,6 @@ class ButtonTest < ActionView::TestCase
|
|
47
47
|
assert_equal expected, actual
|
48
48
|
end
|
49
49
|
|
50
|
-
test 'button block' do
|
51
|
-
actual = ui_button('state', type: :block)
|
52
|
-
expected = '<button class="btn-secondary btn btn-block">state</button>'
|
53
|
-
|
54
|
-
assert_equal expected, actual
|
55
|
-
end
|
56
|
-
|
57
50
|
test 'button size' do
|
58
51
|
actual = ui_button('state', size: :sm)
|
59
52
|
expected = '<button class="btn-secondary btn btn-sm">state</button>'
|
@@ -70,14 +63,14 @@ class ButtonTest < ActionView::TestCase
|
|
70
63
|
|
71
64
|
test 'button glyph' do
|
72
65
|
actual = ui_button('state', glyph: 'diamond')
|
73
|
-
expected =
|
66
|
+
expected = "<button class=\"btn-secondary btn\"><i class=\"glyph fas fa-diamond\"></i> state</button>"
|
74
67
|
|
75
68
|
assert_equal expected, actual
|
76
69
|
end
|
77
70
|
|
78
71
|
test 'button glyph without text' do
|
79
72
|
actual = ui_button('state', glyph: 'diamond', text: false)
|
80
|
-
expected =
|
73
|
+
expected = "<button class=\"btn-secondary btn\"><i class=\"glyph fas fa-diamond\"></i> <span class=\"visually-hidden\">state</span></button>"
|
81
74
|
|
82
75
|
assert_equal expected, actual
|
83
76
|
end
|