ui_bibz 3.0.0.alpha3 → 3.0.0.alpha10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +11 -11
  3. data/README.md +5 -1
  4. data/lib/ui_bibz.rb +0 -1
  5. data/lib/ui_bibz/helpers/ui/core/forms_helper.rb +2 -1
  6. data/lib/ui_bibz/infos.rb +4 -4
  7. data/lib/ui_bibz/inputs/ui_bibz_inputs/ui_checkbox_field_input.rb +5 -1
  8. data/lib/ui_bibz/inputs/ui_bibz_inputs/ui_multi_select_field_input.rb +3 -3
  9. data/lib/ui_bibz/inputs/ui_bibz_inputs/ui_slider_field_input.rb +1 -1
  10. data/lib/ui_bibz/rails/engine.rb +0 -4
  11. data/lib/ui_bibz/ui/concerns/card_itemable_concern.rb +2 -0
  12. data/lib/ui_bibz/ui/concerns/html_concern.rb +3 -3
  13. data/lib/ui_bibz/ui/core/boxes/components/card_body.rb +8 -0
  14. data/lib/ui_bibz/ui/core/boxes/components/card_image.rb +6 -2
  15. data/lib/ui_bibz/ui/core/forms/buttons/button.rb +3 -12
  16. data/lib/ui_bibz/ui/core/forms/buttons/button_link.rb +1 -2
  17. data/lib/ui_bibz/ui/core/forms/buttons/button_refresh.rb +0 -1
  18. data/lib/ui_bibz/ui/core/forms/choices/checkbox_field.rb +13 -4
  19. data/lib/ui_bibz/ui/core/forms/choices/radio_field.rb +7 -1
  20. data/lib/ui_bibz/ui/core/forms/choices/switch_field.rb +4 -0
  21. data/lib/ui_bibz/ui/core/forms/dropdowns/dropdown.rb +13 -9
  22. data/lib/ui_bibz/ui/core/forms/dropdowns/split_dropdown.rb +7 -2
  23. data/lib/ui_bibz/ui/core/forms/numbers/formula_field.rb +2 -0
  24. data/lib/ui_bibz/ui/core/forms/numbers/range_field.rb +19 -1
  25. data/lib/ui_bibz/ui/core/forms/numbers/slider_field.rb +13 -1
  26. data/lib/ui_bibz/ui/core/forms/numbers/slider_header.rb +4 -4
  27. data/lib/ui_bibz/ui/core/forms/selects/dropdown_select_field.rb +41 -59
  28. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button.rb +1 -9
  29. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button_link.rb +1 -9
  30. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_dropdown.rb +5 -4
  31. data/lib/ui_bibz/ui/core/forms/surrounds/surround_field.rb +3 -8
  32. data/lib/ui_bibz/ui/core/icons/glyph.rb +9 -1
  33. data/lib/ui_bibz/ui/core/navigations/components/nav_dropdown.rb +2 -2
  34. data/lib/ui_bibz/ui/core/navigations/components/nav_link_link.rb +2 -2
  35. data/lib/ui_bibz/ui/core/navigations/nav.rb +3 -3
  36. data/lib/ui_bibz/ui/core/navigations/navbar.rb +6 -4
  37. data/lib/ui_bibz/ui/core/navigations/tab_group.rb +5 -1
  38. data/lib/ui_bibz/ui/core/notifications/components/toast_header.rb +15 -1
  39. data/lib/ui_bibz/ui/core/windows/modal.rb +6 -2
  40. data/lib/ui_bibz/ui/extensions/core/component/glyph_extension.rb +11 -24
  41. data/lib/ui_bibz/ui/extensions/core/component/popover_extension.rb +1 -1
  42. data/lib/ui_bibz/ui/extensions/core/forms/surround_extension.rb +1 -1
  43. data/lib/ui_bibz/ui/ux/containers/components/panel_header.rb +3 -2
  44. data/lib/ui_bibz/ui/ux/containers/components/panel_header_title.rb +47 -0
  45. data/lib/ui_bibz/ui/ux/tables/table_pagination_per_page.rb +3 -3
  46. data/lib/ui_bibz/ui/ux/tables/table_search_field.rb +4 -4
  47. data/lib/ui_bibz/utils/breakdown_class_name_generator.rb +20 -7
  48. data/lib/ui_bibz/utils/internationalization.rb +1 -1
  49. data/test/simple_form_test.rb +6 -28
  50. data/test/ui/core/boxes/card_test.rb +2 -2
  51. data/test/ui/core/component_test.rb +2 -2
  52. data/test/ui/core/forms/buttons/button_group_test.rb +2 -2
  53. data/test/ui/core/forms/buttons/button_link_test.rb +1 -8
  54. data/test/ui/core/forms/buttons/button_refresh_test.rb +1 -1
  55. data/test/ui/core/forms/buttons/button_test.rb +2 -9
  56. data/test/ui/core/forms/choices/checkbox_field_test.rb +8 -1
  57. data/test/ui/core/forms/choices/choice_group_test.rb +3 -3
  58. data/test/ui/core/forms/choices/radio_field_test.rb +1 -1
  59. data/test/ui/core/forms/dropdowns/dropdown_test.rb +2 -2
  60. data/test/ui/core/forms/numbers/range_field_test.rb +14 -0
  61. data/test/ui/core/forms/numbers/slider_field_test.rb +2 -2
  62. data/test/ui/core/forms/selects/multi_select_field_test.rb +6 -6
  63. data/test/ui/core/forms/selects/select_field_test.rb +1 -1
  64. data/test/ui/core/forms/surrounds/surround_field_test.rb +27 -3
  65. data/test/ui/core/forms/texts/auto_complete_field_test.rb +2 -2
  66. data/test/ui/core/navigations/breadcrumb_test.rb +1 -1
  67. data/test/ui/core/navigations/link_test.rb +1 -1
  68. data/test/ui/core/navigations/nav_test.rb +7 -6
  69. data/test/ui/core/navigations/navbar_test.rb +5 -6
  70. data/test/ui/core/navigations/tab_group_test.rb +5 -5
  71. data/test/ui/core/notifications/alert_test.rb +1 -1
  72. data/test/ui/core/notifications/badge_test.rb +2 -2
  73. data/test/ui/utils/breakdown_class_name_generator_test.rb +14 -0
  74. data/test/ui/ux/containers/panel_test.rb +1 -1
  75. data/test/ui/ux/tables/table_test.rb +2 -2
  76. data/ui_bibz.gemspec +1 -1
  77. metadata +7 -10
  78. data/lib/ui_bibz/ui/core/forms/selects/multi_select_field.rb +0 -122
  79. data/package.json +0 -5
  80. data/test/ui/core/forms/selects/dropdown_select_field_test.rb +0 -84
@@ -69,7 +69,7 @@ module UiBibz::Ui::Core::Forms::Dropdowns
69
69
  private
70
70
 
71
71
  def component_html_classes
72
- ['btn-group', type]
72
+ ['btn-group', position, alignment, open, inline, keep_open]
73
73
  end
74
74
 
75
75
  def button_html
@@ -77,13 +77,18 @@ module UiBibz::Ui::Core::Forms::Dropdowns
77
77
  end
78
78
 
79
79
  def split_html
80
- content_tag :button, split_content, class: join_classes('btn', button_status, size, 'dropdown-toggle', 'dropdown-toggle-split'), type: 'button', 'data-toggle' => 'dropdown', 'aria-haspopup' => true, 'aria-expanded' => false
80
+ content_tag :button, split_content, class: split_classes, type: 'button',
81
+ 'data-toggle' => 'dropdown', 'aria-haspopup' => true, 'aria-expanded' => false
81
82
  end
82
83
 
83
84
  def split_content
84
85
  src_only
85
86
  end
86
87
 
88
+ def split_classes
89
+ join_classes('btn', button_status, size, 'dropdown-toggle', 'dropdown-toggle-split')
90
+ end
91
+
87
92
  def src_only
88
93
  content_tag :span, 'Toggle Dropdown', class: 'sr-only'
89
94
  end
@@ -49,10 +49,12 @@ module UiBibz::Ui::Core::Forms::Numbers
49
49
 
50
50
  def formula_field_html_tag
51
51
  UiBibz::Ui::Core::Forms::Surrounds::SurroundField.new(class: join_classes('formula_field', state, size)).tap do |sf|
52
+ sf.addon @options[:append] unless @options[:append].nil?
52
53
  sf.text_field formula_field_name, nil, text_field_formula_html_options
53
54
  sf.addon '=', class: 'formula-field-sign'
54
55
  sf.text_field content, nil, text_field_input_html_options
55
56
  sf.addon formula_field_alert_glyph, { class: 'formula-field-alert' }, { data: { toggle: 'tooltip' } }
57
+ sf.addon @options[:prepend] unless @options[:prepend].nil?
56
58
  end.render
57
59
  end
58
60
 
@@ -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)
@@ -52,15 +52,15 @@ module UiBibz::Ui::Core::Forms::Numbers
52
52
 
53
53
  def header_min
54
54
  content_tag :div, class: 'slider-header-min' do
55
- concat content_tag :label, options[:label_min] || 'Min: '
56
- concat content_tag :span, options[:thumb_min]
55
+ concat content_tag :label, options[:label_min] || 'Min: ', for: options[:label_for_min]
56
+ concat content_tag :span, options[:thumb_min], "data-unit": options[:unit] || options[:unit_min]
57
57
  end
58
58
  end
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] || 'max: '
63
- concat content_tag :span, options[:thumb_max]
62
+ concat content_tag :label, options[:label_max] || 'Max: ', for: options[:label_for_max]
63
+ concat content_tag :span, options[:thumb_max], "data-unit": options[:unit] || options[:unit_max]
64
64
  end
65
65
  end
66
66
 
@@ -1,11 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ui_bibz/ui/extensions/core/forms/surround_extension'
4
3
  module UiBibz::Ui::Core::Forms::Selects
5
4
  # Create a DropdownSelectField
6
5
  #
7
- # This element is an extend of UiBibz::Ui::Core::Component.
8
- # source : http://silviomoreto.github.io/bootstrap-select/examples/
6
+ # This element is an extend of UiBibz::Ui::Core::Forms::Buttons::Button
7
+ # source : http://loudev.com/
9
8
  #
10
9
  # ==== Attributes
11
10
  #
@@ -17,18 +16,14 @@ module UiBibz::Ui::Core::Forms::Selects
17
16
  #
18
17
  # You can add HTML attributes using the +html_options+.
19
18
  # You can pass arguments in options attribute:
20
- # * +status+ - status of element with symbol value:
21
- # (+:primary+, +:secondary+, +:info+, +:warning+, +:danger+, +:link+)
22
19
  # * +option_tags+ - Array, Object [required]
20
+ # * +multiple+ - Boolean
21
+ # * +outline+ - Boolean
22
+ # * +theme+ - String
23
+ # * +clickable_opt_group+ - Boolean
24
+ # * +collapsible_opt_group+ - Boolean
23
25
  # * +searchable+ - Boolean
24
- # * +max_options+ - Integer
25
- # * +selected_text_format+ - String
26
- # * +menu_size+ - Integer
27
- # * +header+ - String
28
- # * +actions_box+ - Boolean
29
- # * +show_tick+ - Boolean
30
- # * +show_menu_arrow+ - Boolean
31
- # * +dropup+ - Boolean
26
+ # * +select_all_option+ - Boolean
32
27
  # * +append+ - String, Html
33
28
  # * +prepend+ - String, Html
34
29
  # * +connect+ - Hash
@@ -38,13 +33,6 @@ module UiBibz::Ui::Core::Forms::Selects
38
33
  # * +selector+ - String
39
34
  # * +data+ - Array
40
35
  # * +url+ - String
41
- # * +refresh+ - Hash
42
- # * +event+ - String
43
- # * +mode+ - String
44
- # * +target+ - Hash
45
- # * +selector+ - String
46
- # * +data+ - Array
47
- # * +url+ - String
48
36
  #
49
37
  # ==== Signatures
50
38
  #
@@ -58,7 +46,7 @@ module UiBibz::Ui::Core::Forms::Selects
58
46
  #
59
47
  # UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new('fruits', { option_tags: list_of_fruits, searchable: true }, { class: 'test' })
60
48
  #
61
- # UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new({ option_tags: list_of_fruits, actions_box: true }, { class: 'test' }) do
49
+ # UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new({ option_tags: list_of_fruits, select_all_option: true }, { class: 'test' }) do
62
50
  # 'fruits'
63
51
  # end
64
52
  #
@@ -67,77 +55,71 @@ module UiBibz::Ui::Core::Forms::Selects
67
55
  # dropdown_select_field(content, options = {}, html_options = {})
68
56
  #
69
57
  class DropdownSelectField < UiBibz::Ui::Core::Forms::Selects::AbstractSelect
70
- # See UiBibz::Ui::Core::Component.initialize
58
+ # See UiBibz::Ui::Core::Forms::Buttons::Button.initialize
71
59
 
72
60
  private
73
61
 
74
62
  def component_html_options
75
- super.merge({}.tap do |h|
76
- h[:multiple] = true if options[:multiple]
77
- h[:disabled] = options[:state] == :disabled
78
- h[:include_blank] = options[:include_blank]
79
- h[:title] = h.delete(:prompt) unless options[:prompt].nil?
80
- end)
63
+ super.merge({
64
+ multiple: options[:multiple],
65
+ disabled: options[:state] == :disabled,
66
+ include_blank: false,
67
+ prompt: false
68
+ })
81
69
  end
82
70
 
83
71
  def component_html_classes
84
- super << ['dropdown-select-field', show_tick, dropup]
72
+ [size, type, button_status, 'multi-select-field']
85
73
  end
86
74
 
87
75
  def component_html_data
88
76
  super
77
+ clickable_opt_group
78
+ collapsible_opt_group
89
79
  searchable
90
- max_options
91
- selected_text_format
92
- menu_size
93
- style
94
- header
95
- actions_box
96
- add_status
80
+ select_all_options
81
+ number_displayed
97
82
  end
98
83
 
99
- ############################ Data html options
100
-
101
- def max_options
102
- add_html_data('max_options', value: options[:max_options]) if options[:max_options]
84
+ def clickable_opt_group
85
+ add_html_data('enable_clickable_opt_groups') if options[:clickable_opt_group]
103
86
  end
104
87
 
105
- def selected_text_format
106
- add_html_data('selected_text_format', value: options[:selected_text_format]) if options[:selected_text_format]
88
+ def collapsible_opt_group
89
+ add_html_data('enable_collapsible_opt_groups') if options[:collapsible_opt_group]
107
90
  end
108
91
 
109
92
  def searchable
110
- add_html_data('live_search') if options[:searchable]
93
+ add_html_data('enable_filtering') if options[:searchable]
111
94
  end
112
95
 
113
- def style
114
- add_html_data('style', value: "btn-#{options[:status] || :secondary}")
96
+ def number_displayed
97
+ add_html_data('number_displayed') if options[:number_displayed]
115
98
  end
116
99
 
117
- def menu_size
118
- add_html_data('size', value: options[:menu_size]) if options[:menu_size]
100
+ def select_all_options
101
+ add_html_data('include_select_all_option') if options[:select_all_options]
119
102
  end
120
103
 
121
- def actions_box
122
- add_html_data('actions_box') if options[:actions_box]
104
+ def type
105
+ 'btn-block' if options[:type] == :block
123
106
  end
124
107
 
125
- def header
126
- add_html_data('header', value: options[:header]) if options[:header]
108
+ # :lg, :sm or :xs
109
+ def size
110
+ "btn-#{options[:size]}" if options[:size]
127
111
  end
128
112
 
129
- def add_status
130
- add_html_data('style', value: "btn-#{options[:status]}") if options[:status]
113
+ def button_status
114
+ ['btn', outline, options[:status] || :secondary].compact.join('-')
131
115
  end
132
116
 
133
- ############################# Css classes
134
-
135
- def show_tick
136
- 'show-tick' if options[:show_tick]
117
+ def outline
118
+ 'outline' if options[:outline]
137
119
  end
138
120
 
139
- def dropup
140
- 'dropup' if options[:dropup]
121
+ def theme
122
+ 'dropdown-menu-dark' if @options[:theme]
141
123
  end
142
124
  end
143
125
  end
@@ -1,13 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UiBibz::Ui::Core::Forms::Surrounds
4
- class SurroundButton < UiBibz::Ui::Core::Forms::Buttons::Button
5
- # See UiBibz::Ui::Core::Dropdown.initialize
6
-
7
- def pre_render
8
- content_tag :div, class: 'input-group-btn' do
9
- button_html_tag
10
- end
11
- end
12
- end
4
+ class SurroundButton < UiBibz::Ui::Core::Forms::Buttons::Button; end
13
5
  end
@@ -1,13 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UiBibz::Ui::Core::Forms::Surrounds
4
- class SurroundButtonLink < UiBibz::Ui::Core::Forms::Buttons::ButtonLink
5
- # See UiBibz::Ui::Core::Dropdown.initialize
6
-
7
- def pre_render
8
- content_tag :div, class: 'input-group-btn' do
9
- button_link_html_tag
10
- end
11
- end
12
- end
4
+ class SurroundButtonLink < UiBibz::Ui::Core::Forms::Buttons::ButtonLink; end
13
5
  end
@@ -4,10 +4,11 @@ module UiBibz::Ui::Core::Forms::Surrounds
4
4
  class SurroundDropdown < UiBibz::Ui::Core::Forms::Dropdowns::Dropdown
5
5
  # See UiBibz::Ui::Core::Dropdown.initialize
6
6
 
7
- private
8
-
9
- def component_html_classes
10
- super << 'input-group-btn'
7
+ def pre_render
8
+ capture do
9
+ concat button_html
10
+ concat ul_html
11
+ end
11
12
  end
12
13
  end
13
14
  end
@@ -29,10 +29,8 @@ module UiBibz::Ui::Core::Forms::Surrounds
29
29
  #
30
30
  # ==== Signatures
31
31
  #
32
- # UiBibz::Ui::Core::Forms::Texts::TextField.new(content, options = {}, html_options = {}).render
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
@@ -61,7 +61,7 @@ module UiBibz::Ui::Core::Icons
61
61
 
62
62
  # Render html tag
63
63
  def pre_render
64
- [content_tag(:i, '', html_options), options[:label]].compact.join(' ').html_safe
64
+ [content_tag(:i, '', html_options), label].compact.join(' ').html_safe
65
65
  end
66
66
 
67
67
  private
@@ -138,5 +138,13 @@ module UiBibz::Ui::Core::Icons
138
138
  def match_style
139
139
  { solid: 'fas', regular: 'far', light: 'fal', brands: 'fab' }
140
140
  end
141
+
142
+ def label
143
+ if options[:text] == false
144
+ content_tag :span, options[:label], class: 'visually-hidden'
145
+ else
146
+ options[:label]
147
+ end
148
+ end
141
149
  end
142
150
  end
@@ -56,11 +56,11 @@ module UiBibz::Ui::Core::Navigations
56
56
  private
57
57
 
58
58
  def component_html_classes
59
- [type, 'nav-item', without_caret]
59
+ [position, open, keep_open, 'nav-item', without_caret]
60
60
  end
61
61
 
62
62
  def link_html
63
- link_to button_content, '#', class: join_classes(size, state, 'dropdown-toggle', 'nav-link'), 'data-toggle' => 'dropdown', 'aria-expanded' => false
63
+ content_tag :a, button_content, class: join_classes(size, state, 'dropdown-toggle', 'nav-link'), href: '#', 'data-toggle' => 'dropdown', 'aria-expanded' => false
64
64
  end
65
65
  end
66
66
  end
@@ -23,7 +23,7 @@ module UiBibz::Ui::Core::Navigations
23
23
 
24
24
  # Render html tag
25
25
  def pre_render
26
- link_to options[:url], html_options do
26
+ content_tag :a, { href: options[:url] }.merge(html_options) do
27
27
  concat glyph_and_content_html
28
28
  concat tag_html if options[:tag]
29
29
  end
@@ -45,7 +45,7 @@ module UiBibz::Ui::Core::Navigations
45
45
  when 'nav-tabs'
46
46
  html_tag_base
47
47
  when 'list-group'
48
- html_tag_base.merge("aria-controls": sanitize_text(content))
48
+ html_tag_base.merge("aria-controls": sanitize_text(content).parameterize)
49
49
  else
50
50
  {}
51
51
  end.merge(options[:a_html] || {})
@@ -82,7 +82,7 @@ module UiBibz::Ui::Core::Navigations
82
82
  # Add nav link items
83
83
  # See UiBibz::Ui::Core::Navigations::NavLink
84
84
  def link(content = nil, options = {}, html_options = nil, &block)
85
- if block_given?
85
+ if block
86
86
  content[:nav_type] = type
87
87
  content[:nav_tags] = nav_tags
88
88
  else
@@ -93,7 +93,7 @@ module UiBibz::Ui::Core::Navigations
93
93
  end
94
94
 
95
95
  def text(content = nil, options = {}, html_options = nil, &block)
96
- block_given? ? content[:nav_type] = type : options[:nav_type] = type
96
+ block ? content[:nav_type] = type : options[:nav_type] = type
97
97
  @items << NavText.new(content, options, html_options, &block)
98
98
  end
99
99
 
@@ -120,7 +120,7 @@ module UiBibz::Ui::Core::Navigations
120
120
  end
121
121
 
122
122
  def component_html_options
123
- @options[:type] == :list ? { role: 'tablist' } : super
123
+ %i[tabs list].include?(@options[:type]) ? { role: 'tablist' } : super
124
124
  end
125
125
 
126
126
  # tabs or pills