Compare commits
3 Commits
de7a1e617d
...
64b1515b46
Author | SHA1 | Date |
---|---|---|
Shadowfacts | 64b1515b46 | |
Shadowfacts | 39b48eb52d | |
Shadowfacts | aae48b2500 |
|
@ -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 {
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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 %>
|
|
@ -1,9 +1,6 @@
|
||||||
<h1>Home</h1>
|
<h1>Home</h1>
|
||||||
|
|
||||||
<%= form_tag Routes.frontend_path(@conn, :post_status), method: :post, class: "compose-status" do %>
|
<%= render "_post_form.html", conn: @conn %>
|
||||||
<textarea id="content" name="content" rows="5" placeholder="What's up?" required></textarea>
|
<hr>
|
||||||
<%= submit "Post" %>
|
|
||||||
<hr>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= render "_timeline.html", conn: @conn, statuses_with_authors: @statuses_with_authors %>
|
<%= render "_timeline.html", conn: @conn, statuses_with_authors: @statuses_with_authors %>
|
||||||
|
|
|
@ -3,10 +3,6 @@
|
||||||
<%= unless is_nil(@current_user) do %>
|
<%= unless is_nil(@current_user) do %>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<%= form_tag Routes.frontend_path(@conn, :post_status), method: :post, class: "compose-status" do %>
|
<%= render "_post_form.html", conn: @conn, in_reply_to: @status.data["object"]["id"], placeholder: "Reply", content: mentions_for_replying_to(@conn, @status) %>
|
||||||
<input type="hidden" name="in_reply_to" value="<%= @status.data["object"]["id"] %>">
|
<hr>
|
||||||
<textarea id="content" name="content" rows="5" placeholder="Reply" required><%= mentions_for_replying_to(@conn, @status) %></textarea>
|
|
||||||
<%= submit "Post" %>
|
|
||||||
<hr>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -121,9 +121,14 @@ defmodule ClacksWeb.FrontendView do
|
||||||
actor = Actor.get_cached_by_ap_id(ap_id)
|
actor = Actor.get_cached_by_ap_id(ap_id)
|
||||||
"@#{actor.nickname}"
|
"@#{actor.nickname}"
|
||||||
end)
|
end)
|
||||||
|> Enum.join(" ")
|
|
||||||
|
|
||||||
"#{mentions} "
|
case mentions do
|
||||||
|
[] ->
|
||||||
|
""
|
||||||
|
|
||||||
|
_ ->
|
||||||
|
Enum.join(mentions, " ") <> ""
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp mentions_for_replying_to(_), do: ""
|
defp mentions_for_replying_to(_), do: ""
|
||||||
|
|
Loading…
Reference in New Issue