Files
danbooru/app/helpers/forum_topics_helper.rb
evazion 6504d44223 forum: change BUR counts to status labels.
Use pending / approved / rejected status labels in front of the topic
title instead of a BUR count column. This is to make the forum listing
easier to visually scan for resolved vs unresolved topics.

Labels are only added for topics in the Tags category. This is a hack to
avoid labels on megathreads that have had BURs mistakenly attached to them.

[APPROVED] and [REJECTED] labels are stripped from thread titles to make
the titles cleaner. This is a hack until these titles can be fixed.
2020-03-10 20:13:11 -05:00

24 lines
713 B
Ruby

module ForumTopicsHelper
def forum_topic_category_select(object, field)
select(object, field, ForumTopic.reverse_category_mapping.to_a)
end
def available_min_user_levels
ForumTopic::MIN_LEVELS.select { |name, level| level <= CurrentUser.level }.to_a
end
def new_forum_topic?(topic, read_forum_topics)
!read_forum_topics.map(&:id).include?(topic.id)
end
def forum_topic_status(topic)
if topic.bulk_update_requests.any?(&:is_pending?)
:pending
elsif topic.category_name == "Tags" && topic.bulk_update_requests.all?(&:is_approved?)
:approved
elsif topic.category_name == "Tags" && topic.bulk_update_requests.all?(&:is_rejected?)
:rejected
end
end
end