#1448, add copy to clipboard option

This commit is contained in:
Ahmed Ejaz 2023-11-12 02:45:35 +05:00 committed by Andreas Nedbal
parent 584ce8c31c
commit 93d67a8307
3 changed files with 9 additions and 0 deletions

View File

@ -13,4 +13,9 @@ module SocialHelper
protocol: (APP_CONFIG["https"] ? :https : :http),
)
end
def answer_copy_content(answer)
# copy content template: "question - answer [link]"
"#{answer.question.content} - #{answer.content} [#{answer_share_url(answer)}]"
end
end

View File

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

View File

@ -79,6 +79,7 @@ en:
pin: "Pin to Profile"
unpin: "Unpin from Profile"
share:
copy: "Copy to Clipboard"
twitter: "Share on Twitter"
tumblr: "Share on Tumblr"
telegram: "Share on Telegram"