web47core 1.0.18 → 1.1.4
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 +57 -36
- data/app/views/common/_flash.html.haml +1 -0
- data/config/locales/en.yml +5 -3
- data/lib/app/controllers/concerns/core_delayed_jobs_controller.rb +24 -5
- data/lib/app/models/concerns/time_zone_able.rb +1 -1
- data/lib/app/models/template.rb +1 -1
- data/lib/templates/slack/error_message.liquid +1 -1
- 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: 47b8925dffc596fd383ed69ede32318ec8f6a4ede85e2f64c3c9edcbc8b6e2a3
|
4
|
+
data.tar.gz: cd955d06104cdcf6070b912e0e5832ef086ca077470fdf80804ec725df8a8d81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ee1fab705f3fb0e87058e8f1d56f49d121d5c136be4b4f74704afd37c4ce77d6355fbf93a04ebabdd9c19994fd00dcb364cb1267f96bebc60fb2b79d9b00885
|
7
|
+
data.tar.gz: 65f4b435fd40e470da4a2697835ef76ca885b20a53ea0cdc64ee025e2d053894e18d61456985036b48e5e7832f863493769ee583f50cf43549da0a38dfc2aa34
|
@@ -65,6 +65,8 @@ module CoreLinkHelper
|
|
65
65
|
# Add a material icon by name
|
66
66
|
#
|
67
67
|
def materialize_icon(name, options = {})
|
68
|
+
return if name.blank?
|
69
|
+
|
68
70
|
classes = %w[material-icons]
|
69
71
|
classes += options[:classes] if options[:classes].present?
|
70
72
|
content_tag(:i, class: classes.join(' '), title: options[:title]) { name }
|
@@ -74,8 +76,11 @@ module CoreLinkHelper
|
|
74
76
|
# Generic link tag
|
75
77
|
#
|
76
78
|
def link_tag(title, path, options = {})
|
77
|
-
|
78
|
-
|
79
|
+
data = {}
|
80
|
+
link_classes = tooltip_data(options, data)
|
81
|
+
confirmation_data(options, data)
|
82
|
+
content_tag(:a, href: path, class: link_classes, data: data) do
|
83
|
+
concat(materialize_icon(icon_name(options), options))
|
79
84
|
concat(title)
|
80
85
|
end
|
81
86
|
end
|
@@ -98,12 +103,10 @@ module CoreLinkHelper
|
|
98
103
|
def edit_link_tag(obj, path, options = {})
|
99
104
|
return unless can? :edit, obj
|
100
105
|
|
101
|
-
|
102
|
-
|
103
|
-
content_tag(:a, href: path, class: '
|
104
|
-
concat(
|
105
|
-
icon
|
106
|
-
end)
|
106
|
+
data = {}
|
107
|
+
link_classes = tooltip_data(options, data, 'Edit')
|
108
|
+
content_tag(:a, href: path, class: link_classes.join(' '), data: data) do
|
109
|
+
concat(materialize_icon(icon_name(options, 'edit'), options))
|
107
110
|
concat(options[:label]) if options[:label].present?
|
108
111
|
end
|
109
112
|
end
|
@@ -122,12 +125,11 @@ module CoreLinkHelper
|
|
122
125
|
def replay_link_tag(obj, path, options = {})
|
123
126
|
return unless can? :edit, obj
|
124
127
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
end)
|
128
|
+
data = {}
|
129
|
+
confirmation_data(options, data, t('links.replay_confirmation', name: obj.class.to_s.underscore.humanize))
|
130
|
+
link_classes = tooltip_data(options, data)
|
131
|
+
content_tag(:a, href: path, data: data, class: link_classes.join(' ')) do
|
132
|
+
concat(materialize_icon(icon_name(options), options))
|
131
133
|
concat(options[:label]) if options[:label].present?
|
132
134
|
end
|
133
135
|
end
|
@@ -160,11 +162,10 @@ module CoreLinkHelper
|
|
160
162
|
def info_link_tag(obj, path, options = {})
|
161
163
|
return unless can? :read, obj
|
162
164
|
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
end)
|
165
|
+
data = {}
|
166
|
+
link_classes = tooltip_data(options, data)
|
167
|
+
content_tag(:a, href: path, classes: link_classes, data: data) do
|
168
|
+
concat(materialize_icon(icon_name(options, 'info'), options))
|
168
169
|
concat(options[:label]) if options[:label].present?
|
169
170
|
end
|
170
171
|
end
|
@@ -188,12 +189,11 @@ module CoreLinkHelper
|
|
188
189
|
def action_link_tag(condition, path, options = {})
|
189
190
|
return unless condition
|
190
191
|
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
end)
|
192
|
+
data = {}
|
193
|
+
confirmation_data(options, data)
|
194
|
+
link_classes = tooltip_data(options, data)
|
195
|
+
content_tag(:a, href: path, class: link_classes.join(' '), data: data) do
|
196
|
+
concat(materialize_icon(icon_name(options, 'directions_run'), options))
|
197
197
|
concat(options[:label]) if options[:label].present?
|
198
198
|
end
|
199
199
|
end
|
@@ -216,12 +216,11 @@ module CoreLinkHelper
|
|
216
216
|
def delete_link_tag(obj, path, options = {})
|
217
217
|
return unless can? :destroy, obj
|
218
218
|
|
219
|
-
data = { method: :delete
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
end)
|
219
|
+
data = { method: :delete }
|
220
|
+
confirmation_data(data, options, t('links.deletion_confirmation', name: obj.class.to_s.underscore.humanize))
|
221
|
+
link_classes = tooltip_data(options, data)
|
222
|
+
content_tag(:a, href: path, class: link_classes, data: data) do
|
223
|
+
concat(materialize_icon(icon_name(options, 'delete'), options))
|
225
224
|
concat(options[:label]) if options[:label].present?
|
226
225
|
end
|
227
226
|
end
|
@@ -244,11 +243,11 @@ module CoreLinkHelper
|
|
244
243
|
def create_link_tag(obj, path, options = {})
|
245
244
|
return unless can? :create, obj
|
246
245
|
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
246
|
+
data = {}
|
247
|
+
confirmation_data(options, data, t('links.action_confirmation', name: obj.class.to_s.underscore.humanize))
|
248
|
+
link_classes = tooltip_data(options, data)
|
249
|
+
content_tag(:a, href: path, class: link_classes, data: { confirm: data }) do
|
250
|
+
concat(materialize_icon(icon_name(options, 'add'), options))
|
252
251
|
concat(options[:label]) if options[:label].present?
|
253
252
|
end
|
254
253
|
end
|
@@ -401,4 +400,26 @@ module CoreLinkHelper
|
|
401
400
|
concat(content_tag(:i, class: 'material-icons right') { button_icon })
|
402
401
|
end
|
403
402
|
end
|
403
|
+
|
404
|
+
#
|
405
|
+
# See if there is any confirmation and add it to the data element
|
406
|
+
#
|
407
|
+
def confirmation_data(options, data, default = nil)
|
408
|
+
confirm = options[:confirm] || options[:confirmation] || default
|
409
|
+
data[:confirm] = confirm if confirm.present?
|
410
|
+
end
|
411
|
+
|
412
|
+
def tooltip_data(options, data, default = nil)
|
413
|
+
link_classes = options[:link_classes] || []
|
414
|
+
tooltip = options[:tooltip] || default
|
415
|
+
if tooltip.present?
|
416
|
+
link_classes << 'tooltipped'
|
417
|
+
data[:tooltip] = tooltip
|
418
|
+
end
|
419
|
+
link_classes
|
420
|
+
end
|
421
|
+
|
422
|
+
def icon_name(options, default = nil)
|
423
|
+
options[:icon] || options[:icon_name] || default
|
424
|
+
end
|
404
425
|
end
|
data/config/locales/en.yml
CHANGED
@@ -10,14 +10,16 @@ en:
|
|
10
10
|
save: Save
|
11
11
|
time:
|
12
12
|
formats:
|
13
|
-
long: '%
|
14
|
-
medium: '%
|
15
|
-
short: '%m/%d/%Y'
|
13
|
+
long: '%a, %d %b %Y %H:%M:%S (%Z)'
|
14
|
+
medium: '%b %d, %Y %H:%M (%Z)'
|
15
|
+
short: '%m/%d/%Y %H:%M (%Z)'
|
16
|
+
axlsx: '%Y-%m-%d %H:%M:%S (%Z)'
|
16
17
|
date:
|
17
18
|
formats:
|
18
19
|
long: '%B %d, %Y'
|
19
20
|
medium: '%b %d, %Y'
|
20
21
|
short: '%m/%d/%Y'
|
22
|
+
axlsx: '%Y-%m-%d'
|
21
23
|
ui_form:
|
22
24
|
actions:
|
23
25
|
reset: Reset
|
@@ -10,7 +10,7 @@ module CoreDelayedJobsController
|
|
10
10
|
#
|
11
11
|
def index
|
12
12
|
authorize! :read, Delayed::Backend::Mongoid::Job
|
13
|
-
|
13
|
+
delayed_jobs
|
14
14
|
end
|
15
15
|
|
16
16
|
def show
|
@@ -23,7 +23,7 @@ module CoreDelayedJobsController
|
|
23
23
|
def destroy_all
|
24
24
|
authorize! :manage, Delayed::Backend::Mongoid::Job
|
25
25
|
failed_only = params[:failed_only].eql?('true')
|
26
|
-
|
26
|
+
delayed_jobs.each do |job|
|
27
27
|
next if failed_only && !job.failed?
|
28
28
|
|
29
29
|
job.destroy
|
@@ -41,7 +41,7 @@ module CoreDelayedJobsController
|
|
41
41
|
def resubmit_all
|
42
42
|
authorize! :read, Delayed::Backend::Mongoid::Job
|
43
43
|
failed_only = params[:failed_only].eql?('true')
|
44
|
-
|
44
|
+
delayed_jobs.each do |job|
|
45
45
|
next if failed_only && !job.failed?
|
46
46
|
|
47
47
|
job.resubmit
|
@@ -79,9 +79,28 @@ module CoreDelayedJobsController
|
|
79
79
|
redirect_to index_path
|
80
80
|
end
|
81
81
|
|
82
|
-
|
83
|
-
|
82
|
+
#
|
83
|
+
# Fetch the required job by id
|
84
|
+
#
|
84
85
|
def delayed_job
|
85
86
|
@delayed_job ||= Delayed::Backend::Mongoid::Job.find(params[:id])
|
86
87
|
end
|
88
|
+
|
89
|
+
#
|
90
|
+
# Find the first jobs for index or deleting all
|
91
|
+
#
|
92
|
+
def delayed_jobs
|
93
|
+
@delayed_jobs ||= Delayed::Backend::Mongoid::Job
|
94
|
+
.order_by(locked_by: :desc, priority: :asc, run_at: :asc)
|
95
|
+
.limit(delayed_jobs_limit)
|
96
|
+
end
|
97
|
+
|
98
|
+
#
|
99
|
+
# Define the limit of jobs to fetch for the index of delete all/resubmit all
|
100
|
+
#
|
101
|
+
# Override this in your project if you want a different limit
|
102
|
+
#
|
103
|
+
def delayed_jobs_limit
|
104
|
+
100
|
105
|
+
end
|
87
106
|
end
|
@@ -31,7 +31,7 @@ module TimeZoneAble
|
|
31
31
|
# Return the given time in the localized time for this object
|
32
32
|
#
|
33
33
|
def local_date(date, format = :medium, default = 'N/A')
|
34
|
-
tz = TZInfo::Timezone.get(time_zone ||
|
34
|
+
tz = TZInfo::Timezone.get(time_zone.presence || SystemConfiguration.default_time_zone)
|
35
35
|
date.present? ? I18n.l(date.in_time_zone(tz).to_date, format: format) : default
|
36
36
|
rescue StandardError
|
37
37
|
default
|
data/lib/app/models/template.rb
CHANGED
@@ -40,7 +40,7 @@ class Template
|
|
40
40
|
if File.exist?(Rails.root.join('lib/templates', delivery_channel, file_name))
|
41
41
|
File.open(Rails.root.join('lib/templates', delivery_channel, file_name))
|
42
42
|
else
|
43
|
-
File.
|
43
|
+
File.open(File.join(__dir__, '../../../lib/templates', delivery_channel, file_name))
|
44
44
|
end.read
|
45
45
|
rescue StandardError
|
46
46
|
nil
|
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: 1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Schroeder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|