Compare commits

...

3 Commits

6 changed files with 42 additions and 15 deletions

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 {

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

View File

@ -0,0 +1,19 @@
<%= form_tag Routes.frontend_path(@conn, :post_status), method: :post, class: "compose-status" do %>
<%= 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>
<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 %>

View File

@ -1,9 +1,6 @@
<h1>Home</h1>
<%= form_tag Routes.frontend_path(@conn, :post_status), method: :post, class: "compose-status" do %>
<textarea id="content" name="content" rows="5" placeholder="What's up?" required></textarea>
<%= submit "Post" %>
<hr>
<% end %>
<%= render "_post_form.html", conn: @conn %>
<hr>
<%= render "_timeline.html", conn: @conn, statuses_with_authors: @statuses_with_authors %>

View File

@ -3,10 +3,6 @@
<%= unless is_nil(@current_user) do %>
<hr>
<%= form_tag Routes.frontend_path(@conn, :post_status), method: :post, class: "compose-status" do %>
<input type="hidden" name="in_reply_to" value="<%= @status.data["object"]["id"] %>">
<textarea id="content" name="content" rows="5" placeholder="Reply" required><%= mentions_for_replying_to(@conn, @status) %></textarea>
<%= submit "Post" %>
<hr>
<% end %>
<%= render "_post_form.html", conn: @conn, in_reply_to: @status.data["object"]["id"], placeholder: "Reply", content: mentions_for_replying_to(@conn, @status) %>
<hr>
<% end %>

View File

@ -121,9 +121,14 @@ defmodule ClacksWeb.FrontendView do
actor = Actor.get_cached_by_ap_id(ap_id)
"@#{actor.nickname}"
end)
|> Enum.join(" ")
"#{mentions} "
case mentions do
[] ->
""
_ ->
Enum.join(mentions, " ") <> ""
end
end
defp mentions_for_replying_to(_), do: ""