ui_bibz 4.0.0.beta18 → 4.0.0.beta21

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 55234cd5c8312bb328c5548bd848fc063f3c06ae53cf0920c5eae8ca63df2e2c
4
- data.tar.gz: 12848022bd01b16bc0c4c5d00f8400776282f235c7d7ca27cf78a806cc2943d7
3
+ metadata.gz: a4cb50c5c79d9e893d861d7245501442920e614e1dd92163e4987cfdab24136f
4
+ data.tar.gz: 573b3dea48e44fbc2f99ff3ac1e54f76d79fd23460af00d3cceebb5368342111
5
5
  SHA512:
6
- metadata.gz: caab98f20585d7df92baa51d5a150c91280e289943cf2eea9ad7a31718e6d86ac4926273cc11eb3bc52e9b7a1aa789c7022dbd23ff7ebb8ec74e133daa5276cd
7
- data.tar.gz: cc6866cedf7a79c282df902bac683594f95fab9941d031ee9bf3d3be38e1cea660809fc82a372d3e90fef9864c581c8c7c3e3bcc426c267453115cd05ff9094a
6
+ metadata.gz: f47132d8c1c8e911b8eac29dbc0ec39cf69b5278ee18722a379295a5c378d387f18da2ea6f83dd6b8b2dd75aefe9cb93cb22facf3270677d0177c8d16155308e
7
+ data.tar.gz: a355f8c9c4e5cc16fe015fd1dc054fafe63a7ecda701d669ae2c2606e6df3682fed0022466e67c9b3d962657321a21947d15b12c0a39048df4a4592ba2f60dfe
data/.rubocop.yml CHANGED
@@ -1,8 +1,10 @@
1
1
  require:
2
2
  - rubocop-ast
3
+
4
+ plugins:
3
5
  - rubocop-performance
4
- - rubocop-rails
5
6
  - rubocop-minitest
7
+ - rubocop-rails
6
8
 
7
9
  Layout/LineLength:
8
10
  Enabled: false
@@ -13,24 +15,24 @@ AllCops:
13
15
  Lint/UselessAssignment:
14
16
  Enabled: true
15
17
  Exclude:
16
- - 'test/ui/ux/tables/table_test.rb'
18
+ - "test/ui/ux/tables/table_test.rb"
17
19
 
18
20
  Style/AsciiComments:
19
21
  Enabled: true
20
22
  Exclude:
21
- - 'test/**/**/**/**/*'
23
+ - "test/**/**/**/**/*"
22
24
 
23
25
  Metrics/ClassLength:
24
26
  Enabled: false
25
27
 
26
28
  Style/FormatString:
27
29
  Exclude:
28
- - 'config/initializers/will_paginate.rb'
30
+ - "config/initializers/will_paginate.rb"
29
31
 
30
32
  Style/StringLiterals:
31
33
  Enabled: true
32
34
  Exclude:
33
- - 'test/**/**/**/**/*'
35
+ - "test/**/**/**/**/*"
34
36
 
35
37
  Style/ClassAndModuleChildren:
36
38
  Enabled: false
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ui_bibz (4.0.0.beta18)
4
+ ui_bibz (4.0.0.beta21)
5
5
  bootstrap (~> 5.3.3)
6
6
  dartsass-rails
7
7
  rails (>= 7.1.0)
@@ -81,22 +81,19 @@ GEM
81
81
  securerandom (>= 0.3)
82
82
  tzinfo (~> 2.0, >= 2.0.5)
83
83
  uri (>= 0.13.1)
84
- ast (2.4.2)
85
- autoprefixer-rails (10.4.19.0)
86
- execjs (~> 2)
84
+ ast (2.4.3)
87
85
  awesome_print (1.9.2)
88
86
  base64 (0.2.0)
89
87
  benchmark (0.4.0)
90
88
  bigdecimal (3.1.9)
91
- bootstrap (5.3.3)
92
- autoprefixer-rails (>= 9.1.0)
89
+ bootstrap (5.3.5)
93
90
  popper_js (>= 2.11.8, < 3)
94
91
  builder (3.3.0)
95
- byebug (11.1.3)
92
+ byebug (12.0.0)
96
93
  childprocess (5.1.0)
97
94
  logger (~> 1.5)
98
95
  concurrent-ruby (1.3.5)
99
- connection_pool (2.5.0)
96
+ connection_pool (2.5.2)
100
97
  crass (1.0.6)
101
98
  dartsass-rails (0.5.1)
102
99
  railties (>= 6.0.0)
@@ -105,7 +102,6 @@ GEM
105
102
  docile (1.4.1)
106
103
  drb (2.2.1)
107
104
  erubi (1.13.1)
108
- execjs (2.10.0)
109
105
  factory_bot (4.11.1)
110
106
  activesupport (>= 3.0.0)
111
107
  factory_bot_rails (4.11.1)
@@ -113,10 +109,10 @@ GEM
113
109
  railties (>= 3.0.0)
114
110
  globalid (1.2.1)
115
111
  activesupport (>= 6.1)
116
- google-protobuf (4.30.1-x86_64-darwin)
112
+ google-protobuf (4.30.2-x86_64-darwin)
117
113
  bigdecimal
118
114
  rake (>= 13)
119
- google-protobuf (4.30.1-x86_64-linux)
115
+ google-protobuf (4.30.2-x86_64-linux)
120
116
  bigdecimal
121
117
  rake (>= 13)
122
118
  haml (6.3.0)
@@ -136,14 +132,14 @@ GEM
136
132
  railties (>= 6.0.0)
137
133
  iniparse (1.5.0)
138
134
  io-console (0.8.0)
139
- irb (1.15.1)
135
+ irb (1.15.2)
140
136
  pp (>= 0.6.0)
141
137
  rdoc (>= 4.0.0)
142
138
  reline (>= 0.4.2)
143
139
  json (2.10.2)
144
140
  language_server-protocol (3.17.0.4)
145
141
  lint_roller (1.1.0)
146
- logger (1.6.6)
142
+ logger (1.7.0)
147
143
  loofah (2.24.0)
148
144
  crass (~> 1.0.2)
149
145
  nokogiri (>= 1.12.0)
@@ -155,7 +151,7 @@ GEM
155
151
  marcel (1.0.4)
156
152
  mini_mime (1.1.5)
157
153
  minitest (5.25.5)
158
- net-imap (0.5.6)
154
+ net-imap (0.5.7)
159
155
  date
160
156
  net-protocol
161
157
  net-pop (0.1.2)
@@ -165,22 +161,23 @@ GEM
165
161
  net-smtp (0.5.1)
166
162
  net-protocol
167
163
  nio4r (2.7.4)
168
- nokogiri (1.18.4-x86_64-darwin)
164
+ nokogiri (1.18.8-x86_64-darwin)
169
165
  racc (~> 1.4)
170
- nokogiri (1.18.4-x86_64-linux-gnu)
166
+ nokogiri (1.18.8-x86_64-linux-gnu)
171
167
  racc (~> 1.4)
172
168
  overcommit (0.67.1)
173
169
  childprocess (>= 0.6.3, < 6)
174
170
  iniparse (~> 1.4)
175
171
  rexml (>= 3.3.9)
176
- parallel (1.26.3)
177
- parser (3.3.7.1)
172
+ parallel (1.27.0)
173
+ parser (3.3.8.0)
178
174
  ast (~> 2.4.1)
179
175
  racc
180
176
  popper_js (2.11.8)
181
177
  pp (0.6.2)
182
178
  prettyprint
183
179
  prettyprint (0.2.0)
180
+ prism (1.4.0)
184
181
  propshaft (1.1.0)
185
182
  actionpack (>= 7.0.0)
186
183
  activesupport (>= 7.0.0)
@@ -192,7 +189,7 @@ GEM
192
189
  puma (6.6.0)
193
190
  nio4r (~> 2.0)
194
191
  racc (1.8.1)
195
- rack (3.1.12)
192
+ rack (3.1.13)
196
193
  rack-session (2.1.0)
197
194
  base64 (>= 0.1.0)
198
195
  rack (>= 3.0.0)
@@ -231,13 +228,13 @@ GEM
231
228
  zeitwerk (~> 2.6)
232
229
  rainbow (3.1.1)
233
230
  rake (13.2.1)
234
- rdoc (6.12.0)
231
+ rdoc (6.13.1)
235
232
  psych (>= 4.0.0)
236
233
  regexp_parser (2.10.0)
237
- reline (0.6.0)
234
+ reline (0.6.1)
238
235
  io-console (~> 0.5)
239
236
  rexml (3.4.1)
240
- rubocop (1.74.0)
237
+ rubocop (1.75.3)
241
238
  json (~> 2.3)
242
239
  language_server-protocol (~> 3.17.0.2)
243
240
  lint_roller (~> 1.1.0)
@@ -245,30 +242,31 @@ GEM
245
242
  parser (>= 3.3.0.2)
246
243
  rainbow (>= 2.2.2, < 4.0)
247
244
  regexp_parser (>= 2.9.3, < 3.0)
248
- rubocop-ast (>= 1.38.0, < 2.0)
245
+ rubocop-ast (>= 1.44.0, < 2.0)
249
246
  ruby-progressbar (~> 1.7)
250
247
  unicode-display_width (>= 2.4.0, < 4.0)
251
- rubocop-ast (1.38.1)
252
- parser (>= 3.3.1.0)
253
- rubocop-minitest (0.37.1)
248
+ rubocop-ast (1.44.1)
249
+ parser (>= 3.3.7.2)
250
+ prism (~> 1.4)
251
+ rubocop-minitest (0.38.0)
254
252
  lint_roller (~> 1.1)
255
- rubocop (>= 1.72.1, < 2.0)
253
+ rubocop (>= 1.75.0, < 2.0)
256
254
  rubocop-ast (>= 1.38.0, < 2.0)
257
- rubocop-performance (1.24.0)
255
+ rubocop-performance (1.25.0)
258
256
  lint_roller (~> 1.1)
259
- rubocop (>= 1.72.1, < 2.0)
257
+ rubocop (>= 1.75.0, < 2.0)
260
258
  rubocop-ast (>= 1.38.0, < 2.0)
261
- rubocop-rails (2.30.3)
259
+ rubocop-rails (2.31.0)
262
260
  activesupport (>= 4.2.0)
263
261
  lint_roller (~> 1.1)
264
262
  rack (>= 1.1)
265
- rubocop (>= 1.72.1, < 2.0)
263
+ rubocop (>= 1.75.0, < 2.0)
266
264
  rubocop-ast (>= 1.38.0, < 2.0)
267
265
  ruby-progressbar (1.13.0)
268
- sass-embedded (1.85.1-x86_64-darwin)
269
- google-protobuf (~> 4.29)
270
- sass-embedded (1.85.1-x86_64-linux-gnu)
271
- google-protobuf (~> 4.29)
266
+ sass-embedded (1.87.0-x86_64-darwin)
267
+ google-protobuf (~> 4.30)
268
+ sass-embedded (1.87.0-x86_64-linux-gnu)
269
+ google-protobuf (~> 4.30)
272
270
  securerandom (0.4.1)
273
271
  simple_form (5.3.1)
274
272
  actionpack (>= 5.2)
@@ -281,7 +279,7 @@ GEM
281
279
  simplecov_json_formatter (0.1.4)
282
280
  sqlite3 (2.6.0-x86_64-darwin)
283
281
  sqlite3 (2.6.0-x86_64-linux-gnu)
284
- stringio (3.1.5)
282
+ stringio (3.1.7)
285
283
  temple (0.10.3)
286
284
  thor (1.3.2)
287
285
  tilt (2.6.0)
data/lib/ui_bibz/infos.rb CHANGED
@@ -12,6 +12,6 @@ module UiBibz
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 = '4.0.0.beta18'
15
+ VERSION = '4.0.0.beta21'
16
16
  AUTHORS = ['Thooams'].freeze
17
17
  end
@@ -18,8 +18,8 @@ module UiBibzForm
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
20
  required = surround_field.required_fields.any?(true)
21
- wrapper_classes = UiBibz::Builders::HtmlClassesBuilder.join_classes(('has-error' if errors_text.present?), wrapper_html.try(:[], :class))
22
- label_classes = UiBibz::Builders::HtmlClassesBuilder.join_classes(('required' if required), 'control-label')
21
+ wrapper_classes = UiBibz::Builders::HtmlClassesBuilder.join_classes(errors_text.present? ? 'has-error' : nil, wrapper_html.try(:[], :class))
22
+ label_classes = UiBibz::Builders::HtmlClassesBuilder.join_classes(required ? 'required' : nil, '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
24
24
 
25
25
  wrapper_html[:class] = wrapper_classes
@@ -71,6 +71,10 @@ module UiBibz::Ui::Core::Forms::Buttons
71
71
  options[:url] || "##{options[:collapse]}"
72
72
  end
73
73
 
74
+ def component_html_data
75
+ @data_html_options_builder.add 'confirm', value: options[:confirm]
76
+ end
77
+
74
78
  def component_html_options
75
79
  super.merge({ role: :button })
76
80
  end
@@ -79,7 +79,7 @@ module UiBibz::Ui::Core::Forms::Choices
79
79
  @items << @options[:form].input(attribute_name, new_options, &)
80
80
  obj = @options[:form].object
81
81
  @errors << obj.errors[attribute_name] unless obj.errors[attribute_name].empty?
82
- @required_fields << (obj._validators[attribute_name].try(:first).instance_of?(::ActiveRecord::Validations::PresenceValidator))
82
+ @required_fields << obj._validators[attribute_name].try(:first).instance_of?(::ActiveRecord::Validations::PresenceValidator)
83
83
  end
84
84
 
85
85
  private
@@ -94,7 +94,7 @@ module UiBibz::Ui::Core::Forms::Dropdowns::Components
94
94
  end
95
95
 
96
96
  def button_html
97
- content_tag :a, button_content, { class: join_classes(state, 'dropdown-toggle'), role: 'button', 'data-bs-toggle' => 'dropdown', 'aria-expanded' => false, 'id' => id }
97
+ content_tag :a, button_content, { class: join_classes(state, 'dropdown-toggle', options.dig(:html_button, :class)), role: 'button', 'data-bs-toggle' => 'dropdown', 'aria-expanded' => false, 'id' => id }
98
98
  end
99
99
 
100
100
  def ul_html
@@ -40,30 +40,13 @@ module UiBibz::Ui::Core::Forms::Dropdowns::Components
40
40
  # 'Home'
41
41
  # end.render
42
42
  #
43
- class DropdownLink < UiBibz::Ui::Core::Component
43
+ class DropdownLink < UiBibz::Ui::Core::Navigations::Link
44
44
  # See UiBibz::Ui::Core::Component.initialize
45
- def initialize(...)
46
- super
47
- @html_options = @html_options.merge(link_html_options)
48
- end
49
-
50
- # Render html tag
51
- def pre_render
52
- link_to glyph_and_content_html, link_url, html_options
53
- end
54
45
 
55
46
  private
56
47
 
57
48
  def component_html_classes
58
49
  'dropdown-item'
59
50
  end
60
-
61
- def link_url
62
- options[:url] || '#'
63
- end
64
-
65
- def link_html_options
66
- @options[:link_html_options].nil? ? {} : @options[:link_html_options]
67
- end
68
51
  end
69
52
  end
@@ -124,9 +124,9 @@ module UiBibz::Ui::Core::Forms::Dropdowns
124
124
  def button_html
125
125
  html_button = options[:html_button] || {}
126
126
  if options[:tag] == :a
127
- content_tag dropdown_tag, button_content, { class: join_classes('btn', button_status, state, size, 'dropdown-toggle'), role: 'button', 'data-bs-toggle' => 'dropdown', 'aria-expanded' => false, 'id' => id }.merge(html_button)
127
+ content_tag dropdown_tag, button_content, { class: join_classes('btn', button_status, state, size, 'dropdown-toggle', html_button.delete(:class)), role: 'button', 'data-bs-toggle' => 'dropdown', 'aria-expanded' => false, 'id' => id }.merge(html_button)
128
128
  else
129
- content_tag dropdown_tag, button_content, { class: join_classes('btn', button_status, state, size, 'dropdown-toggle'), type: 'button', 'data-bs-toggle' => 'dropdown', 'aria-expanded' => false, 'id' => id }.merge(html_button)
129
+ content_tag dropdown_tag, button_content, { class: join_classes('btn', button_status, state, size, 'dropdown-toggle', html_button.delete(:class)), type: 'button', 'data-bs-toggle' => 'dropdown', 'aria-expanded' => false, 'id' => id }.merge(html_button)
130
130
  end
131
131
  end
132
132
 
@@ -72,7 +72,7 @@ module UiBibz::Ui::Core::Forms::Surrounds
72
72
  @items << @options[:form].input(attribute_name, options.merge({ label: false, wrapper: false, error: false }), &)
73
73
  obj = @options[:form].object
74
74
  @errors << obj.errors[attribute_name] unless obj.errors[attribute_name].empty?
75
- @required_fields << (obj._validators[attribute_name].try(:first).instance_of?(::ActiveRecord::Validations::PresenceValidator))
75
+ @required_fields << obj._validators[attribute_name].try(:first).instance_of?(::ActiveRecord::Validations::PresenceValidator)
76
76
  end
77
77
 
78
78
  def glyph(content = nil, options = {}, html_options = nil, &)
@@ -55,6 +55,10 @@ module UiBibz::Ui::Core::Navigations
55
55
  opts
56
56
  end
57
57
 
58
+ def component_html_data
59
+ @data_html_options_builder.add 'confirm', value: options[:confirm]
60
+ end
61
+
58
62
  def collapse
59
63
  {
60
64
  role: 'button',
@@ -97,7 +97,7 @@ module UiBibz::Ui::Core::Notifications
97
97
  stacked_colors.map.with_index do |color, i|
98
98
  if percentages[0, i].sum <= content.to_f
99
99
  if content.to_f.between?(percentages[0, i].sum, percentages[0, i + 1].sum)
100
- UiBibz::Ui::Core::Notifications::Components::Bar.new((content.to_f * percentages[i] / 100), min: 0, striped: options[:striped], animated: options[:animated], max: 100, status: color).render
100
+ UiBibz::Ui::Core::Notifications::Components::Bar.new(content.to_f * percentages[i] / 100, min: 0, striped: options[:striped], animated: options[:animated], max: 100, status: color).render
101
101
  else
102
102
  UiBibz::Ui::Core::Notifications::Components::Bar.new(percentages[i], min: 0, striped: options[:striped], animated: options[:animated], max: 100, status: color).render
103
103
  end
@@ -53,7 +53,7 @@ module UiBibz::Ui::Ux::Tables
53
53
  [
54
54
  UiBibz::Ui::Core::Forms::Dropdowns::Components::DropdownLink.new(show_name, url: { controller: @store.actions_controller, action: 'show' }.merge({ @store.id_key => @store.id_key }), glyph: 'eye').render,
55
55
  UiBibz::Ui::Core::Forms::Dropdowns::Components::DropdownLink.new(edit_name, url: { controller: @store.actions_controller, action: 'edit' }.merge({ @store.id_key => @store.id_key }), glyph: 'edit').render,
56
- UiBibz::Ui::Core::Forms::Dropdowns::Components::DropdownLink.new(delete_name, { glyph: 'trash', url: { controller: @store.actions_controller, action: 'destroy' }.merge({ @store.id_key => @store.id_key }), link_html_options: { data: { confirm: 'Are you sure?', method: :delete } } }).render
56
+ UiBibz::Ui::Core::Forms::Dropdowns::Components::DropdownLink.new(delete_name, { glyph: 'trash', url: { controller: @store.actions_controller, action: 'destroy' }.merge({ @store.id_key => @store.id_key }), link_html_options: { data: { turbo_confirm: 'Are you sure?', turbo_method: :delete } } }).render
57
57
  ]
58
58
  end
59
59
 
@@ -20,6 +20,8 @@ module UiBibz::Ui::Ux::Tables
20
20
  when :input
21
21
  inp_options = (@col.input_options || {}).merge({ label: false })
22
22
  @form.input @col.data_index, inp_options
23
+ when :association
24
+ @record.send(@col.data_index).send(@col.association_attribute)
23
25
  end
24
26
  end
25
27
 
@@ -4,7 +4,7 @@ module UiBibz::Ui::Ux::Tables
4
4
  class Column < UiBibz::Ui::Core::Component
5
5
  attr_accessor :hidden, :link, :name, :input_options, :class, :as, :data_index,
6
6
  :date_format, :sort, :format, :count, :custom_sort, :parent, :id, :progress_options,
7
- :sortable
7
+ :sortable, :association_attribute
8
8
 
9
9
  def initialize(content = nil, options = nil, html_options = nil, &)
10
10
  super
@@ -24,6 +24,7 @@ module UiBibz::Ui::Ux::Tables
24
24
  @hidden = @options[:hidden]
25
25
  @sortable = @options[:sortable]
26
26
  @input_options = @options[:input_options]
27
+ @association_attribute = @options[:association_attribute]
27
28
  @progress_options = @options[:progress_options] || {}
28
29
  end
29
30
 
data/lib/ui_bibz.rb CHANGED
@@ -231,6 +231,8 @@ module UiBibz
231
231
  autoload :TableSearchField, 'ui_bibz/ui/ux/tables/table_search_field'
232
232
  autoload :TablePagination, 'ui_bibz/ui/ux/tables/table_pagination'
233
233
  autoload :TablePaginationPerPage, 'ui_bibz/ui/ux/tables/table_pagination_per_page'
234
+ autoload :Sortable, 'ui_bibz/ui/ux/tables/extensions/sortable'
235
+ autoload :Column, 'ui_bibz/ui/ux/tables/components/column'
234
236
  end
235
237
 
236
238
  module Containers
@@ -24,4 +24,11 @@ class LinkTest < ActionView::TestCase
24
24
 
25
25
  assert_equal expected, actual
26
26
  end
27
+
28
+ test 'confirm option' do
29
+ actual = ui_link 'My link', url: '#link', confirm: "Are you sure?"
30
+ expected = "<a data-confirm=\"Are you sure?\" href=\"#link\">My link</a>"
31
+
32
+ assert_equal expected, actual
33
+ end
27
34
  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: 4.0.0.beta18
4
+ version: 4.0.0.beta21
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: 2025-03-15 00:00:00.000000000 Z
11
+ date: 2025-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bootstrap