Mercurial > rsstweet
view app/views/tweets/_tweet.html.erb @ 240:c454ea4f7b34 legit-client
Add support for note tweets (with no formatting)
author | nanaya <me@nanaya.net> |
---|---|
date | Sat, 15 Jul 2023 03:24:56 +0900 |
parents | 961d362e42c7 |
children | be0b78fb5f57 |
line wrap: on
line source
<% if tweet[:retweet].present? %> <p> <%= link_to status_url(tweet[:retweet]) do %> <em>Retweeted:</em> <% end %> </p> <%= render "tweet", :tweet => tweet[:retweet], :with_time => true %> <% else %> <% if defined?(with_time) && with_time %> <p> <small>Originally tweeted at <%= tweet[:created_at].rfc822 %></small> </p> <% end %> <% if tweet[:reply_to_id].present? %> <p> <small> Replying to <%= link_to 'tweet', status_url_base(tweet[:reply_to_username], tweet[:reply_to_id]) %> by <%= link_to "@#{tweet[:reply_to_username]}", "https://twitter.com/#{tweet[:reply_to_username]}" %> </small> </p> <% end %> <p> <%= auto_link(expand_url( tweet[:message], { **tweet[:entity_urls], **tweet[:entity_media] } )) .gsub("\n", "<br />") .html_safe %> </p> <p> <%= link_to "https://twitter.com/#{tweet[:user][:username]}" do %> <%= image_tag tweet[:user][:avatar_url].to_s, :alt => "profile image for #{tweet[:user][:name].printable}" %> <%= tweet[:user][:name].printable -%> <% end %> </p> <p> <% tweet[:entity_media].each do |_short_url, media| %> <% if media[:type] == 'photo' %> <%= link_to "#{media[:image_url]}?name=orig" do %> <%= image_tag "#{media[:image_url]}?name=small", :alt => "attachment #{media[:id]}" -%> <% end %> <% elsif media[:type] == 'video' %> <%= video_tag media[:variants] .sort_by { |variant| -variant[:bitrate] } .map { |variant| variant[:url] }, width: '100%', controls: true %> <% end %> <% end %> </p> <% if tweet[:quote_id].present? %> <blockquote> <% if tweet[:quote].present? %> <%= render "tweet", :tweet => tweet[:quote], :with_time => true %> <% else %> <%= link_to status_url_base(nil, tweet[:quote_id]) do %> <em>Preview not available, view tweet directly.</em> <% end %> <% end %> </blockquote> <% end %> <% end %>