From 9154614577d8f06980d6f87102ed29fc4026bdbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 1 Oct 2021 02:06:42 +0200 Subject: [PATCH] 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. --- app/assets/javascripts/votes.js | 1 - app/assets/stylesheets/participation.scss | 4 ++++ app/views/legislation/questions/_answer_form.html.erb | 4 +++- .../questions/_participation_not_allowed.html.erb | 8 ++++---- app/views/legislation/questions/show.html.erb | 1 - 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/votes.js b/app/assets/javascripts/votes.js index c782d428b..be8f73a51 100644 --- a/app/assets/javascripts/votes.js +++ b/app/assets/javascripts/votes.js @@ -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"); } }; diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss index 33509d545..6a80b0ed8 100644 --- a/app/assets/stylesheets/participation.scss +++ b/app/assets/stylesheets/participation.scss @@ -327,6 +327,10 @@ } } +.debate-questions .debate-questions .participation-not-allowed { + position: static; +} + .bullet { color: $text; } diff --git a/app/views/legislation/questions/_answer_form.html.erb b/app/views/legislation/questions/_answer_form.html.erb index 6030b57de..8499082fa 100644 --- a/app/views/legislation/questions/_answer_form.html.erb +++ b/app/views/legislation/questions/_answer_form.html.erb @@ -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 @@ <% end %> + + <%= render "participation_not_allowed" %> <% end %> diff --git a/app/views/legislation/questions/_participation_not_allowed.html.erb b/app/views/legislation/questions/_participation_not_allowed.html.erb index 9bbc88c9a..4e72372bb 100644 --- a/app/views/legislation/questions/_participation_not_allowed.html.erb +++ b/app/views/legislation/questions/_participation_not_allowed.html.erb @@ -1,23 +1,23 @@ <% if user_signed_in? && current_user.organization? %> -