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.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +9 -9
  3. data/README.md +1 -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 +3 -3
  7. data/lib/ui_bibz/inputs/ui_bibz_inputs/base_input.rb +4 -3
  8. data/lib/ui_bibz/inputs/ui_bibz_inputs/ui_checkbox_field_input.rb +5 -1
  9. data/lib/ui_bibz/inputs/ui_bibz_inputs/ui_multi_select_field_input.rb +3 -3
  10. data/lib/ui_bibz/inputs/ui_bibz_inputs/ui_slider_field_input.rb +1 -0
  11. data/lib/ui_bibz/rails/engine.rb +0 -4
  12. data/lib/ui_bibz/ui/concerns/card_itemable_concern.rb +2 -0
  13. data/lib/ui_bibz/ui/concerns/html_concern.rb +3 -3
  14. data/lib/ui_bibz/ui/core/boxes/components/card_body.rb +8 -0
  15. data/lib/ui_bibz/ui/core/boxes/components/card_image.rb +6 -2
  16. data/lib/ui_bibz/ui/core/forms/buttons/button.rb +3 -12
  17. data/lib/ui_bibz/ui/core/forms/buttons/button_link.rb +0 -1
  18. data/lib/ui_bibz/ui/core/forms/buttons/button_refresh.rb +0 -1
  19. data/lib/ui_bibz/ui/core/forms/choices/checkbox_field.rb +13 -4
  20. data/lib/ui_bibz/ui/core/forms/choices/radio_field.rb +7 -1
  21. data/lib/ui_bibz/ui/core/forms/choices/switch_field.rb +4 -0
  22. data/lib/ui_bibz/ui/core/forms/dropdowns/dropdown.rb +12 -8
  23. data/lib/ui_bibz/ui/core/forms/dropdowns/split_dropdown.rb +7 -2
  24. data/lib/ui_bibz/ui/core/forms/numbers/formula_field.rb +2 -0
  25. data/lib/ui_bibz/ui/core/forms/numbers/range_field.rb +19 -1
  26. data/lib/ui_bibz/ui/core/forms/numbers/slider_field.rb +14 -2
  27. data/lib/ui_bibz/ui/core/forms/numbers/slider_header.rb +3 -3
  28. data/lib/ui_bibz/ui/core/forms/selects/dropdown_select_field.rb +41 -59
  29. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button.rb +1 -3
  30. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button_link.rb +1 -3
  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 +1 -1
  36. data/lib/ui_bibz/ui/core/navigations/navbar.rb +6 -4
  37. data/lib/ui_bibz/ui/core/navigations/tab_group.rb +4 -0
  38. data/lib/ui_bibz/ui/core/windows/modal.rb +6 -2
  39. data/lib/ui_bibz/ui/extensions/core/component/glyph_extension.rb +12 -24
  40. data/lib/ui_bibz/ui/extensions/core/forms/surround_extension.rb +1 -1
  41. data/lib/ui_bibz/ui/ux/containers/components/panel_header.rb +3 -2
  42. data/lib/ui_bibz/ui/ux/containers/components/panel_header_title.rb +47 -0
  43. data/lib/ui_bibz/ui/ux/tables/table_pagination_per_page.rb +3 -3
  44. data/lib/ui_bibz/ui/ux/tables/table_search_field.rb +4 -4
  45. data/lib/ui_bibz/utils/breakdown_class_name_generator.rb +20 -7
  46. data/lib/ui_bibz/utils/internationalization.rb +1 -1
  47. data/test/simple_form_test.rb +6 -28
  48. data/test/ui/core/boxes/card_test.rb +2 -2
  49. data/test/ui/core/component_test.rb +2 -2
  50. data/test/ui/core/forms/buttons/button_group_test.rb +2 -2
  51. data/test/ui/core/forms/buttons/button_link_test.rb +1 -8
  52. data/test/ui/core/forms/buttons/button_refresh_test.rb +1 -1
  53. data/test/ui/core/forms/buttons/button_test.rb +2 -9
  54. data/test/ui/core/forms/choices/checkbox_field_test.rb +8 -1
  55. data/test/ui/core/forms/choices/choice_group_test.rb +3 -3
  56. data/test/ui/core/forms/choices/radio_field_test.rb +1 -1
  57. data/test/ui/core/forms/dropdowns/dropdown_test.rb +2 -2
  58. data/test/ui/core/forms/numbers/range_field_test.rb +14 -0
  59. data/test/ui/core/forms/numbers/slider_field_test.rb +2 -2
  60. data/test/ui/core/forms/selects/multi_select_field_test.rb +6 -6
  61. data/test/ui/core/forms/selects/select_field_test.rb +1 -1
  62. data/test/ui/core/forms/surrounds/surround_field_test.rb +27 -3
  63. data/test/ui/core/forms/texts/auto_complete_field_test.rb +2 -2
  64. data/test/ui/core/navigations/breadcrumb_test.rb +1 -1
  65. data/test/ui/core/navigations/link_test.rb +1 -1
  66. data/test/ui/core/navigations/nav_test.rb +7 -6
  67. data/test/ui/core/navigations/navbar_test.rb +5 -6
  68. data/test/ui/core/navigations/tab_group_test.rb +5 -5
  69. data/test/ui/core/notifications/alert_test.rb +1 -1
  70. data/test/ui/core/notifications/badge_test.rb +2 -2
  71. data/test/ui/utils/breakdown_class_name_generator_test.rb +14 -0
  72. data/test/ui/ux/containers/panel_test.rb +1 -1
  73. data/test/ui/ux/tables/table_test.rb +2 -2
  74. metadata +5 -8
  75. data/lib/ui_bibz/ui/core/forms/selects/multi_select_field.rb +0 -122
  76. data/package.json +0 -5
  77. data/test/ui/core/forms/selects/dropdown_select_field_test.rb +0 -84
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d00b806f9b9500786f247d6bc2f3829dd1b5d7032cbcce9f22671b99e84d99d8
4
- data.tar.gz: ebd9c2c6b8c6294aa81ff2e55ad93214504c4c879836fb1364b905aa4a0d9ce3
3
+ metadata.gz: e609add47b874d22474ad98a691fb0511ac6b1704309355079a369ae7141a2ac
4
+ data.tar.gz: c202dad217807b43e0857d17de0fe98d6df0ee9e26b20d74c9d33244fae1ab01
5
5
  SHA512:
6
- metadata.gz: adbbac93cfcae848b630824d23de5a820886258d24d553f7dc7baebbb39393c44a9795dd3c7f638d2fe92b05ec51b60f5d4c8255b63db73d90781fdc4451d804
7
- data.tar.gz: 660b4394a6ab29f5e51223b5fe131518713d9148f5c4c23a04383e660ec7bf630eb46ac43fe30ee5e59cbe45419b87d28951c898e33394e6ab486ea2f0bb58d0
6
+ metadata.gz: c57825fadad8a281d4891732ee10a91fc2d7eef81ca51060c9cecba484658b7132cebf1969b796e1ce49698bd50039c037f78782741fe8226083799a908c1720
7
+ data.tar.gz: d2ff37b288db8a88b8797f22af6f87b43c2f76fe2bcfe0c39bc14d01e582b7a9aacd908a32bf98cd8ee35e6e5df13c32689d1ecd2b669949c6f66338ea3dc5c8
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ui_bibz (3.0.0.alpha2)
4
+ ui_bibz (3.0.0.alpha9)
5
5
  rails (~> 6.0.3, >= 6.0.3.2)
6
6
  will-paginate-i18n
7
7
  will_paginate (~> 3.1.0)
@@ -75,7 +75,7 @@ GEM
75
75
  concurrent-ruby (1.1.7)
76
76
  crass (1.0.6)
77
77
  docile (1.3.2)
78
- erubi (1.9.0)
78
+ erubi (1.10.0)
79
79
  erubis (2.7.0)
80
80
  factory_bot (4.11.1)
81
81
  activesupport (>= 3.0.0)
@@ -123,7 +123,7 @@ GEM
123
123
  overcommit (0.57.0)
124
124
  childprocess (>= 0.6.3, < 5)
125
125
  iniparse (~> 1.4)
126
- parallel (1.19.2)
126
+ parallel (1.20.0)
127
127
  parser (2.7.2.0)
128
128
  ast (~> 2.4.1)
129
129
  rack (2.2.3)
@@ -159,16 +159,16 @@ GEM
159
159
  rake (13.0.1)
160
160
  regexp_parser (1.8.2)
161
161
  rexml (3.2.4)
162
- rubocop (0.93.1)
162
+ rubocop (1.3.1)
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.6.0)
168
+ rubocop-ast (>= 1.1.1)
169
169
  ruby-progressbar (~> 1.7)
170
170
  unicode-display_width (>= 1.4.0, < 2.0)
171
- rubocop-ast (0.8.0)
171
+ rubocop-ast (1.1.1)
172
172
  parser (>= 2.7.1.5)
173
173
  rubocop-minitest (0.10.1)
174
174
  rubocop (>= 0.87)
@@ -186,7 +186,7 @@ GEM
186
186
  simple_form (5.0.3)
187
187
  actionpack (>= 5.0)
188
188
  activemodel (>= 5.0)
189
- simplecov (0.19.0)
189
+ simplecov (0.19.1)
190
190
  docile (~> 1.1)
191
191
  simplecov-html (~> 0.11)
192
192
  simplecov-html (0.12.3)
@@ -202,7 +202,7 @@ GEM
202
202
  thor (1.0.1)
203
203
  thread_safe (0.3.6)
204
204
  tilt (2.0.10)
205
- tzinfo (1.2.7)
205
+ tzinfo (1.2.8)
206
206
  thread_safe (~> 0.1)
207
207
  unicode-display_width (1.7.0)
208
208
  websocket-driver (0.7.3)
@@ -212,7 +212,7 @@ GEM
212
212
  will_paginate (3.1.8)
213
213
  will_paginate-bootstrap4 (0.2.2)
214
214
  will_paginate (~> 3.0, >= 3.0.0)
215
- zeitwerk (2.4.0)
215
+ zeitwerk (2.4.1)
216
216
 
217
217
  PLATFORMS
218
218
  ruby
data/README.md CHANGED
@@ -19,7 +19,7 @@ Ui Bibz load [Bootstrap](http://getbootstrap.com/) and [Font Awesome](http://fon
19
19
 
20
20
  ## Documentation
21
21
  Full documentation is here with bootstrap 5:
22
- [Ui Bibz v3](http://hummel.link/Ui-Bibz/docs/v3/)
22
+ [Ui Bibz v3](http://hummel.link/Ui-Bibz/)
23
23
 
24
24
  Older documentation is here with bootstrap 4:
25
25
  [Ui Bibz v2.5](http://hummel.link/Ui-Bibz/docs/v2.5/)
@@ -24,7 +24,6 @@ module UiBibzInputs
24
24
  autoload :UiFormulaFieldInput, 'ui_bibz/inputs/ui_bibz_inputs/ui_formula_field_input'
25
25
  autoload :UiMarkdownEditorFieldInput, 'ui_bibz/inputs/ui_bibz_inputs/ui_markdown_editor_field_input'
26
26
  autoload :UiMultiColumnFieldInput, 'ui_bibz/inputs/ui_bibz_inputs/ui_multi_column_field_input'
27
- autoload :UiMultiSelectFieldInput, 'ui_bibz/inputs/ui_bibz_inputs/ui_multi_select_field_input'
28
27
  autoload :UiNumberFieldInput, 'ui_bibz/inputs/ui_bibz_inputs/ui_number_field_input'
29
28
  autoload :UiRadioFieldInput, 'ui_bibz/inputs/ui_bibz_inputs/ui_radio_field_input'
30
29
  autoload :UiSelectFieldInput, 'ui_bibz/inputs/ui_bibz_inputs/ui_select_field_input'
@@ -62,7 +62,8 @@ module UiBibz::Helpers::Ui::Core::FormsHelper
62
62
  # +options+ (Hash)
63
63
  # +html_options+ (Hash)
64
64
  def ui_multi_select_field(content = nil, options = nil, html_options = nil, &block)
65
- UiBibz::Ui::Core::Forms::Selects::MultiSelectField.new(content, options, html_options, &block).render
65
+ options = (options || {}).merge(multiple: true)
66
+ UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new(content, options, html_options, &block).render
66
67
  end
67
68
 
68
69
  # Formula Field Component
@@ -3,15 +3,15 @@
3
3
  module UiBibz
4
4
  NAME = 'Ui Bibz'
5
5
  SLUG = 'ui_bibz'
6
- BOOTSTRAP_VERSION = '5.0.0.alpha2'
6
+ BOOTSTRAP_VERSION = '5.0.0.alpha3'
7
7
  DESCRIPTION = "A Rails Interface Framework using Bootstrap #{BOOTSTRAP_VERSION}."
8
8
  SUMMARY = "Ui Bibz is an Ui Framework that allows you to build an interface very quickly and simply using Bootstrap #{BOOTSTRAP_VERSION}."
9
9
  LICENSE = 'MIT'
10
- FONTAWESOME_VERSION = '5.14.0'
10
+ FONTAWESOME_VERSION = '5.15.1'
11
11
  HOMEPAGE = 'http://thooams.github.io/Ui-Bibz/'
12
12
  REPO = 'git+https://github.com/thooams/Ui-Bibz.git'
13
13
  EMAIL = 'thomas@hummel.link'
14
14
  AUTHOR = 'Thooams'
15
- VERSION = '3.0.0.alpha2'
15
+ VERSION = '3.0.0.alpha9'
16
16
  AUTHORS = ['Thooams'].freeze
17
17
  end
@@ -11,9 +11,10 @@ module UiBibzInputs
11
11
  private
12
12
 
13
13
  def input_attribute_name
14
- new_attribute_name = @builder.lookup_model_names.first.to_s
15
- new_attribute_name += "[#{@builder.lookup_model_names.second}_attributes]" if @builder.lookup_model_names.second
16
- new_attribute_name + "[#{attribute_name}]"
14
+ # new_attribute_name = @builder.lookup_model_names.first.to_s
15
+ # new_attribute_name += "[#{@builder.lookup_model_names.second}_attributes]" if @builder.lookup_model_names.second
16
+ # new_attribute_name + "[#{attribute_name}]"
17
+ "#{@builder.object_name}[#{attribute_name}]"
17
18
  end
18
19
  end
19
20
  end
@@ -4,6 +4,10 @@ module UiBibzInputs
4
4
  class UiCheckboxFieldInput < BaseInput
5
5
  include UiBibz::Ui::Core::Forms::Choices
6
6
 
7
+ def label(_wrapper_options)
8
+ false
9
+ end
10
+
7
11
  def input(_wrapper_options)
8
12
  UiBibz::Ui::Core::Forms::Choices::CheckboxField.new(input_attribute_name, new_options, new_input_html_options).render
9
13
  end
@@ -17,7 +21,7 @@ module UiBibzInputs
17
21
  end
18
22
 
19
23
  def new_options
20
- options.merge({ label: attribute_name.to_s.titleize })
24
+ options.merge({ label: options[:label] || attribute_name.to_s.titleize })
21
25
  end
22
26
  end
23
27
  end
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UiBibzInputs
4
- class UiMultiSelectFieldInput < CollectionInput
5
- def input(_wrapper_options)
6
- UiBibz::Ui::Core::Forms::Selects::MultiSelectField.new(input_attribute_name, new_options, input_html_options).render
4
+ class UiMultiSelectFieldInput < UiDropdownSelectFieldInput
5
+ def new_options
6
+ (super || {}).merge(multiple: true)
7
7
  end
8
8
  end
9
9
  end
@@ -5,6 +5,7 @@ module UiBibzInputs
5
5
  include UiBibz::Ui::Core::Forms::Numbers
6
6
 
7
7
  def input(_wrapper_options)
8
+ input_html_options[:id] = "#{sanitize_to_id(input_attribute_name)}_slider"
8
9
  UiBibz::Ui::Core::Forms::Numbers::SliderField.new(input_attribute_name, options, input_html_options).render
9
10
  end
10
11
  end
@@ -21,10 +21,6 @@ module UiBibz
21
21
  initializer 'ui_bibz.helpers.form' do
22
22
  ActionView::Base.include UiBibzForm
23
23
  end
24
-
25
- config.after_initialize do
26
- warn '[Ui Bibz] Ui Bibz is not configured in the application and will use the default values. Use `rails generate ui_bibz:install` to generate the Ui Bibz configuration.' unless UiBibz.configured?
27
- end
28
24
  end
29
25
  end
30
26
  end
@@ -40,6 +40,8 @@ module UiBibz::Ui::Concerns::CardItemableConcern #:nodoc:
40
40
 
41
41
  # Add Image which is a component
42
42
  def image(content = nil, options = nil, html_options = nil, &block)
43
+ # Add position top to the image if the image is in top of the card
44
+ options = (options || {}).merge(position: :top) if @header.nil? && @items.empty? && options.try(:[], :position).nil?
43
45
  @items << UiBibz::Ui::Core::Boxes::Components::CardImage.new(content, options, html_options, &block).render
44
46
  end
45
47
 
@@ -5,11 +5,11 @@ module UiBibz::Ui::Concerns::HtmlConcern #:nodoc:
5
5
 
6
6
  included do
7
7
  def html(content = nil, &block)
8
- if !block.nil?
8
+ if block.nil?
9
+ @items << content
10
+ else
9
11
  context = eval('self', block.binding) # rubocop:disable Style/EvalWithLocation
10
12
  @items << context.capture(&block)
11
- else
12
- @items << content
13
13
  end
14
14
  end
15
15
  end
@@ -70,6 +70,14 @@ module UiBibz::Ui::Core::Boxes::Components
70
70
  @items << UiBibz::Ui::Core::Boxes::Components::Body::CardBodyText.new(content, options, html_options, &block).render
71
71
  end
72
72
 
73
+ def row(content = nil, options = nil, html_options = nil, &block)
74
+ @items << if tapped?(block)
75
+ UiBibz::Ui::Core::Layouts::Row.new(content, options, html_options).tap(&block).render
76
+ else
77
+ UiBibz::Ui::Core::Layouts::Row.new(content, options, html_options, &block).render
78
+ end
79
+ end
80
+
73
81
  private
74
82
 
75
83
  def component_html_classes
@@ -38,7 +38,11 @@ module UiBibz::Ui::Core::Boxes::Components
38
38
  # Render html tag
39
39
  def pre_render
40
40
  # image_tag content, html_options
41
- image_tag content, html_options
41
+ if options[:pack]
42
+ image_pack_tag content, html_options
43
+ else
44
+ image_tag content, html_options
45
+ end
42
46
  end
43
47
 
44
48
  private
@@ -48,7 +52,7 @@ module UiBibz::Ui::Core::Boxes::Components
48
52
  end
49
53
 
50
54
  def position
51
- "card-img-#{@options[:position] || :top}"
55
+ "card-img-#{@options[:position] || :top}" if @options[:position]
52
56
  end
53
57
  end
54
58
  end
@@ -16,12 +16,11 @@ 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+, +:link+)
19
+ # (+:primary+, +:secondary+, +:success+, :info+, +:warning+, +:danger+, +:light+, +:dark+)
20
20
  # * +size+
21
21
  # (+:xs+, +:sm+, +:lg+)
22
22
  # * +outline+ - Boolean
23
23
  # * +state+ - Symbol (+:active+, +:disabled)
24
- # * +type+ - Symbol (+:outline)
25
24
  # * +collapse+ - String
26
25
  # * +expand_collaspe+ - Boolean
27
26
  # * +glyph+ - Add glyph with name or hash options
@@ -63,13 +62,13 @@ module UiBibz::Ui::Core::Forms::Buttons
63
62
  def button_html_tag
64
63
  content_tag :button, html_options do
65
64
  concat spinner_html unless options[:spinner].nil?
66
- concat glyph_and_content_html(options[:text].nil? ? @content : '')
65
+ concat glyph_and_content_html(@content)
67
66
  concat badge_html unless options[:badge].nil?
68
67
  end
69
68
  end
70
69
 
71
70
  def component_html_classes
72
- super << ['btn', size, type, without_text]
71
+ super << ['btn', size]
73
72
  end
74
73
 
75
74
  def component_html_options
@@ -107,14 +106,6 @@ module UiBibz::Ui::Core::Forms::Buttons
107
106
  { 'aria-pressed' => true }
108
107
  end
109
108
 
110
- def type
111
- 'btn-block' if options[:type] == :block
112
- end
113
-
114
- def without_text
115
- 'without-text' unless options[:text].nil?
116
- end
117
-
118
109
  def action
119
110
  add_html_data('action', value: options[:action]) unless options[:action].nil?
120
111
  end
@@ -22,7 +22,6 @@ module UiBibz::Ui::Core::Forms::Buttons
22
22
  # * +url+ - String url
23
23
  # * +outline+ - Boolean
24
24
  # * +state+ - Symbol (+:active+, +:disabled)
25
- # * +type+ - Symbol (+:block)
26
25
  # * +glyph+ - Add glyph with name or hash options
27
26
  # * +name+ - String
28
27
  # * +size+ - Integer
@@ -20,7 +20,6 @@ module UiBibz::Ui::Core::Forms::Buttons
20
20
  # (+:xs+, +:sm+, +:lg+)
21
21
  # * +outline+ - Boolean
22
22
  # * +state+ - Symbol (+:active+, +:disabled)
23
- # * +type+ - Symbol (+:outline)
24
23
  # * +glyph+ - Add glyph with name or hash options
25
24
  # * +name+ - String
26
25
  # * +size+ - Integer
@@ -20,7 +20,8 @@ module UiBibz::Ui::Core::Forms::Choices
20
20
  # * +inline+ - Boolean
21
21
  # * +checked+ - Boolean
22
22
  # * +action+ - String Stimulus Option
23
- # * +label+ - String
23
+ # * +label+ - [String/Boolean]
24
+ # * +boolean+ - Boolean Add an hidden field for rails
24
25
  #
25
26
  # ==== Signatures
26
27
  #
@@ -58,7 +59,7 @@ module UiBibz::Ui::Core::Forms::Choices
58
59
 
59
60
  def checkbox_field_html_tag
60
61
  content_tag(:div, html_options.except(:id, 'data-action')) do
61
- concat hidden_field_tag content, '0', id: "#{content}-hidden"
62
+ concat hidden_field_tag content, '0', id: "#{content}-hidden" if options[:boolean]
62
63
  concat check_box_tag content, options[:value] || '1', options[:checked] || html_options[:checked], checkbox_html_options
63
64
  concat label_tag(label_name, label_content, class: 'form-check-label') if options[:label] != false
64
65
  end
@@ -69,8 +70,10 @@ module UiBibz::Ui::Core::Forms::Choices
69
70
  disabled: disabled?,
70
71
  indeterminate: options[:indeterminate],
71
72
  "data-action": options[:action],
72
- class: 'form-check-input'
73
- }
73
+ class: UiBibz::Utils::Screwdriver.join_classes('form-check-input', input_status)
74
+ }.tap do |html|
75
+ html[:id] = html_options[:id] if html_options[:id]
76
+ end
74
77
  end
75
78
 
76
79
  def label_name
@@ -92,6 +95,12 @@ module UiBibz::Ui::Core::Forms::Choices
92
95
  super << component_wrapper_html_classes
93
96
  end
94
97
 
98
+ def input_status
99
+ "form-check-input-#{options[:status]}" if options[:status]
100
+ end
101
+
102
+ def status; end
103
+
95
104
  def inline
96
105
  'form-check-inline' if options[:inline]
97
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
@@ -27,6 +27,10 @@ module UiBibz::Ui::Core::Forms::Dropdowns
27
27
  # * +size+ - Integer
28
28
  # * +type+ - Symbol
29
29
  # * +html_button+ - Hash
30
+ # * +position+ - Symbol
31
+ # (+:up+, +:right+, +:down+, +:left+)
32
+ # * +alignment+ - Symbol
33
+ # (+:right)
30
34
  #
31
35
  # ==== Signatures
32
36
  #
@@ -103,7 +107,7 @@ module UiBibz::Ui::Core::Forms::Dropdowns
103
107
  protected
104
108
 
105
109
  def component_html_classes
106
- [type, open, inline, without_caret, keep_open]
110
+ [position, open, inline, without_caret, keep_open]
107
111
  end
108
112
 
109
113
  def button_content
@@ -113,26 +117,26 @@ module UiBibz::Ui::Core::Forms::Dropdowns
113
117
  def button_html
114
118
  html_button = options[:html_button] || {}
115
119
  if options[:tag] == :a
116
- content_tag dropdown_tag, button_content, { class: join_classes('btn', button_status, state, size, 'dropdown-toggle'), href: '#', role: 'button', 'data-toggle' => 'dropdown', 'aria-haspopup' => true, 'aria-expanded' => false, 'id' => id }.merge(html_button)
120
+ content_tag dropdown_tag, button_content, { class: join_classes('btn', button_status, state, size, 'dropdown-toggle'), role: 'button', 'data-toggle' => 'dropdown', 'aria-haspopup' => true, 'aria-expanded' => false, 'id' => id }.merge(html_button)
117
121
  else
118
122
  content_tag dropdown_tag, button_content, { class: join_classes('btn', button_status, state, size, 'dropdown-toggle'), type: 'button', 'data-toggle' => 'dropdown', 'aria-haspopup' => true, 'aria-expanded' => false, 'id' => id }.merge(html_button)
119
123
  end
120
124
  end
121
125
 
122
126
  def ul_html
123
- content_tag :div, @items.join.html_safe, class: join_classes('dropdown-menu', theme, position, open), 'arial-labelledby' => id
127
+ content_tag :div, @items.join.html_safe, class: join_classes('dropdown-menu', theme, alignment, open), 'arial-labelledby' => id
124
128
  end
125
129
 
126
130
  def dropdown_tag
127
131
  options[:tag] || :button
128
132
  end
129
133
 
130
- def position
131
- "dropdown-menu-#{@options[:position]}" unless @options[:position].nil?
134
+ def alignment
135
+ "dropdown-menu-#{@options[:alignment]}" unless @options[:alignment].nil?
132
136
  end
133
137
 
134
- def type
135
- @options[:type] || 'dropdown'
138
+ def position
139
+ "drop#{@options[:position] || 'down'}"
136
140
  end
137
141
 
138
142
  def open
@@ -144,7 +148,7 @@ module UiBibz::Ui::Core::Forms::Dropdowns
144
148
  end
145
149
 
146
150
  def inline
147
- 'btn-group' if @options[:inline]
151
+ 'btn-group' if @options[:inline] || @options[:alignment]
148
152
  end
149
153
 
150
154
  def without_caret