mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-02 19:30:48 +08:00
新增:项目搜索标签功能
This commit is contained in:
@@ -3,7 +3,7 @@ class Projects::ListQuery < ApplicationQuery
|
||||
|
||||
attr_reader :params, :current_user_id
|
||||
|
||||
sort_columns :updated_on, :created_on, :forked_count, :praises_count, default_by: :updated_on, default_direction: :desc
|
||||
sort_columns :updated_on, :created_on, :forked_count, :praises_count, default_by: :updated_on, default_direction: :desc, default_table: 'projects'
|
||||
|
||||
def initialize(params, current_user_id=nil)
|
||||
@params = params
|
||||
@@ -32,6 +32,7 @@ class Projects::ListQuery < ApplicationQuery
|
||||
collection = by_project_type(collection)
|
||||
collection = by_project_category(collection)
|
||||
collection = by_project_language(collection)
|
||||
collection = by_project_topic(collection)
|
||||
collection
|
||||
end
|
||||
|
||||
@@ -74,6 +75,10 @@ class Projects::ListQuery < ApplicationQuery
|
||||
(params[:pinned].present? && params[:category_id].present?) ? items.pinned : items
|
||||
end
|
||||
|
||||
def by_project_topic(items)
|
||||
items.with_project_topic(params[:topic_id])
|
||||
end
|
||||
|
||||
# 优化排序
|
||||
def optimize_sorting(relations, sort_by)
|
||||
if sort_by == "updated_on"
|
||||
|
||||
Reference in New Issue
Block a user