web47core 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5083f4affc41013e5f87fd7255022bc3db758316a6e0d0b653fdd2ee31095f07
4
- data.tar.gz: 36dee71787549e3ac8d4f15c3a732b2946823de6e36f5bdbd5b6cf15fb9cbe35
3
+ metadata.gz: 545d59c80e6d9e2feb0a379b49f765a0b6a5911d901f2eee369785b3a941916b
4
+ data.tar.gz: 2f98551b73af32e6779aec38942421dd4ffd8279ef3da5f2bb4edf699e90349f
5
5
  SHA512:
6
- metadata.gz: 55e9fbe3b7c3d43ae23139437c9ee8b7cedd1ed8bc6c15ab51744b78f64e33d493388eddd0a48a711a7cff3e461e0e1e02913c267b1a76c939ab53b1599e168e
7
- data.tar.gz: e1a202c78f7320600a389cec264a4439de66ccc174db973804a6bfcf9ec291a11978c18269629a811868859b71898f0c15915c4a5434bfd10f105537591a4b8b
6
+ metadata.gz: b4b06e1c1637fc8345b2706f4587ab45f093eb0b5afb3f61ca20ef7d7b38a9f9314e130bd631017a2280e672a26fd6b0d737b3911a2d6f908462a1679f4cdc99
7
+ data.tar.gz: 142d15c993e81f30a77b2d148497fb194f726fde3d990a7e544d1f867a975e821423c6c1985f67e2ea414ad40473b302f0ced0581cd8d68bd2380b4b19e43ec1
@@ -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
- content_tag(:a, href: path, class: options[:class]) do
78
- concat(content_tag(:i, class: 'material-icons left') { options[:icon_name] }) if options[:icon_name].present?
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
- icon = options[:icon] || 'edit'
102
- tooltip = options[:tooltip] || 'Edit'
103
- content_tag(:a, href: path, class: 'tooltipped', data: {tooltip: tooltip}) do
104
- concat(content_tag(:i, class: 'material-icons') do
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
- icon_name = options[:icon_name] || 'replay'
126
- data = { confirm: options[:confirm] || t('links.replay_confirmation', name: obj.class.to_s.underscore.humanize) }
127
- content_tag(:a, href: path, data: data, class: options[:link_classes]) do
128
- concat(content_tag(:i, class: 'material-icons') do
129
- icon_name
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
- icon = options[:icon] || 'info'
164
- content_tag(:a, href: path) do
165
- concat(content_tag(:i, class: 'material-icons') do
166
- icon
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
- confirmation = options[:confirmation] || t('links.action_confirmation')
192
- confirmation_required = options[:confirmation].present? ? { confirm: confirmation } : {}
193
- content_tag(:a, href: path, class: options[:classes], data: confirmation_required) do
194
- concat(content_tag(:i, class: 'material-icons') do
195
- options[:icon_name] || 'info'
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
- confirm: options[:confirm] || t('links.deletion_confirmation', name: obj.class.to_s.underscore.humanize) }
221
- content_tag(:a, href: path, data: data) do
222
- concat(content_tag(:i, class: 'material-icons') do
223
- options[:icon_name] || 'delete'
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
- confirmation = options[:confirmation] || t('links.action_confirmation', name: obj.class.to_s.underscore.humanize)
248
- content_tag(:a, href: path, data: { confirm: confirmation }) do
249
- concat(content_tag(:i, class: 'material-icons') do
250
- options[:icon_name] || 'add'
251
- end)
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
@@ -1,5 +1,6 @@
1
1
  .flash
2
2
  - flash.each do |key, value|
3
+ - next if 'timedout'.eql?(key)
3
4
  .message
4
5
  %i.material-icons
5
6
  = flash_map_name(key)
@@ -90,9 +90,9 @@ module CoreDelayedJobsController
90
90
  # Find the first jobs for index or deleting all
91
91
  #
92
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)
93
+ @delayed_jobs ||= Delayed::Backend::Mongoid::Job
94
+ .order_by(locked_by: :desc, priority: :asc, run_at: :asc)
95
+ .limit(delayed_jobs_limit)
96
96
  end
97
97
 
98
98
  #
@@ -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.read(File.join(__dir__, '../../../lib/templates', delivery_channel, file_name))
43
+ File.open(File.join(__dir__, '../../../lib/templates', delivery_channel, file_name))
44
44
  end.read
45
45
  rescue StandardError
46
46
  nil
@@ -1,3 +1,3 @@
1
1
  *ERROR:* `{{message}}`{% if exception != blank %} -
2
- ```ruby {{exception}}```
2
+ ```{{exception}}```
3
3
  {% endif %}
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Web47core
4
- VERSION = '1.1.2'
4
+ VERSION = '1.1.3'
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: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Schroeder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-07 00:00:00.000000000 Z
11
+ date: 2021-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport