mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-15 01:31:42 +00:00
enviar la dirección de origen con el formulario de contacto
This commit is contained in:
parent
5900e63b07
commit
f7828127d8
4 changed files with 11 additions and 4 deletions
|
@ -20,7 +20,8 @@ module Api
|
||||||
# El sitio nos dice a dónde tenemos que ir.
|
# El sitio nos dice a dónde tenemos que ir.
|
||||||
ContactJob.perform_async site.id,
|
ContactJob.perform_async site.id,
|
||||||
params[:form],
|
params[:form],
|
||||||
contact_params.to_h.symbolize_keys
|
contact_params.to_h.symbolize_keys,
|
||||||
|
params[:redirect]
|
||||||
|
|
||||||
redirect_to params[:redirect] || origin.to_s
|
redirect_to params[:redirect] || origin.to_s
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,13 +5,13 @@ class ContactJob < ApplicationJob
|
||||||
# @param [Integer]
|
# @param [Integer]
|
||||||
# @param [String]
|
# @param [String]
|
||||||
# @param [Hash]
|
# @param [Hash]
|
||||||
def perform(site_id, form_name, form)
|
def perform(site_id, form_name, form, origin = nil)
|
||||||
# Retrocompabilidad al actualizar a 2.7.1
|
# Retrocompabilidad al actualizar a 2.7.1
|
||||||
# @see ApplicationJob#site
|
# @see ApplicationJob#site
|
||||||
@params = { site_id: site_id }
|
@params = { site_id: site_id }
|
||||||
|
|
||||||
# Sanitizar los valores
|
# Sanitizar los valores
|
||||||
form.keys.each do |key|
|
form.each_key do |key|
|
||||||
form[key] = ActionController::Base.helpers.sanitize form[key]
|
form[key] = ActionController::Base.helpers.sanitize form[key]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -24,7 +24,8 @@ class ContactJob < ApplicationJob
|
||||||
ContactMailer.with(form_name: form_name,
|
ContactMailer.with(form_name: form_name,
|
||||||
form: form,
|
form: form,
|
||||||
site_id: site_id,
|
site_id: site_id,
|
||||||
usuaries_emails: u)
|
usuaries_emails: u,
|
||||||
|
origin: origin)
|
||||||
.notify_usuaries.deliver_now
|
.notify_usuaries.deliver_now
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
- if @params[:origin].present?
|
||||||
|
%p= @params[:origin]
|
||||||
|
|
||||||
- @params[:form].each do |field, value|
|
- @params[:form].each do |field, value|
|
||||||
%p
|
%p
|
||||||
%strong= @params[:form_definition].t(field) + ':'
|
%strong= @params[:form_definition].t(field) + ':'
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
- @params[:origin]
|
||||||
|
|
||||||
- @params[:form].each do |field, value|
|
- @params[:form].each do |field, value|
|
||||||
= "#{@params[:form_definition].t(field)}: #{value}"
|
= "#{@params[:form_definition].t(field)}: #{value}"
|
||||||
\
|
\
|
||||||
|
|
Loading…
Reference in a new issue