summaryrefslogtreecommitdiff
path: root/src/invidious/views/community.ecr
blob: 3bc29e55211b7197b6ea82cbae75e262fd95b7e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<% ucid = channel.ucid %>
<% author = HTML.escape(channel.author) %>

<% content_for "header" do %>
<title><%= author %> - Invidious</title>
<% end %>

<% if channel.banner %>
    <div class="h-box">
        <img style="width:100%" src="/ggpht<%= URI.parse(channel.banner.not_nil!.gsub("=w1060-", "=w1280-")).request_target %>">
    </div>

    <div class="h-box">
        <hr>
    </div>
<% end %>

<div class="pure-g h-box">
    <div class="pure-u-2-3">
        <div class="channel-profile">
            <img src="/ggpht<%= URI.parse(channel.author_thumbnail).request_target %>">
            <span><%= author %></span><% if !channel.verified.nil? && channel.verified %>&nbsp;<i class="icon ion ion-md-checkmark-circle"></i><% end %>
        </div>
    </div>
    <div class="pure-u-1-3" style="text-align:right">
        <h3 style="text-align:right">
            <a href="/feed/channel/<%= channel.ucid %>"><i class="icon ion-logo-rss"></i></a>
        </h3>
    </div>
</div>

<div class="h-box">
    <div id="descriptionWrapper">
        <p><span style="white-space:pre-wrap"><%= XML.parse_html(channel.description_html).xpath_node(%q(.//pre)).try &.content %></span></p>
    </div>
</div>

<div class="h-box">
    <% sub_count_text = number_to_short_text(channel.sub_count) %>
    <%= rendered "components/subscribe_widget" %>
</div>

<div class="pure-g h-box">
    <div class="pure-u-1-3">
        <a href="https://www.youtube.com/channel/<%= channel.ucid %>/community"><%= translate(locale, "View channel on YouTube") %></a>
        <div class="pure-u-1 pure-md-1-3">
            <% if env.get("preferences").as(Preferences).automatic_instance_redirect%>
                <a href="/redirect?referer=<%= env.get?("current_page") %>"><%= translate(locale, "Switch Invidious Instance") %></a>
            <% else %>
                <a href="https://redirect.invidious.io<%= env.request.resource %>"><%= translate(locale, "Switch Invidious Instance") %></a>
            <% end %>
        </div>
        <% if !channel.auto_generated %>
            <div class="pure-u-1 pure-md-1-3">
                <a href="/channel/<%= channel.ucid %>"><%= translate(locale, "Videos") %></a>
            </div>
        <% end %>
        <div class="pure-u-1 pure-md-1-3">
            <a href="/channel/<%= channel.ucid %>/playlists"><%= translate(locale, "Playlists") %></a>
        </div>
        <div class="pure-u-1 pure-md-1-3">
            <% if channel.tabs.includes? "community" %>
                <b><%= translate(locale, "Community") %></b>
            <% end %>
        </div>
    </div>
    <div class="pure-u-2-3"></div>
</div>

<div class="h-box">
    <hr>
</div>

<% if error_message %>
    <div class="h-box">
        <p><%= error_message %></p>
    </div>
<% else %>
    <div class="h-box pure-g" id="comments">
        <%= template_youtube_comments(items.not_nil!, locale, thin_mode) %>
    </div>
<% end %>

<script id="community_data" type="application/json">
<%=
{
    "ucid" => ucid,
    "youtube_comments_text" => HTML.escape(translate(locale, "View YouTube comments")),
    "comments_text" => HTML.escape(translate(locale, "View `x` comments", "{commentCount}")),
    "hide_replies_text" => HTML.escape(translate(locale, "Hide replies")),
    "show_replies_text" => HTML.escape(translate(locale, "Show replies")),
    "preferences" => env.get("preferences").as(Preferences)
}.to_pretty_json
%>
</script>
<script src="/js/community.js?v=<%= ASSET_COMMIT %>"></script>