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

41 lines
2.1 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">
<input type="hidden" name="csrf_token" value="<%= URI.encode_www_form(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">
<input type="hidden" name="csrf_token" value="<%= URI.encode_www_form(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 id="subscribe_data" type="application/json">
{
"ucid": "<%= ucid %>",
"author": "<%= HTML.escape(author) %>",
"sub_count_text": "<%= HTML.escape(sub_count_text) %>",
"csrf_token": "<%= URI.encode_www_form(env.get?("csrf_token").try &.as(String) || "") %>",
"subscribe_text": "<%= HTML.escape(translate(locale, "Subscribe")) %>",
"unsubscribe_text": "<%= HTML.escape(translate(locale, "Unsubscribe")) %>"
2019-05-05 13:35:54 +00:00
}
</script>
<script src="/js/subscribe_widget.js?v=<%= ASSET_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 %>