Added simple moderate feature in My page
This commit is contained in:
parent
953cd056aa
commit
ce7198b713
5 changed files with 39 additions and 9 deletions
|
|
@ -11,6 +11,9 @@ class AdminController < ApplicationController
|
||||||
def integration
|
def integration
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def moderate_list
|
||||||
|
end
|
||||||
|
|
||||||
def logs
|
def logs
|
||||||
logs = Log
|
logs = Log
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,29 @@ class MyController < ApplicationController
|
||||||
'screenshots.id' => @current_users_screenshots)
|
'screenshots.id' => @current_users_screenshots)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def moderate_list
|
||||||
|
# First package with pending screenshots
|
||||||
|
@packages = Package.joins(:screenshots).where('screenshots.approved=false or screenshots.markedfordelete=true').distinct(:name)
|
||||||
|
|
||||||
|
# # # List of screenshots that were reported (to be removed)
|
||||||
|
# # @reported_screenshots = Screenshot.where(markedfordelete: true)
|
||||||
|
# # # First package with reported screenshots
|
||||||
|
# # @reported_package = Package.joins(:screenshots).where('screenshots.markedfordelete=true').distinct(:name).first
|
||||||
|
|
||||||
|
# if @package
|
||||||
|
# # List of screenshots to be moderated
|
||||||
|
# @pending_screenshots = @package.screenshots_pending
|
||||||
|
# # Number of screenshots that were already moderated (during this session)
|
||||||
|
# session[:already_moderated] ||= 0
|
||||||
|
# @moderated_screenshots = session[:already_moderated]
|
||||||
|
|
||||||
|
# # BUG: calculation is wrong when pending and reported screenshots are in the queue
|
||||||
|
# # Percentage of already moderated screenshots
|
||||||
|
# @percent_moderated = 100 * (@moderated_screenshots+1) / (@moderated_screenshots + @pending_screenshots.count)
|
||||||
|
# # @percent_moderated = 100 * (@moderated_screenshots+1) / (@moderated_screenshots + @pending_screenshots.count + @reported_screenshots.count)
|
||||||
|
# end
|
||||||
|
end
|
||||||
|
|
||||||
# def welcome
|
# def welcome
|
||||||
# end
|
# end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,15 +71,15 @@ class Screenshot < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
# Brief text describing the status of this screenshots (for admins)
|
# Brief text describing the status of this screenshots (for admins)
|
||||||
# def adminstatus
|
def adminstatus
|
||||||
# if self.markedfordelete
|
if self.markedfordelete
|
||||||
# "Removal requested > #{self.delete_reason}"
|
"Removal requested > #{self.delete_reason}"
|
||||||
# elsif self.approved
|
elsif self.approved
|
||||||
# 'Public'
|
'Public'
|
||||||
# else
|
else
|
||||||
# fa_icon('hourglass') + 'Waiting for approval'
|
fa_icon('hourglass') + 'Waiting for approval'
|
||||||
# end
|
end
|
||||||
# end
|
end
|
||||||
|
|
||||||
# Publish a screenshot from the moderation queue
|
# Publish a screenshot from the moderation queue
|
||||||
def approve!
|
def approve!
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,9 @@
|
||||||
li class=('active' if action_name=='profile')
|
li class=('active' if action_name=='profile')
|
||||||
= link_to my_profile_path
|
= link_to my_profile_path
|
||||||
= fa_icon 'user-o 2x', text: 'Myself'
|
= fa_icon 'user-o 2x', text: 'Myself'
|
||||||
|
li class=('active' if action_name=='moderate_list')
|
||||||
|
= link_to moderate_list_path
|
||||||
|
= fa_icon 'check 2x', text: 'Moderate'
|
||||||
// Add link if user has uploaded screenshots
|
// Add link if user has uploaded screenshots
|
||||||
- if @current_users_screenshots and @current_users_screenshots.any?
|
- if @current_users_screenshots and @current_users_screenshots.any?
|
||||||
li class=('active' if controller_name=='my' and action_name=='uploads')
|
li class=('active' if controller_name=='my' and action_name=='uploads')
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ Rails.application.routes.draw do
|
||||||
get 'my/profile'
|
get 'my/profile'
|
||||||
get 'my/uploads'
|
get 'my/uploads'
|
||||||
get 'my/welcome'
|
get 'my/welcome'
|
||||||
|
get 'my/moderate_list', as: :moderate_list
|
||||||
get 'package/:name' => 'packages#details', as: :package, name: /[^\/]+/
|
get 'package/:name' => 'packages#details', as: :package, name: /[^\/]+/
|
||||||
get 'package_reviews/:name' => 'packages#reviews', as: :package_reviews, name: /[^\/]+/
|
get 'package_reviews/:name' => 'packages#reviews', as: :package_reviews, name: /[^\/]+/
|
||||||
get 'upload', to: redirect('/packages'), as: :upload_legacy # legacy upload form
|
get 'upload', to: redirect('/packages'), as: :upload_legacy # legacy upload form
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue