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

41 lines
936 B
Text
Raw Normal View History

2024-05-04 23:09:44 +02:00
<% watch_path = ~p"/galleries/#{@gallery}/subscription"
2024-05-04 23:09:20 +02:00
2024-05-04 23:09:44 +02:00
watch_class =
if @watching do
"hidden"
else
""
end
2024-05-04 23:09:20 +02:00
2024-05-04 23:09:44 +02:00
unwatch_path = ~p"/galleries/#{@gallery}/subscription"
2024-05-04 23:09:20 +02:00
2024-05-04 23:09:44 +02:00
unwatch_class =
if @watching do
""
else
"hidden"
end %>
2024-05-04 23:09:20 +02:00
<%= 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>
<span class="hide-mobile">
Subscribe
</span>
</a>
<a class={"js-subscription-link #{unwatch_class}"} data-method="delete" data-remote="true" href={unwatch_path}>
<i class="fa fa-bell-slash"></i>
<span class="hide-mobile">
Unsubscribe
</span>
</a>
</span>
<% else %>
<a href={~p"/sessions/new"}>
<i class="fa fa-bell"></i>
<span class="hide-mobile">
Subscribe
</span>
</a>
<% end %>