From 6dd42e7150ff73e2525b182308e0fb69a07fc9c8 Mon Sep 17 00:00:00 2001 From: aaronskiba <71047780+aaronskiba@users.noreply.github.com> Date: Thu, 25 Jan 2024 14:44:39 -0700 Subject: [PATCH 1/2] Avoid rendering "You must answer at least 0% ..." Add extra handling for set_visibility_info. Only render "You must answer at least %{percentage}%% of the questions" when percentage is a non-zero value. --- app/views/plans/_share_form.html.erb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/views/plans/_share_form.html.erb b/app/views/plans/_share_form.html.erb index e68cede35a..6e94db3391 100644 --- a/app/views/plans/_share_form.html.erb +++ b/app/views/plans/_share_form.html.erb @@ -4,13 +4,21 @@ <% administerable = @plan.administerable_by?(current_user.id) %> <% email_tooltip = _("Enter the email address of your collaborator: If they are already using #{ApplicationService.application_name}, they will see this plan on their dashboard, and recieve an email. If they are not currently using #{ApplicationService.application_name}, they will recieve an email inviting them to the tool so they can collaborate on your plan.") %> <% permissions_tooltip = _('Co-owner: Has admin-rights to the plan (can invite other users, view the plan, answer questions, or comment). Editor: Has edit-rights to the plan (can view the plan, answer questions, or comment). Read Only: Has read-rights to the plan (can view the plan or comment)') %> +<% percentage = Rails.configuration.x.plans.default_percentage_answered %> +<%# Only include "You must answer at least x% ..." if x is non-zero %> +<% set_visibility_info = if percentage&.nonzero? + _('Public or organisational visibility is intended for finished plans. You must answer at least %{percentage}%% of the questions to enable these options. Note: test plans are set to private visibility by default.') % { percentage: percentage } + else + _('Public or organisational visibility is intended for finished plans. Note: test plans are set to private visibility by default.') + end +%>