ui_bibz 3.0.0.alpha3 → 3.0.0.alpha10

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.
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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 66b83873c408d7f000b851a81c55c3ccc16133cd1e9737902fa80437fd213bf6
4
- data.tar.gz: fdf60c814dae76c0f7e158469120911e984c9453814c28cbabfaed75329ef405
3
+ metadata.gz: 63c95abb3d6e510f893aaa054080dc4e4b3012fd0a071cd0828a8d2333a0d20d
4
+ data.tar.gz: 5c13dccaeea9254bd66d0c0a778b3ee18764973438a0668b74f9a56b9b093f10
5
5
  SHA512:
6
- metadata.gz: 96d77724b67f8c30b7a15ae47a9fa25eb3d45e4ba97b8f4116c45e18ece64d97fc45f9a8168b6c8df81de47fa8c3047efdd44e985b75cc1f0ef10676f477792e
7
- data.tar.gz: 43b3745ed55353ed63c5bb122de4ab1da826da54c649e13b653f1e102e7869e933072851aa8c2b96d97a469a7b68d7ef46c4e2c11524e55ff5b673c807068d9a
6
+ metadata.gz: a138d91759572dec4f047dd5fb7dacd4ea517fffefaca70e73c92aba4fc96a1e799c4e11c8c4ad9420f19e6d9ca0d32a714a9d4ced4ddacac0e8c3368ccafe8c
7
+ data.tar.gz: 380361211a36fbf4cccfff82512233dcd05e84f20949bdf28e5808a53ea16626a1fafd5e8c020d8130307e3ecc3937e0c1e375ac5d91d58acf07cb0d66baaf4b
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ui_bibz (3.0.0.alpha3)
4
+ ui_bibz (3.0.0.alpha10)
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,21 +159,21 @@ 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)
175
- rubocop-performance (1.8.1)
176
- rubocop (>= 0.87.0)
175
+ rubocop-performance (1.9.0)
176
+ rubocop (>= 0.90.0, < 2.0)
177
177
  rubocop-ast (>= 0.4.0)
178
178
  rubocop-rails (2.8.1)
179
179
  activesupport (>= 4.2.0)
@@ -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,11 @@ 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/)
26
+
27
+
28
+ ## Donate
29
+ ![Liberapay](https://img.shields.io/liberapay/patrons/Thomas.svg?logo=liberapay)
@@ -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
10
  FONTAWESOME_VERSION = '5.15.1'
11
- HOMEPAGE = 'http://thooams.github.io/Ui-Bibz/'
11
+ HOMEPAGE = 'https://hummel.link/ui-bibz/'
12
12
  REPO = 'git+https://github.com/thooams/Ui-Bibz.git'
13
13
  EMAIL = 'thomas@hummel.link'
14
- AUTHOR = 'Thooams'
15
- VERSION = '3.0.0.alpha3'
14
+ AUTHOR = 'Thooams [Thomas HUMMEL]'
15
+ VERSION = '3.0.0.alpha10'
16
16
  AUTHORS = ['Thooams'].freeze
17
17
  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,7 +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] = @builder.options[:html][:id]
8
+ input_html_options[:id] = "#{sanitize_to_id(input_attribute_name)}_slider"
9
9
  UiBibz::Ui::Core::Forms::Numbers::SliderField.new(input_attribute_name, options, input_html_options).render
10
10
  end
11
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
@@ -63,7 +62,7 @@ module UiBibz::Ui::Core::Forms::Buttons
63
62
  def button_link_html_tag
64
63
  link_to link_url, 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
@@ -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,36 +107,36 @@ 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
110
- glyph_and_content_html(options[:text].nil? ? @content : '').html_safe
114
+ glyph_and_content_html(@content)
111
115
  end
112
116
 
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