pg_rails 7.0.8.pre.alpha.87 → 7.0.8.pre.alpha.88

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: 11a9943ab64b335423a3cdade44755884793200a84fdcada6e233b57da56e6a2
4
- data.tar.gz: ab282edacb9357c7c33c439243177e35a35ebd681f37a6317bfd7a8bf1a8cc84
3
+ metadata.gz: 2c900ac5b6158852a5a907b1f7f66885a23ac9257490bb927471d001df36b9bd
4
+ data.tar.gz: eead4343c6e37e043067b355f57a4b9dc9e1baf65a78ec40f231efbe2171e73e
5
5
  SHA512:
6
- metadata.gz: c986082ad8aeafff10393b65e028c357cafb90459458e86a3ab8e68b1194e828f392ea33568db2c5e29c797d9830cf9f168a4ac944aaa7c3564c6fb2066b4ced
7
- data.tar.gz: fcdaa6c8d1950ef9b36a6fe27a83cbcf6b9fdadf21e45b8e79315664ce27843c5b983026ce79c6ea8b4ebfbb89b314e118218df31779407c7f1d45581ce22b9f
6
+ metadata.gz: 1791df3ff62596290d1def2c00916bd24bc9248f3eaa3a7fee799b79e1f6c730d8363b87fdaead496b65b6ff1c7faaabc715edb8691cd8c70e0e1fe2c2af42ac
7
+ data.tar.gz: bbd8f3bb0974366926cd19964aad87b61668877e8a5c6a8c8250e6229d00eaf5dec803f25a62489461b13080c3a5bec41bb7ecde735eeb8ec884882dbcc373fb
@@ -14,6 +14,27 @@ module Admin
14
14
 
15
15
  add_breadcrumb Email.nombre_plural, :admin_emails_path
16
16
 
17
+ def new
18
+ render template: 'admin/emails/_send', locals: { email: @email },
19
+ layout: 'pg_layout/containerized'
20
+ end
21
+
22
+ def create
23
+ saved = false
24
+ ActiveRecord::Base.transaction do
25
+ if (saved = @email.save)
26
+ PgEngine::AdminMailer.with(email_object: @email).admin_mail.deliver_later
27
+ end
28
+ end
29
+ if saved
30
+ redirect_to @email.decorate.target_object
31
+ else
32
+ render template: 'admin/emails/_send',
33
+ layout: 'pg_layout/containerized', status: :unprocessable_entity,
34
+ locals: { email: @email }
35
+ end
36
+ end
37
+
17
38
  private
18
39
 
19
40
  def atributos_permitidos
@@ -0,0 +1,9 @@
1
+ module PgEngine
2
+ class AdminMailer < ApplicationMailer
3
+ # default delivery_method: :smtp
4
+
5
+ def admin_mail
6
+ mail
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,14 @@
1
+ / # locals: (email:)
2
+
3
+ = pg_form_for email do |f|
4
+ = f.mensajes_de_error
5
+ = f.input :from_name
6
+ = f.input :from_address
7
+ = f.input :to
8
+ = f.input :subject
9
+ = f.input :reply_to
10
+ = f.input :body_input, as: :text, input_html: { rows: 5 }
11
+
12
+ = button_tag class: 'btn btn-primary', type: :submit do
13
+ span.bi.bi-send
14
+ | Enviar
@@ -0,0 +1 @@
1
+ pre style="font-family:sans-serif" = @email_object.body_input
@@ -97,13 +97,6 @@ RSpec.describe Admin::EmailsController do
97
97
  end
98
98
  end
99
99
 
100
- describe 'GET #new' do
101
- it 'returns a success response' do
102
- get :new, params: {}
103
- expect(response).to be_successful
104
- end
105
- end
106
-
107
100
  describe 'GET #edit' do
108
101
  it 'returns a success response' do
109
102
  email = create(:email)
@@ -112,33 +105,6 @@ RSpec.describe Admin::EmailsController do
112
105
  end
113
106
  end
114
107
 
115
- describe 'POST #create' do
116
- context 'with valid params' do
117
- it 'creates a new Email' do
118
- expect do
119
- post :create, params: { email: valid_attributes }
120
- end.to change(Email, :count).by(1)
121
- end
122
-
123
- it 'redirects to the created email' do
124
- post :create, params: { email: valid_attributes }
125
- expect(response).to redirect_to([:admin, Email.last])
126
- end
127
- end
128
-
129
- context 'with invalid params' do
130
- it 'returns a unprocessable_entity response' do
131
- post :create, params: { email: invalid_attributes }
132
- expect(response).to have_http_status(:unprocessable_entity)
133
- end
134
-
135
- it 'renders the new template' do
136
- post :create, params: { email: invalid_attributes }
137
- expect(response).to render_template(:new)
138
- end
139
- end
140
- end
141
-
142
108
  describe 'PUT #update' do
143
109
  context 'with valid params' do
144
110
  let(:new_attributes) do
@@ -0,0 +1,34 @@
1
+ require 'rails_helper'
2
+
3
+ fdescribe 'Enviar email' do
4
+ include ActiveJob::TestHelper
5
+
6
+ subject do
7
+ fill_in 'email_from_address', with: Faker::Internet.email
8
+ fill_in 'email_from_name', with: Faker::Name.name
9
+ fill_in 'email_reply_to', with: Faker::Internet.email
10
+ fill_in 'email_body_input', with: Faker::Lorem.sentence
11
+ fill_in 'email_subject', with: Faker::Lorem.sentence
12
+ click_on 'Enviar'
13
+ expect(page).to have_text 'revisá los campos obligatorios'
14
+ fill_in 'email_to', with: Faker::Internet.email
15
+ click_on 'Enviar'
16
+ end
17
+
18
+ around do |example|
19
+ perform_enqueued_jobs do
20
+ example.run
21
+ end
22
+ end
23
+
24
+ before do
25
+ driven_by ENV['DRIVER']&.to_sym || :selenium_chrome_headless_iphone
26
+ login_as create(:user, :developer)
27
+ visit '/a/emails/new'
28
+ end
29
+
30
+ it do
31
+ subject
32
+ expect(page).to have_text 'sent'
33
+ end
34
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgRails
4
- VERSION = '7.0.8-alpha.87'
4
+ VERSION = '7.0.8-alpha.88'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.8.pre.alpha.87
4
+ version: 7.0.8.pre.alpha.88
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martín Rosso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-31 00:00:00.000000000 Z
11
+ date: 2024-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -989,6 +989,7 @@ files:
989
989
  - pg_engine/app/lib/pg_engine/error_helper.rb
990
990
  - pg_engine/app/lib/pg_engine/filtros_builder.rb
991
991
  - pg_engine/app/lib/pg_form_builder.rb
992
+ - pg_engine/app/mailers/pg_engine/admin_mailer.rb
992
993
  - pg_engine/app/mailers/pg_engine/base_mailer.rb
993
994
  - pg_engine/app/models/account.rb
994
995
  - pg_engine/app/models/current.rb
@@ -1015,6 +1016,7 @@ files:
1015
1016
  - pg_engine/app/views/admin/email_logs/_form.html.slim
1016
1017
  - pg_engine/app/views/admin/email_logs/show.html.slim
1017
1018
  - pg_engine/app/views/admin/emails/_form.html.slim
1019
+ - pg_engine/app/views/admin/emails/_send.html.slim
1018
1020
  - pg_engine/app/views/admin/emails/show.html.slim
1019
1021
  - pg_engine/app/views/admin/user_accounts/_form.html.slim
1020
1022
  - pg_engine/app/views/admin/user_accounts/_user_account.html.slim
@@ -1026,6 +1028,7 @@ files:
1026
1028
  - pg_engine/app/views/admin/users/edit.html.slim
1027
1029
  - pg_engine/app/views/admin/users/new.html.slim
1028
1030
  - pg_engine/app/views/admin/users/show.html.slim
1031
+ - pg_engine/app/views/pg_engine/admin_mailer/admin_mail.html.slim
1029
1032
  - pg_engine/app/views/pg_engine/base/download.xlsx.axlsx
1030
1033
  - pg_engine/app/views/pg_engine/base/edit.html.slim
1031
1034
  - pg_engine/app/views/pg_engine/base/index.html.slim
@@ -1107,6 +1110,7 @@ files:
1107
1110
  - pg_engine/spec/pg_engine/pdf_preview_generator_spec.rb
1108
1111
  - pg_engine/spec/system/destroy_spec.rb
1109
1112
  - pg_engine/spec/system/login_spec.rb
1113
+ - pg_engine/spec/system/send_mail_spec.rb
1110
1114
  - pg_engine/spec/system/signup_spec.rb
1111
1115
  - pg_layout/app/assets/stylesheets/animations.scss
1112
1116
  - pg_layout/app/assets/stylesheets/sidebar.scss