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 +4 -4
- data/app/helpers/core_link_helper.rb +0 -8
- data/app/helpers/model_modal_helper.rb +71 -38
- data/app/helpers/svg_icon_helper.rb +9 -5
- data/config/locales/en.yml +1 -0
- data/lib/web47core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36566c9389b2ee92272fe7432399a3d55029ed0bdaa52ffcd14c2db78aa2a031
|
4
|
+
data.tar.gz: 883b36a38dd85e4fa04b6204ee8d3da95a16ccdd4ee66faa34f6b93780786916
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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,
|
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(
|
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(:
|
102
|
-
concat(content_tag(:
|
103
|
-
|
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: '
|
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(:
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
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(:
|
164
|
-
|
165
|
-
|
166
|
-
|
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(:
|
174
|
-
concat(content_tag(:
|
175
|
-
|
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 =
|
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:
|
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:
|
47
|
+
stroke_width: stroke_width,
|
44
48
|
stroke_linecap: 'round',
|
45
49
|
stroke_linejoin: 'round',
|
46
50
|
data: { bs_toggle: :tooltip },
|
data/config/locales/en.yml
CHANGED
data/lib/web47core/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2025-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|