mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-20 11:45:57 +08:00
update issue tags for pm
This commit is contained in:
@@ -60,8 +60,12 @@ class Api::Pm::IssuesController < Api::Pm::BaseController
|
||||
end
|
||||
|
||||
def tags
|
||||
@issue_tags = IssueTag.init_mp_issues_tags
|
||||
render_ok(@issue_tags)
|
||||
IssueTag.pm_init_data(params[:pm_project_id]) unless $redis_cache.hget("pm_project_init_issue_tags", params[:pm_project_id])
|
||||
@issue_tags = IssueTag.where(pm_project_id: params[:pm_project_id]).reorder("#{tag_sort_by} #{tag_sort_direction}")
|
||||
@issue_tags = @issue_tags.ransack(name_cont: params[:keyword]).result if params[:keyword].present?
|
||||
params[:only_name] = true #强制渲染 不走project
|
||||
@issue_tags = kaminary_select_paginate(@issue_tags.select(:id, :name, :color))
|
||||
render "api/v1/issues/issue_tags/index"
|
||||
end
|
||||
|
||||
def statues
|
||||
@@ -136,4 +140,18 @@ class Api::Pm::IssuesController < Api::Pm::BaseController
|
||||
receivers_login: []
|
||||
)
|
||||
end
|
||||
|
||||
private
|
||||
def tag_sort_by
|
||||
sort_by = params.fetch(:sort_by, "created_at")
|
||||
sort_by = IssueTag.column_names.include?(sort_by) ? sort_by : "created_at"
|
||||
sort_by
|
||||
end
|
||||
|
||||
def tag_sort_direction
|
||||
sort_direction = params.fetch(:sort_direction, "desc").downcase
|
||||
sort_direction = %w(desc asc).include?(sort_direction) ? sort_direction : "desc"
|
||||
sort_direction
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user