pg_rails 7.0.8.pre.alpha.62 → 7.0.8.pre.alpha.63
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/pg_engine/app/assets/config/pg_engine_manifest.js +1 -0
- data/pg_engine/app/assets/images/plantita-sm.png +0 -0
- data/pg_engine/app/assets/images/plantita.png +0 -0
- data/pg_engine/app/controllers/concerns/pg_engine/resource.rb +7 -2
- data/pg_engine/app/controllers/users/registrations_controller.rb +1 -1
- data/pg_engine/app/helpers/pg_engine/flash_helper.rb +2 -1
- data/pg_engine/app/helpers/pg_engine/print_helper.rb +1 -1
- data/pg_engine/app/lib/pg_engine/devise_failure_app.rb +41 -0
- data/pg_engine/app/models/email.rb +1 -1
- data/pg_engine/app/views/public/mensaje_contactos/_gracias.html.slim +1 -1
- data/pg_engine/app/views/public/mensaje_contactos/new.html.slim +4 -0
- data/pg_engine/config/routes.rb +1 -1
- data/pg_engine/lib/pg_engine/email_observer.rb +6 -9
- data/pg_engine/spec/controllers/devise/sessions_controller_spec.rb +23 -0
- data/pg_layout/app/javascript/controllers/pg_form_controller.js +2 -2
- data/pg_layout/app/lib/navbar.rb +1 -1
- data/pg_layout/app/views/devise/confirmations/new.html.erb +1 -3
- data/pg_layout/app/views/layouts/pg_layout/base.html.slim +9 -1
- data/pg_rails/lib/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d32d439bc5fe9dd6527c13d1800daf3381c2590b883844e772ca336732efeec
|
4
|
+
data.tar.gz: f9aff03d93288060f00dfb7efcb6c9160ffc2f7ac6ba9cd3c59aa6f3934d5bbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 397c4960f4e804ed8b88096542573b34475a935426db607cb14542a70991697c76404bae1460b0a8859eb3dbe6eefc2b9f829ebebf9cb019a9501b89c5b24790
|
7
|
+
data.tar.gz: dd5e763c4fe36a2f5b7115dffcadceba504e8bdd99a874c727e5ce1197698dafadb142b5601ada51d61a980421c6beef2fbea865fa3df1a15dd0391e96054d82
|
@@ -0,0 +1 @@
|
|
1
|
+
//= link_tree ../images
|
Binary file
|
Binary file
|
@@ -20,8 +20,6 @@ module PgEngine
|
|
20
20
|
def index
|
21
21
|
@collection = filtros_y_policy atributos_para_buscar
|
22
22
|
@collection = sort_collection(@collection)
|
23
|
-
@records_filtered = policy_scope(clase_modelo).any? if @collection.empty?
|
24
|
-
# FIXME: si hay pero en páginas anteriores, mostrar texto correspondiente
|
25
23
|
pg_respond_index
|
26
24
|
end
|
27
25
|
|
@@ -208,6 +206,7 @@ module PgEngine
|
|
208
206
|
|
209
207
|
def render_listing
|
210
208
|
@collection = @collection.page(params[:page]).per(current_page_size)
|
209
|
+
@records_filtered = default_scope_for_current_model.any? if @collection.empty?
|
211
210
|
end
|
212
211
|
|
213
212
|
def buscar_instancia
|
@@ -272,6 +271,12 @@ module PgEngine
|
|
272
271
|
@filtros.filtrar(scope)
|
273
272
|
end
|
274
273
|
|
274
|
+
def default_scope_for_current_model
|
275
|
+
PgEngine::FiltrosBuilder.new(
|
276
|
+
self, clase_modelo, []
|
277
|
+
).filtrar(policy_scope(clase_modelo))
|
278
|
+
end
|
279
|
+
|
275
280
|
def do_sort(scope, field, direction)
|
276
281
|
# TODO: restringir ciertos campos?
|
277
282
|
unless scope.model.column_names.include?(field.to_s) ||
|
@@ -5,8 +5,9 @@ module PgEngine
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def render_turbo_stream_title
|
8
|
+
title = [breadcrumbs.last&.name, I18n.t('app_name')].compact.join(' - ')
|
8
9
|
# rubocop:disable Rails/SkipsModelValidations
|
9
|
-
turbo_stream.update_all 'title',
|
10
|
+
turbo_stream.update_all 'title', title
|
10
11
|
# rubocop:enable Rails/SkipsModelValidations
|
11
12
|
end
|
12
13
|
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PgEngine
|
4
|
+
class DeviseFailureApp < Devise::FailureApp
|
5
|
+
def respond
|
6
|
+
if warden_message == :unconfirmed
|
7
|
+
render_unconfirmed
|
8
|
+
else
|
9
|
+
super
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def user_email
|
16
|
+
params[:user][:email]
|
17
|
+
rescue StandardError => e
|
18
|
+
pg_warn e, :warn
|
19
|
+
end
|
20
|
+
|
21
|
+
def render_unconfirmed
|
22
|
+
self.content_type = 'text/vnd.turbo-stream.html'
|
23
|
+
self.status = 200
|
24
|
+
self.response_body = <<~HTML
|
25
|
+
<turbo-stream action="update" target="flash">
|
26
|
+
<template>
|
27
|
+
<div class="alert alert-warning d-flex align-items-center">
|
28
|
+
<div class="bi bi-exclamation-circle me-3"></div>
|
29
|
+
<span>
|
30
|
+
Tu cuenta aún no está confirmada.
|
31
|
+
<br>
|
32
|
+
Revisá tu bandeja de entrada o
|
33
|
+
<a href="/users/confirmation/new?email=#{user_email}">hacé click acá para reenviar el correo</a>
|
34
|
+
</span>
|
35
|
+
</div>
|
36
|
+
</template>
|
37
|
+
</turbo-stream>
|
38
|
+
HTML
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/pg_engine/config/routes.rb
CHANGED
@@ -7,7 +7,7 @@ Rails.application.routes.draw do
|
|
7
7
|
devise_for :users, controllers: {
|
8
8
|
confirmations: 'users/confirmations',
|
9
9
|
registrations: 'users/registrations'
|
10
|
-
}
|
10
|
+
}, failure_app: PgEngine::DeviseFailureApp
|
11
11
|
namespace :admin, path: 'a' do
|
12
12
|
pg_resource(:emails)
|
13
13
|
pg_resource(:users)
|
@@ -2,23 +2,20 @@
|
|
2
2
|
|
3
3
|
module PgEngine
|
4
4
|
class EmailObserver
|
5
|
-
def self.delivered_email(message)
|
5
|
+
def self.delivered_email(message) # rubocop:disable Metrics/AbcSize
|
6
6
|
message_id = message.message_id
|
7
7
|
mailer = message.delivery_handler.to_s
|
8
8
|
status = get_status(message)
|
9
|
-
|
10
9
|
if message['email'].present?
|
11
10
|
email = message['email'].unparsed_value
|
12
11
|
email.update_columns(message_id:, mailer:, status:) # rubocop:disable Rails/SkipsModelValidations
|
13
|
-
email.encoded_eml.attach({ io: StringIO.new(message.encoded), filename: "email-#{email.id}.eml" })
|
14
12
|
else
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
# date: DateTime.now, mailer: message.delivery_handler.to_s, associated: associated(message),
|
20
|
-
# status: get_status(message), observations: get_observations(message))
|
13
|
+
to = [message.to].flatten.join(', ')
|
14
|
+
from = [message.from].flatten.join(', ')
|
15
|
+
email = Email.create!(message_id:, subject: message.subject, to:, mailer:, status:, from_address: from,
|
16
|
+
from_name: '')
|
21
17
|
end
|
18
|
+
email.encoded_eml.attach({ io: StringIO.new(message.encoded), filename: "email-#{email.id}.eml" })
|
22
19
|
rescue StandardError => e
|
23
20
|
pg_warn e, :error
|
24
21
|
end
|
@@ -15,4 +15,27 @@ describe Devise::SessionsController do
|
|
15
15
|
expect(response).to have_http_status(:ok)
|
16
16
|
end
|
17
17
|
end
|
18
|
+
|
19
|
+
describe '#create' do
|
20
|
+
subject do
|
21
|
+
post :create, params: { user: { email: user.email, password: } }
|
22
|
+
end
|
23
|
+
|
24
|
+
let(:password) { 'cosas1234' }
|
25
|
+
let(:confirmed_at) { nil }
|
26
|
+
let(:user) { create :user, confirmed_at:, password: }
|
27
|
+
|
28
|
+
it do
|
29
|
+
subject
|
30
|
+
expect(response.body).to include 'Tu cuenta aún no está confirmada.'
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'cuando está confirmado' do
|
34
|
+
let(:confirmed_at) { Time.zone.now }
|
35
|
+
|
36
|
+
it do
|
37
|
+
expect { subject }.to change(controller, :user_signed_in?).from(false).to(true)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
18
41
|
end
|
@@ -16,9 +16,9 @@ export default class extends Controller {
|
|
16
16
|
const baseAlert = document.querySelector('.alert-danger')
|
17
17
|
if (!invalidField && !baseAlert) {
|
18
18
|
const errorTitle = this.element.querySelector('.error-title')
|
19
|
-
//
|
19
|
+
// TODO!: testear con capybara
|
20
20
|
errorTitle.innerText = 'Lo lamentamos mucho pero ocurrió algo inesperado. Por favor, intentá nuevamente o ponete en contacto con nosotros.'
|
21
|
-
//
|
21
|
+
// TODO!: link a contacto
|
22
22
|
const form = this.element.querySelector('form')
|
23
23
|
const errorMsg = `${form.id} - ${form.action} - ${form.dataset.errors}`
|
24
24
|
console.error(errorMsg)
|
data/pg_layout/app/lib/navbar.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
<h2><%= t(".resend_confirmation_instructions") %></h2>
|
2
|
-
|
3
1
|
<%= pg_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
|
4
2
|
<%= f.mensajes_de_error %>
|
5
3
|
<%= f.full_error :confirmation_token %>
|
@@ -9,7 +7,7 @@
|
|
9
7
|
required: true,
|
10
8
|
autofocus: true,
|
11
9
|
value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email),
|
12
|
-
input_html: { autocomplete: "email" } %>
|
10
|
+
input_html: { value: params[:email], autocomplete: "email" } %>
|
13
11
|
</div>
|
14
12
|
|
15
13
|
<div class="form-actions">
|
@@ -1,8 +1,16 @@
|
|
1
1
|
doctype html
|
2
2
|
html
|
3
3
|
head
|
4
|
-
|
4
|
+
meta charset="UTF-8"
|
5
|
+
meta http-equiv="X-UA-Compatible" content="IE=edge"
|
5
6
|
meta name="viewport" content="width=device-width,initial-scale=1"
|
7
|
+
- cache :title_icon
|
8
|
+
title = t('app_name')
|
9
|
+
- begin
|
10
|
+
= render partial: 'layouts/favicon'
|
11
|
+
- rescue ActionView::MissingTemplate => e
|
12
|
+
- pg_err e
|
13
|
+
|
6
14
|
- if @turbo_no_cache
|
7
15
|
meta name="turbo-cache-control" content="no-cache"
|
8
16
|
/ El morph no estaría siendo de utilidad
|
data/pg_rails/lib/version.rb
CHANGED
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.
|
4
|
+
version: 7.0.8.pre.alpha.63
|
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-
|
11
|
+
date: 2024-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -906,6 +906,9 @@ files:
|
|
906
906
|
- pg_engine/app/admin/mensaje_contactos.rb
|
907
907
|
- pg_engine/app/admin/user_accounts.rb
|
908
908
|
- pg_engine/app/admin/users.rb
|
909
|
+
- pg_engine/app/assets/config/pg_engine_manifest.js
|
910
|
+
- pg_engine/app/assets/images/plantita-sm.png
|
911
|
+
- pg_engine/app/assets/images/plantita.png
|
909
912
|
- pg_engine/app/assets/javascripts/active_admin.js
|
910
913
|
- pg_engine/app/assets/stylesheets/active_admin.scss
|
911
914
|
- pg_engine/app/assets/stylesheets/pg_rails_b5.scss
|
@@ -935,6 +938,7 @@ files:
|
|
935
938
|
- pg_engine/app/helpers/pg_engine/print_helper.rb
|
936
939
|
- pg_engine/app/helpers/pg_engine/route_helper.rb
|
937
940
|
- pg_engine/app/inputs/pg_engine/fecha_input.rb
|
941
|
+
- pg_engine/app/lib/pg_engine/devise_failure_app.rb
|
938
942
|
- pg_engine/app/lib/pg_engine/error_helper.rb
|
939
943
|
- pg_engine/app/lib/pg_engine/filtros_builder.rb
|
940
944
|
- pg_engine/app/lib/pg_form_builder.rb
|