philomena/lib/philomena_web/templates/image/subscription/_subscription.html.heex

37 lines
812 B
Text
Raw Normal View History

2024-06-02 05:50:36 +02:00
<%
watch_path = ~p"/images/#{@image}/subscription"
watch_class =
if @watching do
"hidden"
else
""
end
unwatch_path = ~p"/images/#{@image}/subscription"
unwatch_class =
if @watching do
""
else
"hidden"
end
%>
<%= if @conn.assigns.current_user do %>
<span class="js-subscription-target">
<a class={"js-subscription-link #{watch_class}"} data-method="post" data-remote="true" href={watch_path}>
<i class="fa fa-bell"></i>
Subscribe
</a>
<a class={"js-subscription-link #{unwatch_class}"} data-method="delete" data-remote="true" href={unwatch_path}>
<i class="fa fa-bell-slash"></i>
Unsubscribe
</a>
</span>
<% else %>
<a href={~p"/sessions/new"}>
<i class="fa fa-bell"></i>
Subscribe
</a>
<% end %>