docbrown/app/views/articles/_actions.html.erb
Tayllan fc77376c1b
Translate actions in articles view (#14911)
* Translate actions in articles view

* Move reactions to core.reactions namespace

* Add quotes to share_to in yml file

* Fix wrong translation in english locale

Co-authored-by: rhymes <github@rhymes.dev>
2021-10-07 12:08:14 +07:00

107 lines
5.2 KiB
Text

<div class="crayons-article-actions print-hidden">
<div class="crayons-article-actions__inner">
<% if @article.published? %>
<%= render partial: "articles/reaction_button",
locals: {
category: :like,
description: t("core.reactions.heart"),
image_path: "heart.svg",
image_active_path: "heart-filled.svg",
aria_label: "Like"
} %>
<%= render partial: "articles/reaction_button",
locals: {
category: :unicorn,
description: t("core.reactions.unicorn"),
image_path: "unicorn.svg",
image_active_path: "unicorn-filled.svg",
aria_label: "React with unicorn"
} %>
<%= render partial: "articles/reaction_button",
locals: {
category: :readinglist,
description: t("core.reactions.save"),
image_path: "save.svg",
image_active_path: "save-filled.svg",
aria_label: "Add to reading list"
} %>
<% end %>
<div class="align-center m:relative">
<button id="article-show-more-button" aria-controls="article-show-more-dropdown" aria-expanded="false" aria-haspopup="true" class="dropbtn crayons-btn crayons-btn--ghost-dimmed crayons-btn--icon-rounded" aria-label="Share post options">
<%= inline_svg_tag("overflow-horizontal.svg", aria_hidden: true, class: "dropdown-icon crayons-icon", title: "More...") %>
</button>
<div id="article-show-more-dropdown" class="crayons-dropdown side-bar left-2 right-2 m:right-auto m:left-100 s:left-auto bottom-100 m:bottom-auto m:top-0 mb-1 m:mb-0">
<div>
<button
id="copy-post-url-button"
class="flex justify-between crayons-link crayons-link--block w-100 bg-transparent border-0"
data-postUrl="<%= article_url(@article) %>">
<span class="fw-bold"><%= t("core.copy_link") %></span>
<%= inline_svg_tag("copy.svg", aria_hidden: true, id: "article-copy-icon", class: "crayons-icon mx-2 shrink-0", title: "Copy article link to the clipboard") %>
</button>
<div id="article-copy-link-announcer" aria-live="polite" class="crayons-notice crayons-notice--success my-2 p-1" aria-live="polite" hidden>Copied to Clipboard</div>
</div>
<div class="Desktop-only">
<a
target="_blank"
class="crayons-link crayons-link--block"
rel="noopener"
href='https://twitter.com/intent/tweet?text=<%= u "\"#{@article.title.strip}\" by " %><%= u @article.user.twitter_username ? "@#{@article.user.twitter_username}" : @article.user.name %><%= u " #{Settings::General.twitter_hashtag} " %><%= u " #{article_url(@article)}" %>'>
<%= t("core.share_to", media: "Twitter") %>
</a>
<a
target="_blank"
class="crayons-link crayons-link--block"
rel="noopener"
href="https://www.linkedin.com/shareArticle?mini=true&url=<%= u article_url(@article) %>&title=<%= u @article.title %>&summary=<%= u @article.description %>&source=<%= u community_name %>">
<%= t("core.share_to", media: "LinkedIn") %>
</a>
<a
target="_blank"
class="crayons-link crayons-link--block"
rel="noopener"
href="https://www.reddit.com/submit?url=<%= u article_url(@article) %>&title=<%= u @article.title %>">
<%= t("core.share_to", media: "Reddit") %>
</a>
<a
target="_blank"
class="crayons-link crayons-link--block"
rel="noopener"
href="https://news.ycombinator.com/submitlink?u=<%= u article_url(@article) %>&t=<%= u @article.title %>">
<%= t("core.share_to", media: "Hacker News") %>
</a>
<a
target="_blank"
class="crayons-link crayons-link--block"
rel="noopener"
href="https://www.facebook.com/sharer.php?u=<%= u article_url(@article) %>">
<%= t("core.share_to", media: "Facebook") %>
</a>
</div>
<web-share-wrapper shareurl="<%= article_url(@article) %>" sharetitle="<%= @article.title %>" sharetext="<%= @article.description %>" template="web-share-button">
</web-share-wrapper>
<template id="web-share-button">
<a href="#" class="dropdown-link-row crayons-link crayons-link--block">Share Post via...</a>
</template>
<a href="/report-abuse" class="crayons-link crayons-link--block"><%= t("core.report_abuse") %></a>
</div>
</div>
</div>
</div>
<% if !user_signed_in? && @article.body_markdown.size > 900 %>
<% cache("below-article-html-variant-#{rand(20)}", expires_in: 8.hours) do %>
<% @html_variant = HtmlVariant.find_for_test(@article.cached_tag_list_array, "article_show_below_article_cta") %>
<% if @html_variant %>
<div class="html-variant-wrapper" id="html-variant-article-show-below-article" data-variant-id="<%= @html_variant.id %>">
<%= @html_variant.html.html_safe %>
</div>
<% end %>
<% end %>
<% end %>