Add moderation hint below top bar

This commit is contained in:
Christoph Haas 2021-02-24 23:47:30 +01:00
parent ef61db0d11
commit c6bea9b902
3 changed files with 30 additions and 4 deletions

View file

@ -382,6 +382,12 @@ a.black
} }
} }
.moderate-bar
{
background-color: #ffd0d0;
}
/* Properties of a screenshot - shown in details view */ /* Properties of a screenshot - shown in details view */
.property-title .property-title
{ {

View file

@ -6,7 +6,7 @@ class ApplicationController < ActionController::Base
# Do not mention passwords in the log file # Do not mention passwords in the log file
# filter_parameter_logging :password # filter_parameter_logging :password
before_action :get_current_users_screenshots, :debian_sso before_action :get_current_users_screenshots, :debian_sso, :moderate_packages
# TODO: Deprecation. What is the replacement for Rails.env.development? ? # TODO: Deprecation. What is the replacement for Rails.env.development? ?
# Query for packages that were uploaded by the current user. # Query for packages that were uploaded by the current user.
@ -53,6 +53,15 @@ class ApplicationController < ActionController::Base
end end
end end
# If the current user is an administrator then show a second bar below
# the navigation bar that contains a paginator of packages that contain
# screenshots that require moderation.
def moderate_packages
if user_signed_in? and current_user.is_admin? and Package.need_moderation.any?
@moderate_packages = Package.need_moderation
end
end
private private
# Define where the user is redirected to after a successful login. # Define where the user is redirected to after a successful login.

View file

@ -41,7 +41,7 @@ nav.top-bar
i.fa.fa-info-circle i.fa.fa-info-circle
span< About/Privacy span< About/Privacy
// TODO: Check correct classes in Zurb/Foundation for top bar! // TODO: Check correct classes in Zurb/Foundation for top bar!
- if user_signed_in? and current_user.is_admin? and Package.need_moderation.any? /- if user_signed_in? and current_user.is_admin? and Package.need_moderation.any?
li.menu-text li.menu-text
=link_to url_for(Package.need_moderation.first) =link_to url_for(Package.need_moderation.first)
i.fa.fa-thumbs-up i.fa.fa-thumbs-up
@ -59,6 +59,17 @@ nav.top-bar
- if user_signed_in? - if user_signed_in?
= link_to my_profile_path = link_to my_profile_path
/ = image_tag "/images/sso/icons/#{current_user.provider}.svg", width: 20 / = image_tag "/images/sso/icons/#{current_user.provider}.svg", width: 20
' My i.fa.fa-key
span< My
- else - else
= link_to 'Login', new_user_session_path = link_to new_user_session_path
i.fa.fa-key
span< Login
- if @moderate_packages
.row.text-center.moderate-bar
span> Please moderate:
- @moderate_packages.first(10).each do |pkg|
=> link_to pkg.name, pkg
- if @moderate_packages.length > 10
'…