Added colors to status label of a screenshot

This commit is contained in:
Christoph Haas 2021-03-10 01:04:06 +01:00
parent 27a1811153
commit f31502c333
4 changed files with 31 additions and 13 deletions

View file

@ -606,4 +606,8 @@ a.black
.button {
box-shadow: 0.1rem 0.1rem 0.2rem 0 rgba(0, 0, 0, 0.5);
}
}
.label.adminlabel.public { background-color: green !important};
.label.adminlabel.hidden { background-color: blue !important};
.label.adminlabel.unapproved { background-color: orange !important};

View file

@ -36,12 +36,14 @@ module PackagesHelper
# (filled_stars+empty_stars).html_safe
# end
def status_text(screenshot)
# TODO: markedfordelete/reporting will be removed
if screenshot.approved
fa_icon('check-square') + ' Public'
else
fa_icon('hourglass') + ' Waiting for approval'
# Return a readable status of a screenshot and a matching CSS color class
def status(screenshot)
if screenshot.approved && !screenshot.hidden
return (fa_icon('eye') + ' Public'), 'public'
elsif screenshot.hidden
return (fa_icon('eye-slash') + ' Hidden'), 'hidden'
elsif !screenshot.approved
return (fa_icon('hourglass') + ' Waiting for approval'), 'unapproved'
end
end

View file

@ -1,11 +1,22 @@
// Button that reveals a dropdown/modal for moderation/reporting
- if can?(:destroy, screenshot) || can?(:approve, screenshot)
.text
span.label.secondary.adminlabel
= status_text(screenshot)
.button-group.small.align-center
- if can?(:destroy, screenshot) || can?(:approve, screenshot)
.text
- @statustext, @statuscolor = status(screenshot)
span class="label adminlabel #{@statuscolor}"
= @statustext
- if can?(:hide, screenshot)
a.button.small.bordered.radius.warning[
href=hide_screenshot_path(screenshot.id)
onclick="return confirm('Really hide the screenshot from public view?');"
] #{fa_icon 'eye-slash'} Hide
- if can?(:unhide, screenshot)
a.button.small.bordered.radius.warning[
href=unhide_screenshot_path(screenshot.id)
] #{fa_icon 'eye'} Un-Hide
- if can?(:destroy, screenshot)
a.button.small.bordered.radius.alert[

View file

@ -19,6 +19,8 @@
- @divclasses << (screenshot.approved ? "approved" : "unapproved")
- @divclasses << 'highlight' if screenshot.id == @highlight_id
div class=(@divclasses.join(' ')) data-equalizer-watch=true
/ TODO: try to alight the buttons to the bottom
= render(partial: 'admin_buttons', locals: {screenshot: screenshot})
a.black href =url_for(screenshot.simage_url(:large)) rel='fancybox-thumb' title=screenshot.caption data-fancybox='gallery' data-caption=screenshot_caption(screenshot)
.image.image-with-zoom-icon
= small_img(screenshot, cls: '')
@ -34,7 +36,6 @@
' Uploaded by you
- unless screenshot.approved
' (needs to be approved)
= render(partial: 'admin_buttons', locals: {screenshot: screenshot})
// Second paginator at the bottom so the user does not have to scroll up again