29 lines
1.7 KiB
Text
29 lines
1.7 KiB
Text
<div id="share">
|
|
|
|
<p class="note"><%= ts("Copy and paste the following code to link back to this work (") %><kbd><%= ts("CTRL A") %></kbd><%= ts("/") %><kbd><%= ts("CMD A") %></kbd><%= ts(" will select all), or use the Tweet or Tumblr links to share the work on your Twitter or Tumblr account.") %></p>
|
|
|
|
<%# HTML share code %>
|
|
<p>
|
|
<% id_suffix = shareable.is_a?(Bookmark) ? "_#{shareable.id}" : "" %>
|
|
<% embed_partial = shareable.is_a?(Bookmark) ? "share/embed_link_bookmark" : "share/embed_link_work" %>
|
|
<textarea cols="50" rows="4" id="embed_code<%= id_suffix %>"><%= remove_newlines(render(embed_partial, item: shareable)) %></textarea>
|
|
</p>
|
|
|
|
<ul>
|
|
<li class="twitter">
|
|
<% twitter_text = shareable.is_a?(Bookmark) ? get_tweet_text_for_bookmark(shareable) : get_tweet_text(shareable) %>
|
|
<% twitter_url = shareable.is_a?(Bookmark) ? bookmark_url(shareable) : work_url(shareable) %>
|
|
<% twitter_address = "https://twitter.com/intent/tweet/?text=#{u(twitter_text)}&url=#{u(twitter_url)}&via=ao3org&size=large" %>
|
|
<%= sharing_button("twitter", twitter_address, ts("Twitter"), target: "_blank") %>
|
|
</li>
|
|
|
|
<li class="tumblr">
|
|
<% work = shareable.is_a?(Bookmark) ? shareable.bookmarkable : shareable %>
|
|
<% tumblr_url = work_url(work) %>
|
|
<% tumblr_title = get_tumblr_embed_link_title(work) %>
|
|
<% tumblr_caption = shareable.is_a?(Bookmark) ? render("share/embed_link_bookmark", item: shareable) : render("share/embed_meta", work: shareable) %>
|
|
<% tumblr_address = "http://tumblr.com/widgets/share/tool?canonicalUrl=#{u(tumblr_url)}&title=#{u(tumblr_title)}&caption=#{u(tumblr_caption)}" %>
|
|
<%= sharing_button("tumblr", tumblr_address, ts("Tumblr"), target: "_blank") %>
|
|
</li>
|
|
</ul>
|
|
</div>
|