philomena/lib/philomena_web/templates/topic/poll/_display.html.heex
2024-06-01 23:50:49 -04:00

48 lines
1.6 KiB
Text

<div class="block__header block__header--js-tabbed">
<%= link("Voting", to: "#", class: "selected", data: [click_tab: "voting"]) %>
<%= if can?(@conn, :hide, @topic) do %>
<%= link("Voters", to: "#", data: [click_tab: "voters", load_tab: ~p"/forums/#{@forum}/topics/#{@topic}/poll/votes"]) %>
<%= link("Administrate", to: "#", data: [click_tab: "administration"]) %>
<% end %>
</div>
<div class="block__tab" data-tab="voting">
<%= cond do %>
<% @poll.hidden_from_users -> %>
<div class="walloftext"></div>
<div class="block block--fixed block--warning">
<h1>
This poll has been deleted
</h1>
<p>
Reason:
<strong>
<%= @poll.deletion_reason || "Unknown (likely deleted in error). Please contact a moderator." %>
</strong>
</p>
</div>
<% @poll_active and not @voted and not is_nil(@conn.assigns.current_user) -> %>
<div class="poll">
<div class="poll-area">
<%= render(PhilomenaWeb.Topic.PollView, "_vote_form.html", assigns) %>
</div>
</div>
<% true -> %>
<div class="poll">
<div class="poll-area">
<%= render(PhilomenaWeb.Topic.PollView, "_results.html", assigns) %>
</div>
</div>
<% end %>
</div>
<%= if can?(@conn, :hide, @topic) do %>
<div class="block__tab hidden" data-tab="voters">
<p>
Loading&hellip;
</p>
</div>
<div class="block__tab hidden" data-tab="administration">
<a class="button button--state-warning js-staff-action" href={~p"/forums/#{@forum}/topics/#{@topic}/poll/edit"}>
<i class="fa fa-edit"></i> Edit
</a>
</div>
<% end %>