Browse Source

Add post content type to frontend

master
Shadowfacts 12 months ago
parent
commit
64b1515b46
Signed by: shadowfacts GPG Key ID: 94A5AB95422746E5
3 changed files with 23 additions and 3 deletions
  1. +10
    -0
      assets/css/clacks.scss
  2. +2
    -2
      lib/clacks_web/controllers/frontend_controller.ex
  3. +11
    -1
      lib/clacks_web/templates/frontend/_post_form.html.eex

+ 10
- 0
assets/css/clacks.scss View File

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


+ 2
- 2
lib/clacks_web/controllers/frontend_controller.ex View File

@ -274,13 +274,13 @@ defmodule ClacksWeb.FrontendController do
})
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)
UserActionsHelper.post_status(
current_user,
content,
"text/plain",
content_type,
Map.get(params, "in_reply_to")
)
|> case do


+ 11
- 1
lib/clacks_web/templates/frontend/_post_form.html.eex View File

@ -2,8 +2,18 @@
<%= if assigns[:in_reply_to] do %>
<input type="hidden" name="in_reply_to" value="<%= @in_reply_to %>">
<% end %>
<% placeholder = assigns[:placeholder] || "What's up?" %>
<% content = assigns[:content] || "" %>
<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 %>

Loading…
Cancel
Save