philomena/lib/philomena_web/templates/markdown/_input.html.heex

28 lines
1.3 KiB
Text
Raw Normal View History

2024-06-02 05:50:36 +02:00
<% form = assigns[:f] %>
<% action_text = assigns[:action_text] || ~c"Edit" %>
<% action_icon = assigns[:action_icon] || ~c"edit" %>
<% field_name = assigns[:name] || :body %>
<% field_placeholder = assigns[:placeholder] || "Your message" %>
<% is_required = assigns[:required] %>
<% input_classes = assigns[:class] %>
<div class="block__header block__header--js-tabbed">
<a class="selected" data-click-tab="write" href="#">
<i class={"fa #{"fa-#{action_icon}"}"}></i>
<%= action_text %>
</a>
<a data-click-tab="preview" href="#">
<i class="fa fa-cog fa-fw fa-spin js-preview-loading hidden" title={raw('Loading preview&hellip;')}></i>
<i class="fa fa-eye fa-fw js-preview-idle"></i>
Preview
</a>
</div>
<div class="block__tab communication-edit__tab selected js-preview-input-wrapper" data-tab="write">
<%= render(PhilomenaWeb.MarkdownView, "_help.html", conn: @conn) %>
<%= render(PhilomenaWeb.MarkdownView, "_toolbar.html", conn: @conn) %>
<div class="field">
<%= 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) %>
</div>
</div>
<div class="block__tab communication-edit__tab hidden js-preview-content" data-tab="preview"></div>