22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'app/components/comment.rb', line 22
def view_template
div class: "comment-component #{"comment-reported" if @reported}", id: "comment-#{@comment.to_param}" do
div class: "comment-header" do
div do
if @comment.system
Icon icon: "robot", label: t("components.comment.system")
else
Icon icon: "chat", role: "presentation"
end
whitespace
span do
if @comment..is_a?(Federails::Actor)
link_to @comment..name, @comment..profile_url, title: @comment..at_address
else
@comment..try(:name) || @comment..try(:username)
end
end
whitespace
span(class: "comment-time", title: @comment.created_at) { t("components.comment.posted", time: time_ago_in_words(@comment.created_at)) }
end
div class: "comment-header-links" do
link_to polymorphic_path([@comment., @comment, :report], action: :new) do
Icon(icon: "flag", label: t("components.comment.report"))
end
whitespace
if policy(@comment).destroy?
span(class: "ms-2") do
link_to [@comment., @comment], method: :delete, class: "link-danger", data: {confirm: t("components.comment.confirm_delete")} do
Icon(icon: "trash", label: t("components.comment.delete"))
end
end
end
end
end
div(class: "comment-body") { markdownify(@comment.) }
if current_user&.is_moderator? && @comment.reports.any?
div(class: "comment-footer comment-footer-reported") do
span { t("components.comment.reported", time: @comment.reports.order(created_at: :desc).pick(:created_at)) }
end
end
end
end
|