summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOmar Roth <omarroth@hotmail.com>2019-04-28 12:57:06 -0500
committerOmar Roth <omarroth@hotmail.com>2019-04-28 14:11:23 -0500
commitf08d53b0c6c32bc4a696765d98af3efa3039348a (patch)
tree33b1d45b9691cf1afe03216a0fea516c01235e74
parent6859b852661ec522df9407368dba218df1e4ff80 (diff)
downloadinvidious-f08d53b0c6c32bc4a696765d98af3efa3039348a.tar.gz
invidious-f08d53b0c6c32bc4a696765d98af3efa3039348a.tar.bz2
invidious-f08d53b0c6c32bc4a696765d98af3efa3039348a.zip
Add view count to livestreams in search results
-rw-r--r--src/invidious/views/components/item.ecr26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/invidious/views/components/item.ecr b/src/invidious/views/components/item.ecr
index 469dd230..484a340f 100644
--- a/src/invidious/views/components/item.ecr
+++ b/src/invidious/views/components/item.ecr
@@ -68,16 +68,19 @@
<b><a style="width:100%;" href="/channel/<%= item.ucid %>"><%= item.author %></a></b>
</p>
- <% if item.responds_to?(:premiere_timestamp) && item.premiere_timestamp && item.premiere_timestamp.not_nil! > Time.now %>
- <h5><%= translate(locale, "Premieres in `x`", recode_date((item.premiere_timestamp.as(Time) - Time.now).ago, locale)) %></h5>
- <% elsif Time.now - item.published > 1.minute %>
<h5 class="pure-g">
- <div class="pure-u-2-3"><%= translate(locale, "Shared `x` ago", recode_date(item.published, locale)) %></div>
+ <% if item.responds_to?(:premiere_timestamp) && item.premiere_timestamp && item.premiere_timestamp.not_nil! > Time.now %>
+ <%= translate(locale, "Premieres in `x`", recode_date((item.premiere_timestamp.as(Time) - Time.now).ago, locale)) %></h5>
+ <% elsif Time.now - item.published > 1.minute %>
+ <div class="pure-u-2-3"><%= translate(locale, "Shared `x` ago", recode_date(item.published, locale)) %></div>
+ <% else %>
+ <div class="pure-u-2-3"></div>
+ <% end %>
+
<div class="pure-u-1-3" style="text-align: right">
<%= item.responds_to?(:views) ? translate(locale, "`x` views", number_to_short_text(item.views)) : "" %>
</div>
</h5>
- <% end %>
<% else %>
<% if env.get("preferences").as(Preferences).thin_mode %>
<% else %>
@@ -112,16 +115,19 @@
<b><a style="width:100%;" href="/channel/<%= item.ucid %>"><%= item.author %></a></b>
</p>
- <% if item.responds_to?(:premiere_timestamp) && item.premiere_timestamp && item.premiere_timestamp.not_nil! > Time.now %>
- <h5><%= translate(locale, "Premieres in `x`", recode_date((item.premiere_timestamp.as(Time) - Time.now).ago, locale)) %></h5>
- <% elsif Time.now - item.published > 1.minute %>
<h5 class="pure-g">
- <div class="pure-u-2-3"><%= translate(locale, "Shared `x` ago", recode_date(item.published, locale)) %></div>
+ <% if item.responds_to?(:premiere_timestamp) && item.premiere_timestamp && item.premiere_timestamp.not_nil! > Time.now %>
+ <%= translate(locale, "Premieres in `x`", recode_date((item.premiere_timestamp.as(Time) - Time.now).ago, locale)) %></h5>
+ <% elsif Time.now - item.published > 1.minute %>
+ <div class="pure-u-2-3"><%= translate(locale, "Shared `x` ago", recode_date(item.published, locale)) %></div>
+ <% else %>
+ <div class="pure-u-2-3"></div>
+ <% end %>
+
<div class="pure-u-1-3" style="text-align: right">
<%= item.responds_to?(:views) ? translate(locale, "`x` views", number_to_short_text(item.views)) : "" %>
</div>
</h5>
- <% end %>
<% end %>
</div>
</div>