Mercurial > rsstweet
annotate app/views/tweets/_tweet.html.erb @ 190:7b1bdf697063
Add direct link for retweet
author | nanaya <me@nanaya.pro> |
---|---|
date | Sat, 27 Jul 2019 13:57:48 +0900 |
parents | 38598ae5a8f6 |
children | 40c828f83657 |
rev | line source |
---|---|
64
a20bbd1e2dc1
Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents:
62
diff
changeset
|
1 <% if tweet.retweeted_status.present? %> |
a20bbd1e2dc1
Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents:
62
diff
changeset
|
2 <p> |
190 | 3 <%= link_to tweet.retweeted_status.uri.to_s do %> |
4 <em>Retweeted:</em> | |
5 <% end %> | |
64
a20bbd1e2dc1
Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents:
62
diff
changeset
|
6 </p> |
62
9ab79a764434
Sweet tweet media viewer (image only for now)
nanaya <me@myconan.net>
parents:
diff
changeset
|
7 |
131 | 8 <%= render "tweet", :tweet => tweet.retweeted_status, :with_time => true %> |
64
a20bbd1e2dc1
Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents:
62
diff
changeset
|
9 <% else%> |
132 | 10 <% if defined?(with_time) && with_time %> |
131 | 11 <p> |
12 <small>Originally tweeted at <%= tweet.created_at.to_s :rfc822 %></small> | |
13 </p> | |
14 <% end %> | |
15 | |
64
a20bbd1e2dc1
Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents:
62
diff
changeset
|
16 <p> |
100 | 17 <%# FIXME: Twitter gem doesn't support extended mode when writing this %> |
174
d35dbc09bd83
Less double escaping for actual content
nanaya <me@nanaya.pro>
parents:
172
diff
changeset
|
18 <%= auto_link(expand_url( |
d35dbc09bd83
Less double escaping for actual content
nanaya <me@nanaya.pro>
parents:
172
diff
changeset
|
19 tweet.full_text_extended, |
103
1251b3d6ec5d
Use included url data instead of expanding using embiggen
nanaya <me@myconan.net>
parents:
100
diff
changeset
|
20 tweet.attrs[:entities][:urls], |
1251b3d6ec5d
Use included url data instead of expanding using embiggen
nanaya <me@myconan.net>
parents:
100
diff
changeset
|
21 tweet.attrs[:entities][:media] |
174
d35dbc09bd83
Less double escaping for actual content
nanaya <me@nanaya.pro>
parents:
172
diff
changeset
|
22 )) |
169 | 23 .gsub("\n", "<br />") |
103
1251b3d6ec5d
Use included url data instead of expanding using embiggen
nanaya <me@myconan.net>
parents:
100
diff
changeset
|
24 .html_safe |
1251b3d6ec5d
Use included url data instead of expanding using embiggen
nanaya <me@myconan.net>
parents:
100
diff
changeset
|
25 %> |
79 | 26 </p> |
27 | |
28 <p> | |
64
a20bbd1e2dc1
Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents:
62
diff
changeset
|
29 <%= link_to "https://twitter.com/#{tweet.user.screen_name}" do %> |
150
950849c40d42
Update all the things, including rails 5.2
nanaya <me@nanaya.pro>
parents:
132
diff
changeset
|
30 <%= image_tag tweet.user.profile_image_url_https.to_s, :alt => "profile image for #{tweet.user.name.printable}" %> |
125 | 31 <%= tweet.user.name.printable -%> |
64
a20bbd1e2dc1
Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents:
62
diff
changeset
|
32 <% end %> |
75
585952f98978
Put the tweet on different paragraph
nanaya <me@myconan.net>
parents:
65
diff
changeset
|
33 </p> |
64
a20bbd1e2dc1
Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents:
62
diff
changeset
|
34 |
75
585952f98978
Put the tweet on different paragraph
nanaya <me@myconan.net>
parents:
65
diff
changeset
|
35 <p> |
126 | 36 <% tweet.media.each_with_index do |media, i| %> |
64
a20bbd1e2dc1
Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents:
62
diff
changeset
|
37 <% if media.is_a? Twitter::Media::Photo %> |
a20bbd1e2dc1
Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents:
62
diff
changeset
|
38 <%= link_to "#{media.media_url_https}:orig" do %> |
126 | 39 <%= image_tag "#{media.media_url_https}:small", :alt => "attachment #{i + 1}" -%> |
64
a20bbd1e2dc1
Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents:
62
diff
changeset
|
40 <% end %> |
154 | 41 <% elsif media.is_a? Twitter::Media::Video %> |
178 | 42 <%= video_tag media.video_info.variants |
43 .select { |i| i.bitrate.is_a? Integer } | |
44 .sort_by { |i| -i.bitrate } | |
45 .map(&:url), width: '100%', controls: true | |
46 %> | |
62
9ab79a764434
Sweet tweet media viewer (image only for now)
nanaya <me@myconan.net>
parents:
diff
changeset
|
47 <% end %> |
9ab79a764434
Sweet tweet media viewer (image only for now)
nanaya <me@myconan.net>
parents:
diff
changeset
|
48 <% end %> |
64
a20bbd1e2dc1
Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents:
62
diff
changeset
|
49 </p> |
62
9ab79a764434
Sweet tweet media viewer (image only for now)
nanaya <me@myconan.net>
parents:
diff
changeset
|
50 |
64
a20bbd1e2dc1
Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents:
62
diff
changeset
|
51 <% if tweet.quoted_status.present? %> |
a20bbd1e2dc1
Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents:
62
diff
changeset
|
52 <blockquote> |
131 | 53 <%= render "tweet", :tweet => tweet.quoted_status, :with_time => true %> |
64
a20bbd1e2dc1
Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents:
62
diff
changeset
|
54 </blockquote> |
a20bbd1e2dc1
Now with avatar and proper retweet styling and stuff
nanaya <me@myconan.net>
parents:
62
diff
changeset
|
55 <% end %> |
62
9ab79a764434
Sweet tweet media viewer (image only for now)
nanaya <me@myconan.net>
parents:
diff
changeset
|
56 <% end %> |