Show Moderate link in topbar. Add menu icons.
This commit is contained in:
parent
117239ee87
commit
ec43f47f92
3 changed files with 25 additions and 7 deletions
|
|
@ -15,7 +15,8 @@ class MyController < ApplicationController
|
|||
|
||||
def moderate_list
|
||||
# First package with pending screenshots
|
||||
@packages = Package.joins(:screenshots).where('screenshots.approved=false or screenshots.markedfordelete=true').distinct(:name)
|
||||
# @packages = Package.joins(:screenshots).where('screenshots.approved=false or screenshots.markedfordelete=true').distinct(:name)
|
||||
@packages = Package.need_moderation
|
||||
|
||||
# # # List of screenshots that were reported (to be removed)
|
||||
# # @reported_screenshots = Screenshot.where(markedfordelete: true)
|
||||
|
|
|
|||
|
|
@ -51,6 +51,12 @@ class Package < ApplicationRecord
|
|||
where(id: subselect )
|
||||
end
|
||||
|
||||
# Return a list of packages that have screenshots to be moderated
|
||||
def self.need_moderation
|
||||
Package.joins(:screenshots).where('screenshots.approved=false or screenshots.markedfordelete=true').distinct(:name)
|
||||
end
|
||||
|
||||
|
||||
# Return a query of all packages that have screenshots
|
||||
def self.without_screenshots
|
||||
# Query for all packages who's ID does not appear in a screenshot's "package_id" field
|
||||
|
|
|
|||
|
|
@ -16,12 +16,18 @@ nav.top-bar
|
|||
/ .top-bar-right
|
||||
/ ul.menu
|
||||
li.menu-text class=('active' if controller_name=='welcome' and action_name=='home')
|
||||
a href="/" Home
|
||||
a href="/"
|
||||
i.fa.fa-home
|
||||
span< Home
|
||||
li.menu-text class=('active' if controller_name=='packages' and request.fullpath != packages_without_path)
|
||||
a href="/packages" Browse
|
||||
a href="/packages"
|
||||
i.fa.fa-camera
|
||||
span< Browse
|
||||
/ TODO: highlights the "Browse" tab (even) when you click on Upload
|
||||
li.menu-text class=('active' if request.fullpath == packages_without_path)
|
||||
=link_to 'Upload', :packages_without
|
||||
=link_to :packages_without
|
||||
i.fa.fa-upload
|
||||
span< Upload
|
||||
//li.has-dropdown
|
||||
//a href="#" Distributions
|
||||
//ul.dropdown
|
||||
|
|
@ -31,11 +37,16 @@ nav.top-bar
|
|||
//li
|
||||
//a href="#" Ubuntu
|
||||
li.menu-text class=('active' if controller_name=='welcome' and action_name=='about')
|
||||
a href="/about" About/Privacy
|
||||
a href="/about"
|
||||
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?
|
||||
- if user_signed_in? and current_user.is_admin? and Package.need_moderation.any?
|
||||
li.menu-text
|
||||
ul.menu.dropdown data-dropdown-menu=true
|
||||
=link_to url_for(Package.need_moderation.first)
|
||||
i.fa.fa-thumbs-up
|
||||
span< Moderate
|
||||
/ul.menu.dropdown data-dropdown-menu=true
|
||||
li
|
||||
a href='#' Admin
|
||||
ul.menu
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue