Compare commits
No commits in common. "5cb4d1434312c189a2f921c60791d65120d4418a" and "4496deeef599dd7c5192919efae06a6a7e1b0e4d" have entirely different histories.
5cb4d14343
...
4496deeef5
@ -26,12 +26,6 @@ class InvitationsController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def email
|
|
||||||
AdminMailer.with(wedding_id: ActsAsTenant.current_tenant.id).invitations_pdf_email.deliver_later
|
|
||||||
|
|
||||||
head :ok
|
|
||||||
end
|
|
||||||
|
|
||||||
def sheet; end
|
def sheet; end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|||||||
@ -5,9 +5,9 @@
|
|||||||
class AdminMailer < ApplicationMailer
|
class AdminMailer < ApplicationMailer
|
||||||
def attendance_change_email
|
def attendance_change_email
|
||||||
@guest = Guest.find(params[:guest_id])
|
@guest = Guest.find(params[:guest_id])
|
||||||
ActsAsTenant.with_tenant(@guest.wedding) do
|
|
||||||
mail(
|
mail(
|
||||||
to: recipients,
|
to: @guest.wedding.users.pluck(:email),
|
||||||
subject: I18n.t(
|
subject: I18n.t(
|
||||||
'admin_mailer.attendance_change_email.subject',
|
'admin_mailer.attendance_change_email.subject',
|
||||||
name: @guest.name,
|
name: @guest.name,
|
||||||
@ -16,30 +16,3 @@ class AdminMailer < ApplicationMailer
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def invitations_pdf_email
|
|
||||||
ActsAsTenant.with_tenant(Wedding.find(params[:wedding_id])) do
|
|
||||||
invitations = Invitation.includes(:guests).all
|
|
||||||
|
|
||||||
pdf_html = ActionController::Base.new.render_to_string(
|
|
||||||
template: 'invitations/sheet',
|
|
||||||
layout: 'pdf',
|
|
||||||
locals: { invitations: }
|
|
||||||
)
|
|
||||||
pdf = WickedPdf.new.pdf_from_string(pdf_html)
|
|
||||||
|
|
||||||
attachments["invitations_#{Time.current.strftime('%Y%m%d_%H%M%S')}.pdf"] = pdf
|
|
||||||
|
|
||||||
mail(
|
|
||||||
to: recipients,
|
|
||||||
subject: I18n.t('admin_mailer.invitations_pdf_email.subject')
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def recipients
|
|
||||||
ActsAsTenant.current_tenant.users.pluck(:email)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|||||||
@ -1,7 +0,0 @@
|
|||||||
<%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %>
|
|
||||||
|
|
||||||
<p><%= I18n.t('admin_mailer.greeting') %>,</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<%= I18n.t('admin_mailer.invitations_pdf_email.paragraph_1') %>
|
|
||||||
</p>
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
<%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %>
|
|
||||||
|
|
||||||
<%= I18n.t('admin_mailer.greeting') %>,
|
|
||||||
|
|
||||||
<%= I18n.t('admin_mailer.invitations_pdf_email.paragraph_1') %>
|
|
||||||
@ -17,6 +17,3 @@ en:
|
|||||||
subject: "%{name} has changed their attendance status: %{status}"
|
subject: "%{name} has changed their attendance status: %{status}"
|
||||||
paragraph_1: "The guest %{name} has changed their attendance for the wedding."
|
paragraph_1: "The guest %{name} has changed their attendance for the wedding."
|
||||||
notify_on_updates: "You will be notified of any further changes to their attendance status."
|
notify_on_updates: "You will be notified of any further changes to their attendance status."
|
||||||
invitations_pdf_email:
|
|
||||||
subject: "Your wedding invitations are ready"
|
|
||||||
paragraph_1: "Your wedding invitations are ready. Please, find them attached to this email."
|
|
||||||
|
|||||||
@ -42,9 +42,7 @@ Rails.application.routes.draw do
|
|||||||
|
|
||||||
resources :tables_arrangements, only: %i[index show create]
|
resources :tables_arrangements, only: %i[index show create]
|
||||||
resources :summary, only: :index
|
resources :summary, only: :index
|
||||||
resources :invitations, only: %i[show index create update destroy] do
|
resources :invitations, only: %i[show index create update destroy]
|
||||||
post :email, on: :collection
|
|
||||||
end
|
|
||||||
|
|
||||||
root to: redirect("/%{slug}")
|
root to: redirect("/%{slug}")
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user