Moved Screenshot.adminstatus to status_text helper

This change allows the use of fa_icon helpers
This commit is contained in:
Christoph Haas 2020-11-23 00:21:17 +01:00
parent 5fedf92661
commit 427cdf87d7
3 changed files with 22 additions and 11 deletions

View file

@ -58,4 +58,16 @@ module PackagesHelper
# empty_stars = fa_icon('star-o') * (5-rating) # empty_stars = fa_icon('star-o') * (5-rating)
# (filled_stars+empty_stars).html_safe # (filled_stars+empty_stars).html_safe
# end # end
def status_text(screenshot)
# TODO: markedfordelete/reporting will be removed
if screenshot.markedfordelete
"Removal requested > #{screenshot.delete_reason}"
elsif screenshot.approved
fa_icon('check-square') + ' Public'
else
fa_icon('hourglass') + ' Waiting for approval'
end
end
end end

View file

@ -71,15 +71,15 @@ class Screenshot < ApplicationRecord
end end
# Brief text describing the status of this screenshots (for admins) # Brief text describing the status of this screenshots (for admins)
def adminstatus # def adminstatus
if self.markedfordelete # if self.markedfordelete
"Removal requested > #{self.delete_reason}" # "Removal requested > #{self.delete_reason}"
elsif self.approved # elsif self.approved
'Public' # 'Public'
else # else
'Waiting for approval' # fa_icon('hourglass') + 'Waiting for approval'
end # end
end # end
# Publish a screenshot from the moderation queue # Publish a screenshot from the moderation queue
def approve! def approve!

View file

@ -34,8 +34,7 @@
hr hr
.text .text
span.label.secondary span.label.secondary
' Status: = status_text(screenshot)
= screenshot.adminstatus
= render(partial: 'admin_buttons', locals: {screenshot: screenshot}) = render(partial: 'admin_buttons', locals: {screenshot: screenshot})
/ - elsif user_signed_in? and screenshot.user == current_user / - elsif user_signed_in? and screenshot.user == current_user