Formatting
This commit is contained in:
@@ -9,7 +9,6 @@ class Account::ExportsController < ApplicationController
|
||||
|
||||
def create
|
||||
Current.account.exports.create!(user: Current.user).build_later
|
||||
|
||||
redirect_to account_settings_path, notice: "Export started. You'll receive an email when it's ready."
|
||||
end
|
||||
|
||||
|
||||
@@ -19,15 +19,11 @@ class Account::Export < ApplicationRecord
|
||||
|
||||
def build
|
||||
processing!
|
||||
|
||||
zipfile = generate_zip
|
||||
file.attach(
|
||||
io: File.open(zipfile.path),
|
||||
filename: "fizzy-export-#{id}.zip",
|
||||
content_type: "application/zip"
|
||||
)
|
||||
|
||||
file.attach io: File.open(zipfile.path), filename: "fizzy-export-#{id}.zip", content_type: "application/zip"
|
||||
mark_completed
|
||||
|
||||
ExportMailer.completed(self).deliver_later
|
||||
rescue => e
|
||||
update!(status: :failed)
|
||||
|
||||
@@ -34,24 +34,26 @@ module Card::Exportable
|
||||
return "" if rich_text.blank?
|
||||
|
||||
rich_text.body.render_attachments do |attachment|
|
||||
attachable = attachment.attachable
|
||||
|
||||
case attachable
|
||||
when ActiveStorage::Blob
|
||||
path = export_attachment_path(attachable)
|
||||
if attachable.image?
|
||||
tag.img(src: path, alt: attachable.filename)
|
||||
else
|
||||
tag.a(attachable.filename, href: path)
|
||||
end
|
||||
when ActionText::Attachables::RemoteImage
|
||||
tag.img(src: attachable.url, alt: "Remote image")
|
||||
else
|
||||
attachment.to_html
|
||||
end
|
||||
attachment_representation(attachment)
|
||||
end.to_html
|
||||
end
|
||||
|
||||
def attachment_representation(attachment)
|
||||
case attachable = attachment.attachable
|
||||
when ActiveStorage::Blob
|
||||
path = export_attachment_path(attachable)
|
||||
if attachable.image?
|
||||
tag.img(src: path, alt: attachable.filename)
|
||||
else
|
||||
tag.a(attachable.filename, href: path)
|
||||
end
|
||||
when ActionText::Attachables::RemoteImage
|
||||
tag.img(src: attachable.url, alt: "Remote image")
|
||||
else
|
||||
attachment.to_html
|
||||
end
|
||||
end
|
||||
|
||||
def export_user(user)
|
||||
{
|
||||
id: user.id,
|
||||
|
||||
Reference in New Issue
Block a user