diff --git a/app/assets/stylesheets/my_styles.scss b/app/assets/stylesheets/my_styles.scss index 9e0cf6b..2285dbc 100644 --- a/app/assets/stylesheets/my_styles.scss +++ b/app/assets/stylesheets/my_styles.scss @@ -382,6 +382,12 @@ a.black } } +.moderate-bar +{ + background-color: #ffd0d0; +} + + /* Properties of a screenshot - shown in details view */ .property-title { diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index cc36654..56f44a4 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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. diff --git a/app/views/layouts/_topbar.slim b/app/views/layouts/_topbar.slim index 50b08b9..4d9f060 100644 --- a/app/views/layouts/_topbar.slim +++ b/app/views/layouts/_topbar.slim @@ -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 + '…