Browse Source

Use the same template for posting statuses

master
Shadowfacts 1 year ago
parent
commit
39b48eb52d
Signed by: shadowfacts GPG Key ID: 94A5AB95422746E5
3 changed files with 13 additions and 11 deletions
  1. +9
    -0
      lib/clacks_web/templates/frontend/_post_form.html.eex
  2. +2
    -5
      lib/clacks_web/templates/frontend/home.html.eex
  3. +2
    -6
      lib/clacks_web/templates/frontend/status.html.eex

+ 9
- 0
lib/clacks_web/templates/frontend/_post_form.html.eex View File

@ -0,0 +1,9 @@
<%= 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>
<%= submit "Post" %>
<% end %>

+ 2
- 5
lib/clacks_web/templates/frontend/home.html.eex 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 %>

+ 2
- 6
lib/clacks_web/templates/frontend/status.html.eex 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 %>

Loading…
Cancel
Save