ui_bibz 3.0.0.beta13 → 3.0.0.beta18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +1 -1
  3. data/.rubocop.yml +0 -1
  4. data/.ruby-version +1 -1
  5. data/Gemfile.lock +75 -75
  6. data/lib/ui_bibz.rb +2 -0
  7. data/lib/ui_bibz/concerns/models/searchable.rb +9 -7
  8. data/lib/ui_bibz/infos.rb +3 -3
  9. data/lib/ui_bibz/inputs/ui_bibz_form/ui_bibz_form_builder.rb +9 -12
  10. data/lib/ui_bibz/inputs/ui_bibz_inputs/collection_input.rb +6 -8
  11. data/lib/ui_bibz/rails/engine.rb +2 -2
  12. data/lib/ui_bibz/ui/concerns/navigation_concern.rb +12 -0
  13. data/lib/ui_bibz/ui/concerns/notification_concern.rb +13 -0
  14. data/lib/ui_bibz/ui/core/boxes/card.rb +1 -1
  15. data/lib/ui_bibz/ui/core/component.rb +5 -1
  16. data/lib/ui_bibz/ui/core/forms/choices/choice_group.rb +1 -1
  17. data/lib/ui_bibz/ui/core/forms/choices/components/choice.rb +8 -4
  18. data/lib/ui_bibz/ui/core/forms/numbers/formula_field.rb +1 -1
  19. data/lib/ui_bibz/ui/core/forms/selects/dropdown_select_field.rb +11 -0
  20. data/lib/ui_bibz/ui/core/navigations/nav.rb +1 -5
  21. data/lib/ui_bibz/ui/core/navigations/navbar.rb +1 -5
  22. data/lib/ui_bibz/ui/core/notifications/popover.rb +2 -6
  23. data/lib/ui_bibz/ui/core/notifications/toast.rb +32 -2
  24. data/lib/ui_bibz/ui/core/notifications/tooltip.rb +2 -6
  25. data/lib/ui_bibz/ui/ux/tables/components/actions.rb +1 -1
  26. data/lib/ui_bibz/ui/ux/tables/components/store.rb +3 -0
  27. data/lib/ui_bibz/ui/ux/tables/extensions/paginable.rb +0 -3
  28. data/lib/ui_bibz/ui/ux/tables/table_pagination.rb +0 -3
  29. data/lib/ui_bibz/ui/ux/tables/table_pagination_per_page.rb +0 -3
  30. data/lib/ui_bibz/ui/ux/tables/table_search_field.rb +1 -0
  31. data/lib/ui_bibz/utils/breakdown_class_name_generator.rb +2 -2
  32. data/lib/ui_bibz/utils/screwdriver.rb +1 -1
  33. data/test/simple_form_test.rb +36 -27
  34. data/test/ui/core/forms/choices/checkbox_field_test.rb +7 -0
  35. data/test/ui/core/forms/selects/{multi_select_field_test.rb → dropdown_select_field_test.rb} +5 -5
  36. data/test/ui/core/notifications/toast_test.rb +2 -2
  37. data/ui_bibz.gemspec +2 -1
  38. metadata +24 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c8e9f704fae6975451f3f51f700ee7df8e880045c95b686065e2992b9ed027ea
4
- data.tar.gz: 6ae209045ca11867361a63347150cf8435984976f00026b89c556fcf2dea5674
3
+ metadata.gz: 710b0c4a072a6505597eb6f7b2c92685eb6e545e470ba72bec6838b0f6acc4f6
4
+ data.tar.gz: 1c3e4c48723812182a347d8cbe2ef85053fbc72c1f36c07853025212e16f0353
5
5
  SHA512:
6
- metadata.gz: d387972cb0c0b4a0d4d8768782e92608876e0c90fb16a1f3895c5b130707df80901317440b5e69cfaecefebc691d03a614935d595bbcf8246664340d564923df
7
- data.tar.gz: 5786310071a16944f8a45d3c0bb0e282cd21c151fd8513d45a8d31b5e43892e44113e8f2800a326e528b6f424b73db8952b27c508cc6ffca1e1ea063b4591027
6
+ metadata.gz: da63293c5b8bd94bd2a4797aef3d3b94ae360c2f796730f23bee60fc55c645dad59dd5ec09f22c9251a1ff2cce6c7ccc345e6e9ed82c5b63e7832cfb485fa446
7
+ data.tar.gz: 0e7d6f80d5d85506c04c8123fd5b94143a6c96f58ba39a90feacb1ed3ec765330c846a7f810af7ea6a8917ec4c92cbb1a448e552ef29a1b638889b2bb126981a
@@ -23,6 +23,6 @@ jobs:
23
23
  - name: Test with Rake
24
24
  uses: paambaati/codeclimate-action@v2.7.5
25
25
  env:
26
- CC_TEST_REPORTER_ID: 7e50558afc7a861280e3194a765a159e9ea5bdd22d2ebe6c13e5e23fe914c66b
26
+ CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
27
27
  with:
28
28
  coverageCommand: bundle exec rake
data/.rubocop.yml CHANGED
@@ -8,7 +8,6 @@ Layout/LineLength:
8
8
  Enabled: false
9
9
 
10
10
  AllCops:
11
- TargetRubyVersion: 2.7
12
11
  NewCops: enable
13
12
 
14
13
  Lint/UselessAssignment:
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.7.1
1
+ ruby-3.0.1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ui_bibz (3.0.0.beta13)
4
+ ui_bibz (3.0.0.beta18)
5
5
  will-paginate-i18n
6
6
  will_paginate (~> 3.3.0)
7
7
  will_paginate-bootstrap4
@@ -9,63 +9,63 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actioncable (6.0.3.5)
13
- actionpack (= 6.0.3.5)
12
+ actioncable (6.0.3.6)
13
+ actionpack (= 6.0.3.6)
14
14
  nio4r (~> 2.0)
15
15
  websocket-driver (>= 0.6.1)
16
- actionmailbox (6.0.3.5)
17
- actionpack (= 6.0.3.5)
18
- activejob (= 6.0.3.5)
19
- activerecord (= 6.0.3.5)
20
- activestorage (= 6.0.3.5)
21
- activesupport (= 6.0.3.5)
16
+ actionmailbox (6.0.3.6)
17
+ actionpack (= 6.0.3.6)
18
+ activejob (= 6.0.3.6)
19
+ activerecord (= 6.0.3.6)
20
+ activestorage (= 6.0.3.6)
21
+ activesupport (= 6.0.3.6)
22
22
  mail (>= 2.7.1)
23
- actionmailer (6.0.3.5)
24
- actionpack (= 6.0.3.5)
25
- actionview (= 6.0.3.5)
26
- activejob (= 6.0.3.5)
23
+ actionmailer (6.0.3.6)
24
+ actionpack (= 6.0.3.6)
25
+ actionview (= 6.0.3.6)
26
+ activejob (= 6.0.3.6)
27
27
  mail (~> 2.5, >= 2.5.4)
28
28
  rails-dom-testing (~> 2.0)
29
- actionpack (6.0.3.5)
30
- actionview (= 6.0.3.5)
31
- activesupport (= 6.0.3.5)
29
+ actionpack (6.0.3.6)
30
+ actionview (= 6.0.3.6)
31
+ activesupport (= 6.0.3.6)
32
32
  rack (~> 2.0, >= 2.0.8)
33
33
  rack-test (>= 0.6.3)
34
34
  rails-dom-testing (~> 2.0)
35
35
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
36
- actiontext (6.0.3.5)
37
- actionpack (= 6.0.3.5)
38
- activerecord (= 6.0.3.5)
39
- activestorage (= 6.0.3.5)
40
- activesupport (= 6.0.3.5)
36
+ actiontext (6.0.3.6)
37
+ actionpack (= 6.0.3.6)
38
+ activerecord (= 6.0.3.6)
39
+ activestorage (= 6.0.3.6)
40
+ activesupport (= 6.0.3.6)
41
41
  nokogiri (>= 1.8.5)
42
- actionview (6.0.3.5)
43
- activesupport (= 6.0.3.5)
42
+ actionview (6.0.3.6)
43
+ activesupport (= 6.0.3.6)
44
44
  builder (~> 3.1)
45
45
  erubi (~> 1.4)
46
46
  rails-dom-testing (~> 2.0)
47
47
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
48
- activejob (6.0.3.5)
49
- activesupport (= 6.0.3.5)
48
+ activejob (6.0.3.6)
49
+ activesupport (= 6.0.3.6)
50
50
  globalid (>= 0.3.6)
51
- activemodel (6.0.3.5)
52
- activesupport (= 6.0.3.5)
53
- activerecord (6.0.3.5)
54
- activemodel (= 6.0.3.5)
55
- activesupport (= 6.0.3.5)
56
- activestorage (6.0.3.5)
57
- actionpack (= 6.0.3.5)
58
- activejob (= 6.0.3.5)
59
- activerecord (= 6.0.3.5)
60
- marcel (~> 0.3.1)
61
- activesupport (6.0.3.5)
51
+ activemodel (6.0.3.6)
52
+ activesupport (= 6.0.3.6)
53
+ activerecord (6.0.3.6)
54
+ activemodel (= 6.0.3.6)
55
+ activesupport (= 6.0.3.6)
56
+ activestorage (6.0.3.6)
57
+ actionpack (= 6.0.3.6)
58
+ activejob (= 6.0.3.6)
59
+ activerecord (= 6.0.3.6)
60
+ marcel (~> 1.0.0)
61
+ activesupport (6.0.3.6)
62
62
  concurrent-ruby (~> 1.0, >= 1.0.2)
63
63
  i18n (>= 0.7, < 2)
64
64
  minitest (~> 5.1)
65
65
  tzinfo (~> 1.1)
66
66
  zeitwerk (~> 2.2, >= 2.2.2)
67
67
  ast (2.4.2)
68
- awesome_print (1.8.0)
68
+ awesome_print (1.9.2)
69
69
  builder (3.2.4)
70
70
  byebug (11.1.3)
71
71
  childprocess (4.0.0)
@@ -95,70 +95,68 @@ GEM
95
95
  haml (>= 4.0, < 6)
96
96
  nokogiri (>= 1.6.0)
97
97
  ruby_parser (~> 3.5)
98
- i18n (1.8.8)
98
+ i18n (1.8.10)
99
99
  concurrent-ruby (~> 1.0)
100
100
  iniparse (1.5.0)
101
101
  jquery-rails (4.4.0)
102
102
  rails-dom-testing (>= 1, < 3)
103
103
  railties (>= 4.2.0)
104
104
  thor (>= 0.14, < 2.0)
105
- loofah (2.9.0)
105
+ loofah (2.9.1)
106
106
  crass (~> 1.0.2)
107
107
  nokogiri (>= 1.5.9)
108
108
  mail (2.7.1)
109
109
  mini_mime (>= 0.1.1)
110
- marcel (0.3.3)
111
- mimemagic (~> 0.3.2)
110
+ marcel (1.0.1)
112
111
  method_source (1.0.0)
113
- mimemagic (0.3.5)
114
- mini_mime (1.0.2)
115
- mini_portile2 (2.5.0)
116
- minitest (5.14.3)
117
- nio4r (2.5.5)
118
- nokogiri (1.11.1)
112
+ mini_mime (1.1.0)
113
+ mini_portile2 (2.5.1)
114
+ minitest (5.14.4)
115
+ nio4r (2.5.7)
116
+ nokogiri (1.11.3)
119
117
  mini_portile2 (~> 2.5.0)
120
118
  racc (~> 1.4)
121
119
  overcommit (0.57.0)
122
120
  childprocess (>= 0.6.3, < 5)
123
121
  iniparse (~> 1.4)
124
122
  parallel (1.20.1)
125
- parser (3.0.0.0)
123
+ parser (3.0.1.1)
126
124
  ast (~> 2.4.1)
127
125
  racc (1.5.2)
128
126
  rack (2.2.3)
129
127
  rack-test (1.1.0)
130
128
  rack (>= 1.0, < 3)
131
- rails (6.0.3.5)
132
- actioncable (= 6.0.3.5)
133
- actionmailbox (= 6.0.3.5)
134
- actionmailer (= 6.0.3.5)
135
- actionpack (= 6.0.3.5)
136
- actiontext (= 6.0.3.5)
137
- actionview (= 6.0.3.5)
138
- activejob (= 6.0.3.5)
139
- activemodel (= 6.0.3.5)
140
- activerecord (= 6.0.3.5)
141
- activestorage (= 6.0.3.5)
142
- activesupport (= 6.0.3.5)
129
+ rails (6.0.3.6)
130
+ actioncable (= 6.0.3.6)
131
+ actionmailbox (= 6.0.3.6)
132
+ actionmailer (= 6.0.3.6)
133
+ actionpack (= 6.0.3.6)
134
+ actiontext (= 6.0.3.6)
135
+ actionview (= 6.0.3.6)
136
+ activejob (= 6.0.3.6)
137
+ activemodel (= 6.0.3.6)
138
+ activerecord (= 6.0.3.6)
139
+ activestorage (= 6.0.3.6)
140
+ activesupport (= 6.0.3.6)
143
141
  bundler (>= 1.3.0)
144
- railties (= 6.0.3.5)
142
+ railties (= 6.0.3.6)
145
143
  sprockets-rails (>= 2.0.0)
146
144
  rails-dom-testing (2.0.3)
147
145
  activesupport (>= 4.2.0)
148
146
  nokogiri (>= 1.6)
149
147
  rails-html-sanitizer (1.3.0)
150
148
  loofah (~> 2.3)
151
- railties (6.0.3.5)
152
- actionpack (= 6.0.3.5)
153
- activesupport (= 6.0.3.5)
149
+ railties (6.0.3.6)
150
+ actionpack (= 6.0.3.6)
151
+ activesupport (= 6.0.3.6)
154
152
  method_source
155
153
  rake (>= 0.8.7)
156
154
  thor (>= 0.20.3, < 2.0)
157
155
  rainbow (3.0.0)
158
156
  rake (13.0.3)
159
- regexp_parser (2.0.3)
160
- rexml (3.2.4)
161
- rubocop (1.9.1)
157
+ regexp_parser (2.1.1)
158
+ rexml (3.2.5)
159
+ rubocop (1.13.0)
162
160
  parallel (~> 1.10)
163
161
  parser (>= 3.0.0.0)
164
162
  rainbow (>= 2.2.2, < 4.0)
@@ -167,12 +165,12 @@ GEM
167
165
  rubocop-ast (>= 1.2.0, < 2.0)
168
166
  ruby-progressbar (~> 1.7)
169
167
  unicode-display_width (>= 1.4.0, < 3.0)
170
- rubocop-ast (1.4.1)
171
- parser (>= 2.7.1.5)
172
- rubocop-minitest (0.10.3)
173
- rubocop (>= 0.87, < 2.0)
174
- rubocop-performance (1.9.2)
175
- rubocop (>= 0.90.0, < 2.0)
168
+ rubocop-ast (1.5.0)
169
+ parser (>= 3.0.1.1)
170
+ rubocop-minitest (0.12.1)
171
+ rubocop (>= 0.90, < 2.0)
172
+ rubocop-performance (1.11.1)
173
+ rubocop (>= 1.7.0, < 2.0)
176
174
  rubocop-ast (>= 0.4.0)
177
175
  rubocop-rails (2.9.1)
178
176
  activesupport (>= 4.2.0)
@@ -190,7 +188,7 @@ GEM
190
188
  simplecov-html (~> 0.11)
191
189
  simplecov_json_formatter (~> 0.1)
192
190
  simplecov-html (0.12.3)
193
- simplecov_json_formatter (0.1.2)
191
+ simplecov_json_formatter (0.1.3)
194
192
  sprockets (4.0.2)
195
193
  concurrent-ruby (~> 1.0)
196
194
  rack (> 1, < 3)
@@ -213,6 +211,7 @@ GEM
213
211
  will_paginate (3.3.0)
214
212
  will_paginate-bootstrap4 (0.2.2)
215
213
  will_paginate (~> 3.0, >= 3.0.0)
214
+ yard (0.9.26)
216
215
  zeitwerk (2.4.2)
217
216
 
218
217
  PLATFORMS
@@ -236,6 +235,7 @@ DEPENDENCIES
236
235
  simplecov
237
236
  sqlite3
238
237
  ui_bibz!
238
+ yard
239
239
 
240
240
  BUNDLED WITH
241
- 2.1.4
241
+ 2.2.15
data/lib/ui_bibz.rb CHANGED
@@ -78,6 +78,8 @@ module UiBibz
78
78
  module Concerns
79
79
  autoload :HtmlConcern, 'ui_bibz/ui/concerns/html_concern'
80
80
  autoload :CardItemableConcern, 'ui_bibz/ui/concerns/card_itemable_concern'
81
+ autoload :NavigationConcern, 'ui_bibz/ui/concerns/navigation_concern'
82
+ autoload :NotificationConcern, 'ui_bibz/ui/concerns/notification_concern'
81
83
  end
82
84
 
83
85
  # Core
@@ -37,11 +37,13 @@ module UiBibz::Concerns::Models::Searchable
37
37
 
38
38
  # If there is more one table in html page
39
39
  def self.initialize_params
40
+ @tmp_params = { per_page: @arguments[:per_page] }
41
+
40
42
  return unless good_store_id?
41
43
 
42
44
  @tmp_params = {
43
45
  search: @params[:search],
44
- per_page: @params[:per_page],
46
+ per_page: @params[:per_page] || @arguments[:per_page],
45
47
  page: new_search? ? nil : @params[:page],
46
48
  sort: @params[:sort],
47
49
  direction: @params[:direction]
@@ -119,19 +121,19 @@ module UiBibz::Concerns::Models::Searchable
119
121
  if attribute.is_a?(Hash)
120
122
  if attribute == :as
121
123
  attribute.each_value do |value|
122
- sql_subquery << "lower(#{value}) LIKE :#{value}_#{i}"
123
- sql_attributes = sql_attributes.merge(Hash["#{value}_#{i}".to_sym, "%#{pattern}%"])
124
+ sql_subquery << "lower(CAST(#{value} AS TEXT)) LIKE :#{value}_#{i}"
125
+ sql_attributes = sql_attributes.merge({ "#{value}_#{i}".to_sym => "%#{pattern}%" })
124
126
  end
125
127
  else
126
128
  key_name = attribute.keys.first.to_s.pluralize
127
129
  attribute.each_value do |value|
128
- sql_subquery << "lower(#{key_name}.#{value}) LIKE :#{key_name}_#{value}_#{i}"
129
- sql_attributes = sql_attributes.merge(Hash["#{key_name}_#{value}_#{i}".to_sym, "%#{pattern}%"])
130
+ sql_subquery << "lower(CAST(#{key_name}.#{value} AS TEXT)) LIKE :#{key_name}_#{value}_#{i}"
131
+ sql_attributes = sql_attributes.merge({ "#{key_name}_#{value}_#{i}".to_sym => "%#{pattern}%" })
130
132
  end
131
133
  end
132
134
  else
133
- sql_subquery << "lower(#{to_s.underscore.pluralize.split('/').last}.#{attribute}) LIKE :#{attribute}_#{i}"
134
- sql_attributes = sql_attributes.merge(Hash["#{attribute}_#{i}".to_sym, "%#{pattern}%"])
135
+ sql_subquery << "lower(CAST(#{to_s.underscore.pluralize.split('/').last}.#{attribute} AS TEXT)) LIKE :#{attribute}_#{i}"
136
+ sql_attributes = sql_attributes.merge({ "#{attribute}_#{i}".to_sym => "%#{pattern}%" })
135
137
  end
136
138
  end
137
139
  sql_query << "(#{sql_subquery.join(' OR ')})"
data/lib/ui_bibz/infos.rb CHANGED
@@ -3,15 +3,15 @@
3
3
  module UiBibz
4
4
  NAME = 'Ui Bibz'
5
5
  SLUG = 'ui_bibz'
6
- BOOTSTRAP_VERSION = '5.0.0.beta1'
6
+ BOOTSTRAP_VERSION = '5.0.0.beta3'
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.15.2'
10
+ FONTAWESOME_VERSION = '5.15.3'
11
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
14
  AUTHOR = 'Thooams [Thomas HUMMEL]'
15
- VERSION = '3.0.0.beta13'
15
+ VERSION = '3.0.0.beta18'
16
16
  AUTHORS = ['Thooams'].freeze
17
17
  end
@@ -17,7 +17,7 @@ module UiBibzForm
17
17
  wrapper_html = (options[:input_html] || {}).merge({ class: input_classes })
18
18
  surround_field = UiBibz::Ui::Core::Forms::Surrounds::SurroundField.new(content, opts, html_options).tap(&block)
19
19
  errors_text = surround_field.errors.flatten.to_sentence
20
- required = surround_field.required_fields.any? { |u| u == true }
20
+ required = surround_field.required_fields.any?(true)
21
21
  wrapper_classes = UiBibz::Utils::Screwdriver.join_classes(('has-error' if errors_text.present?), wrapper_html.try(:[], :class))
22
22
  label_classes = UiBibz::Utils::Screwdriver.join_classes(('required' if required), 'control-label')
23
23
  abbr_html = content_tag('abbr', I18n.t(:"simple_form.required.mark", default: '*'), title: I18n.t(:"simple_form.required.text", default: 'required')) if required
@@ -32,19 +32,16 @@ module UiBibzForm
32
32
  end
33
33
 
34
34
  def ui_button_group(content = nil, opts = nil, html_options = nil, &block)
35
- content = (options || {}).merge(content || {})
36
- content = content.merge(template: @template, form: self)
37
-
38
- input_classes = UiBibz::Utils::Screwdriver.join_classes('button_group', options[:input_html].try(:[], :class))
39
- wrapper_html = (options[:input_html] || {}).merge({ class: input_classes })
40
-
41
- content_tag :div, wrapper_html do
42
- concat content_tag(:label, content[:label]) unless content[:label].nil?
43
- concat UiBibz::Ui::Core::Forms::Buttons::ButtonGroup.new(content, opts, html_options).tap(&block).render
44
- end
35
+ ui_component_group_by(UiBibz::Ui::Core::Forms::Buttons::ButtonGroup, content, opts, html_options, &block)
45
36
  end
46
37
 
47
38
  def ui_choice_group(content = nil, opts = nil, html_options = nil, &block)
39
+ ui_component_group_by(UiBibz::Ui::Core::Forms::Choices::ChoiceGroup, content, opts, html_options, &block)
40
+ end
41
+
42
+ private
43
+
44
+ def ui_component_group_by(component_class, content = nil, opts = nil, html_options = nil, &block)
48
45
  content = (options || {}).merge(content || {})
49
46
  content = content.merge(template: @template, form: self)
50
47
 
@@ -53,7 +50,7 @@ module UiBibzForm
53
50
 
54
51
  content_tag :div, wrapper_html do
55
52
  concat content_tag(:label, content[:label]) unless content[:label].nil?
56
- concat UiBibz::Ui::Core::Forms::Choices::ChoiceGroup.new(content, opts, html_options).tap(&block).render
53
+ concat component_class.new(content, opts, html_options).tap(&block).render
57
54
  end
58
55
  end
59
56
  end
@@ -60,14 +60,12 @@ module UiBibzInputs
60
60
  end
61
61
 
62
62
  def collection
63
- @collection ||= begin
64
- if options[:grouped]
65
- grouped_collection.map { |collection| collection.try(:send, group_method) }.detect(&:present?) || []
66
- else
67
- collection = options.delete(:collection) || self.class.boolean_collection
68
- collection.respond_to?(:call) ? collection.call : collection.to_a
69
- end
70
- end
63
+ @collection ||= if options[:grouped]
64
+ grouped_collection.map { |collection| collection.try(:send, group_method) }.detect(&:present?) || []
65
+ else
66
+ collection = options.delete(:collection) || self.class.boolean_collection
67
+ collection.respond_to?(:call) ? collection.call : collection.to_a
68
+ end
71
69
  end
72
70
 
73
71
  def group_method
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # to load pagination in rails app
4
- require 'will_paginate' if system('gem list -i will_paginate', out: File::NULL)
5
- require 'simple_form' if system('gem list -i simple_form', out: File::NULL)
4
+ require 'will_paginate' if Gem.loaded_specs.key?('will_paginate')
5
+ require 'simple_form' if Gem.loaded_specs.key?('simple_form')
6
6
 
7
7
  module UiBibz
8
8
  module Rails
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UiBibz::Ui::Concerns::NavigationConcern #:nodoc:
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ def spacer(num = 'auto')
8
+ kls = " me-#{num}"
9
+ @items.last.html_options[:class].nil? ? @items.last.html_options[:class] = kls : @items.last.html_options[:class] << kls
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UiBibz::Ui::Concerns::NotificationConcern #:nodoc:
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ def data_attributes
8
+ self.class.const_get('DATA_ATTRIBUTES').filter_map do |data_attribute|
9
+ options[data_attribute].to_s.blank? ? nil : { "data-bs-#{data_attribute}" => data_attribute_value(data_attribute) }
10
+ end.reduce(&:merge) || {}
11
+ end
12
+ end
13
+ end
@@ -90,7 +90,7 @@ module UiBibz::Ui::Core::Boxes
90
90
  class Card < UiBibz::Ui::Core::Component
91
91
  include UiBibz::Ui::Concerns::CardItemableConcern
92
92
 
93
- # See UiBibz::Ui::Core::Component.initialize
93
+ # (see UiBibz::Ui::Core::Component#initialize)
94
94
  def initialize(content = nil, options = nil, html_options = nil, &block)
95
95
  super
96
96
  @items = @content.nil? ? [] : [UiBibz::Ui::Core::Boxes::Components::CardBody.new(@content).render]
@@ -122,6 +122,10 @@ module UiBibz::Ui::Core
122
122
  # To turbolinks
123
123
  data_turbolinks = html_options.try(:[], :data).try(:[], :turbolinks) || options.try(:delete, :turbolinks)
124
124
  add_html_data(:turbolinks, value: data_turbolinks) unless data_turbolinks.nil?
125
+
126
+ # To Turbo
127
+ data_turbo = html_options.try(:[], :data).try(:[], :turbo) || options.try(:delete, :turbo)
128
+ add_html_data(:turbo, value: data_turbo) unless data_turbo.nil?
125
129
  end
126
130
 
127
131
  # Override this method to add html Options
@@ -145,7 +149,7 @@ module UiBibz::Ui::Core
145
149
  def add_html_data(name, value: true)
146
150
  html_options[:data] = {} if html_options[:data].nil?
147
151
  value = value.is_a?(String) ? value.strip : value
148
- html_options[:data].update(Hash[name, value])
152
+ html_options[:data].update({ name => value })
149
153
  end
150
154
 
151
155
  def disabled?
@@ -94,7 +94,7 @@ module UiBibz::Ui::Core::Forms::Choices
94
94
 
95
95
  def component_html_data
96
96
  super
97
- add_html_data 'toggle', value: 'buttons'
97
+ add_html_data 'toggle', value: 'buttons' if @options[:form].nil?
98
98
  end
99
99
  end
100
100
  end
@@ -82,10 +82,14 @@ module UiBibz::Ui::Core::Forms::Choices
82
82
  if options[:label]
83
83
  content_tag :label, options[:label], html_options.merge(for: input_id)
84
84
  else
85
- content_tag :label, html_options.merge(for: input_id) do
86
- concat glyph_and_content_html(options[:text].nil? ? @content : ' ')
87
- concat badge_html unless options[:badge].nil?
88
- end
85
+ generated_label
86
+ end
87
+ end
88
+
89
+ def generated_label
90
+ content_tag :label, html_options.merge(for: input_id) do
91
+ concat glyph_and_content_html(options[:text].nil? ? @content : ' ')
92
+ concat badge_html unless options[:badge].nil?
89
93
  end
90
94
  end
91
95
 
@@ -86,7 +86,7 @@ module UiBibz::Ui::Core::Forms::Numbers
86
86
  end
87
87
 
88
88
  def content_formula_name
89
- content.to_s.split('').count { |i| i == ']' }.positive? ? content.to_s.gsub(/]$/, '_formula]') : "#{content}_formula"
89
+ content.to_s.chars.count { |i| i == ']' }.positive? ? content.to_s.gsub(/]$/, '_formula]') : "#{content}_formula"
90
90
  end
91
91
 
92
92
  def state
@@ -25,6 +25,7 @@ module UiBibz::Ui::Core::Forms::Selects
25
25
  # * +searchable+ - Boolean
26
26
  # * +select_all_option+ - Boolean
27
27
  # * +append+ - String, Html
28
+ # * +non_selected_text+ - String
28
29
  # * +open+ - Boolean
29
30
  # * +theme+ - Symbol, defaut: +:dark+
30
31
  # * +prepend+ - String, Html
@@ -83,10 +84,12 @@ module UiBibz::Ui::Core::Forms::Selects
83
84
  clickable_opt_group
84
85
  collapsible_opt_group
85
86
  searchable
87
+ non_selected_text
86
88
  select_all_options
87
89
  number_displayed
88
90
  dropdown_menu_classes
89
91
  dropdown_classes
92
+ n_selected_text
90
93
  end
91
94
 
92
95
  def clickable_opt_group
@@ -101,6 +104,10 @@ module UiBibz::Ui::Core::Forms::Selects
101
104
  add_html_data('enable_filtering') if options[:searchable]
102
105
  end
103
106
 
107
+ def n_selected_text
108
+ add_html_data('n_selected_text', value: options[:n_selected_text]) if options[:n_selected_text]
109
+ end
110
+
104
111
  def number_displayed
105
112
  add_html_data('number_displayed') if options[:number_displayed]
106
113
  end
@@ -109,6 +116,10 @@ module UiBibz::Ui::Core::Forms::Selects
109
116
  add_html_data('include_select_all_option') if options[:select_all_options]
110
117
  end
111
118
 
119
+ def non_selected_text
120
+ add_html_data('non_selected_text', value: options[:non_selected_text]) if options[:non_selected_text]
121
+ end
122
+
112
123
  def dropdown_menu_classes
113
124
  classes = join_classes(theme, alignment, open)
114
125
  add_html_data('dropdown_menu_classes', value: classes.nil? ? nil : classes.join(' '))
@@ -67,6 +67,7 @@ module UiBibz::Ui::Core::Navigations
67
67
  #
68
68
  class Nav < UiBibz::Ui::Core::Component
69
69
  include UiBibz::Ui::Concerns::HtmlConcern
70
+ include UiBibz::Ui::Concerns::NavigationConcern
70
71
 
71
72
  # See UiBibz::Ui::Core::Component.initialize
72
73
  def initialize(content = nil, options = nil, html_options = nil, &block)
@@ -108,11 +109,6 @@ module UiBibz::Ui::Core::Navigations
108
109
  @items << NavDropdown.new(content, options, html_options).tap(&block)
109
110
  end
110
111
 
111
- def spacer(num = 'auto')
112
- kls = " me-#{num}"
113
- @items.last.html_options[:class].nil? ? @items.last.html_options[:class] = kls : @items.last.html_options[:class] << kls
114
- end
115
-
116
112
  protected
117
113
 
118
114
  def component_html_classes
@@ -75,6 +75,7 @@ module UiBibz::Ui::Core::Navigations
75
75
  #
76
76
  class Navbar < UiBibz::Ui::Core::Component
77
77
  include UiBibz::Ui::Concerns::HtmlConcern
78
+ include UiBibz::Ui::Concerns::NavigationConcern
78
79
 
79
80
  # See UiBibz::Ui::Core::Component.initialize
80
81
  def initialize(content = nil, options = nil, html_options = nil, &block)
@@ -124,11 +125,6 @@ module UiBibz::Ui::Core::Navigations
124
125
  @brand = UiBibz::Ui::Core::Navigations::NavbarBrand.new(content, options, html_options, &block).render
125
126
  end
126
127
 
127
- def spacer(num = 'auto')
128
- kls = " me-#{num}"
129
- @items.last.html_options[:class].nil? ? @items.last.html_options[:class] = kls : @items.last.html_options[:class] << kls
130
- end
131
-
132
128
  def id
133
129
  @id ||= generate_id('navbar-id')
134
130
  end
@@ -47,6 +47,8 @@ module UiBibz::Ui::Core::Notifications
47
47
  # ui_glyph("diamond", popover: { title: "My content", position: :right})
48
48
  #
49
49
  class Popover < UiBibz::Ui::Core::Component
50
+ include UiBibz::Ui::Concerns::NotificationConcern
51
+
50
52
  # Note that for security reasons the sanitize, sanitizeFn, and allowList
51
53
  # options cannot be supplied using data attributes.
52
54
  # https://getbootstrap.com/docs/5.0/components/popovers/#options
@@ -76,12 +78,6 @@ module UiBibz::Ui::Core::Notifications
76
78
  end
77
79
  end
78
80
 
79
- def data_attributes
80
- DATA_ATTRIBUTES.map do |data_attribute|
81
- options[data_attribute].to_s.blank? ? nil : { "data-bs-#{data_attribute}" => data_attribute_value(data_attribute) }
82
- end.compact.reduce(&:merge) || {}
83
- end
84
-
85
81
  def data_attribute_value(data_attribute)
86
82
  options[data_attribute].is_a?(String) ? options[data_attribute].html_safe : options[data_attribute]
87
83
  end
@@ -76,13 +76,29 @@ module UiBibz::Ui::Core::Notifications
76
76
 
77
77
  # Add Body which is a component
78
78
  def body(content = nil, options = nil, html_options = nil, &block)
79
- @body = UiBibz::Ui::Core::Notifications::Components::ToastBody.new(content, options, html_options, &block).render
79
+ @body = if @header.nil?
80
+ content_tag :div, class: 'd-flex' do
81
+ concat UiBibz::Ui::Core::Notifications::Components::ToastBody.new(content, options, html_options, &block).render
82
+ concat close_html if (options || {})[:closable]
83
+ end
84
+ else
85
+ UiBibz::Ui::Core::Notifications::Components::ToastBody.new(content, options, html_options, &block).render
86
+ end
80
87
  end
81
88
 
82
89
  private
83
90
 
91
+ def only_body_html
92
+ @body = UiBibz::Ui::Core::Notifications::Components::ToastBody.new(content, options, html_options, &block).render
93
+ end
94
+
95
+ def close_html
96
+ content_tag :button, '', type: 'button', class: close_button_classes,
97
+ 'data-bs-dismiss' => 'toast', 'aria-label' => 'Close'
98
+ end
99
+
84
100
  def component_html_classes
85
- super << ['toast', status, white_text_color]
101
+ super << ['toast', status, white_text_color, align_items_center]
86
102
  end
87
103
 
88
104
  def component_html_options
@@ -98,10 +114,24 @@ module UiBibz::Ui::Core::Notifications
98
114
  "bg-#{options[:status]}" if options[:status]
99
115
  end
100
116
 
117
+ def align_items_center
118
+ 'align-items-center' if @header.nil?
119
+ end
120
+
101
121
  def white_text_color
102
122
  return if options[:status].nil?
103
123
 
104
124
  'text-white' unless %i[info warning info light].include?(options[:status])
105
125
  end
126
+
127
+ def white_btn_color
128
+ return if options[:status].nil?
129
+
130
+ 'btn-close-white' unless %i[info warning info light].include?(options[:status])
131
+ end
132
+
133
+ def close_button_classes
134
+ UiBibz::Utils::Screwdriver.join_classes('btn-close', 'me-2', 'm-auto', white_btn_color)
135
+ end
106
136
  end
107
137
  end
@@ -48,6 +48,8 @@ module UiBibz::Ui::Core::Notifications
48
48
  # ui_glyph("diamond", tooltip: { title: "My content", position: :right})
49
49
  #
50
50
  class Tooltip < UiBibz::Ui::Core::Component
51
+ include UiBibz::Ui::Concerns::NotificationConcern
52
+
51
53
  # Note that for security reasons the sanitize, sanitizeFn, and allowList
52
54
  # options cannot be supplied using data attributes.
53
55
  # https://getbootstrap.com/docs/5.0/components/tooltips/#options
@@ -76,12 +78,6 @@ module UiBibz::Ui::Core::Notifications
76
78
  end
77
79
  end
78
80
 
79
- def data_attributes
80
- DATA_ATTRIBUTES.map do |data_attribute|
81
- options[data_attribute].to_s.blank? ? nil : { "data-bs-#{data_attribute}" => data_attribute_value(data_attribute) }
82
- end.compact.reduce(&:merge) || {}
83
- end
84
-
85
81
  def data_attribute_value(data_attribute)
86
82
  options[data_attribute].is_a?(String) ? options[data_attribute].html_safe : options[data_attribute]
87
83
  end
@@ -52,7 +52,7 @@ module UiBibz::Ui::Ux::Tables
52
52
  def defaults_actions
53
53
  [
54
54
  UiBibz::Ui::Core::Forms::Dropdowns::Components::DropdownLink.new(show_name, url: { controller: @store.controller, action: 'show', id: :id }, glyph: 'eye').render,
55
- UiBibz::Ui::Core::Forms::Dropdowns::Components::DropdownLink.new(edit_name, url: { controller: @store.controller, action: 'edit', id: :id }, glyph: 'pencil').render,
55
+ UiBibz::Ui::Core::Forms::Dropdowns::Components::DropdownLink.new(edit_name, url: { controller: @store.controller, action: 'edit', id: :id }, glyph: 'edit').render,
56
56
  UiBibz::Ui::Core::Forms::Dropdowns::Components::DropdownLink.new(delete_name, { glyph: 'trash', url: { controller: @store.controller, action: 'destroy', id: :id }, link_html_options: { data: { confirm: 'Are you sure?', method: :delete } } }).render
57
57
  ]
58
58
  end
@@ -8,6 +8,9 @@ module UiBibz::Ui::Ux::Tables
8
8
 
9
9
  # Store Use WillPaginate store methods
10
10
  def initialize(store)
11
+ raise 'Store is nil!' if store.nil?
12
+ raise 'Store can be created only with "table_search_pagination" method!' if store.try(:records).nil?
13
+
11
14
  @records = store.records
12
15
  @store = store
13
16
  @model = store.model
@@ -26,9 +26,6 @@ module UiBibz::Ui::Ux::Tables
26
26
  private
27
27
 
28
28
  def store
29
- raise 'Store is nil!' if @search_field.options[:store].nil?
30
- raise 'Store can be created only with "table_search_pagination" method!' if @search_field.options[:store].try(:records).nil?
31
-
32
29
  @store ||= Store.new @search_field.options[:store]
33
30
  end
34
31
  end
@@ -53,9 +53,6 @@ module UiBibz::Ui::Ux::Tables
53
53
 
54
54
  # Store must be generated by *table_search_pagination* method
55
55
  def store
56
- raise 'Store is nil!' if @pagination.options[:store].nil?
57
- raise 'Store can be created only with "table_search_pagination" method!' if @pagination.options[:store].try(:records).nil?
58
-
59
56
  @store ||= Store.new @pagination.options[:store]
60
57
  end
61
58
  end
@@ -46,9 +46,6 @@ module UiBibz::Ui::Ux::Tables
46
46
  private
47
47
 
48
48
  def store
49
- raise 'Store is nil!' if @per_page_field.options[:store].nil?
50
- raise 'Store can be created only with "table_search_pagination" method!' if @per_page_field.options[:store].try(:records).nil?
51
-
52
49
  @store ||= Store.new @per_page_field.options[:store]
53
50
  end
54
51
 
@@ -42,6 +42,7 @@ module UiBibz::Ui::Ux::Tables
42
42
  content_tag :div, html_options do
43
43
  concat content_tag(:span, UiBibz::Ui::Core::Icons::Glyph.new('search').render, class: 'input-group-text')
44
44
  concat tag(:input, type: 'search', value: search_content, name: 'search', class: 'form-control', placeholder: search_placeholder_field)
45
+ concat tag(:input, type: 'hidden', name: 'store_id', value: store.id) unless store.id.nil? # if there is more one table in html page
45
46
  concat tag(:input, type: 'hidden', name: 'link_type', value: 'search')
46
47
  concat content_tag(:span, UiBibz::Ui::Core::Icons::Glyph.new('times-circle').render, class: 'clear-search-btn input-group-text')
47
48
  end
@@ -37,9 +37,9 @@ module UiBibz::Utils
37
37
  if opts.is_a?(Hash)
38
38
  @position = opts[:position]
39
39
 
40
- opts.map do |k, v|
40
+ opts.filter_map do |k, v|
41
41
  send(k, size, v) if POSITIONING.include?(k.to_sym)
42
- end.compact.join(' ')
42
+ end.join(' ')
43
43
  else
44
44
  send('num', size, opts)
45
45
  end
@@ -7,7 +7,7 @@ module UiBibz::Utils
7
7
 
8
8
  class << self
9
9
  def join_classes(*classes)
10
- klasses = Array(classes).flatten.map(&:to_s).compact.uniq.reject(&:blank?)
10
+ klasses = Array(classes).flatten.filter_map(&:to_s).uniq.reject(&:blank?)
11
11
  klasses.empty? ? nil : klasses
12
12
  end
13
13
 
@@ -237,31 +237,40 @@ test1</textarea></div></form>"
237
237
  assert_equal expected, actual
238
238
  end
239
239
 
240
- # test 'choice field' do
241
- # actual = ui_form_for @user do |f|
242
- # f.ui_choice_group do |cg|
243
- # cg.input :name_fr, as: :ui_choice_field
244
- # cg.input :name_fr, as: :ui_choice_field
245
- # end
246
- # end
247
- #
248
- # expected = "<form class=\"simple_form\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"button_group\"><div data-toggle=\"buttons\" class=\"btn-group button-choice btn-group-toggle\"><input type=\"checkbox\" autocomplete=\"off\" class=\"btn-check\" id=\"choice-21472\" /><label class=\"btn-secondary btn checkbox\" checked=\"checked\" for=\"choice-21472\">Name Fr</label><input type=\"checkbox\" autocomplete=\"off\" class=\"btn-check\" id=\"choice-13741\" /><label class=\"btn-secondary btn checkbox\" checked=\"checked\" for=\"choice-13741\">Name Fr</label></div></div></form>"
249
- #
250
- # assert_equal expected, actual
251
- # end
252
-
253
- # test 'test surround field into simple form' do
254
- # actual = ui_form_for @user do |f|
255
- # concat(f.ui_surround_field do |sf|
256
- # sf.input :name_en, as: :text_field
257
- # sf.addon("€")
258
- # end)
259
- # concat f.input(:name_fr, as: :ui_auto_complete_field, collection: @users, label_method: :name_fr)
260
- # end
261
- #
262
- # expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input type=\"hidden\" name=\"_method\" value=\"patch\" /><div><div class=\"input-group\"><input type=\"text\" name=\"user[name_en]\" id=\"user_name_en\" value=\"test1 en\" class=\"text_field optional form-control\" /><span class=\"input-group-text\">€</span></div></div><div class=\"form-group ui_auto_complete_field optional user_name_fr\"><label class=\"control-label ui_auto_complete_field optional\" for=\"user_name_fr\">Name fr</label><input type=\"text\" name=\"user[name_fr]\" id=\"user_name_fr\" value=\"test1\" class=\"ui_auto_complete_field optional form-control auto-complete-field\" autocomplete=\"true\" list=\"user_name_fr-datalist\" /><datalist id=\"user_name_fr-datalist\"><option value=\"1\">test1</option>
263
- # <option value=\"2\">test2</option></datalist></div></form>"
264
- #
265
- # assert_equal expected, actual
266
- # end
240
+ test 'ui_button_group' do
241
+ actual = ui_form_for @user do |f|
242
+ f.ui_button_group do |bg|
243
+ bg.button "test"
244
+ end
245
+ end
246
+
247
+ expected = "<form class=\"simple_form\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"button_group\"><div class=\"btn-group\" role=\"group\"><button class=\"btn-secondary btn\">test</button></div></div></form>"
248
+
249
+ assert_equal expected, actual
250
+ end
251
+
252
+ test 'ui_choice_group' do
253
+ actual = ui_form_for @user do |f|
254
+ f.ui_choice_group do |cg|
255
+ cg.input :name_fr, as: :ui_checkbox_field
256
+ end
257
+ end
258
+
259
+ expected = "<form class=\"simple_form\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"button_group\"><div class=\"btn-group button-choice btn-group-toggle\"><div class=\"form-check\"><input type=\"checkbox\" name=\"user[name_fr]\" id=\"user_name_fr\" value=\"test1\" class=\"ui_checkbox_field optional form-check-input\" checked=\"checked\" /><label class=\"form-check-label\" for=\"user_name_fr\">Name Fr</label></div></div></div></form>"
260
+
261
+ assert_equal expected, actual
262
+ end
263
+
264
+ test 'test surround field into simple form' do
265
+ actual = ui_form_for @user do |f|
266
+ f.ui_surround_field do |sf|
267
+ sf.input :name_en, as: :ui_text_field
268
+ sf.addon("€")
269
+ end
270
+ end
271
+
272
+ expected = "<form class=\"simple_form\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"form-group surround_field\"><div class=\"input-group ui_surround_field\"><input type=\"text\" name=\"user[name_en]\" id=\"user_name_en\" value=\"test1 en\" class=\"form-control string ui_text_field optional\" /><span class=\"input-group-text\">€</span></div></div></form>"
273
+
274
+ assert_equal expected, actual
275
+ end
267
276
  end
@@ -23,4 +23,11 @@ class CheckboxFieldTest < ActionView::TestCase
23
23
 
24
24
  assert_equal expected, actual
25
25
  end
26
+
27
+ test 'checkbox_field with html_options' do
28
+ actual = UiBibz::Ui::Core::Forms::Choices::CheckboxField.new('John', { checked: true }, { data: { name: 'check' } }).render
29
+ expected = "<div class=\"form-check\"><input type=\"checkbox\" name=\"John\" id=\"John\" value=\"1\" data-name=\"check\" class=\"form-check-input\" checked=\"checked\" /><label class=\"form-check-label\" for=\"John\">John</label></div>"
30
+
31
+ assert_equal expected, actual
32
+ end
26
33
  end
@@ -3,7 +3,7 @@
3
3
  require 'test_helper'
4
4
 
5
5
  class DropdownSelectFieldTest < ActionView::TestCase
6
- test 'Multi Select Field' do
6
+ test 'Dropdown Select Field' do
7
7
  options = options_for_select(Array.new(2) { |i| "option #{i}" })
8
8
  actual = UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new('example', multiple: true, option_tags: options).render
9
9
  expected = "<select name=\"example[]\" id=\"example\" data-dropdown-classes=\"dropdown\" class=\"btn-secondary multi-select-field\" multiple=\"multiple\"><option value=\"option 0\">option 0</option>
@@ -12,10 +12,10 @@ class DropdownSelectFieldTest < ActionView::TestCase
12
12
  assert_equal expected, actual
13
13
  end
14
14
 
15
- test 'Multi Select Field data html options' do
15
+ test 'Dropdown Select Field data html options' do
16
16
  grouped_options = { 'North America' => [['United statuss', 'US'], 'Canada'], 'Europe' => %w[Denmark Germany France] }
17
- actual = UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new('example', { multiple: true, option_tags: grouped_options_for_select(grouped_options), clickable_opt_group: true, collapsible_opt_group: true, searchable: true, select_all_options: true, number_displayed: 2, status: :danger }).render
18
- expected = "<select name=\"example[]\" id=\"example\" data-enable-clickable-opt-groups=\"true\" data-enable-collapsible-opt-groups=\"true\" data-enable-filtering=\"true\" data-include-select-all-option=\"true\" data-number-displayed=\"true\" data-dropdown-classes=\"dropdown\" class=\"btn-danger multi-select-field\" multiple=\"multiple\"><optgroup label=\"North America\"><option value=\"US\">United statuss</option>
17
+ actual = UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new('example', { multiple: true, option_tags: grouped_options_for_select(grouped_options), clickable_opt_group: true, collapsible_opt_group: true, searchable: true, non_selected_text: 'test', select_all_options: true, number_displayed: 2, status: :danger, n_selected_text: "items selected" }).render
18
+ expected = "<select name=\"example[]\" id=\"example\" data-enable-clickable-opt-groups=\"true\" data-enable-collapsible-opt-groups=\"true\" data-enable-filtering=\"true\" data-non-selected-text=\"test\" data-include-select-all-option=\"true\" data-number-displayed=\"true\" data-dropdown-classes=\"dropdown\" data-n-selected-text=\"items selected\" class=\"btn-danger multi-select-field\" multiple=\"multiple\"><optgroup label=\"North America\"><option value=\"US\">United statuss</option>
19
19
  <option value=\"Canada\">Canada</option></optgroup><optgroup label=\"Europe\"><option value=\"Denmark\">Denmark</option>
20
20
  <option value=\"Germany\">Germany</option>
21
21
  <option value=\"France\">France</option></optgroup></select>"
@@ -23,7 +23,7 @@ class DropdownSelectFieldTest < ActionView::TestCase
23
23
  assert_equal expected, actual
24
24
  end
25
25
 
26
- test 'Multi select Field refresh option' do
26
+ test 'Dropdown Select Field refresh option' do
27
27
  actual = UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new('test', { multiple: true, refresh: { target: { url: '/' } } }).render
28
28
  expected = "<div class=\"field-refresh input-group ui_surround_field\"><select name=\"test[]\" id=\"test\" data-dropdown-classes=\"dropdown\" class=\"btn-secondary multi-select-field\" multiple=\"multiple\"></select><span data-connect=\"{&quot;events&quot;:&quot;click&quot;,&quot;mode&quot;:&quot;remote&quot;,&quot;target&quot;:{&quot;selector&quot;:&quot;#test&quot;,&quot;url&quot;:&quot;/&quot;,&quot;data&quot;:[]}}\" class=\"btn-secondary ui-bibz-connect btn input-refresh-button\"><i class=\"glyph fas fa-sync-alt\"></i></span></div>"
29
29
 
@@ -9,7 +9,7 @@ class ToastTest < ActionView::TestCase
9
9
  t.header 'My header toast', glyph: 'eye', time: 'Now', class: 'my-header-toast'
10
10
  t.body 'My body toast', class: 'my-body-toast'
11
11
  end
12
- expected = "<div data-bs-autohide=\"true\" class=\"my-toast toast\" role=\"alert\" aria-live=\"assertive\" aria-atomic=\"true\"><div class=\"my-header-toast toast-header\"><i class=\"me-2 glyph fas fa-eye\"></i><strong class=\"me-auto\">My header toast</strong><small class=\"text-muted\">Now</small><button class=\"ml-2 mb-1 btn-close\" data-bs-dismiss=\"toast\" aria-label=\"Close\"></button></div><div class=\"my-body-toast toast-body\">My body toast</div></div>"
12
+ expected = "<div data-bs-autohide=\"true\" class=\"my-toast toast align-items-center\" role=\"alert\" aria-live=\"assertive\" aria-atomic=\"true\"><div class=\"my-header-toast toast-header\"><i class=\"me-2 glyph fas fa-eye\"></i><strong class=\"me-auto\">My header toast</strong><small class=\"text-muted\">Now</small><button class=\"ml-2 mb-1 btn-close\" data-bs-dismiss=\"toast\" aria-label=\"Close\"></button></div><div class=\"my-body-toast toast-body\">My body toast</div></div>"
13
13
 
14
14
  assert_equal expected, actual
15
15
  end
@@ -18,7 +18,7 @@ class ToastTest < ActionView::TestCase
18
18
  actual = ui_toast do
19
19
  'My body toast'
20
20
  end
21
- expected = "<div class=\"toast\" role=\"alert\" aria-live=\"assertive\" aria-atomic=\"true\"><div class=\"toast-body\">My body toast</div></div>"
21
+ expected = "<div class=\"toast align-items-center\" role=\"alert\" aria-live=\"assertive\" aria-atomic=\"true\"><div class=\"d-flex\"><div class=\"toast-body\">My body toast</div></div></div>"
22
22
 
23
23
  assert_equal expected, actual
24
24
  end
data/ui_bibz.gemspec CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.description = UiBibz::DESCRIPTION
20
20
  s.license = UiBibz::LICENSE
21
21
 
22
- s.required_ruby_version = '>= 2.7'
22
+ s.required_ruby_version = '>= 3.0.0'
23
23
 
24
24
  s.files = `git ls-files`.split
25
25
  s.test_files = `git ls-files -- {test,spec,features}/*`.split
@@ -47,4 +47,5 @@ Gem::Specification.new do |s|
47
47
  s.add_development_dependency 'simplecov'
48
48
  s.add_development_dependency 'simple_form'
49
49
  s.add_development_dependency 'sqlite3'
50
+ s.add_development_dependency 'yard'
50
51
  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.beta13
4
+ version: 3.0.0.beta18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thooams [Thomas HUMMEL]
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-11 00:00:00.000000000 Z
11
+ date: 2021-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -240,7 +240,21 @@ dependencies:
240
240
  - - ">="
241
241
  - !ruby/object:Gem::Version
242
242
  version: '0'
243
- description: A Rails Interface Framework using Bootstrap 5.0.0.beta1.
243
+ - !ruby/object:Gem::Dependency
244
+ name: yard
245
+ requirement: !ruby/object:Gem::Requirement
246
+ requirements:
247
+ - - ">="
248
+ - !ruby/object:Gem::Version
249
+ version: '0'
250
+ type: :development
251
+ prerelease: false
252
+ version_requirements: !ruby/object:Gem::Requirement
253
+ requirements:
254
+ - - ">="
255
+ - !ruby/object:Gem::Version
256
+ version: '0'
257
+ description: A Rails Interface Framework using Bootstrap 5.0.0.beta3.
244
258
  email: thomas@hummel.link
245
259
  executables:
246
260
  - test
@@ -312,6 +326,8 @@ files:
312
326
  - lib/ui_bibz/ui/base.rb
313
327
  - lib/ui_bibz/ui/concerns/card_itemable_concern.rb
314
328
  - lib/ui_bibz/ui/concerns/html_concern.rb
329
+ - lib/ui_bibz/ui/concerns/navigation_concern.rb
330
+ - lib/ui_bibz/ui/concerns/notification_concern.rb
315
331
  - lib/ui_bibz/ui/core/boxes/card.rb
316
332
  - lib/ui_bibz/ui/core/boxes/card_accordion.rb
317
333
  - lib/ui_bibz/ui/core/boxes/card_column.rb
@@ -544,8 +560,8 @@ files:
544
560
  - test/ui/core/forms/numbers/number_field_test.rb
545
561
  - test/ui/core/forms/numbers/range_field_test.rb
546
562
  - test/ui/core/forms/numbers/slider_field_test.rb
563
+ - test/ui/core/forms/selects/dropdown_select_field_test.rb
547
564
  - test/ui/core/forms/selects/multi_column_field_test.rb
548
- - test/ui/core/forms/selects/multi_select_field_test.rb
549
565
  - test/ui/core/forms/selects/select_field_test.rb
550
566
  - test/ui/core/forms/surrounds/surround_field_test.rb
551
567
  - test/ui/core/forms/textareas/markdown_editor_field_test.rb
@@ -655,18 +671,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
655
671
  requirements:
656
672
  - - ">="
657
673
  - !ruby/object:Gem::Version
658
- version: '2.7'
674
+ version: 3.0.0
659
675
  required_rubygems_version: !ruby/object:Gem::Requirement
660
676
  requirements:
661
677
  - - ">"
662
678
  - !ruby/object:Gem::Version
663
679
  version: 1.3.1
664
680
  requirements: []
665
- rubygems_version: 3.1.2
681
+ rubygems_version: 3.2.15
666
682
  signing_key:
667
683
  specification_version: 4
668
684
  summary: Ui Bibz is an Ui Framework that allows you to build an interface very quickly
669
- and simply using Bootstrap 5.0.0.beta1.
685
+ and simply using Bootstrap 5.0.0.beta3.
670
686
  test_files:
671
687
  - test/dummy/README.rdoc
672
688
  - test/dummy/Rakefile
@@ -757,8 +773,8 @@ test_files:
757
773
  - test/ui/core/forms/numbers/number_field_test.rb
758
774
  - test/ui/core/forms/numbers/range_field_test.rb
759
775
  - test/ui/core/forms/numbers/slider_field_test.rb
776
+ - test/ui/core/forms/selects/dropdown_select_field_test.rb
760
777
  - test/ui/core/forms/selects/multi_column_field_test.rb
761
- - test/ui/core/forms/selects/multi_select_field_test.rb
762
778
  - test/ui/core/forms/selects/select_field_test.rb
763
779
  - test/ui/core/forms/surrounds/surround_field_test.rb
764
780
  - test/ui/core/forms/textareas/markdown_editor_field_test.rb