2024-06-02 05:50:49 +02:00
|
|
|
<% watch_path = ~p"/forums/#{@forum}/topics/#{@topic}/subscription"
|
2024-06-02 05:50:36 +02:00
|
|
|
|
2024-06-02 05:50:49 +02:00
|
|
|
watch_class =
|
|
|
|
if @watching do
|
|
|
|
"hidden"
|
|
|
|
else
|
|
|
|
""
|
|
|
|
end
|
2024-06-02 05:50:36 +02:00
|
|
|
|
2024-06-02 05:50:49 +02:00
|
|
|
unwatch_path = ~p"/forums/#{@forum}/topics/#{@topic}/subscription"
|
2024-06-02 05:50:36 +02:00
|
|
|
|
2024-06-02 05:50:49 +02:00
|
|
|
unwatch_class =
|
|
|
|
if @watching do
|
|
|
|
""
|
|
|
|
else
|
|
|
|
"hidden"
|
|
|
|
end %>
|
2024-06-02 05:50:36 +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 %>
|