Added check in poll card that allows setting the value of results_enabled flag. Access to stats/results now is controlled with abilities. Polls related to proposals will be accessible to the proposal author like they were administrators.
37 lines
1.3 KiB
Plaintext
37 lines
1.3 KiB
Plaintext
<% if can?(:results, @poll) || can?(:stats, @poll) %>
|
|
<div class="row margin-top">
|
|
<div class="small-12 column">
|
|
<ul class="menu simple clear">
|
|
<%# if current_user && current_user.administrator? || @poll.results_enabled? %>
|
|
<% if can?(:results, @poll) %>
|
|
<% if controller_name == "polls" && action_name == "results" %>
|
|
<li class="is-active">
|
|
<h2><%= t("polls.show.results_menu") %></h2>
|
|
</li>
|
|
<% else %>
|
|
<li><%= link_to t("polls.show.results_menu"), results_poll_path(@poll) %></li>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% if can?(:stats, @poll) %>
|
|
<% if controller_name == "polls" && action_name == "stats" %>
|
|
<li class="is-active">
|
|
<h2><%= t("polls.show.stats_menu") %></h2>
|
|
</li>
|
|
<% else %>
|
|
<li><%= link_to t("polls.show.stats_menu"), stats_poll_path(@poll) %></li>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% if controller_name == "polls" && action_name == "show" %>
|
|
<li class="is-active">
|
|
<h2><%= t("polls.show.info_menu") %></h2>
|
|
</li>
|
|
<% else %>
|
|
<li><%= link_to t("polls.show.info_menu"), poll_path(@poll) %></li>
|
|
<% end %>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<% end %>
|