refactor upload tags report
This commit is contained in:
@@ -18,4 +18,10 @@ class ReportsController < ApplicationController
|
||||
def post_versions_create
|
||||
@report = Reports::PostVersions.new(params[:tag], params[:type])
|
||||
end
|
||||
|
||||
def upload_tags
|
||||
@user = User.find(params[:user_id])
|
||||
@upload_reports = Reports::UploadTags.for_user(params[:user_id]).order("id desc").paginate(params[:page], :limit => params[:limit])
|
||||
respond_with(@upload_reports)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -29,7 +29,7 @@ class UploadTagsReport < Post
|
||||
def uploader_tags_array
|
||||
@uploader_tags ||= begin
|
||||
added_tags = []
|
||||
PostVersion.where(post_id: id, updater_id: uploader_id).each do |version|
|
||||
PostArchive.where(post_id: id, updater_id: uploader_id).each do |version|
|
||||
added_tags += version.changes[:added_tags]
|
||||
end
|
||||
added_tags.uniq.sort
|
||||
|
||||
@@ -230,6 +230,7 @@ Rails.application.routes.draw do
|
||||
resource :related_tag, :only => [:show, :update]
|
||||
get "reports/uploads" => "reports#uploads"
|
||||
get "reports/similar_users" => "reports#similar_users"
|
||||
get "reports/upload_tags" => "reports#upload_tags"
|
||||
get "reports/post_versions" => "reports#post_versions"
|
||||
post "reports/post_versions_create" => "reports#post_versions_create"
|
||||
resources :saved_searches, :except => [:show] do
|
||||
@@ -319,8 +320,6 @@ Rails.application.routes.draw do
|
||||
end
|
||||
end
|
||||
|
||||
resources :upload_tags_report, :only => [:show]
|
||||
|
||||
# aliases
|
||||
resources :wpages, :controller => "wiki_pages"
|
||||
resources :ftopics, :controller => "forum_topics"
|
||||
|
||||
Reference in New Issue
Block a user