pg_rails 7.0.8.pre.alpha.49 → 7.0.8.pre.alpha.51
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/pg_engine/app/admin/mensaje_contactos.rb +28 -0
- data/pg_engine/app/controllers/concerns/pg_engine/resource.rb +1 -1
- data/pg_engine/app/controllers/public/mensaje_contactos_controller.rb +29 -0
- data/pg_engine/app/decorators/mensaje_contacto_decorator.rb +16 -0
- data/pg_engine/app/lib/pg_form_builder.rb +2 -0
- data/pg_engine/app/models/mensaje_contacto.rb +21 -0
- data/pg_engine/app/policies/mensaje_contacto_policy.rb +31 -0
- data/pg_engine/app/views/public/mensaje_contactos/_form.html.slim +14 -0
- data/pg_engine/app/views/public/mensaje_contactos/_gracias.html.slim +8 -0
- data/pg_engine/config/routes.rb +3 -0
- data/pg_engine/config/simple_form/simple_form_bootstrap.rb +18 -18
- data/pg_engine/db/migrate/20240428152916_create_mensaje_contactos.rb +15 -0
- data/pg_engine/spec/controllers/public/mensaje_contactos_controller_spec.rb +91 -0
- data/pg_engine/spec/factories/mensaje_contactos.rb +12 -0
- data/pg_engine/spec/models/mensaje_contacto_spec.rb +13 -0
- data/pg_layout/app/views/layouts/pg_layout/base.html.slim +4 -0
- data/pg_rails/lib/version.rb +1 -1
- metadata +13 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12e2f8570100688111978d151d42a814178f2382d18b373455535f7b5d625216
|
4
|
+
data.tar.gz: e867b8911a1a67781515d30efbf3facf6ad31cb27c296444327016c3ad2fdbca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7bc0a0f4e182d2f0fc451278e779acb22c31de3e7939de6d9feeb5047590b972586a70c8f03823b648c1e298bfa9ca7cc9609748175f8de941bc03658e42476
|
7
|
+
data.tar.gz: e5b2f79ca65227fdf85761af0a96629405c0904c6f0027b3f16e001648470c375920c8b5eb2d550ae0b697e4784b95f791ec4d073d4d22ebb37f6d8ea73e9dd9
|
@@ -0,0 +1,28 @@
|
|
1
|
+
ActiveAdmin.register MensajeContacto do
|
2
|
+
permit_params :nombre, :email, :telefono, :mensaje
|
3
|
+
|
4
|
+
index do
|
5
|
+
selectable_column
|
6
|
+
id_column
|
7
|
+
column :nombre
|
8
|
+
column :email
|
9
|
+
column :telefono
|
10
|
+
column :mensaje
|
11
|
+
actions
|
12
|
+
end
|
13
|
+
|
14
|
+
filter :nombre
|
15
|
+
filter :email
|
16
|
+
filter :telefono
|
17
|
+
filter :mensaje
|
18
|
+
|
19
|
+
form do |f|
|
20
|
+
f.inputs do
|
21
|
+
f.input :nombre
|
22
|
+
f.input :email
|
23
|
+
f.input :telefono
|
24
|
+
f.input :mensaje
|
25
|
+
end
|
26
|
+
f.actions
|
27
|
+
end
|
28
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module PgEngine
|
2
2
|
module Resource
|
3
3
|
def self.included(clazz)
|
4
|
-
clazz.before_action :authenticate_user!
|
4
|
+
# clazz.before_action :authenticate_user!
|
5
5
|
clazz.helper_method :atributos_para_listar
|
6
6
|
clazz.helper_method :atributos_para_mostrar
|
7
7
|
clazz.helper_method :current_page_size
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# generado con pg_rails
|
4
|
+
|
5
|
+
module Public
|
6
|
+
class MensajeContactosController < PublicController
|
7
|
+
include PgEngine::Resource
|
8
|
+
|
9
|
+
before_action { @clase_modelo = MensajeContacto }
|
10
|
+
|
11
|
+
before_action(only: :index) { authorize MensajeContacto }
|
12
|
+
|
13
|
+
before_action :set_instancia_modelo, only: %i[new create]
|
14
|
+
|
15
|
+
def create
|
16
|
+
if @mensaje_contacto.save
|
17
|
+
render turbo_stream: turbo_stream.update('mensaje_contacto', partial: 'gracias')
|
18
|
+
else
|
19
|
+
render :new, status: :unprocessable_entity
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def atributos_permitidos
|
26
|
+
%i[nombre email telefono mensaje]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# generado con pg_rails
|
4
|
+
|
5
|
+
class MensajeContactoDecorator < PgEngine::BaseDecorator
|
6
|
+
delegate_all
|
7
|
+
|
8
|
+
# Define presentation-specific methods here. Helpers are accessed through
|
9
|
+
# `helpers` (aka `h`). You can override attributes, for example:
|
10
|
+
#
|
11
|
+
# def created_at
|
12
|
+
# helpers.content_tag :span, class: 'time' do
|
13
|
+
# object.created_at.strftime("%a %m/%d/%y")
|
14
|
+
# end
|
15
|
+
# end
|
16
|
+
end
|
@@ -43,6 +43,8 @@ class PgFormBuilder < SimpleForm::FormBuilder
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def associations
|
46
|
+
return [] unless object.class.respond_to?(:reflect_on_all_associations)
|
47
|
+
|
46
48
|
object.class.reflect_on_all_associations
|
47
49
|
.select { |a| a.instance_of? ActiveRecord::Reflection::HasManyReflection }
|
48
50
|
.map(&:name)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# == Schema Information
|
4
|
+
#
|
5
|
+
# Table name: mensaje_contactos
|
6
|
+
#
|
7
|
+
# id :bigint not null, primary key
|
8
|
+
# email :string
|
9
|
+
# mensaje :string
|
10
|
+
# nombre :string
|
11
|
+
# telefono :string
|
12
|
+
# created_at :datetime not null
|
13
|
+
# updated_at :datetime not null
|
14
|
+
#
|
15
|
+
|
16
|
+
class MensajeContacto < ApplicationRecord
|
17
|
+
audited
|
18
|
+
|
19
|
+
validates :nombre, :email, :mensaje, presence: true
|
20
|
+
validates_format_of :email, with: /\A[^@\s]+@[^@\s]+\z/
|
21
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# generado con pg_rails
|
4
|
+
|
5
|
+
class MensajeContactoPolicy < ApplicationPolicy
|
6
|
+
class Scope < ApplicationPolicy::Scope
|
7
|
+
# def resolve
|
8
|
+
# if policy.acceso_total?
|
9
|
+
# scope.all
|
10
|
+
# else
|
11
|
+
# scope.none
|
12
|
+
# end
|
13
|
+
# end
|
14
|
+
end
|
15
|
+
|
16
|
+
# def puede_editar?
|
17
|
+
# acceso_total? && !record.readonly?
|
18
|
+
# end
|
19
|
+
|
20
|
+
# def puede_crear?
|
21
|
+
# acceso_total? || user.asesor?
|
22
|
+
# end
|
23
|
+
|
24
|
+
# def puede_borrar?
|
25
|
+
# acceso_total? && !record.readonly?
|
26
|
+
# end
|
27
|
+
|
28
|
+
def acceso_total?
|
29
|
+
true
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
/ # locals: (object: nil, asociable: false)
|
2
|
+
#mensaje_contacto.text-center
|
3
|
+
.d-inline-block style="width: 22em; max-width: 100%"
|
4
|
+
div data-controller="pg_form"
|
5
|
+
= pg_form_for(@mensaje_contacto || object, asociable:) do |f|
|
6
|
+
= f.mensajes_de_error
|
7
|
+
|
8
|
+
= hidden_field_tag :asociable, true if asociable
|
9
|
+
= f.input :nombre
|
10
|
+
= f.input :email
|
11
|
+
= f.input :telefono, hint: '(Opcional)'
|
12
|
+
= f.input :mensaje, as: :text
|
13
|
+
.mt-2
|
14
|
+
= f.button :submit, value: 'Enviar'
|
data/pg_engine/config/routes.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
include PgEngine::RouteHelpers
|
2
2
|
|
3
3
|
Rails.application.routes.draw do
|
4
|
+
namespace :public, path: '' do
|
5
|
+
pg_resource(:mensaje_contactos, only: [:new, :create], path: 'contacto')
|
6
|
+
end
|
4
7
|
devise_for :users, controllers: {
|
5
8
|
confirmations: 'users/confirmations',
|
6
9
|
registrations: 'users/registrations'
|
@@ -98,7 +98,7 @@ SimpleForm.setup do |config|
|
|
98
98
|
b.wrapper :form_check_wrapper, class: 'form-check' do |bb|
|
99
99
|
bb.use :input, class: 'form-check-input', error_class: 'is-invalid'
|
100
100
|
bb.use :label, class: 'form-check-label'
|
101
|
-
bb.use :
|
101
|
+
bb.use :error, wrap_with: { class: 'invalid-feedback' }
|
102
102
|
bb.use :hint, wrap_with: { class: 'form-text' }
|
103
103
|
end
|
104
104
|
end
|
@@ -112,7 +112,7 @@ SimpleForm.setup do |config|
|
|
112
112
|
ba.use :label_text
|
113
113
|
end
|
114
114
|
b.use :input, class: 'form-check-input', error_class: 'is-invalid'
|
115
|
-
b.use :
|
115
|
+
b.use :error, wrap_with: { class: 'invalid-feedback d-block' }
|
116
116
|
b.use :hint, wrap_with: { class: 'form-text' }
|
117
117
|
end
|
118
118
|
|
@@ -125,7 +125,7 @@ SimpleForm.setup do |config|
|
|
125
125
|
ba.use :label_text
|
126
126
|
end
|
127
127
|
b.use :input, class: 'form-check-input', error_class: 'is-invalid'
|
128
|
-
b.use :
|
128
|
+
b.use :error, wrap_with: { class: 'invalid-feedback d-block' }
|
129
129
|
b.use :hint, wrap_with: { class: 'form-text' }
|
130
130
|
end
|
131
131
|
|
@@ -138,7 +138,7 @@ SimpleForm.setup do |config|
|
|
138
138
|
b.optional :readonly
|
139
139
|
b.use :label, class: 'form-label'
|
140
140
|
b.use :input, class: 'form-control', error_class: 'is-invalid'
|
141
|
-
b.use :
|
141
|
+
b.use :error, wrap_with: { class: 'invalid-feedback' }
|
142
142
|
b.use :hint, wrap_with: { class: 'form-text' }
|
143
143
|
end
|
144
144
|
|
@@ -153,7 +153,7 @@ SimpleForm.setup do |config|
|
|
153
153
|
b.wrapper class: 'd-flex flex-row justify-content-between align-items-center' do |ba|
|
154
154
|
ba.use :input, class: 'form-select mx-1', error_class: 'is-invalid'
|
155
155
|
end
|
156
|
-
b.use :
|
156
|
+
b.use :error, wrap_with: { class: 'invalid-feedback d-block' }
|
157
157
|
b.use :hint, wrap_with: { class: 'form-text' }
|
158
158
|
end
|
159
159
|
|
@@ -165,7 +165,7 @@ SimpleForm.setup do |config|
|
|
165
165
|
b.optional :step
|
166
166
|
b.use :label, class: 'form-label'
|
167
167
|
b.use :input, class: 'form-range', error_class: 'is-invalid'
|
168
|
-
b.use :
|
168
|
+
b.use :error, wrap_with: { class: 'invalid-feedback' }
|
169
169
|
b.use :hint, wrap_with: { class: 'form-text' }
|
170
170
|
end
|
171
171
|
|
@@ -183,7 +183,7 @@ SimpleForm.setup do |config|
|
|
183
183
|
b.use :label, class: 'col-sm-3 col-form-label'
|
184
184
|
b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba|
|
185
185
|
ba.use :input, class: 'form-control', error_class: 'is-invalid'
|
186
|
-
ba.use :
|
186
|
+
ba.use :error, wrap_with: { class: 'invalid-feedback' }
|
187
187
|
ba.use :hint, wrap_with: { class: 'form-text' }
|
188
188
|
end
|
189
189
|
end
|
@@ -196,7 +196,7 @@ SimpleForm.setup do |config|
|
|
196
196
|
wr.wrapper :form_check_wrapper, class: 'form-check' do |bb|
|
197
197
|
bb.use :input, class: 'form-check-input', error_class: 'is-invalid'
|
198
198
|
bb.use :label, class: 'form-check-label'
|
199
|
-
bb.use :
|
199
|
+
bb.use :error, wrap_with: { class: 'invalid-feedback' }
|
200
200
|
bb.use :hint, wrap_with: { class: 'form-text' }
|
201
201
|
end
|
202
202
|
end
|
@@ -210,7 +210,7 @@ SimpleForm.setup do |config|
|
|
210
210
|
b.use :label, class: 'col-sm-3 col-form-label pt-0'
|
211
211
|
b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba|
|
212
212
|
ba.use :input, class: 'form-check-input', error_class: 'is-invalid'
|
213
|
-
ba.use :
|
213
|
+
ba.use :error, wrap_with: { class: 'invalid-feedback d-block' }
|
214
214
|
ba.use :hint, wrap_with: { class: 'form-text' }
|
215
215
|
end
|
216
216
|
end
|
@@ -223,7 +223,7 @@ SimpleForm.setup do |config|
|
|
223
223
|
b.use :label, class: 'col-sm-3 col-form-label pt-0'
|
224
224
|
b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba|
|
225
225
|
ba.use :input, class: 'form-check-input', error_class: 'is-invalid'
|
226
|
-
ba.use :
|
226
|
+
ba.use :error, wrap_with: { class: 'invalid-feedback d-block' }
|
227
227
|
ba.use :hint, wrap_with: { class: 'form-text' }
|
228
228
|
end
|
229
229
|
end
|
@@ -238,7 +238,7 @@ SimpleForm.setup do |config|
|
|
238
238
|
b.use :label, class: 'col-sm-3 col-form-label'
|
239
239
|
b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba|
|
240
240
|
ba.use :input, class: 'form-control', error_class: 'is-invalid'
|
241
|
-
ba.use :
|
241
|
+
ba.use :error, wrap_with: { class: 'invalid-feedback' }
|
242
242
|
ba.use :hint, wrap_with: { class: 'form-text' }
|
243
243
|
end
|
244
244
|
end
|
@@ -250,7 +250,7 @@ SimpleForm.setup do |config|
|
|
250
250
|
b.use :label, class: 'col-sm-3 col-form-label'
|
251
251
|
b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba|
|
252
252
|
ba.use :input, class: 'form-select', error_class: 'is-invalid'
|
253
|
-
ba.use :
|
253
|
+
ba.use :error, wrap_with: { class: 'invalid-feedback' }
|
254
254
|
ba.use :hint, wrap_with: { class: 'form-text' }
|
255
255
|
end
|
256
256
|
end
|
@@ -264,7 +264,7 @@ SimpleForm.setup do |config|
|
|
264
264
|
ba.wrapper class: 'd-flex flex-row justify-content-between align-items-center' do |bb|
|
265
265
|
bb.use :input, class: 'form-select mx-1', error_class: 'is-invalid'
|
266
266
|
end
|
267
|
-
ba.use :
|
267
|
+
ba.use :error, wrap_with: { class: 'invalid-feedback d-block' }
|
268
268
|
ba.use :hint, wrap_with: { class: 'form-text' }
|
269
269
|
end
|
270
270
|
end
|
@@ -278,7 +278,7 @@ SimpleForm.setup do |config|
|
|
278
278
|
b.use :label, class: 'col-sm-3 col-form-label pt-0'
|
279
279
|
b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba|
|
280
280
|
ba.use :input, class: 'form-range', error_class: 'is-invalid'
|
281
|
-
ba.use :
|
281
|
+
ba.use :error, wrap_with: { class: 'invalid-feedback' }
|
282
282
|
ba.use :hint, wrap_with: { class: 'form-text' }
|
283
283
|
end
|
284
284
|
end
|
@@ -322,7 +322,7 @@ SimpleForm.setup do |config|
|
|
322
322
|
b.wrapper :form_check_wrapper, tag: 'div', class: 'form-check form-switch' do |bb|
|
323
323
|
bb.use :input, class: 'form-check-input', error_class: 'is-invalid'
|
324
324
|
bb.use :label, class: 'form-check-label'
|
325
|
-
bb.use :
|
325
|
+
bb.use :error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
|
326
326
|
bb.use :hint, wrap_with: { class: 'form-text' }
|
327
327
|
end
|
328
328
|
end
|
@@ -342,7 +342,7 @@ SimpleForm.setup do |config|
|
|
342
342
|
ba.optional :prepend
|
343
343
|
ba.use :input, class: 'form-control', error_class: 'is-invalid'
|
344
344
|
ba.optional :append
|
345
|
-
ba.use :
|
345
|
+
ba.use :error, wrap_with: { class: 'invalid-feedback' }
|
346
346
|
end
|
347
347
|
b.use :hint, wrap_with: { class: 'form-text' }
|
348
348
|
end
|
@@ -360,7 +360,7 @@ SimpleForm.setup do |config|
|
|
360
360
|
b.optional :readonly
|
361
361
|
b.use :input, class: 'form-control', error_class: 'is-invalid'
|
362
362
|
b.use :label
|
363
|
-
b.use :
|
363
|
+
b.use :error, wrap_with: { class: 'invalid-feedback' }
|
364
364
|
b.use :hint, wrap_with: { class: 'form-text' }
|
365
365
|
end
|
366
366
|
|
@@ -370,7 +370,7 @@ SimpleForm.setup do |config|
|
|
370
370
|
b.optional :readonly
|
371
371
|
b.use :input, class: 'form-select', error_class: 'is-invalid'
|
372
372
|
b.use :label
|
373
|
-
b.use :
|
373
|
+
b.use :error, wrap_with: { class: 'invalid-feedback' }
|
374
374
|
b.use :hint, wrap_with: { class: 'form-text' }
|
375
375
|
end
|
376
376
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# generado con pg_rails
|
2
|
+
|
3
|
+
class CreateMensajeContactos < ActiveRecord::Migration[7.1]
|
4
|
+
def change
|
5
|
+
create_table :mensaje_contactos do |t|
|
6
|
+
t.string :nombre
|
7
|
+
t.string :email
|
8
|
+
t.string :telefono
|
9
|
+
t.string :mensaje
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# generado con pg_rails
|
4
|
+
|
5
|
+
require 'rails_helper'
|
6
|
+
|
7
|
+
# This spec was generated by rspec-rails when you ran the scaffold generator.
|
8
|
+
# It demonstrates how one might use RSpec to specify the controller code that
|
9
|
+
# was generated by Rails when you ran the scaffold generator.
|
10
|
+
#
|
11
|
+
# It assumes that the implementation code is generated by the rails scaffold
|
12
|
+
# generator. If you are using any extension libraries to generate different
|
13
|
+
# controller code, this generated spec may or may not pass.
|
14
|
+
#
|
15
|
+
# It only uses APIs available in rails and/or rspec-rails. There are a number
|
16
|
+
# of tools you can use to make these specs even more expressive, but we're
|
17
|
+
# sticking to rails and rspec-rails APIs to keep things simple and stable.
|
18
|
+
#
|
19
|
+
# Compared to earlier versions of this generator, there is very limited use of
|
20
|
+
# stubs and message expectations in this spec. Stubs are only used when there
|
21
|
+
# is no simpler way to get a handle on the object needed for the example.
|
22
|
+
# Message expectations are only used when there is no simpler way to specify
|
23
|
+
# that an instance is receiving a specific message.
|
24
|
+
#
|
25
|
+
# Also compared to earlier versions of this generator, there are no longer any
|
26
|
+
# expectations of assigns and templates rendered. These features have been
|
27
|
+
# removed from Rails core in Rails 5, but can be added back in via the
|
28
|
+
# `rails-controller-testing` gem.
|
29
|
+
|
30
|
+
RSpec.describe Public::MensajeContactosController do
|
31
|
+
render_views
|
32
|
+
# This should return the minimal set of attributes required to create a valid
|
33
|
+
# MensajeContacto. As you add validations to MensajeContacto, be sure to
|
34
|
+
# adjust the attributes here as well.
|
35
|
+
let(:valid_attributes) do
|
36
|
+
attributes_for(:mensaje_contacto)
|
37
|
+
end
|
38
|
+
|
39
|
+
let(:invalid_attributes) do
|
40
|
+
{
|
41
|
+
nombre: nil
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
let(:logged_user) { create :user, :developer }
|
46
|
+
|
47
|
+
before do
|
48
|
+
sign_in logged_user if logged_user.present?
|
49
|
+
end
|
50
|
+
|
51
|
+
describe 'routing' do
|
52
|
+
it 'routes GET index correctly' do
|
53
|
+
route = { get: '/contacto/new' }
|
54
|
+
expect(route).to route_to(controller: 'public/mensaje_contactos', action: 'new')
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe 'GET #new' do
|
59
|
+
it 'returns a success response' do
|
60
|
+
get :new, params: {}
|
61
|
+
expect(response).to be_successful
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe 'POST #create' do
|
66
|
+
context 'with valid params' do
|
67
|
+
it 'creates a new MensajeContacto' do
|
68
|
+
expect do
|
69
|
+
post :create, params: { mensaje_contacto: valid_attributes }
|
70
|
+
end.to change(MensajeContacto, :count).by(1)
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'redirects to the created mensaje_contacto' do
|
74
|
+
post :create, params: { mensaje_contacto: valid_attributes }
|
75
|
+
expect(response).to have_http_status(:ok)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
context 'with invalid params' do
|
80
|
+
it 'returns a unprocessable_entity response' do
|
81
|
+
post :create, params: { mensaje_contacto: invalid_attributes }
|
82
|
+
expect(response).to have_http_status(:unprocessable_entity)
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'renders the new template' do
|
86
|
+
post :create, params: { mensaje_contacto: invalid_attributes }
|
87
|
+
expect(response).to render_template(:new)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# generado con pg_rails
|
4
|
+
|
5
|
+
FactoryBot.define do
|
6
|
+
factory :mensaje_contacto do
|
7
|
+
nombre { Faker::Lorem.sentence }
|
8
|
+
email { Faker::Internet.email }
|
9
|
+
telefono { Faker::Lorem.sentence }
|
10
|
+
mensaje { Faker::Lorem.sentence }
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# generado con pg_rails
|
4
|
+
|
5
|
+
require 'rails_helper'
|
6
|
+
|
7
|
+
RSpec.describe MensajeContacto do
|
8
|
+
let(:mensaje_contacto) { create(:mensaje_contacto) }
|
9
|
+
|
10
|
+
it 'se persiste' do
|
11
|
+
expect(mensaje_contacto).to be_persisted
|
12
|
+
end
|
13
|
+
end
|
@@ -5,7 +5,11 @@ html
|
|
5
5
|
meta name="viewport" content="width=device-width,initial-scale=1"
|
6
6
|
- if @turbo_no_cache
|
7
7
|
meta name="turbo-cache-control" content="no-cache"
|
8
|
+
/ El morph no estaría siendo de utilidad
|
8
9
|
/ meta name="turbo-refresh-method" content="morph"
|
10
|
+
|
11
|
+
/ En general es deseable el comportamiento scroll "reset", por ejemplo en los forms,
|
12
|
+
/ ya que los errores se muestran arriba y el botón de submit está abajo
|
9
13
|
/ meta name="turbo-refresh-scroll" content="preserve"
|
10
14
|
meta name="turbo-prefetch" content="false"
|
11
15
|
meta name="view-transition" content="same-origin"
|
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.51
|
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-04-
|
11
|
+
date: 2024-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -846,6 +846,7 @@ files:
|
|
846
846
|
- pg_engine/app/admin/accounts.rb
|
847
847
|
- pg_engine/app/admin/audits.rb
|
848
848
|
- pg_engine/app/admin/dashboard.rb
|
849
|
+
- pg_engine/app/admin/mensaje_contactos.rb
|
849
850
|
- pg_engine/app/admin/user_accounts.rb
|
850
851
|
- pg_engine/app/admin/users.rb
|
851
852
|
- pg_engine/app/assets/javascripts/active_admin.js
|
@@ -858,9 +859,11 @@ files:
|
|
858
859
|
- pg_engine/app/controllers/pg_engine/base_controller.rb
|
859
860
|
- pg_engine/app/controllers/pg_engine/devise_controller.rb
|
860
861
|
- pg_engine/app/controllers/pg_engine/require_sign_in.rb
|
862
|
+
- pg_engine/app/controllers/public/mensaje_contactos_controller.rb
|
861
863
|
- pg_engine/app/controllers/users/confirmations_controller.rb
|
862
864
|
- pg_engine/app/controllers/users/registrations_controller.rb
|
863
865
|
- pg_engine/app/decorators/account_decorator.rb
|
866
|
+
- pg_engine/app/decorators/mensaje_contacto_decorator.rb
|
864
867
|
- pg_engine/app/decorators/pg_engine/base_decorator.rb
|
865
868
|
- pg_engine/app/decorators/user_account_decorator.rb
|
866
869
|
- pg_engine/app/decorators/user_decorator.rb
|
@@ -878,10 +881,12 @@ files:
|
|
878
881
|
- pg_engine/app/lib/pg_form_builder.rb
|
879
882
|
- pg_engine/app/models/account.rb
|
880
883
|
- pg_engine/app/models/current.rb
|
884
|
+
- pg_engine/app/models/mensaje_contacto.rb
|
881
885
|
- pg_engine/app/models/pg_engine/base_record.rb
|
882
886
|
- pg_engine/app/models/user.rb
|
883
887
|
- pg_engine/app/models/user_account.rb
|
884
888
|
- pg_engine/app/policies/account_policy.rb
|
889
|
+
- pg_engine/app/policies/mensaje_contacto_policy.rb
|
885
890
|
- pg_engine/app/policies/pg_engine/application_policy.rb
|
886
891
|
- pg_engine/app/policies/user_account_policy.rb
|
887
892
|
- pg_engine/app/policies/user_policy.rb
|
@@ -904,6 +909,8 @@ files:
|
|
904
909
|
- pg_engine/app/views/pg_engine/base/edit.html.slim
|
905
910
|
- pg_engine/app/views/pg_engine/base/index.html.slim
|
906
911
|
- pg_engine/app/views/pg_engine/base/new.html.slim
|
912
|
+
- pg_engine/app/views/public/mensaje_contactos/_form.html.slim
|
913
|
+
- pg_engine/app/views/public/mensaje_contactos/_gracias.html.slim
|
907
914
|
- pg_engine/config/initializers/action_mailer.rb
|
908
915
|
- pg_engine/config/initializers/active_admin.rb
|
909
916
|
- pg_engine/config/initializers/anycable.rb
|
@@ -925,6 +932,7 @@ files:
|
|
925
932
|
- pg_engine/db/migrate/20240222115722_create_active_storage_tables.active_storage.rb
|
926
933
|
- pg_engine/db/migrate/20240305200900_nombre_user.rb
|
927
934
|
- pg_engine/db/migrate/20240314114503_remove_hash_ids.rb
|
935
|
+
- pg_engine/db/migrate/20240428152916_create_mensaje_contactos.rb
|
928
936
|
- pg_engine/db/seeds.rb
|
929
937
|
- pg_engine/lib/pg_engine.rb
|
930
938
|
- pg_engine/lib/pg_engine/configuracion.rb
|
@@ -941,9 +949,11 @@ files:
|
|
941
949
|
- pg_engine/spec/controllers/concerns/pg_engine/resource_helper_spec.rb
|
942
950
|
- pg_engine/spec/controllers/devise/sessions_controller_spec.rb
|
943
951
|
- pg_engine/spec/controllers/pg_engine/base_controller_spec.rb
|
952
|
+
- pg_engine/spec/controllers/public/mensaje_contactos_controller_spec.rb
|
944
953
|
- pg_engine/spec/controllers/users/confirmations_controller_spec.rb
|
945
954
|
- pg_engine/spec/controllers/users/registrations_controller_spec.rb
|
946
955
|
- pg_engine/spec/factories/accounts.rb
|
956
|
+
- pg_engine/spec/factories/mensaje_contactos.rb
|
947
957
|
- pg_engine/spec/factories/user_accounts.rb
|
948
958
|
- pg_engine/spec/factories/users.rb
|
949
959
|
- pg_engine/spec/fixtures/test.pdf
|
@@ -952,6 +962,7 @@ files:
|
|
952
962
|
- pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
|
953
963
|
- pg_engine/spec/lib/pg_form_builder_spec.rb
|
954
964
|
- pg_engine/spec/models/account_spec.rb
|
965
|
+
- pg_engine/spec/models/mensaje_contacto_spec.rb
|
955
966
|
- pg_engine/spec/models/pg_engine/base_record_spec.rb
|
956
967
|
- pg_engine/spec/models/user_account_spec.rb
|
957
968
|
- pg_engine/spec/models/user_spec.rb
|