From c8408376cc6de77302fa5b1381003643d52e55f3 Mon Sep 17 00:00:00 2001 From: "Luna D." Date: Sun, 23 Jun 2024 14:51:40 +0200 Subject: [PATCH] move post top options into a partial --- .../templates/post/_post.html.slime | 16 +--------------- .../templates/post/_post_options_top.html.slime | 13 +++++++++++++ 2 files changed, 14 insertions(+), 15 deletions(-) create mode 100644 lib/philomena_web/templates/post/_post_options_top.html.slime diff --git a/lib/philomena_web/templates/post/_post.html.slime b/lib/philomena_web/templates/post/_post.html.slime index ff516044..4fc34680 100644 --- a/lib/philomena_web/templates/post/_post.html.slime +++ b/lib/philomena_web/templates/post/_post.html.slime @@ -1,18 +1,4 @@ -elixir: - 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 +- options = render PhilomenaWeb.PostView, "_post_options_top.html", conn: @conn, post: @post 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 diff --git a/lib/philomena_web/templates/post/_post_options_top.html.slime b/lib/philomena_web/templates/post/_post_options_top.html.slime new file mode 100644 index 00000000..356b4f57 --- /dev/null +++ b/lib/philomena_web/templates/post/_post_options_top.html.slime @@ -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