Mercurial > rsstweet
comparison app/views/tweets/_tweet.html.erb @ 234:7a773720d81f legit-client
Totally legit client
author | nanaya <me@nanaya.net> |
---|---|
date | Fri, 14 Jul 2023 22:42:20 +0900 |
parents | 12287b32fbda |
children | 961d362e42c7 |
comparison
equal
deleted
inserted
replaced
233:0f0cc55ff11b | 234:7a773720d81f |
---|---|
1 <% if tweet.retweeted_status.present? %> | 1 <% if tweet[:retweet].present? %> |
2 <p> | 2 <p> |
3 <%= link_to status_url(tweet.retweeted_status) do %> | 3 <%= link_to status_url(tweet[:retweet]) do %> |
4 <em>Retweeted:</em> | 4 <em>Retweeted:</em> |
5 <% end %> | 5 <% end %> |
6 </p> | 6 </p> |
7 | 7 |
8 <%= render "tweet", :tweet => tweet.retweeted_status, :with_time => true %> | 8 <%= render "tweet", :tweet => tweet[:retweet], :with_time => true %> |
9 <% else%> | 9 <% else %> |
10 <% if defined?(with_time) && with_time %> | 10 <% if defined?(with_time) && with_time %> |
11 <p> | 11 <p> |
12 <small>Originally tweeted at <%= tweet.created_at.rfc822 %></small> | 12 <small>Originally tweeted at <%= tweet[:created_at].rfc822 %></small> |
13 </p> | 13 </p> |
14 <% end %> | 14 <% end %> |
15 | 15 |
16 <% if tweet.in_reply_to_status_id.present? %> | 16 <% if tweet[:reply_to_id].present? %> |
17 <p> | 17 <p> |
18 <small> | 18 <small> |
19 Replying to | 19 Replying to |
20 <%= link_to 'tweet', status_url_base(tweet.in_reply_to_screen_name, tweet.in_reply_to_status_id) %> | 20 <%= link_to 'tweet', status_url_base(tweet[:reply_to_username], tweet[:reply_to_id]) %> |
21 by <%= link_to tweet.in_reply_to_screen_name, "https://twitter.com/#{tweet.in_reply_to_screen_name}" %> | 21 by <%= link_to "@#{tweet[:reply_to_username]}", "https://twitter.com/#{tweet[:reply_to_username]}" %> |
22 </small> | 22 </small> |
23 </p> | 23 </p> |
24 <% end %> | 24 <% end %> |
25 | 25 |
26 <p> | 26 <p> |
27 <%# FIXME: Twitter gem doesn't support extended mode when writing this %> | |
28 <%= auto_link(expand_url( | 27 <%= auto_link(expand_url( |
29 tweet.full_text_extended, | 28 tweet[:message], |
30 tweet.attrs[:entities][:urls], | 29 { **tweet[:entity_urls], **tweet[:entity_media] } |
31 tweet.attrs[:entities][:media] | |
32 )) | 30 )) |
33 .gsub("\n", "<br />") | 31 .gsub("\n", "<br />") |
34 .html_safe | 32 .html_safe |
35 %> | 33 %> |
36 </p> | 34 </p> |
37 | 35 |
38 <p> | 36 <p> |
39 <%= link_to "https://twitter.com/#{tweet.user.screen_name}" do %> | 37 <%= link_to "https://twitter.com/#{tweet[:user][:username]}" do %> |
40 <%= image_tag tweet.user.profile_image_url_https.to_s, :alt => "profile image for #{tweet.user.name.printable}" %> | 38 <%= image_tag tweet[:user][:avatar_url].to_s, :alt => "profile image for #{tweet[:user][:name].printable}" %> |
41 <%= tweet.user.name.printable -%> | 39 <%= tweet[:user][:name].printable -%> |
42 <% end %> | 40 <% end %> |
43 </p> | 41 </p> |
44 | 42 |
45 <p> | 43 <p> |
46 <% tweet.media.each_with_index do |media, i| %> | 44 <% tweet[:entity_media].each do |_short_url, media| %> |
47 <% if media.is_a? Twitter::Media::Photo %> | 45 <% if media[:type] == 'photo' %> |
48 <%= link_to "#{media.media_url_https}?name=orig" do %> | 46 <%= link_to "#{media[:url]}?name=orig" do %> |
49 <%= image_tag "#{media.media_url_https}?name=small", :alt => "attachment #{i + 1}" -%> | 47 <%= image_tag "#{media[:url]}?name=small", :alt => "attachment #{media[:id]}" -%> |
50 <% end %> | 48 <% end %> |
51 <% elsif media.is_a? Twitter::Media::Video %> | 49 <% elsif media[:type] == 'video' %> |
52 <%= video_tag media.video_info.variants | 50 <%= video_tag media[:variants] |
53 .select { |i| i.bitrate.is_a? Integer } | 51 .sort_by { |variant| -variant[:bitrate] } |
54 .sort_by { |i| -i.bitrate } | 52 .map { |variant| variant[:url] }, width: '100%', controls: true |
55 .map(&:url), width: '100%', controls: true | |
56 %> | 53 %> |
57 <% end %> | 54 <% end %> |
58 <% end %> | 55 <% end %> |
59 </p> | 56 </p> |
60 | 57 |
61 <% if tweet.quoted_status.present? %> | 58 <% if tweet[:quote_id].present? %> |
62 <blockquote> | 59 <blockquote> |
63 <%= render "tweet", :tweet => tweet.quoted_status, :with_time => true %> | 60 <% if tweet[:quote].present? %> |
61 <%= render "tweet", :tweet => tweet[:quote], :with_time => true %> | |
62 <% else %> | |
63 <%= link_to status_url_base(nil, tweet[:quote_id]) do %> | |
64 <em>Preview not available, view tweet directly.</em> | |
65 <% end %> | |
66 <% end %> | |
64 </blockquote> | 67 </blockquote> |
65 <% end %> | 68 <% end %> |
66 <% end %> | 69 <% end %> |