ui_bibz 3.0.0.alpha5 → 3.0.0.alpha11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +9 -9
  3. data/README.md +4 -0
  4. data/lib/ui_bibz/concerns/models/searchable.rb +1 -1
  5. data/lib/ui_bibz/infos.rb +4 -4
  6. data/lib/ui_bibz/inputs/ui_bibz_inputs/ui_checkbox_field_input.rb +1 -1
  7. data/lib/ui_bibz/inputs/ui_bibz_inputs/ui_text_field_input.rb +1 -1
  8. data/lib/ui_bibz/ui/concerns/html_concern.rb +3 -3
  9. data/lib/ui_bibz/ui/core/boxes/components/card_image.rb +5 -1
  10. data/lib/ui_bibz/ui/core/forms/buttons/button.rb +3 -12
  11. data/lib/ui_bibz/ui/core/forms/buttons/button_link.rb +1 -2
  12. data/lib/ui_bibz/ui/core/forms/buttons/button_refresh.rb +0 -1
  13. data/lib/ui_bibz/ui/core/forms/choices/checkbox_field.rb +7 -1
  14. data/lib/ui_bibz/ui/core/forms/choices/radio_field.rb +7 -1
  15. data/lib/ui_bibz/ui/core/forms/choices/switch_field.rb +4 -0
  16. data/lib/ui_bibz/ui/core/forms/dropdowns/dropdown.rb +6 -6
  17. data/lib/ui_bibz/ui/core/forms/dropdowns/split_dropdown.rb +1 -1
  18. data/lib/ui_bibz/ui/core/forms/numbers/formula_field.rb +2 -0
  19. data/lib/ui_bibz/ui/core/forms/numbers/range_field.rb +19 -1
  20. data/lib/ui_bibz/ui/core/forms/numbers/slider_field.rb +13 -1
  21. data/lib/ui_bibz/ui/core/forms/numbers/slider_header.rb +2 -2
  22. data/lib/ui_bibz/ui/core/forms/selects/dropdown_select_field.rb +29 -5
  23. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button.rb +1 -9
  24. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button_link.rb +1 -9
  25. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_dropdown.rb +5 -4
  26. data/lib/ui_bibz/ui/core/forms/surrounds/surround_field.rb +3 -8
  27. data/lib/ui_bibz/ui/core/icons/glyph.rb +9 -1
  28. data/lib/ui_bibz/ui/core/navigations/components/nav_dropdown.rb +1 -1
  29. data/lib/ui_bibz/ui/core/navigations/components/nav_link_link.rb +1 -1
  30. data/lib/ui_bibz/ui/core/navigations/nav.rb +3 -3
  31. data/lib/ui_bibz/ui/core/navigations/navbar.rb +6 -4
  32. data/lib/ui_bibz/ui/core/navigations/tab_group.rb +5 -1
  33. data/lib/ui_bibz/ui/core/notifications/components/toast_header.rb +15 -1
  34. data/lib/ui_bibz/ui/core/windows/modal.rb +6 -2
  35. data/lib/ui_bibz/ui/extensions/core/component/glyph_extension.rb +11 -24
  36. data/lib/ui_bibz/ui/extensions/core/component/popover_extension.rb +1 -1
  37. data/lib/ui_bibz/ui/extensions/core/forms/surround_extension.rb +1 -1
  38. data/lib/ui_bibz/ui/ux/containers/components/panel_header.rb +3 -2
  39. data/lib/ui_bibz/ui/ux/containers/components/panel_header_title.rb +47 -0
  40. data/lib/ui_bibz/ui/ux/tables/table_pagination_per_page.rb +3 -3
  41. data/lib/ui_bibz/ui/ux/tables/table_search_field.rb +4 -4
  42. data/lib/ui_bibz/utils/breakdown_class_name_generator.rb +14 -6
  43. data/lib/ui_bibz/utils/internationalization.rb +1 -1
  44. data/test/simple_form_test.rb +4 -4
  45. data/test/ui/core/boxes/card_test.rb +2 -2
  46. data/test/ui/core/component_test.rb +2 -2
  47. data/test/ui/core/forms/buttons/button_group_test.rb +1 -1
  48. data/test/ui/core/forms/buttons/button_link_test.rb +1 -8
  49. data/test/ui/core/forms/buttons/button_refresh_test.rb +1 -1
  50. data/test/ui/core/forms/buttons/button_test.rb +2 -9
  51. data/test/ui/core/forms/choices/checkbox_field_test.rb +2 -2
  52. data/test/ui/core/forms/choices/choice_group_test.rb +3 -3
  53. data/test/ui/core/forms/choices/radio_field_test.rb +1 -1
  54. data/test/ui/core/forms/dropdowns/dropdown_test.rb +2 -2
  55. data/test/ui/core/forms/numbers/range_field_test.rb +14 -0
  56. data/test/ui/core/forms/numbers/slider_field_test.rb +2 -2
  57. data/test/ui/core/forms/selects/multi_select_field_test.rb +3 -3
  58. data/test/ui/core/forms/selects/select_field_test.rb +1 -1
  59. data/test/ui/core/forms/surrounds/surround_field_test.rb +27 -3
  60. data/test/ui/core/forms/texts/auto_complete_field_test.rb +2 -2
  61. data/test/ui/core/navigations/breadcrumb_test.rb +1 -1
  62. data/test/ui/core/navigations/link_test.rb +1 -1
  63. data/test/ui/core/navigations/nav_test.rb +2 -2
  64. data/test/ui/core/navigations/navbar_test.rb +2 -4
  65. data/test/ui/core/navigations/tab_group_test.rb +5 -5
  66. data/test/ui/core/notifications/alert_test.rb +1 -1
  67. data/test/ui/core/notifications/badge_test.rb +2 -2
  68. data/test/ui/utils/breakdown_class_name_generator_test.rb +14 -0
  69. data/test/ui/ux/containers/panel_test.rb +1 -1
  70. data/test/ui/ux/tables/table_test.rb +2 -2
  71. data/ui_bibz.gemspec +1 -1
  72. metadata +7 -6
@@ -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
@@ -60,7 +60,7 @@ module UiBibz::Ui::Core::Navigations
60
60
  end
61
61
 
62
62
  def link_html
63
- content_tag :a, 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
@@ -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
@@ -31,6 +31,8 @@ module UiBibz::Ui::Core::Navigations
31
31
  # * +title+ - String
32
32
  # * +container+ - Hash container options
33
33
  # * +container_html+ - Hash container html options
34
+ # * +expand_size+ - Symbol size
35
+ # (+:sm+, +:md+, +:lg+, +:xl+, +:xxl+)
34
36
  #
35
37
  # ==== Signatures
36
38
  #
@@ -132,11 +134,11 @@ module UiBibz::Ui::Core::Navigations
132
134
  end
133
135
 
134
136
  def navbar_toggle_html(content = nil, &block)
135
- @navbar_toggle_html = if !block.nil?
137
+ @navbar_toggle_html = if block.nil?
138
+ content
139
+ else
136
140
  context = eval('self', block.binding) # rubocop:disable Style/EvalWithLocation
137
141
  context.capture(&block)
138
- else
139
- content
140
142
  end
141
143
  end
142
144
 
@@ -165,7 +167,7 @@ module UiBibz::Ui::Core::Navigations
165
167
  end
166
168
 
167
169
  def expand_size
168
- "navbar-expand-#{@options[:expand_size] || :lg}" # unless @options[:expand_size].nil?
170
+ "navbar-expand-#{@options[:expand_size] || :lg}" unless options[:collapsible] == false
169
171
  end
170
172
 
171
173
  def position
@@ -67,7 +67,7 @@ module UiBibz::Ui::Core::Navigations
67
67
  # Add nav link items
68
68
  # See UiBibz::Ui::Core::Navigations::NavLink
69
69
  def tab(content = nil, options = {}, html_options = nil, &block)
70
- if block_given?
70
+ if block
71
71
  content[:nav_type] = type
72
72
  content[:tag_type] = @options[:tag_type]
73
73
  else
@@ -83,6 +83,10 @@ module UiBibz::Ui::Core::Navigations
83
83
  ['nav', 'nav-tabs', position, justify, fill]
84
84
  end
85
85
 
86
+ def component_html_options
87
+ { role: 'tablist' }
88
+ end
89
+
86
90
  def type
87
91
  'nav-tabs'
88
92
  end
@@ -31,12 +31,13 @@ module UiBibz::Ui::Core::Notifications::Components
31
31
  # end.render
32
32
  #
33
33
  class ToastHeader < UiBibz::Ui::Core::Component
34
+ include Webpacker::Helper if defined?(Webpacker)
34
35
  # See UiBibz::Ui::Core::Component.initialize
35
36
 
36
37
  def pre_render
37
38
  content_tag :div, html_options do
38
39
  concat UiBibz::Ui::Core::Icons::Glyph.new(options[:glyph], class: 'mr-2').render unless options[:glyph].nil?
39
- concat image_tag(options[:img], class: 'rounded mr-2') unless options[:img].nil?
40
+ concat image unless options[:image].nil?
40
41
  concat content_tag(:strong, content, class: 'mr-auto')
41
42
  concat content_tag(:small, options[:time], class: 'text-muted') unless options[:time].nil?
42
43
  concat close_button
@@ -45,6 +46,19 @@ module UiBibz::Ui::Core::Notifications::Components
45
46
 
46
47
  private
47
48
 
49
+ def image
50
+ if options[:image].is_a?(String)
51
+ image_tag(options[:image], class: 'rounded mr-2', alt: sanitize_text(options[:image])) unless options[:image].nil?
52
+ else
53
+ options[:image][:class] = UiBibz::Utils::Screwdriver.join_classes(options[:image][:class], 'rounded mr-2')
54
+ if options[:image].delete(:pack)
55
+ image_pack_tag(options[:image].delete(:href), **options[:image])
56
+ else
57
+ image_tag(options[:image].delete(:href), **options[:image])
58
+ end
59
+ end
60
+ end
61
+
48
62
  def close_button
49
63
  content_tag :button, '', class: 'ml-2 mb-1 btn-close', "data-dismiss": 'toast', "aria-label": 'Close'
50
64
  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 size
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,26 @@
3
3
  module GlyphExtension
4
4
  # Render glyph and content html
5
5
  def glyph_and_content_html(content_html = nil)
6
- [glyph_with_space, ct_html(content_html)].compact.join(' ').html_safe
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 glyph
23
- options[:content] = content if options[:text] == false
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
- when String
13
+ elsif options[:glyph]
29
14
  { name: options[:glyph] }
30
15
  else
31
16
  {}
32
17
  end
33
18
 
34
- glyph_options[:text] = options[:text] unless options[:text].nil?
35
- glyph_options[:content] = options[:content] unless options[:content].nil?
36
- glyph_options[:shortcut] = options[:shortcut] unless options[:shortcut].nil?
37
- glyph_options[:html_options] = options[:html_options] unless options[:html_options].nil?
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
+ end
38
24
 
39
- UiBibz::Utils::GlyphChanger.new(glyph_options[:name], glyph_options).render unless glyph_options[:name].nil?
25
+ # UiBibz::Utils::GlyphChanger.new(glyph_options[:name], glyph_options).render unless glyph_options[:name].nil?
26
+ UiBibz::Ui::Core::Icons::Glyph.new(glyph_options[:name], glyph_options).render if glyph_options[:name].present?
40
27
  end
41
28
  end
@@ -28,7 +28,7 @@ module PopoverExtension
28
28
  TOOLTIP_METHODS.each { |mth| add_html_data(mth, value: options[:tooltip].try(:[], mth)) unless options[:tooltip].try(:[], mth).nil? }
29
29
  add_html_data :placement, value: options[:tooltip].try(:[], :position) unless options[:tooltip].try(:[], :position).nil?
30
30
  else
31
- add_html_data :title, value: options[:tooltip]
31
+ add_html_data :title, value: options[:tooltip] == true ? sanitize_text(content) : options[:tooltip]
32
32
  end
33
33
  end
34
34
  end
@@ -7,7 +7,7 @@ module SurroundExtension
7
7
  private
8
8
 
9
9
  def surrounded?
10
- !options[:append].nil? || !options[:prepend].nil? || !options[:refresh].nil? || !options[:surrounded].nil?
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(text)
46
- @content = content_tag :div, text, class: 'panel-title'
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] != false
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] != false
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
@@ -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) if kl.empty? || @options.key?('num')
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
- @position = opts[:position]
35
- opts.map do |k, v|
36
- send(k, size, v) if POSITIONING.include?(k.to_sym)
37
- end.compact.join(' ')
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