mirror of
https://github.com/internetee/registry.git
synced 2025-08-06 01:35:10 +02:00
Refactor invoice PDF generation, download and delivery
- Remove `Que::Mailer` (#895) - Extract controllers - Extract translations - Convert HAML to ERB - Add mailer preview - Improve UI - Remove unused routes - Add tests
This commit is contained in:
parent
7e0fd30125
commit
27ea790b28
30 changed files with 288 additions and 138 deletions
26
app/controllers/concerns/deliverable.rb
Normal file
26
app/controllers/concerns/deliverable.rb
Normal file
|
@ -0,0 +1,26 @@
|
|||
module Deliverable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
before_action :find_invoice
|
||||
end
|
||||
|
||||
def new
|
||||
authorize! :manage, @invoice
|
||||
@recipient = @invoice.buyer.billing_email
|
||||
end
|
||||
|
||||
def create
|
||||
authorize! :manage, @invoice
|
||||
|
||||
InvoiceMailer.invoice_email(invoice: @invoice, recipient: params[:recipient]).deliver_now
|
||||
|
||||
redirect_to redirect_url, notice: t('.delivered')
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_invoice
|
||||
@invoice = Invoice.find(params[:invoice_id])
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue