web47core 1.0.10 → 1.0.15

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: 9622e0a6af565d04a9632845a6b6800bfb5b81d14d7d5a553827dc97b3eac30e
4
- data.tar.gz: e44feb61e1103d7e3abec6a0498f4d9b2cbf691d38a638a350a1cc5162139811
3
+ metadata.gz: 20fa4ad255499f3d899ca64125951b60e7502d5e129f4989680bf84182e3671c
4
+ data.tar.gz: c47a90846316d62d4e63bf9f198912806c637f3a586b2b5441c0962ec22ce9b5
5
5
  SHA512:
6
- metadata.gz: 2f5cabb03ecd3a26f650093aa3724b4adef50c484e9c20fad24cad95b6edbc1d5b6782611dfa3938e221c376a1699bbf4915ddefcfdfb66e1a614e576c65b64e
7
- data.tar.gz: 7bcd7542a8a4f7042f4077538df3f83b12a59b934e41180befaa40614da9b2872bec565aabd194d443f523ab2242ebf166b1432be7c4eda609f1ec94209c7bf2
6
+ metadata.gz: f2e502d727e5b177adf2a4b22d09ab54f0281b4f0fa2106d4f1dbf18064f10e2c99d0644d99e96e6d44468a5a35c5918ae3ec2c164db8a782195d22419c230a8
7
+ data.tar.gz: 9b9ae4ea919b1f63a87bc144f9db10a65e047fbca2f28517b0eaf3ef2c4ea510d6b595931d65e1e845dd8f32e940fea07227adc75dc7c4bdfccd0c98498765c6
@@ -21,12 +21,12 @@ module CoreFormHelper
21
21
  # tag_options = {class: []} # text_field_options(model, field, options)
22
22
  # tag_options[:class] += ['materialize-textarea']
23
23
  content_tag(:div, class: (%w[input-field col] + classes).join(' ')) do
24
- concat(text_area(model, field, value, options))
24
+ concat(text_area_tag(model, field, value, options))
25
25
  concat(form_label_tag(model, field, value, options))
26
26
  end
27
27
  end
28
28
 
29
- def text_area(model, field, value, options = {})
29
+ def text_area_tag(model, field, value, options = {})
30
30
  tag_options = text_field_options(model, field, options)
31
31
  tag_options[:class] += ['materialize-textarea']
32
32
  content_tag(:textarea, tag_options) do
@@ -97,7 +97,8 @@ module CoreLinkHelper
97
97
  return unless can? :edit, obj
98
98
 
99
99
  icon = options[:icon] || 'edit'
100
- content_tag(:a, href: path) do
100
+ tooltip = options[:tooltip] || 'Edit'
101
+ content_tag(:a, href: path, class: 'tooltipped', data: {tooltip: tooltip}) do
101
102
  concat(content_tag(:i, class: 'material-icons') do
102
103
  icon
103
104
  end)
@@ -31,12 +31,19 @@ module Cron
31
31
  # Test if this should be archived
32
32
  #
33
33
  def archive?(item)
34
- item.updated_at < allowed_time_for_item(item)
34
+ item.send(comparison_field) < allowed_time_for_item(item)
35
35
  rescue StandardError => error
36
36
  App47Logger.log_warn "Unable to archive item #{item.inspect}", error
37
37
  false
38
38
  end
39
39
 
40
+ #
41
+ # Return which field to use for comparison when trimming objects
42
+ #
43
+ def comparison_field
44
+ :updated_at
45
+ end
46
+
40
47
  #
41
48
  # Try to get a TTL from System configuration, otherwise return the default
42
49
  #
@@ -28,7 +28,7 @@ module Cron
28
28
  time = if item.is_a?(EmailNotification) && template?(item)
29
29
  5.years.ago.utc
30
30
  else
31
- allowed_time
31
+ allowed_time_for_item(item)
32
32
  end
33
33
  item.updated_at < time
34
34
  end
@@ -68,8 +68,10 @@ module CoreSystemConfiguration
68
68
  field :switchboard_stack_id, type: String
69
69
  field :switchboard_stack_api_token, type: String
70
70
  field :switchboard_last_sync_at, type: Time
71
- # Audit Logs TTL
71
+ # TTLs
72
72
  field :user_model_audit_log_ttl, type: Integer, default: 365
73
+ field :slack_notification_ttl, type: Integer, default: 5
74
+ field :email_notification_ttl, type: Integer, default: 180
73
75
  #
74
76
  # Validations
75
77
  #
@@ -312,6 +312,7 @@ module StandardModel
312
312
  #
313
313
  def log_deletion(user, model)
314
314
  Web47core::Config.audit_model_log_class.create!(Web47core::Config.audit_model => user,
315
+ deleted_oid: model.id,
315
316
  model: model,
316
317
  action: AuditLog::DELETE_ACTION,
317
318
  changed_values: App47Logger.clean_params(attributes).to_json)
@@ -233,6 +233,15 @@ class Notification
233
233
  result
234
234
  end
235
235
 
236
+ #
237
+ # Titleize the type of this notification as its name
238
+ #
239
+ def name
240
+ _type.titleize
241
+ rescue StandardError
242
+ _type
243
+ end
244
+
236
245
  private
237
246
 
238
247
  #
@@ -8,6 +8,7 @@ class UserModelAuditLog < UserAuditLog
8
8
  # Fields
9
9
  #
10
10
  field :changed_values, type: String
11
+ field :deleted_oid, type: BSON::ObjectId
11
12
  #
12
13
  # Relationships
13
14
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Web47core
4
- VERSION = '1.0.10'
4
+ VERSION = '1.0.15'
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.0.10
4
+ version: 1.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Schroeder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-23 00:00:00.000000000 Z
11
+ date: 2020-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport