Add moderation hint below top bar
This commit is contained in:
parent
ef61db0d11
commit
c6bea9b902
3 changed files with 30 additions and 4 deletions
|
|
@ -382,6 +382,12 @@ a.black
|
|||
}
|
||||
}
|
||||
|
||||
.moderate-bar
|
||||
{
|
||||
background-color: #ffd0d0;
|
||||
}
|
||||
|
||||
|
||||
/* Properties of a screenshot - shown in details view */
|
||||
.property-title
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ class ApplicationController < ActionController::Base
|
|||
# Do not mention passwords in the log file
|
||||
# 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? ?
|
||||
|
||||
# Query for packages that were uploaded by the current user.
|
||||
|
|
@ -53,6 +53,15 @@ class ApplicationController < ActionController::Base
|
|||
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
|
||||
|
||||
# Define where the user is redirected to after a successful login.
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ nav.top-bar
|
|||
i.fa.fa-info-circle
|
||||
span< About/Privacy
|
||||
// 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
|
||||
=link_to url_for(Package.need_moderation.first)
|
||||
i.fa.fa-thumbs-up
|
||||
|
|
@ -59,6 +59,17 @@ nav.top-bar
|
|||
- if user_signed_in?
|
||||
= link_to my_profile_path
|
||||
/ = image_tag "/images/sso/icons/#{current_user.provider}.svg", width: 20
|
||||
' My
|
||||
i.fa.fa-key
|
||||
span< My
|
||||
- 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
|
||||
'…
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue