ui_bibz 3.0.0.beta16 → 3.0.0

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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +0 -1
  3. data/.ruby-version +1 -1
  4. data/Gemfile.lock +97 -95
  5. data/lib/ui_bibz/concerns/models/searchable.rb +7 -5
  6. data/lib/ui_bibz/infos.rb +3 -3
  7. data/lib/ui_bibz/inputs/ui_bibz_form/ui_bibz_form_builder.rb +1 -1
  8. data/lib/ui_bibz/inputs/ui_bibz_inputs/collection_input.rb +6 -8
  9. data/lib/ui_bibz/ui/concerns/notification_concern.rb +2 -2
  10. data/lib/ui_bibz/ui/core/boxes/components/card_body.rb +1 -1
  11. data/lib/ui_bibz/ui/core/forms/buttons/button.rb +4 -4
  12. data/lib/ui_bibz/ui/core/forms/buttons/button_link.rb +3 -3
  13. data/lib/ui_bibz/ui/core/forms/choices/choice_group.rb +1 -1
  14. data/lib/ui_bibz/ui/core/forms/numbers/formula_field.rb +2 -2
  15. data/lib/ui_bibz/ui/core/forms/numbers/slider_header.rb +2 -2
  16. data/lib/ui_bibz/ui/core/forms/surrounds/surround_field.rb +1 -1
  17. data/lib/ui_bibz/ui/core/navigations/breadcrumb.rb +1 -1
  18. data/lib/ui_bibz/ui/core/navigations/components/breadcrumb_link.rb +1 -1
  19. data/lib/ui_bibz/ui/core/navigations/components/nav_link_link.rb +1 -1
  20. data/lib/ui_bibz/ui/core/navigations/link.rb +1 -1
  21. data/lib/ui_bibz/ui/core/navigations/navbar.rb +1 -1
  22. data/lib/ui_bibz/ui/core/notifications/components/bar.rb +1 -1
  23. data/lib/ui_bibz/ui/core/notifications/components/toast_header.rb +1 -1
  24. data/lib/ui_bibz/ui/core/notifications/toast.rb +33 -3
  25. data/lib/ui_bibz/ui/ux/tables/components/actions.rb +1 -1
  26. data/lib/ui_bibz/ui/ux/tables/components/store.rb +1 -1
  27. data/lib/ui_bibz/ui/ux/tables/table.rb +6 -2
  28. data/lib/ui_bibz/ui/ux/tables/table_search_field.rb +1 -0
  29. data/lib/ui_bibz/utils/breakdown_class_name_generator.rb +2 -2
  30. data/lib/ui_bibz/utils/screwdriver.rb +1 -1
  31. data/test/simple_form_test.rb +1 -1
  32. data/test/ui/core/notifications/toast_test.rb +2 -2
  33. data/test/ui/ux/tables/table_test.rb +7 -0
  34. data/ui_bibz.gemspec +2 -2
  35. metadata +12 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ffa18823b220fe50b0aab6b3b25e06d184bc514266edaf8a24e47345e8816001
4
- data.tar.gz: c189f21d3f6ad9943f8fc9ce303eb9578d1159366a7fc3340d9a5fed8205d9ad
3
+ metadata.gz: '08901c79a02f3cdf155c8ebaaabbbeb51ca9f1c288683c9ed7a011f9fd0db79b'
4
+ data.tar.gz: a6775b311c69081ceaa310231e8a75c1734ee2e5137995dc14a667a88f77555f
5
5
  SHA512:
6
- metadata.gz: 53ef82ec6ccc0bd9f4036887402fef838f6e206d2ce59282fd3b9571eaa1b960767607e99286bb515e95d801c8c8a4c4f7750c219096bed99b49ccd55cabc37c
7
- data.tar.gz: 7e4f7f43e3fb0e1830eafc73b35c6901184586973db3d5964b06de5e27503edbee78d945f8203104effc617c3a4b0263a8903fd5d7cc0193a83a4e6c626b22ea
6
+ metadata.gz: b0ea16797c341c948a1d249a72e9707368fce3b8547ece6cbde40a5c29932e0871a78247d2e28ef22b74b392eb89913b5e30c73bb0535dd1b6bc79b537cc7a88
7
+ data.tar.gz: d79f28d50fd11585ec2f798a49a151c9422e240d9573f4ae52502eb13f22a7f4d2a15054e50174e6b41ba629ca663f05336a7c64692c9821c68bff82f73ba020
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.beta16)
4
+ ui_bibz (3.0.0)
5
5
  will-paginate-i18n
6
6
  will_paginate (~> 3.3.0)
7
7
  will_paginate-bootstrap4
@@ -9,69 +9,73 @@ 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.1.4)
13
+ actionpack (= 6.1.4)
14
+ activesupport (= 6.1.4)
14
15
  nio4r (~> 2.0)
15
16
  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)
17
+ actionmailbox (6.1.4)
18
+ actionpack (= 6.1.4)
19
+ activejob (= 6.1.4)
20
+ activerecord (= 6.1.4)
21
+ activestorage (= 6.1.4)
22
+ activesupport (= 6.1.4)
22
23
  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)
24
+ actionmailer (6.1.4)
25
+ actionpack (= 6.1.4)
26
+ actionview (= 6.1.4)
27
+ activejob (= 6.1.4)
28
+ activesupport (= 6.1.4)
27
29
  mail (~> 2.5, >= 2.5.4)
28
30
  rails-dom-testing (~> 2.0)
29
- actionpack (6.0.3.5)
30
- actionview (= 6.0.3.5)
31
- activesupport (= 6.0.3.5)
32
- rack (~> 2.0, >= 2.0.8)
31
+ actionpack (6.1.4)
32
+ actionview (= 6.1.4)
33
+ activesupport (= 6.1.4)
34
+ rack (~> 2.0, >= 2.0.9)
33
35
  rack-test (>= 0.6.3)
34
36
  rails-dom-testing (~> 2.0)
35
37
  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)
38
+ actiontext (6.1.4)
39
+ actionpack (= 6.1.4)
40
+ activerecord (= 6.1.4)
41
+ activestorage (= 6.1.4)
42
+ activesupport (= 6.1.4)
41
43
  nokogiri (>= 1.8.5)
42
- actionview (6.0.3.5)
43
- activesupport (= 6.0.3.5)
44
+ actionview (6.1.4)
45
+ activesupport (= 6.1.4)
44
46
  builder (~> 3.1)
45
47
  erubi (~> 1.4)
46
48
  rails-dom-testing (~> 2.0)
47
49
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
48
- activejob (6.0.3.5)
49
- activesupport (= 6.0.3.5)
50
+ activejob (6.1.4)
51
+ activesupport (= 6.1.4)
50
52
  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)
53
+ activemodel (6.1.4)
54
+ activesupport (= 6.1.4)
55
+ activerecord (6.1.4)
56
+ activemodel (= 6.1.4)
57
+ activesupport (= 6.1.4)
58
+ activestorage (6.1.4)
59
+ actionpack (= 6.1.4)
60
+ activejob (= 6.1.4)
61
+ activerecord (= 6.1.4)
62
+ activesupport (= 6.1.4)
63
+ marcel (~> 1.0.0)
64
+ mini_mime (>= 1.1.0)
65
+ activesupport (6.1.4)
62
66
  concurrent-ruby (~> 1.0, >= 1.0.2)
63
- i18n (>= 0.7, < 2)
64
- minitest (~> 5.1)
65
- tzinfo (~> 1.1)
66
- zeitwerk (~> 2.2, >= 2.2.2)
67
+ i18n (>= 1.6, < 2)
68
+ minitest (>= 5.1)
69
+ tzinfo (~> 2.0)
70
+ zeitwerk (~> 2.3)
67
71
  ast (2.4.2)
68
72
  awesome_print (1.9.2)
69
73
  builder (3.2.4)
70
74
  byebug (11.1.3)
71
- childprocess (4.0.0)
72
- concurrent-ruby (1.1.8)
75
+ childprocess (4.1.0)
76
+ concurrent-ruby (1.1.9)
73
77
  crass (1.0.6)
74
- docile (1.3.5)
78
+ docile (1.4.0)
75
79
  erubi (1.10.0)
76
80
  erubis (2.7.0)
77
81
  factory_bot (4.11.1)
@@ -95,93 +99,92 @@ GEM
95
99
  haml (>= 4.0, < 6)
96
100
  nokogiri (>= 1.6.0)
97
101
  ruby_parser (~> 3.5)
98
- i18n (1.8.9)
102
+ i18n (1.8.10)
99
103
  concurrent-ruby (~> 1.0)
100
104
  iniparse (1.5.0)
101
105
  jquery-rails (4.4.0)
102
106
  rails-dom-testing (>= 1, < 3)
103
107
  railties (>= 4.2.0)
104
108
  thor (>= 0.14, < 2.0)
105
- loofah (2.9.0)
109
+ loofah (2.10.0)
106
110
  crass (~> 1.0.2)
107
111
  nokogiri (>= 1.5.9)
108
112
  mail (2.7.1)
109
113
  mini_mime (>= 0.1.1)
110
- marcel (0.3.3)
111
- mimemagic (~> 0.3.2)
114
+ marcel (1.0.1)
112
115
  method_source (1.0.0)
113
- mimemagic (0.3.5)
114
- mini_mime (1.0.2)
115
- mini_portile2 (2.5.0)
116
+ mini_mime (1.1.0)
117
+ mini_portile2 (2.5.3)
116
118
  minitest (5.14.4)
117
119
  nio4r (2.5.7)
118
- nokogiri (1.11.1)
120
+ nokogiri (1.11.7)
119
121
  mini_portile2 (~> 2.5.0)
120
122
  racc (~> 1.4)
121
- overcommit (0.57.0)
123
+ overcommit (0.58.0)
122
124
  childprocess (>= 0.6.3, < 5)
123
125
  iniparse (~> 1.4)
126
+ rexml (~> 3.2)
124
127
  parallel (1.20.1)
125
- parser (3.0.0.0)
128
+ parser (3.0.2.0)
126
129
  ast (~> 2.4.1)
127
130
  racc (1.5.2)
128
131
  rack (2.2.3)
129
132
  rack-test (1.1.0)
130
133
  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)
143
- bundler (>= 1.3.0)
144
- railties (= 6.0.3.5)
134
+ rails (6.1.4)
135
+ actioncable (= 6.1.4)
136
+ actionmailbox (= 6.1.4)
137
+ actionmailer (= 6.1.4)
138
+ actionpack (= 6.1.4)
139
+ actiontext (= 6.1.4)
140
+ actionview (= 6.1.4)
141
+ activejob (= 6.1.4)
142
+ activemodel (= 6.1.4)
143
+ activerecord (= 6.1.4)
144
+ activestorage (= 6.1.4)
145
+ activesupport (= 6.1.4)
146
+ bundler (>= 1.15.0)
147
+ railties (= 6.1.4)
145
148
  sprockets-rails (>= 2.0.0)
146
149
  rails-dom-testing (2.0.3)
147
150
  activesupport (>= 4.2.0)
148
151
  nokogiri (>= 1.6)
149
152
  rails-html-sanitizer (1.3.0)
150
153
  loofah (~> 2.3)
151
- railties (6.0.3.5)
152
- actionpack (= 6.0.3.5)
153
- activesupport (= 6.0.3.5)
154
+ railties (6.1.4)
155
+ actionpack (= 6.1.4)
156
+ activesupport (= 6.1.4)
154
157
  method_source
155
- rake (>= 0.8.7)
156
- thor (>= 0.20.3, < 2.0)
158
+ rake (>= 0.13)
159
+ thor (~> 1.0)
157
160
  rainbow (3.0.0)
158
- rake (13.0.3)
161
+ rake (13.0.6)
159
162
  regexp_parser (2.1.1)
160
- rexml (3.2.4)
161
- rubocop (1.11.0)
163
+ rexml (3.2.5)
164
+ rubocop (1.18.3)
162
165
  parallel (~> 1.10)
163
166
  parser (>= 3.0.0.0)
164
167
  rainbow (>= 2.2.2, < 4.0)
165
168
  regexp_parser (>= 1.8, < 3.0)
166
169
  rexml
167
- rubocop-ast (>= 1.2.0, < 2.0)
170
+ rubocop-ast (>= 1.7.0, < 2.0)
168
171
  ruby-progressbar (~> 1.7)
169
172
  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.10.1)
175
- rubocop (>= 0.90.0, < 2.0)
173
+ rubocop-ast (1.8.0)
174
+ parser (>= 3.0.1.1)
175
+ rubocop-minitest (0.14.0)
176
+ rubocop (>= 0.90, < 2.0)
177
+ rubocop-performance (1.11.4)
178
+ rubocop (>= 1.7.0, < 2.0)
176
179
  rubocop-ast (>= 0.4.0)
177
- rubocop-rails (2.9.1)
180
+ rubocop-rails (2.11.3)
178
181
  activesupport (>= 4.2.0)
179
182
  rack (>= 1.1)
180
- rubocop (>= 0.90.0, < 2.0)
183
+ rubocop (>= 1.7.0, < 2.0)
181
184
  ruby-progressbar (1.11.0)
182
- ruby_parser (3.15.1)
183
- sexp_processor (~> 4.9)
184
- sexp_processor (4.15.2)
185
+ ruby_parser (3.16.0)
186
+ sexp_processor (~> 4.15, >= 4.15.1)
187
+ sexp_processor (4.15.3)
185
188
  simple_form (5.1.0)
186
189
  actionpack (>= 5.2)
187
190
  activemodel (>= 5.2)
@@ -190,7 +193,7 @@ GEM
190
193
  simplecov-html (~> 0.11)
191
194
  simplecov_json_formatter (~> 0.1)
192
195
  simplecov-html (0.12.3)
193
- simplecov_json_formatter (0.1.2)
196
+ simplecov_json_formatter (0.1.3)
194
197
  sprockets (4.0.2)
195
198
  concurrent-ruby (~> 1.0)
196
199
  rack (> 1, < 3)
@@ -201,12 +204,11 @@ GEM
201
204
  sqlite3 (1.4.2)
202
205
  temple (0.8.2)
203
206
  thor (1.1.0)
204
- thread_safe (0.3.6)
205
207
  tilt (2.0.10)
206
- tzinfo (1.2.9)
207
- thread_safe (~> 0.1)
208
+ tzinfo (2.0.4)
209
+ concurrent-ruby (~> 1.0)
208
210
  unicode-display_width (2.0.0)
209
- websocket-driver (0.7.3)
211
+ websocket-driver (0.7.5)
210
212
  websocket-extensions (>= 0.1.0)
211
213
  websocket-extensions (0.1.5)
212
214
  will-paginate-i18n (0.1.15)
@@ -227,7 +229,7 @@ DEPENDENCIES
227
229
  jquery-rails (>= 3.1.0)
228
230
  minitest
229
231
  overcommit
230
- rails (~> 6.0.3, >= 6.0.3.2)
232
+ rails (~> 6.1.3, >= 6.1.3.2)
231
233
  rubocop
232
234
  rubocop-ast
233
235
  rubocop-minitest
@@ -240,4 +242,4 @@ DEPENDENCIES
240
242
  yard
241
243
 
242
244
  BUNDLED WITH
243
- 2.1.4
245
+ 2.2.21
@@ -16,7 +16,7 @@ module UiBibz::Concerns::Models::Searchable
16
16
 
17
17
  def self.generate_parameters
18
18
  {
19
- controller: @params[:controller],
19
+ controller: @arguments[:controller] || @params[:controller],
20
20
  param_id: @params[:id],
21
21
  params: @params,
22
22
  direction: @params[:direction],
@@ -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,18 +121,18 @@ 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}"
124
+ sql_subquery << "lower(CAST(#{value} AS TEXT)) LIKE :#{value}_#{i}"
123
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}"
130
+ sql_subquery << "lower(CAST(#{key_name}.#{value} AS TEXT)) LIKE :#{key_name}_#{value}_#{i}"
129
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}"
135
+ sql_subquery << "lower(CAST(#{to_s.underscore.pluralize.split('/').last}.#{attribute} AS TEXT)) LIKE :#{attribute}_#{i}"
134
136
  sql_attributes = sql_attributes.merge({ "#{attribute}_#{i}".to_sym => "%#{pattern}%" })
135
137
  end
136
138
  end
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.beta2'
6
+ BOOTSTRAP_VERSION = '5.0.2'
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.beta16'
15
+ VERSION = '3.0.0'
16
16
  AUTHORS = ['Thooams'].freeze
17
17
  end
@@ -20,7 +20,7 @@ module UiBibzForm
20
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
- abbr_html = content_tag('abbr', I18n.t(:"simple_form.required.mark", default: '*'), title: I18n.t(:"simple_form.required.text", default: 'required')) if required
23
+ abbr_html = content_tag('abbr', I18n.t(:'simple_form.required.mark', default: '*'), title: I18n.t(:'simple_form.required.text', default: 'required')) if required
24
24
 
25
25
  wrapper_html[:class] = wrapper_classes
26
26
 
@@ -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
@@ -5,9 +5,9 @@ module UiBibz::Ui::Concerns::NotificationConcern #:nodoc:
5
5
 
6
6
  included do
7
7
  def data_attributes
8
- self.class.const_get('DATA_ATTRIBUTES').map do |data_attribute|
8
+ self.class.const_get('DATA_ATTRIBUTES').filter_map do |data_attribute|
9
9
  options[data_attribute].to_s.blank? ? nil : { "data-bs-#{data_attribute}" => data_attribute_value(data_attribute) }
10
- end.compact.reduce(&:merge) || {}
10
+ end.reduce(&:merge) || {}
11
11
  end
12
12
  end
13
13
  end
@@ -46,7 +46,7 @@ module UiBibz::Ui::Core::Boxes::Components
46
46
  # Render html tag
47
47
  def pre_render
48
48
  if options[:collapse]
49
- content_tag :div, class: join_classes('collapse', show), id: options[:collapse], "data-bs-parent": "##{options[:parent_collapse]}" do
49
+ content_tag :div, class: join_classes('collapse', show), id: options[:collapse], 'data-bs-parent': "##{options[:parent_collapse]}" do
50
50
  content_tag :div, @items.join.html_safe, html_options
51
51
  end
52
52
  else
@@ -83,10 +83,10 @@ module UiBibz::Ui::Core::Forms::Buttons
83
83
  def collapse
84
84
  # Must be flat hash not deep hash
85
85
  {
86
- "data-bs-toggle": :collapse,
87
- "data-bs-target": "##{options[:collapse]}",
88
- "aria-controls": options[:collapse],
89
- "aria-expanded": options[:expand_collapse].nil? ? false : options[:expand_collapse]
86
+ 'data-bs-toggle': :collapse,
87
+ 'data-bs-target': "##{options[:collapse]}",
88
+ 'aria-controls': options[:collapse],
89
+ 'aria-expanded': options[:expand_collapse].nil? ? false : options[:expand_collapse]
90
90
  }
91
91
  end
92
92
 
@@ -78,9 +78,9 @@ module UiBibz::Ui::Core::Forms::Buttons
78
78
  def collapse
79
79
  # Must be flat hash not deep hash
80
80
  {
81
- "data-bs-toggle": :collapse,
82
- "aria-controls": options[:collapse],
83
- "aria-expanded": options[:expand_collaspe].nil? ? false : options[:expand_collaspe]
81
+ 'data-bs-toggle': :collapse,
82
+ 'aria-controls': options[:collapse],
83
+ 'aria-expanded': options[:expand_collaspe].nil? ? false : options[:expand_collaspe]
84
84
  }
85
85
  end
86
86
  end
@@ -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
@@ -53,7 +53,7 @@ module UiBibz::Ui::Core::Forms::Numbers
53
53
  sf.text_field formula_field_name, nil, text_field_formula_html_options
54
54
  sf.addon '=', class: 'formula-field-sign'
55
55
  sf.text_field content, nil, text_field_input_html_options
56
- sf.addon formula_field_alert_glyph, { class: 'formula-field-alert' }, { data: { "bs-toggle": 'tooltip' } }
56
+ sf.addon formula_field_alert_glyph, { class: 'formula-field-alert' }, { data: { 'bs-toggle': 'tooltip' } }
57
57
  sf.addon @options[:prepend] unless @options[:prepend].nil?
58
58
  end.render
59
59
  end
@@ -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
@@ -53,14 +53,14 @@ module UiBibz::Ui::Core::Forms::Numbers
53
53
  def header_min
54
54
  content_tag :div, class: 'slider-header-min' do
55
55
  concat content_tag :label, options[:label_min] || 'Min: ', for: options[:label_for_min]
56
- concat content_tag :span, options[:thumb_min], "data-unit": options[:unit] || options[:unit_min]
56
+ concat content_tag :span, options[:thumb_min], 'data-unit': options[:unit] || options[:unit_min]
57
57
  end
58
58
  end
59
59
 
60
60
  def header_max
61
61
  content_tag :div, class: 'slider-header-max' do
62
62
  concat content_tag :label, options[:label_max] || 'Max: ', for: options[:label_for_max]
63
- concat content_tag :span, options[:thumb_max], "data-unit": options[:unit] || options[:unit_max]
63
+ concat content_tag :span, options[:thumb_max], 'data-unit': options[:unit] || options[:unit_max]
64
64
  end
65
65
  end
66
66
 
@@ -116,7 +116,7 @@ module UiBibz::Ui::Core::Forms::Surrounds
116
116
  end
117
117
 
118
118
  def dropdown_select_field(content = nil, options = nil, html_options = nil, &block)
119
- html_options = (html_options || {}).merge("data-wrapper-classes": 'input-group-btn')
119
+ html_options = (html_options || {}).merge('data-wrapper-classes': 'input-group-btn')
120
120
  @items << UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new(content, options, html_options, &block).render
121
121
  end
122
122
 
@@ -93,7 +93,7 @@ module UiBibz::Ui::Core::Navigations
93
93
  private
94
94
 
95
95
  def component_html_options
96
- super.merge({ "arial-label": 'breadcrumb' })
96
+ super.merge({ 'arial-label': 'breadcrumb' })
97
97
  end
98
98
 
99
99
  def model_name
@@ -50,7 +50,7 @@ module UiBibz::Ui::Core::Navigations::Components
50
50
  private
51
51
 
52
52
  def component_html_options
53
- super.merge(options[:current] ? { "aria-current": 'page' } : {})
53
+ super.merge(options[:current] ? { 'aria-current': 'page' } : {})
54
54
  end
55
55
 
56
56
  def component_html_classes
@@ -45,7 +45,7 @@ module UiBibz::Ui::Core::Navigations
45
45
  when 'nav-tabs'
46
46
  html_tag_base
47
47
  when 'list-group'
48
- html_tag_base.merge("aria-controls": sanitize_text(content).parameterize)
48
+ html_tag_base.merge('aria-controls': sanitize_text(content).parameterize)
49
49
  else
50
50
  {}
51
51
  end.merge(options[:a_html] || {})
@@ -58,7 +58,7 @@ module UiBibz::Ui::Core::Navigations
58
58
  def collapse
59
59
  {
60
60
  role: 'button',
61
- data: { "bs-toggle": :collapse },
61
+ data: { 'bs-toggle': :collapse },
62
62
  aria: {
63
63
  controls: options[:collapse],
64
64
  expanded: options[:active_collapse].nil? ? false : options[:active_collapse]
@@ -159,7 +159,7 @@ module UiBibz::Ui::Core::Navigations
159
159
  end
160
160
 
161
161
  def navbar_toggle_button_html
162
- content_tag :button, '☰', class: 'navbar-toggler hidden-sm-up', type: :button, data: { "bs-toggle": 'collapse', "bs-target": "##{id}" }
162
+ content_tag :button, '☰', class: 'navbar-toggler hidden-sm-up', type: :button, data: { 'bs-toggle': 'collapse', 'bs-target': "##{id}" }
163
163
  end
164
164
 
165
165
  def expand_size
@@ -56,7 +56,7 @@ module UiBibz::Ui::Core::Notifications::Components
56
56
  end
57
57
 
58
58
  def component_html_options
59
- { "aria-valuenow": value, "aria-valuemin": min, "aria-valuemax": max, style: "width: #{value}%", role: 'progressbar' }
59
+ { 'aria-valuenow': value, 'aria-valuemin': min, 'aria-valuemax': max, style: "width: #{value}%", role: 'progressbar' }
60
60
  end
61
61
 
62
62
  def striped
@@ -60,7 +60,7 @@ module UiBibz::Ui::Core::Notifications::Components
60
60
  end
61
61
 
62
62
  def close_button
63
- content_tag :button, '', class: 'ml-2 mb-1 btn-close', "data-bs-dismiss": 'toast', "aria-label": 'Close'
63
+ content_tag :button, '', class: 'ml-2 mb-1 btn-close', 'data-bs-dismiss': 'toast', 'aria-label': 'Close'
64
64
  end
65
65
 
66
66
  def component_html_classes
@@ -76,17 +76,33 @@ 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
89
- { role: 'alert', "aria-live": 'assertive', "aria-atomic": true }
105
+ { role: 'alert', 'aria-live': 'assertive', 'aria-atomic': true }
90
106
  end
91
107
 
92
108
  def component_html_data
@@ -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
@@ -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
@@ -57,7 +57,7 @@ module UiBibz::Ui::Ux::Tables
57
57
  end
58
58
 
59
59
  def columns
60
- @columns ||= Columns.new(model.new.attributes.keys.map { |record| Column.new(record, { name: record.humanize }) })
60
+ @columns ||= Columns.new(model.attribute_names.map { |attribute_name| Column.new(attribute_name, { name: attribute_name.humanize }) })
61
61
  end
62
62
 
63
63
  attr_reader :model
@@ -172,12 +172,16 @@ module UiBibz::Ui::Ux::Tables
172
172
 
173
173
  # Maybe create a class for td_content
174
174
  def td_content(record, col)
175
- content = col.count ? record.send(col.data_index).count : record.send(col.data_index)
175
+ begin
176
+ content = col.count ? record.send(col.data_index).count : record.send(col.data_index)
177
+ rescue StandardError
178
+ content = nil
179
+ end
176
180
  unless content.nil?
177
181
  content = content.strftime(col.date_format) unless col.date_format.nil?
178
182
  content = link_to content, action.inject_url(col.link, record) unless col.link.nil?
179
- content = col.format.call(@store.records, record) unless col.format.nil?
180
183
  end
184
+ content = col.format.call(@store.records, record) unless col.format.nil?
181
185
  content = As.new(col, record, content, @options).render unless col.as.nil?
182
186
  content
183
187
  end
@@ -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
 
@@ -256,7 +256,7 @@ test1</textarea></div></form>"
256
256
  end
257
257
  end
258
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 data-toggle=\"buttons\" 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>"
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
260
 
261
261
  assert_equal expected, actual
262
262
  end
@@ -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
@@ -129,6 +129,13 @@ class TableTest < ActionView::TestCase
129
129
  assert_equal expected, actual
130
130
  end
131
131
 
132
+ test 'table actionable with antoher controller' do
133
+ @users = User.table_search_pagination(params, session, { controller: "areas" })
134
+ @store = UiBibz::Ui::Ux::Tables::Store.new @users
135
+
136
+ assert_equal("areas", @store.controller)
137
+ end
138
+
132
139
  test 'table non actionable header' do
133
140
  options = { actionable: false }
134
141
  action = UiBibz::Ui::Ux::Tables::Actionable.new(@store, options)
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
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
27
27
  s.require_paths = %w[lib vendor]
28
28
 
29
29
  # Rails gems
30
- s.add_development_dependency 'rails', '~> 6.0.3', '>= 6.0.3.2'
30
+ s.add_development_dependency 'rails', '~> 6.1.3', '>= 6.1.3.2'
31
31
 
32
32
  # Remove these dependencies after
33
33
  s.add_dependency 'will_paginate', '~> 3.3.0'
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.beta16
4
+ version: 3.0.0
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-03-10 00:00:00.000000000 Z
11
+ date: 2021-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 6.0.3
19
+ version: 6.1.3
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 6.0.3.2
22
+ version: 6.1.3.2
23
23
  type: :development
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: 6.0.3
29
+ version: 6.1.3
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 6.0.3.2
32
+ version: 6.1.3.2
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: will_paginate
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -254,7 +254,7 @@ dependencies:
254
254
  - - ">="
255
255
  - !ruby/object:Gem::Version
256
256
  version: '0'
257
- description: A Rails Interface Framework using Bootstrap 5.0.0.beta2.
257
+ description: A Rails Interface Framework using Bootstrap 5.0.2.
258
258
  email: thomas@hummel.link
259
259
  executables:
260
260
  - test
@@ -671,18 +671,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
671
671
  requirements:
672
672
  - - ">="
673
673
  - !ruby/object:Gem::Version
674
- version: '2.7'
674
+ version: 3.0.0
675
675
  required_rubygems_version: !ruby/object:Gem::Requirement
676
676
  requirements:
677
- - - ">"
677
+ - - ">="
678
678
  - !ruby/object:Gem::Version
679
- version: 1.3.1
679
+ version: '0'
680
680
  requirements: []
681
- rubygems_version: 3.1.2
681
+ rubygems_version: 3.2.21
682
682
  signing_key:
683
683
  specification_version: 4
684
684
  summary: Ui Bibz is an Ui Framework that allows you to build an interface very quickly
685
- and simply using Bootstrap 5.0.0.beta2.
685
+ and simply using Bootstrap 5.0.2.
686
686
  test_files:
687
687
  - test/dummy/README.rdoc
688
688
  - test/dummy/Rakefile