unrequire editor fields that weren't previously required

This commit is contained in:
SeinopSys 2021-09-30 23:56:38 +02:00
parent 2684c3f83b
commit 27af96fe3a
No known key found for this signature in database
GPG key ID: 9BFB053C1BA6C5C4
6 changed files with 8 additions and 5 deletions

View file

@ -65,7 +65,7 @@
.field
.block
.communication-edit__wrap
= render PhilomenaWeb.MarkdownView, "_input.html", conn: @conn, f: f, action_icon: "pencil-alt", action_text: "Description", placeholder: "Describe this image in plain words - this should generally be info about the image that doesn't belong in the tags or source."
= render PhilomenaWeb.MarkdownView, "_input.html", conn: @conn, f: f, action_icon: "pencil-alt", action_text: "Description", placeholder: "Describe this image in plain words - this should generally be info about the image that doesn't belong in the tags or source.", required: false
= render PhilomenaWeb.MarkdownView, "_anon_checkbox.html", conn: @conn, f: f, label: "Post anonymously"

View file

@ -18,7 +18,7 @@
= render PhilomenaWeb.MarkdownView, "_toolbar.html", conn: @conn
.field
= textarea form, field_name, class: "input input--wide input--text input--resize-vertical js-toolbar-input js-preview-input", placeholder: field_placeholder, required: true
= textarea form, field_name, class: "input input--wide input--text input--resize-vertical js-toolbar-input js-preview-input", placeholder: field_placeholder, required: required?(@conn)
= error_tag form, field_name
.block__tab.communication-edit__tab.hidden.js-preview-content data-tab="preview"

View file

@ -15,7 +15,7 @@ h1 Updating Profile Description
.block
div
= render PhilomenaWeb.MarkdownView, "_input.html", conn: @conn, f: f, action_text: "About Me", placeholder: "Description (up to 10000 characters)", name: :description
= render PhilomenaWeb.MarkdownView, "_input.html", conn: @conn, f: f, action_text: "About Me", placeholder: "Description (up to 10000 characters)", name: :description, required: false
.block__content.communication-edit__actions
=> submit "Update", class: "button"

View file

@ -6,7 +6,7 @@ h1 Updating Moderation Scratchpad
p Oops, something went wrong! Please check the errors below.
.block
div
= render PhilomenaWeb.MarkdownView, "_input.html", conn: @conn, f: f, action_text: "Scratchpad", placeholder: "Scratchpad Contents", name: :scratchpad
= render PhilomenaWeb.MarkdownView, "_input.html", conn: @conn, f: f, action_text: "Scratchpad", placeholder: "Scratchpad Contents", name: :scratchpad, required: false
.block__content.communication-edit__actions
=> submit "Update", class: "button"

View file

@ -45,7 +45,7 @@ p
.field
= select f, :category, report_categories(), class: "input"
.block
= render PhilomenaWeb.MarkdownView, "_input.html", conn: @conn, f: f, placeholder: "Provide anything else we should know here.", name: :reason
= render PhilomenaWeb.MarkdownView, "_input.html", conn: @conn, f: f, placeholder: "Provide anything else we should know here.", name: :reason, required: false
= render PhilomenaWeb.CaptchaView, "_captcha.html", name: "report", conn: @conn

View file

@ -4,4 +4,7 @@ defmodule PhilomenaWeb.MarkdownView do
def anonymous_by_default?(conn) do
conn.assigns.current_user.anonymous_by_default
end
def required?(%{assigns: %{required: false}}), do: nil
def required?(_), do: true
end