Create new entrypoint for sharable Wrapstodon (#37121)

This commit is contained in:
Echo
2025-12-04 16:48:10 +01:00
committed by GitHub
parent 75b9e9a8b0
commit 0dac31dfd5
8 changed files with 132 additions and 5 deletions

View File

@@ -0,0 +1,16 @@
# frozen_string_literal: true
module WrapstodonHelper
def render_wrapstodon_share_data(report)
json = ActiveModelSerializers::SerializableResource.new(
AnnualReportsPresenter.new([report]),
serializer: REST::AnnualReportsSerializer,
scope: nil,
scope_name: :current_user
).to_json
# rubocop:disable Rails/OutputSafety
content_tag(:script, json_escape(json).html_safe, type: 'application/json', id: 'wrapstodon-data')
# rubocop:enable Rails/OutputSafety
end
end