eac_rails_base0 0.46.0 → 0.47.0
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 +4 -4
- data/app/controllers/eac_rails_base0/mailer_controller.rb +20 -0
- data/app/helpers/eac_rails_base0/layout_helper.rb +6 -3
- data/app/mailers/eac_rails_base0/send_test_mailer.rb +10 -0
- data/app/tableless_models/eac_rails_base0/email_send_test.rb +32 -0
- data/app/views/eac_rails_base0/mailer/send_test.html.erb +5 -0
- data/app/views/eac_rails_base0/send_test_mailer/main.html.erb +1 -0
- data/config/locales/en.yml +3 -0
- data/config/locales/pt-BR.yml +3 -0
- data/config/routes.rb +4 -1
- data/lib/eac_rails_base0/version.rb +1 -1
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9dbf7853e319ed40781d1ba226a0a69ab73429884cbd6355c9ffc53cd8e3ac62
|
4
|
+
data.tar.gz: acf438c17b387f7b2fc025d92371809a4ec2dc68c2373678bd91c275d5e3e011
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db2d718db7eca5f9720efcd5e3d4cf7618364611b9d08ca8329da68abcdab1acee7a414dc3dae7c676aaaf8f68c8948c5a568fbb5b958a3b3a95790087039340
|
7
|
+
data.tar.gz: '08a70dac3579768cd8d3f7596e064a4ba16e2b8e8fa17b7263743669e5aab78b12bf70463324d853fca00126c7bbd516d0499f2d47aa0e790e9498ca314019f9'
|
@@ -8,5 +8,25 @@ module EacRailsBase0
|
|
8
8
|
["#{klass}.#{section}", klass.send(section)]
|
9
9
|
end.to_h
|
10
10
|
end
|
11
|
+
|
12
|
+
def send_test
|
13
|
+
@record = ::EacRailsBase0::EmailSendTest.new
|
14
|
+
end
|
15
|
+
|
16
|
+
def send_test_submit
|
17
|
+
@record = ::EacRailsBase0::EmailSendTest.new(send_test_submit_params)
|
18
|
+
if @record.save
|
19
|
+
flash[:success] = t('eac_rails_base0.mailer.send_test_successful', address: @record.address)
|
20
|
+
redirect_to action: :send_test
|
21
|
+
else
|
22
|
+
render :send_test
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def send_test_submit_params
|
29
|
+
params[::EacRailsBase0::EmailSendTest.model_name.param_key].permit(:alternative_address)
|
30
|
+
end
|
11
31
|
end
|
12
32
|
end
|
@@ -36,9 +36,12 @@ module EacRailsBase0
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def mailer_main_menu_admin_entries
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
%w[info send_test].map do |action|
|
40
|
+
[
|
41
|
+
t("eac_rails_base0.mailer.#{action}"),
|
42
|
+
main_app.send("#{action}_eac_rails_base0_mailer_index_path")
|
43
|
+
]
|
44
|
+
end.to_h
|
42
45
|
end
|
43
46
|
|
44
47
|
def eac_users_support_main_menu_admin_entries
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EacRailsBase0
|
6
|
+
class EmailSendTest < ::EacRailsUtils::Models::Tableless
|
7
|
+
attribute :alternative_address, ::String
|
8
|
+
|
9
|
+
validates :alternative_address, allow_blank: true, format: { with: URI::MailTo::EMAIL_REGEXP }
|
10
|
+
validates :logged_user_address, allow_blank: true, format: { with: URI::MailTo::EMAIL_REGEXP }
|
11
|
+
validates :address, presence: true, format: { with: URI::MailTo::EMAIL_REGEXP }
|
12
|
+
|
13
|
+
def save
|
14
|
+
return false unless valid?
|
15
|
+
|
16
|
+
send_mail
|
17
|
+
true
|
18
|
+
end
|
19
|
+
|
20
|
+
def address
|
21
|
+
alternative_address.presence || logged_user_address.presence
|
22
|
+
end
|
23
|
+
|
24
|
+
def logged_user_address
|
25
|
+
::EacUsersSupport::User.current_user.if_present(&:email)
|
26
|
+
end
|
27
|
+
|
28
|
+
def send_mail
|
29
|
+
::EacRailsBase0::SendTestMailer.with(address: address).main.deliver_later
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<h2><%= @subject %></h2>
|
data/config/locales/en.yml
CHANGED
data/config/locales/pt-BR.yml
CHANGED
data/config/routes.rb
CHANGED
@@ -9,10 +9,13 @@ Rails.application.routes.draw do
|
|
9
9
|
mount ::BrRailties::Engine => '/br_railties'
|
10
10
|
|
11
11
|
namespace(:eac_rails_base0) do
|
12
|
-
resources(:mailer,
|
12
|
+
resources(:mailer, only: []) do
|
13
13
|
collection do
|
14
14
|
get :info
|
15
|
+
get :send_test
|
15
16
|
end
|
16
17
|
end
|
17
18
|
end
|
19
|
+
|
20
|
+
post '/eac_rails_base0/mailer/send_test', to: 'eac_rails_base0/mailer#send_test_submit'
|
18
21
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eac_rails_base0
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.47.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esquilo Azul Company
|
@@ -581,7 +581,9 @@ files:
|
|
581
581
|
- app/helpers/eac_rails_base0/app_version_helper.rb
|
582
582
|
- app/helpers/eac_rails_base0/layout_helper.rb
|
583
583
|
- app/helpers/eac_rails_base0/panel_default_helper.rb
|
584
|
+
- app/mailers/eac_rails_base0/send_test_mailer.rb
|
584
585
|
- app/models/eac_rails_base0/application_record.rb
|
586
|
+
- app/tableless_models/eac_rails_base0/email_send_test.rb
|
585
587
|
- app/uploaders/eac_rails_base0/default_file_uploader.rb
|
586
588
|
- app/views/devise/confirmations/new.html.erb
|
587
589
|
- app/views/devise/mailer/confirmation_instructions.html.erb
|
@@ -593,6 +595,8 @@ files:
|
|
593
595
|
- app/views/devise/sessions/new.html.erb
|
594
596
|
- app/views/devise/shared/_links.html.erb
|
595
597
|
- app/views/eac_rails_base0/mailer/info.html.erb
|
598
|
+
- app/views/eac_rails_base0/mailer/send_test.html.erb
|
599
|
+
- app/views/eac_rails_base0/send_test_mailer/main.html.erb
|
596
600
|
- app/views/layouts/eac_rails_base0/_flash.html.erb
|
597
601
|
- app/views/layouts/eac_rails_base0/_main_menu.html.erb
|
598
602
|
- app/views/layouts/eac_rails_base0/_navbar_user.html.erb
|