view app/views/tweets/_tweet.html.erb @ 65:eecb35eac2f3

Replace `\n` with newlines Replicates what the actual client do. Of course comes with possible trollings.
author nanaya <me@myconan.net>
date Tue, 01 Dec 2015 01:27:22 +0900
parents a20bbd1e2dc1
children 585952f98978
line wrap: on
line source

<% if tweet.retweeted_status.present? %>
  <p>
    <em>Retweeted:</em>
  </p>

  <%= render "tweet", :tweet => tweet.retweeted_status %>
<% else%>
  <p>
    <%= link_to "https://twitter.com/#{tweet.user.screen_name}" do %>
      <%= image_tag tweet.user.profile_image_url_https %>
      <%= tweet.user.name -%>
    <% end %>

    /

    <%= auto_link(tweet.text).gsub("\n", "<br>").html_safe %>
  </p>

  <p>
    <% tweet.media.each do |media| %>
      <% if media.is_a? Twitter::Media::Photo %>
        <%= link_to "#{media.media_url_https}:orig" do %>
          <%= image_tag "#{media.media_url_https}:small" -%>
        <% end %>
      <% end %>
    <% end %>
  </p>

  <% if tweet.quoted_status.present? %>
    <blockquote>
      <%= render "tweet", :tweet => tweet.quoted_status %>
    </blockquote>
  <% end %>
<% end %>