2019-01-28 03:06:28 +00:00
|
|
|
<% 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-09-24 17:31:33 +00:00
|
|
|
<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>
|
2019-01-28 03:06:28 +00:00
|
|
|
<% 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-09-24 17:31:33 +00:00
|
|
|
<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>
|
2019-01-28 03:06:28 +00:00
|
|
|
<% end %>
|
2019-05-05 13:35:54 +00:00
|
|
|
|
2020-03-15 21:46:08 +00:00
|
|
|
<script id="subscribe_data" type="application/json">
|
2020-03-29 21:44:45 +00:00
|
|
|
<%=
|
2020-03-15 21:46:08 +00:00
|
|
|
{
|
2020-03-29 21:44:45 +00:00
|
|
|
"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"))
|
|
|
|
}.to_pretty_json
|
|
|
|
%>
|
2019-05-05 13:35:54 +00:00
|
|
|
</script>
|
2019-05-09 16:52:37 +00:00
|
|
|
<script src="/js/subscribe_widget.js?v=<%= ASSET_COMMIT %>"></script>
|
2019-01-28 03:06:28 +00:00
|
|
|
<% else %>
|
|
|
|
<p>
|
2019-03-23 19:05:13 +00:00
|
|
|
<a id="subscribe" class="pure-button pure-button-primary"
|
2019-01-28 03:06:28 +00:00
|
|
|
href="/login?referer=<%= env.get("current_page") %>">
|
2019-04-14 22:10:32 +00:00
|
|
|
<b><%= translate(locale, "Subscribe") %> | <%= sub_count_text %></b>
|
2019-01-28 03:06:28 +00:00
|
|
|
</a>
|
|
|
|
</p>
|
|
|
|
<% end %>
|