Always show not allowed message in legislation debates

This message is only shown in the `show` action, so it's shown at most
once in the whole page, so it doesn't take up too much space and it
isn't as overwhelming as if we were showing it on the index page, once
per debate.

We're only showing it when there are closed options, though, since
there's already a message to sign in to comment when the question
accepts open answers.
This commit is contained in:
Javi Martín
2021-10-01 02:06:42 +02:00
parent aa2c551411
commit 9154614577
5 changed files with 11 additions and 7 deletions

View File

@@ -14,7 +14,6 @@
initialize: function() {
App.Votes.hoverize("div.votes");
App.Votes.hoverize("div.supports");
App.Votes.hoverize("div.debate-questions");
App.Votes.hoverize("div.comment-footer");
}
};

View File

@@ -327,6 +327,10 @@
}
}
.debate-questions .debate-questions .participation-not-allowed {
position: static;
}
.bullet {
color: $text;
}

View File

@@ -1,5 +1,5 @@
<% if question.question_options.any? %>
<% if process.debate_phase.open? && !answer.persisted? %>
<% if process.debate_phase.open? && !answer.persisted? && can?(:create, Legislation::Answer) %>
<%= form_for answer, url: legislation_process_question_answers_path(process, question, answer), remote: true, html: { class: "controls-stacked" } do |f| %>
<% question.question_options.each do |question_option| %>
@@ -25,4 +25,6 @@
</form>
<% end %>
<%= render "participation_not_allowed" %>
<% end %>

View File

@@ -1,23 +1,23 @@
<% if user_signed_in? && current_user.organization? %>
<div class="participation-not-allowed" style="display:none" aria-hidden="false">
<div class="participation-not-allowed">
<p>
<%= t("legislation.questions.participation.organizations") %>
</p>
</div>
<% elsif user_signed_in? && current_user.unverified? %>
<div class="participation-not-allowed" style="display:none" aria-hidden="false">
<div class="participation-not-allowed">
<p>
<%= sanitize(t("legislation.questions.participation.verified_only",
verify_account: link_to_verify_account)) %>
</p>
</div>
<% elsif !user_signed_in? %>
<div class="participation-not-allowed" style="display:none" aria-hidden="false">
<div class="participation-not-allowed">
<%= sanitize(t("legislation.questions.participation.unauthenticated",
signin: link_to_signin, signup: link_to_signup)) %>
</div>
<% elsif !@process.debate_phase.open? %>
<div class="participation-not-allowed" style="display:none" aria-hidden="false">
<div class="participation-not-allowed">
<%= t("legislation.questions.participation.debate_phase_not_open") %>
</div>
<% end %>

View File

@@ -31,7 +31,6 @@
<h3 class="quiz-question"><%= @question.title %></h3>
<div class="debate-questions" id="legislation-answer-form">
<%= render "answer_form", process: @process, question: @question, answer: @answer %>
<%= render "participation_not_allowed" %>
</div>
</div>