philomena/lib/philomena_web/templates/topic/new.html.heex
2024-06-01 23:50:36 -04:00

39 lines
1.5 KiB
Text

<%= form_for @changeset, ~p"/forums/#{@forum}/topics", fn f -> %>
<%= if @changeset.action do %>
<div class="alert alert-danger">
<p>
Oops, something went wrong! Please check the errors below.
</p>
</div>
<% end %>
<h1>
Create a Topic
</h1>
<div class="field">
<%= text_input(f, :title, class: "input input--wide", placeholder: "Title") %>
<%= error_tag(f, :title) %>
<%= error_tag(f, :slug) %>
</div>
<div class="block">
<%= inputs_for f, :posts, fn fp -> %>
<%= render(PhilomenaWeb.MarkdownView, "_input.html", conn: @conn, f: fp, action_icon: "pencil-alt", action_text: "First Post", placeholder: "Please read the site rules before posting and use ||spoilers|| for NSFW stuff in SFW forums.") %>
<% end %>
<div class="block__content communication-edit__wrap">
<%= render(PhilomenaWeb.MarkdownView, "_anon_checkbox.html", conn: @conn, f: f, label: "Post anonymously") %>
<%= inputs_for f, :poll, fn fp -> %>
<div class="field" id="add-poll">
<input class="toggle-box" id="add_poll" name="add_poll" type="checkbox" />
<label for="add_poll">
Add a poll
</label>
<div class="toggle-box-container">
<%= render(PhilomenaWeb.Topic.PollView, "_form.html", Map.put(assigns, :f, fp)) %>
</div>
</div>
<% end %>
</div>
<div class="block__content communication-edit__actions">
<%= submit("Post", class: "button", data: [disable_with: raw("Posting&hellip;")]) %>
</div>
</div>
<% end %>