web47core 3.2.3.21 → 3.2.3.23

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: 96617e4b5114564358a5845a1907cea6ea09fa64d5e0b5c27015766f31ee7043
4
- data.tar.gz: a12a58c8f63fbca854409224431e617e874595ca8ffe4b2553ebf52da30b0fcf
3
+ metadata.gz: a09635f3dfd9386e18ac0368fe795611308035dad8f099d0462dca45741b6e80
4
+ data.tar.gz: dd2d6d96fa1202e7738f2d1634e7be51d5499a573e32c5cd3745b0cb5d12b19f
5
5
  SHA512:
6
- metadata.gz: 2a0271b0b92ad4d8e47c80b468253b68fe1ad74a99330676698dc2c4750d2d96e79662cd049e0961ce32cf0e98a1e294440f11e5bf5ee061207570425e6a4494
7
- data.tar.gz: 1a662452387bcc8c36580ac3b4b4c158688c78bfda0fb2531a203cc959e9bd723cbe732470520510a5111ed371aa8a26de5fb62fe718bf3c79c679e507e9d5f3
6
+ metadata.gz: cd89824d741a5b185a9445ad3ad74ed2e40caff989b92e48551580fe5180f61637791e9eb3931587af8cd6c493c7fdfb85d1dca510adfba9b7732dd91031ca0e
7
+ data.tar.gz: f2a66062999aa47ac433d4582304da72aca1b52f7180dcbe925a22df769c31cb86c3dbb0bbe15382f20289d86791f264dfa1784551870b03ba612312d1410195
@@ -4,44 +4,6 @@
4
4
  # helpers for creating forms
5
5
  #
6
6
  module CoreFormHelper
7
- # def materialize_form_for(options = {}, &block)
8
- # options[:form_authenticity_token] = form_authenticity_token
9
- # form = Materialize::Form.new(options)
10
- # form.render_form(&block)
11
- # end
12
-
13
-
14
-
15
- #
16
- # Text field
17
- #
18
- # def form_text_field(model, field, options = {})
19
- # classes = options[:classes] || %w[s12 m6 l4 xl3]
20
- # value = model.send(field)
21
- # options[:type] ||= :text
22
- # options[:value] = value
23
- # options[:disabled] ||= false
24
- # tag_options = text_field_options(model, field, options)
25
- # content_tag(:div, class: (%w[input-field col] + classes).join(' ')) do
26
- # concat(tag(:input, tag_options))
27
- # concat(form_label_tag(model, field, value, options))
28
- # end
29
- # end
30
-
31
- def form_date_field(model, field, options = {})
32
- classes = options[:classes] || %w[s12 m6 l4 xl3]
33
- value = model.send(field)
34
- options[:value] = value.strftime('%d %B, %Y') if value.present?
35
- options[:type] = :text
36
- options[:disabled] ||= false
37
- tag_options = text_field_options(model, field, options)
38
- tag_options[:class] = options[:date_picker_type] || 'simple-date-picker'
39
- content_tag(:div, class: (%w[input-field col] + classes).join(' ')) do
40
- concat(tag(:input, tag_options))
41
- concat(form_label_tag(model, field, value, options))
42
- end
43
- end
44
-
45
7
  #
46
8
  # Time picker field
47
9
  #
@@ -59,43 +21,6 @@ module CoreFormHelper
59
21
  end
60
22
  end
61
23
 
62
- #
63
- # Password field
64
- #
65
- # def form_password(model, field, options = {})
66
- # classes = options[:classes] || %w[s12 m6 l4 xl3]
67
- # value = model.send(field)
68
- # options[:type] = :password
69
- # options[:place_holder] ||= mask_value(value)
70
- # tag_options = text_field_options(model, field, options)
71
- # content_tag(:div, class: (%w[input-field col] + classes).join(' ')) do
72
- # concat(tag(:input, tag_options))
73
- # concat(form_label_tag(model, field, value, options))
74
- # end
75
- # end
76
-
77
- #
78
- # Select field
79
- #
80
- # def form_select(model, field, options = {})
81
- # value = model.send(field)
82
- # raise 'Prompt needed' if value.blank? && options[:prompt].blank? && !options[:no_label]
83
- #
84
- # hint_key = "ui_form.#{model.class.to_s.underscore}.hints.#{field}"
85
- # if I18n.exists?(hint_key)
86
- # base_classes = %w[input-field col tooltipped]
87
- # data = { tooltip: I18n.t(hint_key), position: :top }
88
- # else
89
- # base_classes = %w[input-field col]
90
- # data = {}
91
- # end
92
- # classes = (base_classes + (options[:classes] || %w[s12 m6 l4 xl3])).join(' ')
93
- # content_tag(:div, class: classes, data: data) do
94
- # concat(form_select_tag(model, field, options))
95
- # concat(form_label_tag(model, field, value, options))
96
- # end
97
- # end
98
-
99
24
  #
100
25
  # Create the select tag
101
26
  #
@@ -145,51 +70,6 @@ module CoreFormHelper
145
70
  select_options
146
71
  end
147
72
 
148
- #
149
- # Checkbox field
150
- #
151
- # def form_checkbox(model, field, classes = %w[s12 m6 l4 xl3], options = {})
152
- # value = model.send(field)
153
- # options[:disabled] ||= false
154
- # properties = {
155
- # class: 'validate',
156
- # id: form_field_id(model, field, options),
157
- # name: form_field_name(model, field, options),
158
- # type: :checkbox,
159
- # disabled: options[:disabled]
160
- # }
161
- # properties[:checked] = true if model.send(field)
162
- # checkbox_tag = tag(:input, properties)
163
- # content_tag(:div, class: (%w[input-field col] + classes).join(' ')) do
164
- # concat(content_tag(:label) do
165
- # concat(checkbox_tag)
166
- # concat(form_checkbox_label_tag(model, field, value, input_classes: classes))
167
- # end)
168
- # end
169
- # end
170
-
171
- #
172
- # get the label for checkbox
173
- #
174
- # def form_checkbox_label_tag(model, field, value, options = {})
175
- # # dont do a label if we are in default browser mode
176
- # return if options[:input_classes].present? && options[:input_classes].include?('browser-default')
177
- #
178
- # # or if we have a prompt with now value
179
- # place_holder = field_place_holder(model, field)
180
- # return if place_holder.blank? && value.blank? && options[:prompt].present?
181
- #
182
- # error = model.errors[field]
183
- # key = "ui_form.#{model.class.to_s.underscore}.labels.#{field}"
184
- # classes = value.nil? && place_holder.blank? ? '' : 'active'
185
- # classes += error.present? ? ' invalid red-text' : ' valid'
186
- # options[:class] = classes
187
- # options['data-error'] = error.join(', ') if error.present?
188
- # content_tag(:span, options) do
189
- # concat(I18n.exists?(key) ? I18n.t(key) : field.to_s.humanize)
190
- # end
191
- # end
192
-
193
73
  #
194
74
  # File field
195
75
  #
@@ -245,35 +125,6 @@ module CoreFormHelper
245
125
  end
246
126
  end
247
127
 
248
- #
249
- # Add the placeholder option if found in the translations
250
- #
251
- # def text_field_options(model, field, options)
252
- # hint_key = "ui_form.#{model.class.to_s.underscore}.hints.#{field}"
253
- # if I18n.exists?(hint_key)
254
- # classes = %w[validate tooltipped]
255
- # options[:data] = { tooltip: I18n.t(hint_key), position: :top }
256
- # else
257
- # classes = %w[validate]
258
- # end
259
- # classes += options[:input_classes] if options[:input_classes].present?
260
- # options[:name] = form_field_name(model, field, options)
261
- # options[:id] = form_field_id(model, field, options)
262
- # place_holder = options[:place_holder] || field_place_holder(model, field)
263
- # if place_holder.present?
264
- # classes << 'active'
265
- # options[:placeholder] = place_holder
266
- # end
267
- # classes << 'active' if options[:value].present?
268
- # options[:class] = classes.uniq
269
- # options
270
- # end
271
-
272
- # def field_place_holder(model, field)
273
- # place_holder_key = "ui_form.#{model.class.to_s.underscore}.placeholders.#{field}"
274
- # I18n.exists?(place_holder_key) ? I18n.t(place_holder_key) : nil
275
- # end
276
-
277
128
  # @abstract Return a consistent form field name
278
129
  # @param [Mongoid::Document] model
279
130
  # @param [Symbol] field
@@ -1,5 +1,14 @@
1
1
  module CoreFormInputHelper
2
2
 
3
+ # @abstract Render a date field
4
+ # @param [Mongoid::Document] model - The model to render the field for
5
+ # @param [Symbol] field - The field to render
6
+ # @param [Hash] options - Options to pass to the field
7
+ def form_date_field(model, field, options = {})
8
+ options[:type] ||= :date
9
+ form_text_field(model, field, options)
10
+ end
11
+
3
12
  # @abstract Render a email text field
4
13
  # @param [Mongoid::Document] model - The model to render the field for
5
14
  # @param [Symbol] field - The field to render
@@ -23,7 +23,7 @@
23
23
  %tbody
24
24
  - @delayed_jobs.each do |delayed_job|
25
25
  %tr
26
- %td=current_user.local_time(delayed_job.created_at)
26
+ %td=current_user.local_time(delayed_job.run_at)
27
27
  %td.name=link_to(delayed_job.display_name, model_path(delayed_job))
28
28
  %td=delayed_job.priority
29
29
  %td=delayed_job.status_description
@@ -152,7 +152,7 @@ module App47Logger
152
152
  #
153
153
  def self.clean_params(pars)
154
154
  pars.each do |key, value|
155
- if App47Logger.mask_parameter_keys.include?(key.to_s)
155
+ if App47Logger.mask_parameter_keys.any? { |f| matches_filter?(f, key.to_s) }
156
156
  pars[key] = '[FILTERED]'
157
157
  elsif App47Logger.delete_parameter_keys.include?(key.to_s)
158
158
  pars.delete(key)
@@ -163,6 +163,19 @@ module App47Logger
163
163
  pars
164
164
  end
165
165
 
166
+ def self.matches_filter?(filter, key)
167
+ case filter
168
+ when String, Symbol
169
+ filter.to_s == key
170
+ when Regexp
171
+ key.match?(filter)
172
+ when Proc
173
+ filter.call(key)
174
+ else
175
+ false
176
+ end
177
+ end
178
+
166
179
  #
167
180
  # which parameters to filter out
168
181
  #
@@ -15,7 +15,7 @@ module CoreAccount
15
15
  #
16
16
  # Relationships
17
17
  #
18
- has_many :notifications, dependent: :destroy do
18
+ has_many :notifications, inverse_of: :account, class_name: 'Notification', dependent: :destroy do
19
19
  def emails
20
20
  where(_type: 'EmailNotification')
21
21
  end
@@ -28,7 +28,7 @@ module CoreAccount
28
28
  where(_type: 'SmsNotification')
29
29
  end
30
30
  end
31
- has_many :templates, dependent: :destroy
31
+ has_many :templates, inverse_of: :account, class_name: 'Template', dependent: :destroy
32
32
  embeds_one :smtp_configuration
33
33
  end
34
34
  end
@@ -17,6 +17,9 @@ module SearchAble
17
17
  # Call backs
18
18
  #
19
19
  before_save :update_search_and_sort_text
20
+
21
+ index({ search_text: Mongo::Index::ASCENDING }, { background: true })
22
+ index({ sort_text: Mongo::Index::ASCENDING }, { background: true })
20
23
  end
21
24
  end
22
25
 
@@ -10,7 +10,7 @@ module StandardModel
10
10
  include Mongoid::Timestamps
11
11
  include App47Logger
12
12
 
13
- unless defined? FILER_NAMES
13
+ unless defined? STANDARD_FIELDS
14
14
  STANDARD_FIELDS = %w[created_at updated_at _type _id search_text sort_text last_modified_by_email
15
15
  last_modified_by_name created_by_email created_by_name last_modified_by_id created_by_id
16
16
  last_modified_by_type created_by_type].sort
@@ -47,7 +47,7 @@ class Notification
47
47
  #
48
48
  # Relationships
49
49
  #
50
- belongs_to :account, inverse_of: :notifications, optional: true
50
+ belongs_to :account, inverse_of: :notifications, optional: true, class_name: 'Account'
51
51
  belongs_to :notification_template, inverse_of: :notifications, optional: true
52
52
  #
53
53
  # Validations
@@ -17,16 +17,11 @@ class SmtpConfiguration
17
17
  field :server_name, type: String
18
18
  field :username, type: String
19
19
  field :password, type: String
20
- #
21
20
  # Relationships
22
- #
23
21
  embedded_in :account
24
- #
25
22
  # Validations
26
23
  validates :server_name, :username, :email_address, :port, presence: true
27
- #
28
24
  # Callbacks
29
- #
30
25
  before_save :update_token
31
26
 
32
27
  #
@@ -11,7 +11,7 @@ class Template
11
11
  #
12
12
  # Relationships
13
13
  #
14
- belongs_to :account, inverse_of: :templates
14
+ belongs_to :account, inverse_of: :templates, class_name: 'Account'
15
15
  #
16
16
  # Validations
17
17
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Web47core
4
- VERSION = '3.2.3.21'
4
+ VERSION = '3.2.3.23'
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: 3.2.3.21
4
+ version: 3.2.3.23
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-11-22 00:00:00.000000000 Z
11
+ date: 2025-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel