web47core 0.7.3 → 0.8.1

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: 6a0d81bc097ac74a05e76b6b3ba20f246b89ef28df5d2de1770477d1cd4f008a
4
- data.tar.gz: fc7d0b4f63aafae7900e71b0e39b9e6b498b61eab81c093af5ecc78dbdd3b4a5
3
+ metadata.gz: 85a1b6e625ef9c79d09fca54ade10cc6b7198582ef753e0ca0cb153af3d01d48
4
+ data.tar.gz: f5e8926a67eb5667222cdb6eb420a532b8f589ac697c4d9ed89f8b2f9e955f2e
5
5
  SHA512:
6
- metadata.gz: e5cc45c8b415e32f21fa1fc4508e91705de8be29d73e561d5b6848e9dc06b286aae1fa9f88013ac86cfa913ac24f1dabad36a4257ab1256281a7ce71137f79c2
7
- data.tar.gz: 2d7083baad1719b412c710d2e1bd1a74e9c37c7f83112ef0969a9508fdbf06431d8148060251f049480a0570d689a91b611c48338e090774e538f9e8bdbdd58d
6
+ metadata.gz: c6426b56a727ac5ba567a99e586737f98e02d1959da73736869ad872c1e9059dab0826691ff71546e3e35830d7307404981ffb0fdb96900854d1bbd6f2e167ea
7
+ data.tar.gz: ab293fdf38d406356d332eba27ea0be7a61d2b3e6799589caf8477dea227bad039a12d94bc121ff08a5a50c800552e815242bed9b6b944881ee70520214fa6b0
@@ -21,7 +21,13 @@ module CoreSystemConfiguration
21
21
  # Fields
22
22
  #
23
23
  field :environment, type: String, default: 'test'
24
- field :fips_mode, type: String, default: false
24
+ field :fips_mode, type: Boolean, default: false
25
+ field :fav_icon_path, { type: String, default: '/favicon.ico' }
26
+ field :stack_logo_path, { type: String, default: 'ui-company-logo.png' }
27
+ field :primary_stylesheet, { type: String, default: 'app47' }
28
+ field :short_cache, { type: Integer, default: 1 }
29
+ field :medium_cache, { type: Integer, default: 5 }
30
+ field :long_cache, { type: Integer, default: 15 }
25
31
  # SMTP configuration
26
32
  field :default_email, type: String, default: 'support@app47.com'
27
33
  field :support_email, type: String, default: 'support@app47.com'
@@ -75,11 +81,7 @@ module CoreSystemConfiguration
75
81
 
76
82
  module ClassMethods
77
83
  def configuration
78
- @configuration ||= SystemConfiguration.find_or_create_by!(environment: Rails.env)
79
- end
80
-
81
- def reset
82
- @configuration = nil
84
+ SystemConfiguration.find_or_create_by!(environment: Rails.env)
83
85
  end
84
86
 
85
87
  def smtp_configuration
@@ -125,6 +127,21 @@ module CoreSystemConfiguration
125
127
  zendesk_token]
126
128
  end
127
129
 
130
+ #
131
+ # Cache times in minutes
132
+ #
133
+ def short_cache_time
134
+ short_cache.minutes
135
+ end
136
+
137
+ def medium_cache_time
138
+ medium_cache.minutes
139
+ end
140
+
141
+ def long_cache_time
142
+ long_cache.minutes
143
+ end
144
+
128
145
  #
129
146
  # Determine if SMTP is configured
130
147
  #
@@ -249,13 +266,4 @@ module CoreSystemConfiguration
249
266
  def slack_configured?
250
267
  slack_api_url.present?
251
268
  end
252
-
253
- # private
254
-
255
- #
256
- # Clear the cache when the object is saved
257
- #
258
- def clear_cache
259
- SystemConfiguration.reset
260
- end
261
269
  end
@@ -22,9 +22,9 @@ module StandardModel
22
22
  #
23
23
  # Relationships
24
24
  #
25
- belongs_to :last_modified_by, class_name: Web47core::Config.audit_model_class_name, optional: true
26
- belongs_to :created_by, class_name: Web47core::Config.audit_model_class_name, optional: true
27
- has_many Web47core::Config.audit_model_log_symbol, dependent: :nullify
25
+ belongs_to :last_modified_by, polymorphic: true, dependent: :nullify, optional: true
26
+ belongs_to :created_by, polymorphic: true, dependent: :nullify, optional: true
27
+ has_many Web47core::Config.audit_model_log_symbol, dependent: :nullify, inverse_of: :model
28
28
  #
29
29
  # Callbacks
30
30
  #
@@ -98,9 +98,10 @@ module StandardModel
98
98
  # Record the creation with this user
99
99
  #
100
100
  def create_and_log(user, attributes)
101
- attributes[:last_modified_by_id] = user.id
102
- attributes[:created_by_id] = user.id
103
101
  model = create(attributes)
102
+ model.last_modified_by = user
103
+ model.created_by = user
104
+ model.save
104
105
  log_change(user, model, attributes) if model.valid?
105
106
  model
106
107
  end
@@ -109,9 +110,10 @@ module StandardModel
109
110
  # Record the creation with this user
110
111
  #
111
112
  def create_and_log!(user, attributes)
112
- attributes[:last_modified_by_id] = user.id
113
- attributes[:created_by_id] = user.id
114
113
  model = create!(attributes)
114
+ model.last_modified_by = user
115
+ model.created_by = user
116
+ model.save!
115
117
  log_change(user, model, attributes)
116
118
  model
117
119
  end
@@ -209,7 +211,7 @@ module StandardModel
209
211
  return self if attributes.blank?
210
212
 
211
213
  action = audit_action
212
- attributes[:last_modified_by_id] = user.id
214
+ self.last_modified_by = user
213
215
  result = update(attributes)
214
216
  log_change(user, attributes, action) if valid?
215
217
  result
@@ -224,7 +226,7 @@ module StandardModel
224
226
  return self if attributes.blank?
225
227
 
226
228
  action = audit_action
227
- attributes[:last_modified_by_id] = user.id
229
+ self.last_modified_by = user
228
230
  result = update!(attributes)
229
231
  log_change(user, attributes, action)
230
232
  result
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Web47core
4
- VERSION = '0.7.3'
4
+ VERSION = '0.8.1'
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: 0.7.3
4
+ version: 0.8.1
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-05-11 00:00:00.000000000 Z
11
+ date: 2020-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport