effective_classifieds 0.2.2 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/mailers/effective/classifieds_mailer.rb +5 -10
- data/app/views/effective/classifieds_mailer/classified_submitted.html.haml +1 -1
- data/config/effective_classifieds.rb +12 -16
- data/db/migrate/01_create_effective_classifieds.rb.erb +4 -4
- data/lib/effective_classifieds/version.rb +1 -1
- data/lib/effective_classifieds.rb +2 -20
- metadata +2 -3
- data/app/views/layouts/effective_classifieds_mailer_layout.html.haml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68e3527fba69fa6c8b8c487d99738c1d45f20b4b12fd8daa9ba425a977805015
|
4
|
+
data.tar.gz: a8f587d9a36bd2a37eae7629d0ba9586de7c94ad189e3f8f5d740b766941d950
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ed6350f3d0e6dc2244cf30ccfa0ebcc0aa14f10fe5665ce9f4d993d718169ca3bd9ec6f7eba347803fd14cfecc6fb2ca9d0c4932f6bfa587cb7b370f9bc2e22
|
7
|
+
data.tar.gz: 26d6d75e322bfd4d5e30b635266012e229b2136cfa5a8feac4291fbfcf0280c8d0d352c74babdb5c247ed94c7c4101971ca480a4efb821c9018d87ace94a18bc
|
@@ -1,21 +1,16 @@
|
|
1
1
|
module Effective
|
2
2
|
class ClassifiedsMailer < EffectiveClassifieds.parent_mailer_class
|
3
3
|
|
4
|
-
|
5
|
-
layout -> { EffectiveClassifieds.mailer_layout || 'effective_classifieds_mailer_layout' }
|
4
|
+
include EffectiveMailer
|
6
5
|
|
7
6
|
def classified_submitted(resource, opts = {})
|
8
|
-
raise('expected an Effective::
|
7
|
+
raise('expected an Effective::Classified') unless resource.kind_of?(Effective::Classified)
|
9
8
|
|
10
9
|
@classified = resource
|
10
|
+
subject = subject_for(:classified_submitted, 'Classified Submitted', resource, opts)
|
11
|
+
headers = headers_for(resource, opts)
|
11
12
|
|
12
|
-
mail(to:
|
13
|
-
end
|
14
|
-
|
15
|
-
protected
|
16
|
-
|
17
|
-
def headers_for(resource, opts = {})
|
18
|
-
resource.respond_to?(:log_changes_datatable) ? opts.merge(log: resource) : opts
|
13
|
+
mail(to: mailer_admin, subject: subject, **headers)
|
19
14
|
end
|
20
15
|
|
21
16
|
end
|
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
%hr
|
14
14
|
|
15
|
-
-
|
15
|
+
- unless @classified.approved?
|
16
16
|
%p= link_to('Approve Classified Ad', effective_classifieds.edit_admin_classified_path(@classified))
|
17
17
|
|
18
18
|
%p= link_to('View Classified Ad', effective_classifieds.classified_path(@classified))
|
@@ -24,22 +24,18 @@ EffectiveClassifieds.setup do |config|
|
|
24
24
|
# Automatically approve classified ad submissions, otherwise require admin approval
|
25
25
|
config.auto_approve = false
|
26
26
|
|
27
|
-
# Mailer
|
27
|
+
# Mailer Settings
|
28
|
+
# Please see config/initializers/effective_resources.rb for default effective_* gem mailer settings
|
29
|
+
#
|
28
30
|
# Configure the class responsible to send e-mails.
|
29
31
|
# config.mailer = 'Effective::ClassifiedsMailer'
|
30
|
-
|
31
|
-
#
|
32
|
-
#
|
33
|
-
|
34
|
-
#
|
35
|
-
# config.
|
36
|
-
|
37
|
-
# Default
|
38
|
-
# config.
|
39
|
-
|
40
|
-
# Default From
|
41
|
-
config.mailer_sender = "no-reply@example.com"
|
42
|
-
|
43
|
-
# Send Admin correspondence To
|
44
|
-
config.mailer_admin = "admin@example.com"
|
32
|
+
#
|
33
|
+
# Override effective_resource mailer defaults
|
34
|
+
#
|
35
|
+
# config.parent_mailer = nil # The parent class responsible for sending emails
|
36
|
+
# config.deliver_method = nil # The deliver method, deliver_later or deliver_now
|
37
|
+
# config.mailer_layout = nil # Default mailer layout
|
38
|
+
# config.mailer_sender = nil # Default From value
|
39
|
+
# config.mailer_admin = nil # Default To value for Admin correspondence
|
40
|
+
# config.mailer_subject = nil # Proc.new method used to customize Subject
|
45
41
|
end
|
@@ -33,8 +33,8 @@ class CreateEffectiveClassifieds < ActiveRecord::Migration[6.1]
|
|
33
33
|
t.timestamps
|
34
34
|
end
|
35
35
|
|
36
|
-
add_index
|
37
|
-
add_index
|
36
|
+
add_index <%= @classifieds_table_name %>, [:owner_id, :owner_type]
|
37
|
+
add_index <%= @classifieds_table_name %>, :slug
|
38
38
|
|
39
39
|
create_table <%= @classified_wizards_table_name %> do |t|
|
40
40
|
t.string :token
|
@@ -56,7 +56,7 @@ class CreateEffectiveClassifieds < ActiveRecord::Migration[6.1]
|
|
56
56
|
t.datetime :created_at
|
57
57
|
end
|
58
58
|
|
59
|
-
add_index
|
60
|
-
add_index
|
59
|
+
add_index <%= @classified_wizards_table_name %>, [:owner_id, :owner_type]
|
60
|
+
add_index <%= @classified_wizards_table_name %>, :token
|
61
61
|
end
|
62
62
|
end
|
@@ -8,9 +8,9 @@ module EffectiveClassifieds
|
|
8
8
|
def self.config_keys
|
9
9
|
[
|
10
10
|
:classifieds_table_name, :classified_wizards_table_name,
|
11
|
+
:mailer, :parent_mailer, :deliver_method, :mailer_layout, :mailer_sender, :mailer_admin, :mailer_subject,
|
11
12
|
:layout, :categories, :per_page, :use_effective_roles, :max_duration, :auto_approve,
|
12
|
-
:classified_wizard_class_name
|
13
|
-
:mailer, :parent_mailer, :deliver_method, :mailer_layout, :mailer_sender, :mailer_admin
|
13
|
+
:classified_wizard_class_name
|
14
14
|
]
|
15
15
|
end
|
16
16
|
|
@@ -24,22 +24,4 @@ module EffectiveClassifieds
|
|
24
24
|
mailer&.constantize || Effective::ClassifiedsMailer
|
25
25
|
end
|
26
26
|
|
27
|
-
def self.parent_mailer_class
|
28
|
-
return parent_mailer.constantize if parent_mailer.present?
|
29
|
-
ActionMailer::Base
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.send_email(email, *args)
|
33
|
-
raise('expected args to be an Array') unless args.kind_of?(Array)
|
34
|
-
|
35
|
-
if defined?(Tenant)
|
36
|
-
tenant = Tenant.current || raise('expected a current tenant')
|
37
|
-
args.last.kind_of?(Hash) ? args.last.merge!(tenant: tenant) : args << { tenant: tenant }
|
38
|
-
end
|
39
|
-
|
40
|
-
deliver_method = EffectiveClassifieds.deliver_method || EffectiveResources.deliver_method
|
41
|
-
|
42
|
-
EffectiveClassifieds.mailer_class.send(email, *args).send(deliver_method)
|
43
|
-
end
|
44
|
-
|
45
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_classifieds
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -213,7 +213,6 @@ files:
|
|
213
213
|
- app/views/effective/classifieds/index.html.haml
|
214
214
|
- app/views/effective/classifieds/show.html.haml
|
215
215
|
- app/views/effective/classifieds_mailer/classified_submitted.html.haml
|
216
|
-
- app/views/layouts/effective_classifieds_mailer_layout.html.haml
|
217
216
|
- config/effective_classifieds.rb
|
218
217
|
- config/routes.rb
|
219
218
|
- db/migrate/01_create_effective_classifieds.rb.erb
|