Mercurial > rsstweet
annotate app/views/tweets/_tweet.html.erb @ 254:89f6c0016bab default tip
Update to latest rails
author | nanaya <me@nanaya.net> |
---|---|
date | Tue, 03 Sep 2024 19:21:25 +0900 |
parents | d726e8b92dd1 |
children |
rev | line source |
---|---|
234 | 1 <% if tweet[:retweet].present? %> |
250
be0b78fb5f57
Link to original tweet in tweet header
nanaya <me@nanaya.net>
parents:
237
diff
changeset
|
2 <p><em>Retweeted:</em></p> |
62
9ab79a764434
Sweet tweet media viewer (image only for now)
nanaya <me@myconan.net>
parents:
diff
changeset
|
3 |
234 | 4 <%= render "tweet", :tweet => tweet[:retweet], :with_time => true %> |
5 <% else %> | |
132 | 6 <% if defined?(with_time) && with_time %> |
131 | 7 <p> |
250
be0b78fb5f57
Link to original tweet in tweet header
nanaya <me@nanaya.net>
parents:
237
diff
changeset
|
8 <small> |
be0b78fb5f57
Link to original tweet in tweet header
nanaya <me@nanaya.net>
parents:
237
diff
changeset
|
9 Originally <%= link_to 'tweeted', status_url(tweet) %> at <%= tweet[:created_at].rfc822 %> |
be0b78fb5f57
Link to original tweet in tweet header
nanaya <me@nanaya.net>
parents:
237
diff
changeset
|
10 </small> |
131 | 11 </p> |
12 <% end %> | |
13 | |
234 | 14 <% if tweet[:reply_to_id].present? %> |
229
12287b32fbda
Show link to parent tweet for replies
nanaya <me@nanaya.pro>
parents:
223
diff
changeset
|
15 <p> |
12287b32fbda
Show link to parent tweet for replies
nanaya <me@nanaya.pro>
parents:
223
diff
changeset
|
16 <small> |
12287b32fbda
Show link to parent tweet for replies
nanaya <me@nanaya.pro>
parents:
223
diff
changeset
|
17 Replying to |
234 | 18 <%= link_to 'tweet', status_url_base(tweet[:reply_to_username], tweet[:reply_to_id]) %> |
19 by <%= link_to "@#{tweet[:reply_to_username]}", "https://twitter.com/#{tweet[:reply_to_username]}" %> | |
229
12287b32fbda
Show link to parent tweet for replies
nanaya <me@nanaya.pro>
parents:
223
diff
changeset
|
20 </small> |
12287b32fbda
Show link to parent tweet for replies
nanaya <me@nanaya.pro>
parents:
223
diff
changeset
|
21 </p> |
12287b32fbda
Show link to parent tweet for replies
nanaya <me@nanaya.pro>
parents:
223
diff
changeset
|
22 <% end %> |
12287b32fbda
Show link to parent tweet for replies
nanaya <me@nanaya.pro>
parents:
223
diff
changeset
|
23 |
64
a20bbd1e2dc1
Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents:
62
diff
changeset
|
24 <p> |
174
d35dbc09bd83
Less double escaping for actual content
nanaya <me@nanaya.pro>
parents:
172
diff
changeset
|
25 <%= auto_link(expand_url( |
234 | 26 tweet[:message], |
27 { **tweet[:entity_urls], **tweet[:entity_media] } | |
174
d35dbc09bd83
Less double escaping for actual content
nanaya <me@nanaya.pro>
parents:
172
diff
changeset
|
28 )) |
169 | 29 .gsub("\n", "<br />") |
103
1251b3d6ec5d
Use included url data instead of expanding using embiggen
nanaya <me@myconan.net>
parents:
100
diff
changeset
|
30 .html_safe |
1251b3d6ec5d
Use included url data instead of expanding using embiggen
nanaya <me@myconan.net>
parents:
100
diff
changeset
|
31 %> |
79 | 32 </p> |
33 | |
34 <p> | |
234 | 35 <%= link_to "https://twitter.com/#{tweet[:user][:username]}" do %> |
36 <%= image_tag tweet[:user][:avatar_url].to_s, :alt => "profile image for #{tweet[:user][:name].printable}" %> | |
37 <%= tweet[:user][:name].printable -%> | |
64
a20bbd1e2dc1
Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents:
62
diff
changeset
|
38 <% end %> |
75
585952f98978
Put the tweet on different paragraph
nanaya <me@myconan.net>
parents:
65
diff
changeset
|
39 </p> |
64
a20bbd1e2dc1
Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents:
62
diff
changeset
|
40 |
75
585952f98978
Put the tweet on different paragraph
nanaya <me@myconan.net>
parents:
65
diff
changeset
|
41 <p> |
234 | 42 <% tweet[:entity_media].each do |_short_url, media| %> |
253
d726e8b92dd1
Support animated gif (same as video)
nanaya <me@nanaya.net>
parents:
250
diff
changeset
|
43 <% case media[:type] %> |
d726e8b92dd1
Support animated gif (same as video)
nanaya <me@nanaya.net>
parents:
250
diff
changeset
|
44 <% when 'photo' %> |
d726e8b92dd1
Support animated gif (same as video)
nanaya <me@nanaya.net>
parents:
250
diff
changeset
|
45 <%= link_to "#{media[:image_url]}&name=orig" do %> |
d726e8b92dd1
Support animated gif (same as video)
nanaya <me@nanaya.net>
parents:
250
diff
changeset
|
46 <%= image_tag "#{media[:image_url]}&name=small", :alt => "attachment #{media[:id]}" -%> |
d726e8b92dd1
Support animated gif (same as video)
nanaya <me@nanaya.net>
parents:
250
diff
changeset
|
47 <% end %> |
d726e8b92dd1
Support animated gif (same as video)
nanaya <me@nanaya.net>
parents:
250
diff
changeset
|
48 <% when 'animated_gif', 'video' %> |
d726e8b92dd1
Support animated gif (same as video)
nanaya <me@nanaya.net>
parents:
250
diff
changeset
|
49 <%= video_tag media[:variants] |
d726e8b92dd1
Support animated gif (same as video)
nanaya <me@nanaya.net>
parents:
250
diff
changeset
|
50 .sort_by { |variant| -variant[:bitrate] } |
d726e8b92dd1
Support animated gif (same as video)
nanaya <me@nanaya.net>
parents:
250
diff
changeset
|
51 .map { |variant| variant[:url] }, width: '100%', controls: true |
d726e8b92dd1
Support animated gif (same as video)
nanaya <me@nanaya.net>
parents:
250
diff
changeset
|
52 %> |
62
9ab79a764434
Sweet tweet media viewer (image only for now)
nanaya <me@myconan.net>
parents:
diff
changeset
|
53 <% end %> |
9ab79a764434
Sweet tweet media viewer (image only for now)
nanaya <me@myconan.net>
parents:
diff
changeset
|
54 <% end %> |
64
a20bbd1e2dc1
Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents:
62
diff
changeset
|
55 </p> |
62
9ab79a764434
Sweet tweet media viewer (image only for now)
nanaya <me@myconan.net>
parents:
diff
changeset
|
56 |
234 | 57 <% if tweet[:quote_id].present? %> |
64
a20bbd1e2dc1
Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents:
62
diff
changeset
|
58 <blockquote> |
234 | 59 <% if tweet[:quote].present? %> |
60 <%= render "tweet", :tweet => tweet[:quote], :with_time => true %> | |
61 <% else %> | |
62 <%= link_to status_url_base(nil, tweet[:quote_id]) do %> | |
63 <em>Preview not available, view tweet directly.</em> | |
64 <% end %> | |
65 <% end %> | |
64
a20bbd1e2dc1
Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents:
62
diff
changeset
|
66 </blockquote> |
a20bbd1e2dc1
Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents:
62
diff
changeset
|
67 <% end %> |
62
9ab79a764434
Sweet tweet media viewer (image only for now)
nanaya <me@myconan.net>
parents:
diff
changeset
|
68 <% end %> |