Formatting

This commit is contained in:
Kevin McConnell
2025-12-01 17:05:55 +00:00
parent 3eaf9cb350
commit 2c1ab1bb29
3 changed files with 19 additions and 22 deletions
@@ -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
+2 -6
View File
@@ -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)
+17 -15
View File
@@ -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,