web47core 3.2.36 → 3.2.38

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: 51addb55203d5e9bca94ca014394dc522b41ef51c1dabb32e2b1fa294f1aa1b8
4
- data.tar.gz: 341d01b151ce0c08ee6409c434a37f292dd424c8bcea2647f0434bf7e52cdb3f
3
+ metadata.gz: 36566c9389b2ee92272fe7432399a3d55029ed0bdaa52ffcd14c2db78aa2a031
4
+ data.tar.gz: 883b36a38dd85e4fa04b6204ee8d3da95a16ccdd4ee66faa34f6b93780786916
5
5
  SHA512:
6
- metadata.gz: f3278e6e57ed98a3e54910cb10676844554e8e418397a991193342b09c5500a6bc6915cae2f11a5d616f4699ceeb18f35c0bbfba0400342a577cbb23d5dbd035
7
- data.tar.gz: 73694c5acd82fbd7879289fe536be74cef0024073ae3f182333ec97323907dc0c040f44b1df16eea53c5908473cae84ada2cc10af6fc97b6a12ef76d2bfc1e49
6
+ metadata.gz: 8c6cb73735a771a00c40a7d305f7c8bfc6aa065bafa3ca92683e14c6decea87c7dbdf79a869d14c2e651737323661a323d2b0dd131b2434bebf6e886653a8abc
7
+ data.tar.gz: 3c022b643ec889afc646d67974825ccda35656e8a0ac5b5d929bf3845239a993cbe9832f51cf2c0bd259f6eb680cff6926c834ca680a756d1fd88da98c8f75cf
@@ -115,14 +115,6 @@ module CoreLinkHelper
115
115
  end
116
116
  end
117
117
 
118
- def edit_modal_tag(obj, path, _options = {})
119
- return unless can? :edit, obj
120
-
121
- content_tag(:a, href: path, class: 'modal-action') do
122
- concat(I18n.t('ui_form.actions.edit'))
123
- end
124
- end
125
-
126
118
  #
127
119
  # Restart a thingy
128
120
  #
@@ -69,15 +69,20 @@ module ModelModalHelper
69
69
  end
70
70
 
71
71
  def model_modal_action(model, _options = {})
72
- content_tag(:a, class: 'modal-trigger', href: "#modal-#{model.id}") do
72
+ content_tag(:a, data: { bs_toggle: :modal, bs_target: "#modal-#{model.id}" }) do
73
73
  concat(model.name)
74
74
  end
75
75
  end
76
76
 
77
77
  def model_modal(model, edit_path, options = {})
78
- content_tag(:div, class: 'modal', id: "modal-#{model.id}") do
78
+ content_tag(:div, class: 'modal', id: "modal-#{model.id}", tabindex: -1) do
79
+ concat(model_modal_dialog(model, options))
80
+ end
81
+ end
82
+
83
+ def model_modal_dialog(model, edit_path, options = {})
84
+ content_tag(:div, class: 'modal-dialog', role: :document) do
79
85
  concat(model_modal_content(model, options))
80
- concat(model_modal_footer(model, edit_path))
81
86
  end
82
87
  end
83
88
 
@@ -87,27 +92,47 @@ module ModelModalHelper
87
92
 
88
93
  def model_modal_content(model, options = {})
89
94
  content_tag(:div, class: 'modal-content') do
95
+ concat(model_modal_header(model, edit_path, options))
96
+ concat(model_modal_body(model, edit_path, options))
97
+ concat(model_modal_footer(model, edit_path))
98
+ end
99
+ end
100
+
101
+ def model_modal_header(model, edit_path, options = {})
102
+ content_tag(:div, class: 'modal-header') do
90
103
  concat(content_tag(:h2) { model.name })
91
- concat(content_tag(:div, class: 'row') do
92
- concat(model_modal_tabs(model, options))
93
- concat(model_modal_fields_tab(model, options))
94
- concat(model_modal_standard_tab(model, options))
95
- concat(model_modal_logs_tab(model, options)) if model.respond_to?(:logs) && options[:show_audit_logs]
96
- end)
104
+ concat(tag(:button, class: 'btn-close', data: { bs_dismiss: :modal }, aria_label: :close))
97
105
  end
98
106
  end
99
107
 
108
+ def model_modal_body(model, edit_path, options = {})
109
+ concat(content_tag(:div, class: 'model-body') do
110
+ concat(model_modal_tabs(model, options))
111
+ concat(model_modal_tab_content(model, options))
112
+ end)
113
+ end
114
+
100
115
  def model_modal_tabs(model, _options = {})
101
- content_tag(:div, class: 'col s12') do
102
- concat(content_tag(:ul, class: 'tabs tabs-fixed-width') do
103
- concat(content_tag(:li, class: 'tab') do
104
- content_tag(:a, href: "#field-tab-#{model.id}") { model.class.to_s.titleize }
105
- end)
106
- concat(content_tag(:li, class: 'tab') { content_tag(:a, href: "#standard-tab-#{model.id}") { 'Details' } })
107
- if model.respond_to?(:logs)
108
- concat(content_tag(:li, class: 'tab') { content_tag(:a, href: "#logs-tab-#{model.id}") { 'Logs' } })
109
- end
116
+ content_tag(:ul, class: 'nav nav-tabs', data: { bs_toggle: :tabs }) do
117
+ concat(content_tag(:li, class: 'nav-item') do
118
+ content_tag(:a, class: 'nav-link', href: "#field-tab-#{model.id}", data: { bs_toggle: :tab }) { model.class.to_s.titleize }
110
119
  end)
120
+ concat(content_tag(:li, class: 'nav-item') do
121
+ content_tag(:a, class: 'nav-link', href: "#standard-tab-#{model.id}", data: { bs_toggle: :tab }) { 'Details' }
122
+ end)
123
+ if model.respond_to?(:logs)
124
+ concat(content_tag(:li, class: 'nav-item') do
125
+ content_tag(:a, class: 'nav-item', href: "#logs-tab-#{model.id}", data: { bs_toggler: :tab }) { 'Logs' }
126
+ end)
127
+ end
128
+ end
129
+ end
130
+
131
+ def model_modal_tab_content(model, options = {})
132
+ content_tag(:div, class: 'tab-content') do
133
+ concat(model_modal_fields_tab(model, options))
134
+ concat(model_modal_standard_tab(model, options))
135
+ # concat(model_modal_logs_tab(model, options)) if model.respond_to?(:logs) && options[:show_audit_logs]
111
136
  end
112
137
  end
113
138
 
@@ -118,7 +143,7 @@ module ModelModalHelper
118
143
  end
119
144
 
120
145
  def model_modal_fields_tab(model, options = {})
121
- content_tag(:div, id: "field-tab-#{model.id}", class: 'col s12') do
146
+ content_tag(:div, id: "field-tab-#{model.id}", class: 'tab-pane active') do
122
147
  concat(model_modal_fields(model, options))
123
148
  end
124
149
  end
@@ -150,33 +175,28 @@ module ModelModalHelper
150
175
  end
151
176
 
152
177
  def model_modal_fields(model, _options = {})
153
- content_tag(:table, class: 'center-align') do
154
- concat(content_tag(:tbody) do
155
- model.class.allowed_param_names.sort.each do |field_name|
156
- concat(model_modal_field(model, field_name))
157
- end
158
- end)
178
+ content_tag(:div, class: '.datagrid') do
179
+ model.class.allowed_param_names.sort.each do |field_name|
180
+ next if %w[_id _type created_at updated_at search_text sort_text].include?(field_name)
181
+ next if model.respond_to?(field_name) && model.send(field_name).blank?
182
+
183
+ concat(model_modal_field(model, field_name))
184
+ end
159
185
  end
160
186
  end
161
187
 
162
188
  def model_modal_standard(model, _options = {})
163
- content_tag(:table, class: 'center-align highlight') do
164
- concat(content_tag(:tbody) do
165
- %w[_id _type created_at updated_at search_text sort_text].each do |field_name|
166
- concat(model_modal_field(model, field_name))
167
- end
168
- end)
189
+ content_tag(:div, class: '.datagrid') do
190
+ %w[_id _type created_at updated_at search_text sort_text].each do |field_name|
191
+ concat(model_modal_field(model, field_name))
192
+ end
169
193
  end
170
194
  end
171
195
 
172
196
  def model_modal_field(model, field_name)
173
- content_tag(:tr) do
174
- concat(content_tag(:th, class: 'right-align') do
175
- field_name
176
- end)
177
- concat(content_tag(:td) do
178
- model_modal_field_value(model, field_name)
179
- end)
197
+ content_tag(:div, class: 'datagrid-item') do
198
+ concat(content_tag(:div, class: 'datagrid-title') { field_name })
199
+ concat(content_tag(:div, class: 'datagrid-content') { model_modal_field_value(model, field_name) })
180
200
  end
181
201
  end
182
202
 
@@ -207,7 +227,20 @@ module ModelModalHelper
207
227
 
208
228
  def model_modal_footer(model, edit_path)
209
229
  content_tag(:div, class: 'modal-footer') do
230
+ concat(content_tag(:button, class: 'btn me-auto', data: { bs_dismiss: :modal }) do
231
+ concat(I18n.t('ui_form.actions.close'))
232
+ concat(svg_icon(:close))
233
+ end)
210
234
  concat(edit_modal_tag(model, edit_path))
211
235
  end
212
236
  end
237
+
238
+ def edit_modal_tag(obj, path, _options = {})
239
+ return unless can? :edit, obj
240
+
241
+ content_tag(:a, href: path, class: 'modal-action') do
242
+ concat(I18n.t('ui_form.actions.edit'))
243
+ concat(svg_icon(:edit))
244
+ end
245
+ end
213
246
  end
@@ -2,8 +2,12 @@
2
2
  module SvgIconHelper
3
3
  # @abstract Render the appropriate icon based on the name and type
4
4
  # @return [View]
5
- def svg_icon(name, size: 24, type: :outline, classes: [], color: 'currentColor')
6
- classes = ['icon', classes].compact.flatten.join(' ')
5
+ def svg_icon(name, size: 24, type: :outline, classes: [], color: 'currentColor', stroke_width: 2)
6
+ classes = if size <= 24
7
+ ['icon', classes].compact.flatten.join(' ')
8
+ else
9
+ classes.compact.flatten.join(' ')
10
+ end
7
11
  key = "icon_partial_path:#{name}:#{type}"
8
12
  (partial, stroke) = Rails.cache.fetch(key, expires_in: 1.hour) do
9
13
  path_with_type = "icons/#{name}-#{type}"
@@ -27,12 +31,12 @@ module SvgIconHelper
27
31
  class: classes,
28
32
  fill: 'none',
29
33
  stroke: stroke,
30
- stroke_width: 1,
34
+ stroke_width: stroke_width,
31
35
  stroke_linecap: 'round',
32
36
  stroke_linejoin: 'round') do
33
37
  render partial
34
38
  end
35
- rescue StandardError
39
+ rescue StandardError
36
40
  tag.svg(xmlns: "http://www.w3.org/2000/svg",
37
41
  viewBox: "0 0 24 24",
38
42
  width: size,
@@ -40,7 +44,7 @@ module SvgIconHelper
40
44
  class: classes,
41
45
  fill: 'none',
42
46
  stroke: 'red',
43
- stroke_width: 1,
47
+ stroke_width: stroke_width,
44
48
  stroke_linecap: 'round',
45
49
  stroke_linejoin: 'round',
46
50
  data: { bs_toggle: :tooltip },
@@ -22,6 +22,7 @@ en:
22
22
  axlsx: '%Y-%m-%d'
23
23
  ui_form:
24
24
  actions:
25
+ close: Close
25
26
  reset: Reset
26
27
  cancel: Cancel
27
28
  update: Update
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Web47core
4
- VERSION = '3.2.36'
4
+ VERSION = '3.2.38'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web47core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.36
4
+ version: 3.2.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Schroeder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-08-06 00:00:00.000000000 Z
11
+ date: 2025-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel