Add Stimulus sharing feature to answerboxes

This commit is contained in:
Andreas Nedbal 2023-10-16 15:20:04 +02:00 committed by Andreas Nedbal
parent 5ccdd9bbc2
commit 9f999189cd
2 changed files with 10 additions and 1 deletions

View File

@ -4,4 +4,13 @@ module SocialHelper
include SocialHelper::TwitterMethods include SocialHelper::TwitterMethods
include SocialHelper::TumblrMethods include SocialHelper::TumblrMethods
include SocialHelper::TelegramMethods include SocialHelper::TelegramMethods
def answer_share_url(answer)
answer_url(
id: answer.id,
username: answer.user.screen_name,
host: APP_CONFIG["hostname"],
protocol: (APP_CONFIG["https"] ? :https : :http)
)
end
end end

View File

@ -8,5 +8,5 @@
%a.dropdown-item{ href: telegram_share_url(answer), target: "_blank" } %a.dropdown-item{ href: telegram_share_url(answer), target: "_blank" }
%i.fa.fa-fw.fa-telegram %i.fa.fa-fw.fa-telegram
= t(".telegram") = t(".telegram")
%a.dropdown-item{ href: "#", name: "ab-share" } %a.dropdown-item{ href: "#", data: { controller: :share, action: "share#share", share_url_value: answer_share_url(answer) } }
= t(".other") = t(".other")