From d3f32978c850b7f6035c9bf3fbb850ef6ffd4c9d Mon Sep 17 00:00:00 2001 From: taitus Date: Mon, 13 Oct 2025 12:36:35 +0200 Subject: [PATCH] Hide "Maximum number of votes" message for unique and open-ended questions The "Maximum number of votes" text in poll question show was unnecessary. It appeared for both unique and open-ended questions, but it only makes sense for questions that allow multiple answers. --- app/views/admin/poll/questions/show.html.erb | 2 +- spec/system/admin/poll/questions_spec.rb | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/admin/poll/questions/show.html.erb b/app/views/admin/poll/questions/show.html.erb index 35b09b9f9..4a6a98378 100644 --- a/app/views/admin/poll/questions/show.html.erb +++ b/app/views/admin/poll/questions/show.html.erb @@ -35,7 +35,7 @@
<%= VotationType.human_attribute_name("vote_type.#{@question.vote_type}") %>

- <% if @question.max_votes.present? %> + <% if @question.multiple? %>

<%= VotationType.human_attribute_name("max_votes") %>
diff --git a/spec/system/admin/poll/questions_spec.rb b/spec/system/admin/poll/questions_spec.rb index 3997c3af7..1bb7a55fb 100644 --- a/spec/system/admin/poll/questions_spec.rb +++ b/spec/system/admin/poll/questions_spec.rb @@ -88,6 +88,7 @@ describe "Admin poll questions", :admin do expect(page).to have_content "Question with unique answer" expect(page).to have_content "Unique answer" + expect(page).not_to have_content "Maximum number of votes" end scenario "Multiple" do @@ -104,6 +105,7 @@ describe "Admin poll questions", :admin do expect(page).to have_content "Question with multiple answers" expect(page).to have_content "Multiple answers" + expect(page).to have_text "Maximum number of votes 6", normalize_ws: true end scenario "Open-ended" do @@ -119,6 +121,7 @@ describe "Admin poll questions", :admin do expect(page).to have_content "What do you want?" expect(page).to have_content "Open-ended" + expect(page).not_to have_content "Maximum number of votes" end end end