invidious-mod-JP/src/invidious/views/components/subscribe_widget.ecr

41 lines
2 KiB
Plaintext
Raw Normal View History

<% if user %>
<% if subscriptions.includes? ucid %>
2019-05-02 01:03:39 +00:00
<p>
2019-05-05 13:35:54 +00:00
<form action="/subscription_ajax?action_remove_subscriptions=1&c=<%= ucid %>&referer=<%= env.get("current_page") %>" method="post">
2019-05-02 01:03:39 +00:00
<input type="hidden" name="csrf_token" value="<%= URI.escape(env.get?("csrf_token").try &.as(String) || "") %>">
2019-05-05 13:35:54 +00:00
<button data-type="unsubscribe" id="subscribe" class="pure-button pure-button-primary">
2019-05-02 01:03:39 +00:00
<b><input style="all:unset" type="submit" value="<%= translate(locale, "Unsubscribe") %> | <%= sub_count_text %>"></b>
2019-05-05 13:35:54 +00:00
</button>
2019-05-02 01:03:39 +00:00
</form>
</p>
<% else %>
2019-05-02 01:03:39 +00:00
<p>
2019-05-05 13:35:54 +00:00
<form action="/subscription_ajax?action_create_subscription_to_channel=1&c=<%= ucid %>&referer=<%= env.get("current_page") %>" method="post">
2019-05-02 01:03:39 +00:00
<input type="hidden" name="csrf_token" value="<%= URI.escape(env.get?("csrf_token").try &.as(String) || "") %>">
2019-05-05 13:35:54 +00:00
<button data-type="subscribe" id="subscribe" class="pure-button pure-button-primary">
2019-05-02 01:03:39 +00:00
<b><input style="all:unset" type="submit" value="<%= translate(locale, "Subscribe") %> | <%= sub_count_text %>"></b>
2019-05-05 13:35:54 +00:00
</button>
2019-05-02 01:03:39 +00:00
</form>
</p>
<% end %>
2019-05-05 13:35:54 +00:00
<script>
var subscribe_data = {
ucid: '<%= ucid %>',
2019-05-08 13:58:10 +00:00
author: '<%= HTML.escape(author) %>',
sub_count_text: '<%= HTML.escape(sub_count_text) %>',
2019-05-05 13:35:54 +00:00
csrf_token: '<%= URI.escape(env.get?("csrf_token").try &.as(String) || "") %>',
2019-05-08 13:58:10 +00:00
subscribe_text: '<%= HTML.escape(translate(locale, "Subscribe")) %>',
unsubscribe_text: '<%= HTML.escape(translate(locale, "Unsubscribe")) %>'
2019-05-05 13:35:54 +00:00
}
</script>
2019-05-08 13:58:10 +00:00
<script src="/js/subscribe_widget.js?v=<%= CURRENT_COMMIT %>"></script>
<% else %>
<p>
<a id="subscribe" class="pure-button pure-button-primary"
href="/login?referer=<%= env.get("current_page") %>">
2019-04-14 22:10:32 +00:00
<b><%= translate(locale, "Subscribe") %> | <%= sub_count_text %></b>
</a>
</p>
<% end %>