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
|
|
|
|
|
|
|
<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-09-24 17:31:33 +00:00
|
|
|
csrf_token: '<%= URI.encode_www_form(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-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 %>
|