mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-12-17 22:47:59 +01:00
fix issues with the image upload description markdown input
This commit is contained in:
parent
b5d9c0fee3
commit
a1e848514e
3 changed files with 8 additions and 3 deletions
|
@ -65,7 +65,7 @@
|
||||||
.field
|
.field
|
||||||
.block
|
.block
|
||||||
.communication-edit__wrap
|
.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.", required: false
|
= 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.", name: :description, class: "js-image-input", required: false
|
||||||
|
|
||||||
= render PhilomenaWeb.MarkdownView, "_anon_checkbox.html", conn: @conn, f: f, label: "Post anonymously"
|
= render PhilomenaWeb.MarkdownView, "_anon_checkbox.html", conn: @conn, f: f, label: "Post anonymously"
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
- action_icon = assigns[:action_icon] || 'edit'
|
- action_icon = assigns[:action_icon] || 'edit'
|
||||||
- field_name = assigns[:name] || :body
|
- field_name = assigns[:name] || :body
|
||||||
- field_placeholder = assigns[:placeholder] || "Your message"
|
- field_placeholder = assigns[:placeholder] || "Your message"
|
||||||
|
- is_required = assigns[:required]
|
||||||
|
- input_classes = assigns[:class]
|
||||||
.block__header.block__header--js-tabbed
|
.block__header.block__header--js-tabbed
|
||||||
a.selected href="#" data-click-tab="write"
|
a.selected href="#" data-click-tab="write"
|
||||||
i.fa> class="fa-#{action_icon}"
|
i.fa> class="fa-#{action_icon}"
|
||||||
|
@ -18,7 +20,7 @@
|
||||||
= render PhilomenaWeb.MarkdownView, "_toolbar.html", conn: @conn
|
= render PhilomenaWeb.MarkdownView, "_toolbar.html", conn: @conn
|
||||||
|
|
||||||
.field
|
.field
|
||||||
= 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)
|
= textarea form, field_name, class: add_classes("input input--wide input--text input--resize-vertical js-toolbar-input js-preview-input", input_classes), placeholder: field_placeholder, required: required?(is_required)
|
||||||
= error_tag form, field_name
|
= error_tag form, field_name
|
||||||
|
|
||||||
.block__tab.communication-edit__tab.hidden.js-preview-content data-tab="preview"
|
.block__tab.communication-edit__tab.hidden.js-preview-content data-tab="preview"
|
||||||
|
|
|
@ -5,6 +5,9 @@ defmodule PhilomenaWeb.MarkdownView do
|
||||||
conn.assigns.current_user.anonymous_by_default
|
conn.assigns.current_user.anonymous_by_default
|
||||||
end
|
end
|
||||||
|
|
||||||
def required?(%{assigns: %{required: false}}), do: nil
|
def required?(required) when required == false, do: nil
|
||||||
def required?(_), do: true
|
def required?(_), do: true
|
||||||
|
|
||||||
|
def add_classes(base_classes, new_classes) when is_binary(new_classes), do: "#{base_classes} #{new_classes}"
|
||||||
|
def add_classes(base_classes, _), do: base_classes
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue