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
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.compose-status-options {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
|
||||
.spacer {
|
||||
flex-grow: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.search-form {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
||||
<%= 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" %>
|
||||
<%= render "_post_form.html", conn: @conn %>
|
||||
<hr>
|
||||
<% end %>
|
||||
|
||||
<%= render "_timeline.html", conn: @conn, statuses_with_authors: @statuses_with_authors %>
|
||||
|
|
|
@ -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" %>
|
||||
<%= render "_post_form.html", conn: @conn, in_reply_to: @status.data["object"]["id"], placeholder: "Reply", content: mentions_for_replying_to(@conn, @status) %>
|
||||
<hr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -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: ""
|
||||
|
|
Loading…
Reference in New Issue