views: refactor post flag and appeal reasons.

* Prefer partials over helpers.
* Add css classes to flag/appeal reason lists.
* Wrap dtext in span.prose container.
This commit is contained in:
evazion
2019-09-18 03:20:26 -05:00
parent 49f91a6100
commit 312adb772d
8 changed files with 43 additions and 59 deletions

View File

@@ -1,22 +0,0 @@
module PostAppealsHelper
def post_appeal_reasons(post)
html = []
html << '<ul>'
post.appeals.each do |appeal|
reason = format_text(appeal.reason, inline: true)
user = link_to_user(appeal.creator)
if CurrentUser.is_moderator?
ip = "(#{link_to_ip(appeal.creator_ip_addr)})"
else
ip = ""
end
time = time_ago_in_words_tagged(appeal.created_at)
html << "<li>#{reason} - #{user} #{ip} #{time}</li>"
end
html << '</ul>'
html.join("\n").html_safe
end
end

View File

@@ -1,29 +0,0 @@
module PostFlagsHelper
def post_flag_reasons(post)
html = []
html << '<ul>'
post.flags.each do |flag|
html << '<li>'
html << format_text(flag.reason, inline: true)
if CurrentUser.can_view_flagger_on_post?(flag)
html << " - #{link_to_user(flag.creator)}"
if CurrentUser.is_moderator?
html << " (#{link_to_ip(flag.creator_ip_addr)})"
end
end
html << ' - ' + time_ago_in_words_tagged(flag.created_at)
if flag.is_resolved?
html << ' <span class="resolved">RESOLVED</span>'
end
html << '</li>'
end
html << '</ul>'
html.join("\n").html_safe
end
end