mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-03 03:40:49 +08:00
fixed 项目列表支持多个标签名称查询
This commit is contained in:
@@ -7,6 +7,7 @@ module Matchable
|
||||
scope :with_project_type, ->(project_type) { where(project_type: project_type) if Project.project_types.include?(project_type) }
|
||||
scope :by_name_or_identifier, ->(search) { where("name like :search or identifier LIKE :search", :search => "%#{search.split(" ").join('|')}%") unless search.blank? }
|
||||
scope :with_project_topic, ->(topic_id) {joins(:project_topics).where(project_topics: {id: topic_id}) unless topic_id.blank?}
|
||||
scope :with_project_topic_name, ->(topic_name) {joins(:project_topics).where(project_topics: {name: topic_name}) unless topic_name.blank?}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -77,7 +77,11 @@ class Projects::ListQuery < ApplicationQuery
|
||||
end
|
||||
|
||||
def by_project_topic(items)
|
||||
items.with_project_topic(params[:topic_id])
|
||||
if params[:topic_name].present?
|
||||
items.with_project_topic_name(params[:topic_name].to_s.split(","))
|
||||
else
|
||||
items.with_project_topic(params[:topic_id])
|
||||
end
|
||||
end
|
||||
|
||||
# 优化排序
|
||||
|
||||
Reference in New Issue
Block a user