philomena/lib/philomena_web/templates/channel/subscription/_subscription.html.heex
2024-06-01 23:50:36 -04:00

42 lines
1.2 KiB
Text

<%
watch_path = ~p"/channels/#{@channel}/subscription"
watch_class =
if @watching do
"hidden"
else
""
end
unwatch_path = ~p"/channels/#{@channel}/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 media-box__header media-box__header--channel media-box__header--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 media-box__header media-box__header--channel media-box__header--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 class="media-box__header media-box__header--channel media-box__header--link" href={~p"/sessions/new"}>
<i class="fa fa-bell"></i>
<span class="hide-mobile">
Subscribe
</span>
</a>
<% end %>