Add post content type to frontend

This commit is contained in:
Shadowfacts 2020-05-25 19:34:58 -04:00
parent 39b48eb52d
commit 64b1515b46
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
3 changed files with 23 additions and 3 deletions

View File

@ -189,6 +189,16 @@ ul.notifications-list {
// we want 100% width to include the border // we want 100% width to include the border
box-sizing: border-box; box-sizing: border-box;
} }
.compose-status-options {
display: flex;
flex-direction: row;
align-items: center;
.spacer {
flex-grow: 1;
}
}
} }
.search-form { .search-form {

View File

@ -274,13 +274,13 @@ defmodule ClacksWeb.FrontendController do
}) })
end end
def post_status(conn, %{"content" => content} = params) do def post_status(conn, %{"content" => content, "content_type" => content_type} = params) do
current_user = conn.assigns[:user] |> Repo.preload(:actor) current_user = conn.assigns[:user] |> Repo.preload(:actor)
UserActionsHelper.post_status( UserActionsHelper.post_status(
current_user, current_user,
content, content,
"text/plain", content_type,
Map.get(params, "in_reply_to") Map.get(params, "in_reply_to")
) )
|> case do |> case do

View File

@ -2,8 +2,18 @@
<%= if assigns[:in_reply_to] do %> <%= if assigns[:in_reply_to] do %>
<input type="hidden" name="in_reply_to" value="<%= @in_reply_to %>"> <input type="hidden" name="in_reply_to" value="<%= @in_reply_to %>">
<% end %> <% end %>
<% placeholder = assigns[:placeholder] || "What's up?" %> <% placeholder = assigns[:placeholder] || "What's up?" %>
<% content = assigns[:content] || "" %> <% content = assigns[:content] || "" %>
<textarea id="content" name="content" rows="5" placeholder="<%= placeholder %>"><%= content %></textarea> <textarea id="content" name="content" rows="5" placeholder="<%= placeholder %>"><%= content %></textarea>
<%= submit "Post" %>
<div class="compose-status-options">
<select name="content_type">
<option value="text/plain">Plain</option>
<option value="text/markdown">Markdown</option>
<option value="text/html">HTML</option>
</select>
<div class="spacer"></div>
<%= submit "Post" %>
</div>
<% end %> <% end %>