pg_rails 7.0.8.pre.alpha.86 → 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: 777adfba6510fb280d827dab94dc0a924f851608924a38e16eeedc43c3bba896
4
- data.tar.gz: 9d099949a82596a82e8c2d62e71aaef3bda568cfc3a58793daaa2ab4d53f1d1b
3
+ metadata.gz: 2c900ac5b6158852a5a907b1f7f66885a23ac9257490bb927471d001df36b9bd
4
+ data.tar.gz: eead4343c6e37e043067b355f57a4b9dc9e1baf65a78ec40f231efbe2171e73e
5
5
  SHA512:
6
- metadata.gz: 142b66b567ed6f4aa81666b04f7157bb327af673420d4a3a333c723ffb2aa85895e6c80acbfa826a4f81b1db363f025a46d2d850b9dc6b399b4fad281caffa42
7
- data.tar.gz: 8317ed39418fe41a693810801ed8fdd5936d3b3dd4670f6247e92575c3a566962e61565c388cced8f5f8512a5910be7b06ca7d9d4b58ffe155168eca61f28749
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
@@ -23,5 +23,5 @@ CableReady.configure do |config|
23
23
  # Doing so is a best practice to avoid heavy ActionCable traffic
24
24
  #
25
25
  # config.updatable_debounce_time = 0.1.seconds
26
- config.verifier_key = ENV.fetch('ANYCABLE_CABLE_READY_KEY', nil)
26
+ # config.verifier_key = Rails.application.credentials.dig(:anycable, :cable_ready_secret)
27
27
  end
@@ -96,4 +96,10 @@ module PgEngine
96
96
  db = (env_value.nil? ? 1 : (env_value.presence || 1)).to_i - 1
97
97
  "redis://127.0.0.1:6379/#{db}"
98
98
  end
99
+
100
+ GOOGLE_FONTS_URL =
101
+ <<~URL.chomp
102
+ https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@0,300;0,400;\
103
+ 0,500;0,700;1,300;1,400;1,500;1,700&display=swap
104
+ URL
99
105
  end
@@ -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
@@ -66,7 +66,7 @@ describe DummyBaseController do
66
66
  request.headers['Accept'] = 'application/json'
67
67
  end
68
68
 
69
- fit do
69
+ it do
70
70
  subject
71
71
  expect(response).to have_http_status(:internal_server_error)
72
72
  end
@@ -26,7 +26,7 @@ def build_body(log_id, signature, timestamp)
26
26
  JSON
27
27
  end
28
28
 
29
- fdescribe Public::WebhooksController do
29
+ describe Public::WebhooksController do
30
30
  include ActiveSupport::Testing::TimeHelpers
31
31
 
32
32
  before { travel_to Time.zone.at(1_716_564_587) }
@@ -61,7 +61,7 @@ fdescribe Public::WebhooksController do
61
61
  expect(response).to have_http_status(:internal_server_error)
62
62
  end
63
63
 
64
- fit do
64
+ it do
65
65
  expect { subject }.to have_errored('internal server error')
66
66
  .and(have_errored('no me sirve'))
67
67
  end
@@ -75,7 +75,7 @@ fdescribe Public::WebhooksController do
75
75
  expect(response).to have_http_status(:bad_request)
76
76
  end
77
77
 
78
- fit do
78
+ it do
79
79
  expect { subject }.to have_warned('parser error').and(have_warned('mal json'))
80
80
  end
81
81
  end
@@ -107,7 +107,7 @@ fdescribe Public::WebhooksController do
107
107
 
108
108
  it_behaves_like 'todo bien pero no guarda el log'
109
109
 
110
- fit do
110
+ it do
111
111
  expect { subject }.to have_warned('refusing invalid signature')
112
112
  end
113
113
  end
@@ -123,7 +123,7 @@ fdescribe Public::WebhooksController do
123
123
 
124
124
  it_behaves_like 'todo bien pero no guarda el log'
125
125
 
126
- fit do
126
+ it do
127
127
  expect { subject }.to have_warned('refusing used token')
128
128
  end
129
129
  end
@@ -134,7 +134,7 @@ fdescribe Public::WebhooksController do
134
134
 
135
135
  it_behaves_like 'todo bien pero no guarda el log'
136
136
 
137
- fit do
137
+ it do
138
138
  expect { subject }.to have_warned('refusing due to timestamp')
139
139
  end
140
140
  end
@@ -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
@@ -36,8 +36,7 @@ html
36
36
 
37
37
  link rel="preconnect" href="https://fonts.googleapis.com"
38
38
  link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="crossorigin"
39
- link href="https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@0,300;0,400; \
40
- 0,500;0,700;1,300;1,400;1,500;1,700&display=swap" rel="stylesheet"
39
+ link href=PgEngine::GOOGLE_FONTS_URL rel="stylesheet"
41
40
  css:
42
41
  body {
43
42
  font-family: "Ubuntu", sans-serif;
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgRails
4
- VERSION = '7.0.8-alpha.86'
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.86
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-30 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