move post top options into a partial

This commit is contained in:
Luna D. 2024-06-23 14:51:40 +02:00
parent 952993de10
commit c8408376cc
No known key found for this signature in database
GPG key ID: 4B1C63448394F688
2 changed files with 14 additions and 15 deletions

View file

@ -1,18 +1,4 @@
elixir: - options = render PhilomenaWeb.PostView, "_post_options_top.html", conn: @conn, post: @post
post_link = ~p"/forums/#{@post.topic.forum}/topics/#{@post.topic}?#{[post_id: @post.id]}" <> "#post_#{@post.id}"
- options = if true do
.flex__spacer.hidden--desktop
a.communication__interaction.hidden--desktop title="Link to post" href="#{post_link}"
i.fa.fa-link
= if not is_nil(@post.edited_at) and can?(@conn, :show, @post) do
a href=~p"/forums/#{@post.topic.forum}/topics/#{@post.topic}/posts/#{@post}/history"
' Edited
=> pretty_time(@post.edited_at)
= if @post.edit_reason not in [nil, ""] do
' because:
=> @post.edit_reason
article.block.communication id="post_#{@post.id}" article.block.communication id="post_#{@post.id}"
= if not @post.approved and not @post.hidden_from_users and (can?(@conn, :hide, @post) or @post.user_id == @conn.assigns.current_user.id) do = if not @post.approved and not @post.hidden_from_users and (can?(@conn, :hide, @post) or @post.user_id == @conn.assigns.current_user.id) do

View file

@ -0,0 +1,13 @@
- post_link = ~p"/forums/#{@post.topic.forum}/topics/#{@post.topic}?#{[post_id: @post.id]}" <> "#post_#{@post.id}"
.flex__spacer.hidden--desktop
a.communication__interaction.hidden--desktop title="Link to post" href="#{post_link}"
i.fa.fa-link
= if not is_nil(@post.edited_at) and can?(@conn, :show, @post) do
a href=~p"/forums/#{@post.topic.forum}/topics/#{@post.topic}/posts/#{@post}/history"
' Edited
=> pretty_time(@post.edited_at)
= if @post.edit_reason not in [nil, ""] do
' because:
=> @post.edit_reason