fix spaghetti code

This commit is contained in:
Luna D 2019-12-10 15:42:52 -05:00
parent 53183d70f0
commit 90e7c6a53d
No known key found for this signature in database
GPG key ID: D0F46C94720BAA4B

View file

@ -25,11 +25,8 @@ article.block.communication id="comment_#{@comment.id}"
= render PhilomenaWeb.CommentView, "_comment_options.html", comment: @comment, conn: @conn = render PhilomenaWeb.CommentView, "_comment_options.html", comment: @comment, conn: @conn
= if can?(@conn, :hide, @comment) do = if can?(@conn, :hide, @comment) do
.js-staff-action .js-staff-action
= case @comment.destroyed_content do = cond do
- true -> - @comment.hidden_from_users and not @comment.destroyed_content ->
- _false ->
= case @comment.hidden_from_users do
- true ->
= link(to: Routes.image_comment_hide_path(@conn, :delete, @comment.image_id, @comment), data: [confirm: "Are you sure?"], method: :delete, class: "communication__interaction") do = link(to: Routes.image_comment_hide_path(@conn, :delete, @comment.image_id, @comment), data: [confirm: "Are you sure?"], method: :delete, class: "communication__interaction") do
i.fas.fa-check> i.fas.fa-check>
' Restore ' Restore
@ -37,10 +34,11 @@ article.block.communication id="comment_#{@comment.id}"
= link(to: Routes.image_comment_delete_path(@conn, :delete, @comment.image_id, @comment), method: :delete, data: [confirm: "Are you sure?"], class: "communication__interaction") do = link(to: Routes.image_comment_delete_path(@conn, :delete, @comment.image_id, @comment), method: :delete, data: [confirm: "Are you sure?"], class: "communication__interaction") do
i.fas.fa-times> i.fas.fa-times>
' Delete Contents ' Delete Contents
- _false -> - !@comment.hidden_from_users and not @comment.destroyed_content ->
a.communication__interaction.togglable-delete-form-link href="#" data-click-toggle="#inline-del-form-comment-#{@comment.id}" a.communication__interaction.togglable-delete-form-link href="#" data-click-toggle="#inline-del-form-comment-#{@comment.id}"
i.fas.fa-times> i.fas.fa-times>
' Delete ' Delete
- true ->
= if can?(@conn, :show, :ip_address) do = if can?(@conn, :show, :ip_address) do
.communication__info .communication__info
=<> link_to_ip(@conn, @comment.ip) =<> link_to_ip(@conn, @comment.ip)