ui_bibz 3.0.0.alpha5 → 3.0.0.alpha6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/lib/ui_bibz/infos.rb +1 -1
- data/lib/ui_bibz/inputs/ui_bibz_inputs/ui_checkbox_field_input.rb +1 -1
- data/lib/ui_bibz/ui/core/forms/buttons/button.rb +1 -1
- data/lib/ui_bibz/ui/core/forms/choices/checkbox_field.rb +7 -1
- 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 +5 -5
- data/lib/ui_bibz/ui/core/forms/dropdowns/split_dropdown.rb +1 -1
- 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 +1 -1
- data/lib/ui_bibz/ui/core/forms/surrounds/surround_field.rb +3 -8
- data/lib/ui_bibz/ui/core/windows/modal.rb +6 -2
- data/lib/ui_bibz/ui/extensions/core/component/glyph_extension.rb +7 -5
- 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/utils/breakdown_class_name_generator.rb +14 -6
- data/lib/ui_bibz/utils/internationalization.rb +1 -1
- data/test/ui/core/forms/choices/checkbox_field_test.rb +2 -2
- data/test/ui/core/forms/choices/radio_field_test.rb +1 -1
- data/test/ui/core/forms/dropdowns/dropdown_test.rb +1 -1
- 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/surrounds/surround_field_test.rb +24 -0
- data/test/ui/core/navigations/navbar_test.rb +2 -4
- data/test/ui/utils/breakdown_class_name_generator_test.rb +14 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38589277f9143465e38e93374fe2a2c2b5c98b6c419b817e71807258dd694d11
|
4
|
+
data.tar.gz: '087b07e3cecf23f9eace93ff8cab21324cbcbfaf30f7f26d1cf5af229a85c45a'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0116b98a6962813164b842c69424c368ab0dfb4425b05259c6b16b93d2067712a642182d4ec1147932cc6880c34fe29e2b7acfc84d2b5f7ef96d064d20bf4a5b
|
7
|
+
data.tar.gz: c54954c90ca0d394ead85a12f7ab2b353c860fa8d93c9b73bc82e7735cc9a23c9ec8e2cdd699d4d7b00fd2db0c84751c5cb22b381bf018122acafcd28be56183
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ui_bibz (3.0.0.
|
4
|
+
ui_bibz (3.0.0.alpha6)
|
5
5
|
rails (~> 6.0.3, >= 6.0.3.2)
|
6
6
|
will-paginate-i18n
|
7
7
|
will_paginate (~> 3.1.0)
|
@@ -159,13 +159,13 @@ GEM
|
|
159
159
|
rake (13.0.1)
|
160
160
|
regexp_parser (1.8.2)
|
161
161
|
rexml (3.2.4)
|
162
|
-
rubocop (1.
|
162
|
+
rubocop (1.1.0)
|
163
163
|
parallel (~> 1.10)
|
164
164
|
parser (>= 2.7.1.5)
|
165
165
|
rainbow (>= 2.2.2, < 4.0)
|
166
166
|
regexp_parser (>= 1.8)
|
167
167
|
rexml
|
168
|
-
rubocop-ast (>= 0.
|
168
|
+
rubocop-ast (>= 1.0.1)
|
169
169
|
ruby-progressbar (~> 1.7)
|
170
170
|
unicode-display_width (>= 1.4.0, < 2.0)
|
171
171
|
rubocop-ast (1.1.0)
|
data/lib/ui_bibz/infos.rb
CHANGED
@@ -16,7 +16,7 @@ module UiBibz::Ui::Core::Forms::Buttons
|
|
16
16
|
# You can add HTML attributes using the +html_options+.
|
17
17
|
# You can pass arguments in options attribute:
|
18
18
|
# * +status+ - status of element with symbol value:
|
19
|
-
# (+:primary+, +:secondary+, +:info+, +:warning+, +:danger+, +:
|
19
|
+
# (+:primary+, +:secondary+, +:success+, :info+, +:warning+, +:danger+, +:light+, +:dark+)
|
20
20
|
# * +size+
|
21
21
|
# (+:xs+, +:sm+, +:lg+)
|
22
22
|
# * +outline+ - Boolean
|
@@ -70,7 +70,7 @@ module UiBibz::Ui::Core::Forms::Choices
|
|
70
70
|
disabled: disabled?,
|
71
71
|
indeterminate: options[:indeterminate],
|
72
72
|
"data-action": options[:action],
|
73
|
-
class: 'form-check-input'
|
73
|
+
class: UiBibz::Utils::Screwdriver.join_classes('form-check-input', input_status)
|
74
74
|
}.tap do |html|
|
75
75
|
html[:id] = html_options[:id] if html_options[:id]
|
76
76
|
end
|
@@ -95,6 +95,12 @@ module UiBibz::Ui::Core::Forms::Choices
|
|
95
95
|
super << component_wrapper_html_classes
|
96
96
|
end
|
97
97
|
|
98
|
+
def input_status
|
99
|
+
"form-check-input-#{options[:status]}" if options[:status]
|
100
|
+
end
|
101
|
+
|
102
|
+
def status; end
|
103
|
+
|
98
104
|
def inline
|
99
105
|
'form-check-inline' if options[:inline]
|
100
106
|
end
|
@@ -67,7 +67,7 @@ module UiBibz::Ui::Core::Forms::Choices
|
|
67
67
|
{
|
68
68
|
disabled: options[:state] == :disabled,
|
69
69
|
"data-action": options[:action],
|
70
|
-
class: 'form-check-input'
|
70
|
+
class: UiBibz::Utils::Screwdriver.join_classes('form-check-input', input_status)
|
71
71
|
}
|
72
72
|
end
|
73
73
|
|
@@ -79,6 +79,12 @@ module UiBibz::Ui::Core::Forms::Choices
|
|
79
79
|
super << component_wrapper_html_classes
|
80
80
|
end
|
81
81
|
|
82
|
+
def status; end
|
83
|
+
|
84
|
+
def input_status
|
85
|
+
"form-check-input-#{options[:status]}" if options[:status]
|
86
|
+
end
|
87
|
+
|
82
88
|
def inline
|
83
89
|
'form-check-inline' if options[:inline]
|
84
90
|
end
|
@@ -43,6 +43,10 @@ module UiBibz::Ui::Core::Forms::Choices
|
|
43
43
|
class SwitchField < UiBibz::Ui::Core::Forms::Choices::CheckboxField
|
44
44
|
private
|
45
45
|
|
46
|
+
def component_options
|
47
|
+
{ boolean: true }
|
48
|
+
end
|
49
|
+
|
46
50
|
def component_html_classes
|
47
51
|
['form-check', 'form-switch', inline]
|
48
52
|
end
|
@@ -29,7 +29,7 @@ module UiBibz::Ui::Core::Forms::Dropdowns
|
|
29
29
|
# * +html_button+ - Hash
|
30
30
|
# * +position+ - Symbol
|
31
31
|
# (+:up+, +:right+, +:down+, +:left+)
|
32
|
-
# * +
|
32
|
+
# * +alignment+ - Symbol
|
33
33
|
# (+:right)
|
34
34
|
#
|
35
35
|
# ==== Signatures
|
@@ -124,15 +124,15 @@ module UiBibz::Ui::Core::Forms::Dropdowns
|
|
124
124
|
end
|
125
125
|
|
126
126
|
def ul_html
|
127
|
-
content_tag :div, @items.join.html_safe, class: join_classes('dropdown-menu', theme,
|
127
|
+
content_tag :div, @items.join.html_safe, class: join_classes('dropdown-menu', theme, alignment, open), 'arial-labelledby' => id
|
128
128
|
end
|
129
129
|
|
130
130
|
def dropdown_tag
|
131
131
|
options[:tag] || :button
|
132
132
|
end
|
133
133
|
|
134
|
-
def
|
135
|
-
"dropdown-menu-#{@options[:
|
134
|
+
def alignment
|
135
|
+
"dropdown-menu-#{@options[:alignment]}" unless @options[:alignment].nil?
|
136
136
|
end
|
137
137
|
|
138
138
|
def position
|
@@ -148,7 +148,7 @@ module UiBibz::Ui::Core::Forms::Dropdowns
|
|
148
148
|
end
|
149
149
|
|
150
150
|
def inline
|
151
|
-
'btn-group' if @options[:inline] || @options[:
|
151
|
+
'btn-group' if @options[:inline] || @options[:alignment]
|
152
152
|
end
|
153
153
|
|
154
154
|
def without_caret
|
@@ -20,6 +20,12 @@ module UiBibz::Ui::Core::Forms::Numbers
|
|
20
20
|
# * +step+ - [Float, Integer]
|
21
21
|
# * +in+ - Array
|
22
22
|
# * +within+ - Array
|
23
|
+
# * +status+ - status of element with symbol value:
|
24
|
+
# (+:primary+, +:secondary+, +:success+, :info+, +:warning+, +:danger+, +:light+, +:dark+)
|
25
|
+
# * +thumb_status+ - status of the thumb:
|
26
|
+
# (+:primary+, +:secondary+, +:success+, :info+, +:warning+, +:danger+, +:light+, +:dark+)
|
27
|
+
# * +track_status+ - status of track:
|
28
|
+
# (+:primary+, +:secondary+, +:success+, :info+, +:warning+, +:danger+, +:light+, +:dark+)
|
23
29
|
#
|
24
30
|
# ==== Signatures
|
25
31
|
#
|
@@ -75,7 +81,19 @@ module UiBibz::Ui::Core::Forms::Numbers
|
|
75
81
|
end
|
76
82
|
|
77
83
|
def component_html_classes
|
78
|
-
'form-range'
|
84
|
+
['form-range', status, thumb_status, track_status]
|
85
|
+
end
|
86
|
+
|
87
|
+
def status
|
88
|
+
"form-range-#{options[:status]}" if options[:status]
|
89
|
+
end
|
90
|
+
|
91
|
+
def thumb_status
|
92
|
+
"form-range-thumb-#{options[:thumb_status]}" if options[:thumb_status]
|
93
|
+
end
|
94
|
+
|
95
|
+
def track_status
|
96
|
+
"form-range-track-#{options[:track_status]}" if options[:track_status]
|
79
97
|
end
|
80
98
|
|
81
99
|
def option_label(value)
|
@@ -20,6 +20,10 @@ module UiBibz::Ui::Core::Forms::Numbers
|
|
20
20
|
# * +step+ - [Float, Integer]
|
21
21
|
# * +in+ - Array
|
22
22
|
# * +within+ - Array
|
23
|
+
# * +status+ - status of element with symbol value:
|
24
|
+
# (+:primary+, +:secondary+, +:success+, :info+, +:warning+, +:danger+, +:light+, +:dark+)
|
25
|
+
# * +track_status+ - status of track:
|
26
|
+
# (+:primary+, +:secondary+, +:success+, :info+, +:warning+, +:danger+, +:light+, +:dark+)
|
23
27
|
#
|
24
28
|
# ==== Signatures
|
25
29
|
#
|
@@ -114,13 +118,21 @@ module UiBibz::Ui::Core::Forms::Numbers
|
|
114
118
|
end
|
115
119
|
|
116
120
|
def component_html_classes
|
117
|
-
['slider', ('disabled' if disabled)]
|
121
|
+
['slider', status, track_status, ('disabled' if disabled)]
|
118
122
|
end
|
119
123
|
|
120
124
|
def disabled
|
121
125
|
'disabled' if options[:state] == :disabled || html_options[:disabled]
|
122
126
|
end
|
123
127
|
|
128
|
+
def status
|
129
|
+
"slider-#{options[:status]}" if options[:status]
|
130
|
+
end
|
131
|
+
|
132
|
+
def track_status
|
133
|
+
"slider-track-#{options[:track_status]}" if options[:track_status]
|
134
|
+
end
|
135
|
+
|
124
136
|
def range_name(suffix)
|
125
137
|
if content.end_with?(']')
|
126
138
|
content.dup.insert(-2, suffix)
|
@@ -59,7 +59,7 @@ module UiBibz::Ui::Core::Forms::Numbers
|
|
59
59
|
|
60
60
|
def header_max
|
61
61
|
content_tag :div, class: 'slider-header-max' do
|
62
|
-
concat content_tag :label, options[:label_max] || '
|
62
|
+
concat content_tag :label, options[:label_max] || 'Max: '
|
63
63
|
concat content_tag :span, options[:thumb_max], "data-unit": options[:unit] || options[:unit_max]
|
64
64
|
end
|
65
65
|
end
|
@@ -29,10 +29,8 @@ module UiBibz::Ui::Core::Forms::Surrounds
|
|
29
29
|
#
|
30
30
|
# ==== Signatures
|
31
31
|
#
|
32
|
-
# UiBibz::Ui::Core::Forms::
|
33
|
-
#
|
34
|
-
# UiBibz::Ui::Core::Forms::Texts::TextField.new(options = {}, html_options = {}) do
|
35
|
-
# content
|
32
|
+
# UiBibz::Ui::Core::Forms::Surrounds::Surround.new(options = {}, html_options = {}) do |s|
|
33
|
+
# s.
|
36
34
|
# end.render
|
37
35
|
#
|
38
36
|
# ==== Examples
|
@@ -118,6 +116,7 @@ module UiBibz::Ui::Core::Forms::Surrounds
|
|
118
116
|
end
|
119
117
|
|
120
118
|
def dropdown_select_field(content = nil, options = nil, html_options = nil, &block)
|
119
|
+
html_options = (html_options || {}).merge("data-wrapper-classes": 'input-group-btn')
|
121
120
|
@items << UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new(content, options, html_options, &block).render
|
122
121
|
end
|
123
122
|
|
@@ -125,10 +124,6 @@ module UiBibz::Ui::Core::Forms::Surrounds
|
|
125
124
|
@items << UiBibz::Ui::Core::Forms::Selects::SelectField.new(content, options, html_options, &block).render
|
126
125
|
end
|
127
126
|
|
128
|
-
def multi_select_field(content = nil, options = nil, html_options = nil, &block)
|
129
|
-
@items << UiBibz::Ui::Core::Forms::Selects::MultiSelectField.new(content, options, html_options, &block).render
|
130
|
-
end
|
131
|
-
|
132
127
|
def auto_complete_field(content = nil, options = nil, html_options = nil, &block)
|
133
128
|
@items << UiBibz::Ui::Core::Forms::Texts::AutoCompleteField.new(content, options, html_options, &block).render
|
134
129
|
end
|
@@ -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
|
@@ -13,8 +13,11 @@ module GlyphExtension
|
|
13
13
|
# Render glyph with space html
|
14
14
|
def glyph_with_space
|
15
15
|
out = [glyph]
|
16
|
-
out <<
|
17
|
-
|
16
|
+
out << if options[:text] == false
|
17
|
+
content_tag(:span, ' ', class: 'empty-space')
|
18
|
+
else
|
19
|
+
' '
|
20
|
+
end
|
18
21
|
out.join unless glyph.nil?
|
19
22
|
end
|
20
23
|
|
@@ -22,10 +25,9 @@ module GlyphExtension
|
|
22
25
|
def glyph
|
23
26
|
options[:content] = content if options[:text] == false
|
24
27
|
|
25
|
-
glyph_options =
|
26
|
-
when Hash
|
28
|
+
glyph_options = if options[:glyph].is_a?(Hash)
|
27
29
|
options[:glyph]
|
28
|
-
|
30
|
+
elsif options[:glyph]
|
29
31
|
{ name: options[:glyph] }
|
30
32
|
else
|
31
33
|
{}
|
@@ -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
|
@@ -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
|
@@ -4,8 +4,8 @@ require 'test_helper'
|
|
4
4
|
|
5
5
|
class CheckboxFieldTest < ActionView::TestCase
|
6
6
|
test 'checkbox_field' do
|
7
|
-
actual = UiBibz::Ui::Core::Forms::Choices::CheckboxField.new('John', { value: 1 }).render
|
8
|
-
expected = "<div class=\"form-check\"><input type=\"checkbox\" name=\"John\" id=\"John\" value=\"1\" class=\"form-check-input\" /><label class=\"form-check-label\" for=\"John\">John</label></div>"
|
7
|
+
actual = UiBibz::Ui::Core::Forms::Choices::CheckboxField.new('John', { value: 1, status: :primary }).render
|
8
|
+
expected = "<div class=\"form-check\"><input type=\"checkbox\" name=\"John\" id=\"John\" value=\"1\" class=\"form-check-input form-check-input-primary\" /><label class=\"form-check-label\" for=\"John\">John</label></div>"
|
9
9
|
|
10
10
|
assert_equal expected, actual
|
11
11
|
end
|
@@ -5,7 +5,7 @@ require 'test_helper'
|
|
5
5
|
class RadioFieldTest < ActionView::TestCase
|
6
6
|
test 'radio_field' do
|
7
7
|
actual = UiBibz::Ui::Core::Forms::Choices::RadioField.new('John', { value: 1, status: :primary, type: :square }).render
|
8
|
-
expected = "<div class=\"form-check\"><input type=\"radio\" name=\"John\" id=\"John_1\" value=\"1\" class=\"form-check-input\" /><label class=\"form-check-label\" for=\"John_1\">John</label></div>"
|
8
|
+
expected = "<div class=\"form-check\"><input type=\"radio\" name=\"John\" id=\"John_1\" value=\"1\" class=\"form-check-input form-check-input-primary\" /><label class=\"form-check-label\" for=\"John_1\">John</label></div>"
|
9
9
|
|
10
10
|
assert_equal expected, actual
|
11
11
|
end
|
@@ -32,7 +32,7 @@ class DropdownTest < ActionView::TestCase
|
|
32
32
|
end
|
33
33
|
|
34
34
|
test 'Dropdown options' do
|
35
|
-
actual = UiBibz::Ui::Core::Forms::Dropdowns::Dropdown.new('Dropdown', position: :up,
|
35
|
+
actual = UiBibz::Ui::Core::Forms::Dropdowns::Dropdown.new('Dropdown', position: :up, alignment: :right, status: :success, glyph: 'diamond').tap do |d|
|
36
36
|
d.link 'Link 1', url: '#link1', glyph: 'eye'
|
37
37
|
d.header 'header'
|
38
38
|
d.link 'Link 2', url: '#link2'
|
@@ -37,4 +37,18 @@ class RangeFieldTest < ActionView::TestCase
|
|
37
37
|
|
38
38
|
assert_equal expected, actual.render
|
39
39
|
end
|
40
|
+
|
41
|
+
test "range status" do
|
42
|
+
actual = UiBibz::Ui::Core::Forms::Numbers::RangeField.new('myrange', value: 2, max: 3, status: :sucesss).render
|
43
|
+
expected = "<input type=\"range\" name=\"myrange\" id=\"myrange\" value=\"2\" class=\"form-range-sucesss form-range\" max=\"3\" />"
|
44
|
+
|
45
|
+
assert_equal expected, actual
|
46
|
+
end
|
47
|
+
|
48
|
+
test "range thumb and track status" do
|
49
|
+
actual = UiBibz::Ui::Core::Forms::Numbers::RangeField.new('myrange', value: 2, max: 3, thumb_status: :sucesss, track_status: :dark).render
|
50
|
+
expected = "<input type=\"range\" name=\"myrange\" id=\"myrange\" value=\"2\" class=\"form-range form-range-thumb-sucesss form-range-track-dark\" max=\"3\" />"
|
51
|
+
|
52
|
+
assert_equal expected, actual
|
53
|
+
end
|
40
54
|
end
|
@@ -11,8 +11,8 @@ class SliderFieldTest < ActionView::TestCase
|
|
11
11
|
end
|
12
12
|
|
13
13
|
test 'slider field with options' do
|
14
|
-
actual = UiBibz::Ui::Core::Forms::Numbers::SliderField.new('myrange', thumb_max: 2, thumb_min: -7, min: -9, max: 6, step: 2, input_name_max: "price_max", input_name_min: "price_min").render
|
15
|
-
expected = "<div class=\"slider\" min=\"-9\" max=\"6\" step=\"2\"><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: 13%; right: 26%\"></div><div class=\"slider-thumb slider-thumb-left\" style=\"left: 13%\"></div><div class=\"slider-thumb slider-thumb-right\" style=\"left: 74%\"></div></div><input type=\"range\" name=\"price_min\" id=\"price_min\" value=\"-7\" max=\"6\" min=\"-9\" step=\"2\" /><input type=\"range\" name=\"price_max\" id=\"price_max\" value=\"2\" max=\"6\" min=\"-9\" step=\"2\" /></div>"
|
14
|
+
actual = UiBibz::Ui::Core::Forms::Numbers::SliderField.new('myrange', status: :secondary, track_status: :dark, thumb_max: 2, thumb_min: -7, min: -9, max: 6, step: 2, input_name_max: "price_max", input_name_min: "price_min").render
|
15
|
+
expected = "<div class=\"slider-secondary slider slider-track-dark\" min=\"-9\" max=\"6\" step=\"2\"><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: 13%; right: 26%\"></div><div class=\"slider-thumb slider-thumb-left\" style=\"left: 13%\"></div><div class=\"slider-thumb slider-thumb-right\" style=\"left: 74%\"></div></div><input type=\"range\" name=\"price_min\" id=\"price_min\" value=\"-7\" max=\"6\" min=\"-9\" step=\"2\" /><input type=\"range\" name=\"price_max\" id=\"price_max\" value=\"2\" max=\"6\" min=\"-9\" step=\"2\" /></div>"
|
16
16
|
|
17
17
|
assert_equal expected, actual
|
18
18
|
end
|
@@ -67,4 +67,28 @@ class SurroundFieldTest < ActionView::TestCase
|
|
67
67
|
|
68
68
|
assert_equal expected, actual
|
69
69
|
end
|
70
|
+
|
71
|
+
test "surround with all fields" do
|
72
|
+
actual = UiBibz::Ui::Core::Forms::Surrounds::SurroundField.new.tap do |sf|
|
73
|
+
sf.glyph 'gem'
|
74
|
+
sf.addon "test"
|
75
|
+
sf.button "button"
|
76
|
+
sf.button_group do |bg|
|
77
|
+
bg.button "test"
|
78
|
+
end
|
79
|
+
sf.button_link "link", url: "#"
|
80
|
+
sf.checkbox_field :check
|
81
|
+
sf.radio_field :radio
|
82
|
+
sf.text_field :text
|
83
|
+
sf.date_picker_field :date
|
84
|
+
sf.dropdown_select_field :dropdown_select
|
85
|
+
sf.select_field :select
|
86
|
+
sf.auto_complete_field :auto
|
87
|
+
sf.button_refresh
|
88
|
+
end.render
|
89
|
+
|
90
|
+
expected = "<div class=\"input-group ui_surround_field\"><span class=\"input-group-text\"><i class=\"glyph fas fa-gem\"></i></span><span class=\"input-group-text\">test</span><div class=\"input-group-btn\"><button class=\"btn-secondary btn\">button</button></div><div class=\"input-group-btn\" role=\"group\"><button class=\"btn-secondary btn\">test</button></div><div class=\"input-group-btn\"><a class=\"btn-secondary btn\" role=\"button\" href=\"#\">link</a></div><div class=\"input-group-text\" label=\"false\"><input type=\"checkbox\" name=\"check\" id=\"check\" value=\"1\" class=\"form-check-input\" /><label class=\"form-check-label\" for=\"check\">check</label></div><div class=\"input-group-text\" label=\"false\"><input type=\"radio\" name=\"radio\" id=\"radio_\" class=\"form-check-input\" /><label class=\"form-check-label\" for=\"radio_\">radio</label></div><input type=\"text\" name=\"text\" id=\"text\" class=\"form-control\" /><input type=\"text\" name=\"date\" id=\"date\" data-date-locale=\"en\" data-provide=\"datepicker\" data-date-format=\"yyyy-mm-dd\" data-date-today-btn=\"linked\" data-date-toggle-active=\"true\" class=\"date_picker form-control\" /><select name=\"dropdown_select\" id=\"dropdown_select\" data-wrapper-classes=\"input-group-btn\" class=\"btn-secondary multi-select-field\"></select><select name=\"select\" id=\"select\" class=\"select-field form-control form-select\"></select><input type=\"text\" name=\"auto\" id=\"auto\" class=\"form-control auto-complete-field\" autocomplete=\"true\" list=\"auto-datalist\" /><datalist id=\"auto-datalist\"></datalist><span data-connect=\"{"events":"click","mode":"remote","target":{"selector":"","url":"","data":[]}}\" class=\"btn-secondary ui-bibz-connect btn input-refresh-button\"><i class=\"glyph fas fa-sync-alt\"></i> </span></div>"
|
91
|
+
|
92
|
+
assert_equal expected, actual
|
93
|
+
end
|
70
94
|
end
|
@@ -3,16 +3,14 @@
|
|
3
3
|
require 'test_helper'
|
4
4
|
class NavbarTest < ActionView::TestCase
|
5
5
|
test 'Navbar' do
|
6
|
-
actual = UiBibz::Ui::Core::Navigations::Navbar.new
|
7
|
-
end
|
6
|
+
actual = UiBibz::Ui::Core::Navigations::Navbar.new
|
8
7
|
expected = "<nav class=\"navbar navbar-light navbar-expand-lg\"><div class=\"container\"><button class=\"navbar-toggler hidden-sm-up\" type=\"button\" data-toggle=\"collapse\" data-target=\"##{actual.id}\">☰</button><div class=\"navbar-collapse collapse\" id=\"#{actual.id}\"></div></div></nav>"
|
9
8
|
|
10
9
|
assert_equal expected, actual.render
|
11
10
|
end
|
12
11
|
|
13
12
|
test 'Navbar with options' do
|
14
|
-
actual = UiBibz::Ui::Core::Navigations::Navbar.new(title: 'Brand', expand_size: :xs, status: :primary, position: :top, brand_position: :right)
|
15
|
-
end
|
13
|
+
actual = UiBibz::Ui::Core::Navigations::Navbar.new(title: 'Brand', expand_size: :xs, status: :primary, position: :top, brand_position: :right)
|
16
14
|
expected = "<nav class=\"bg-primary navbar navbar-light fixed-top navbar-expand-xs\"><div class=\"container\"><button class=\"navbar-toggler hidden-sm-up\" type=\"button\" data-toggle=\"collapse\" data-target=\"##{actual.id}\">☰</button><span class=\"navbar-brand\">Brand</span><div class=\"navbar-collapse collapse\" id=\"#{actual.id}\"></div></div></nav>"
|
17
15
|
|
18
16
|
assert_equal expected, actual.render
|
@@ -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
|
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.alpha6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thooams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -427,6 +427,7 @@ files:
|
|
427
427
|
- lib/ui_bibz/ui/ux/containers/components/panel_footer.rb
|
428
428
|
- lib/ui_bibz/ui/ux/containers/components/panel_group.rb
|
429
429
|
- lib/ui_bibz/ui/ux/containers/components/panel_header.rb
|
430
|
+
- lib/ui_bibz/ui/ux/containers/components/panel_header_title.rb
|
430
431
|
- lib/ui_bibz/ui/ux/containers/components/panel_tab_group.rb
|
431
432
|
- lib/ui_bibz/ui/ux/containers/components/panel_toolbar.rb
|
432
433
|
- lib/ui_bibz/ui/ux/containers/panel.rb
|