|
|
|
@@ -45,6 +45,8 @@ class Api::Pm::IssuesController < Api::Pm::BaseController |
|
|
|
.where.not(id: @issue.id) |
|
|
|
.where.not(id: Issue.full_children_issues(@issue).map{|i|i.id}) |
|
|
|
@issues = @issues.where(pm_issue_type: params[:pm_issue_type]) if params[:pm_issue_type].present? |
|
|
|
@issues = @issues.ransack(id_or_project_issues_index_eq: params[:keyword]).result.or(@issues.ransack(subject_or_description_cont: params[:keyword]).result) if params[:keyword].present? |
|
|
|
@issues = @issues.reorder("#{issue_sort_by} #{issue_sort_direction}") |
|
|
|
if params[:only_name].present? |
|
|
|
@issues = kaminary_select_paginate( |
|
|
|
@issues.select(:id, :subject, :project_issues_index, :updated_on, :created_on)) |
|
|
|
@@ -185,6 +187,18 @@ class Api::Pm::IssuesController < Api::Pm::BaseController |
|
|
|
:assigner_ids => [] ) |
|
|
|
end |
|
|
|
|
|
|
|
def issue_sort_by |
|
|
|
sort_by = params.fetch(:sort_by, "updated_on") |
|
|
|
sort_by = Issue.column_names.include?(sort_by) ? sort_by : "updated_on" |
|
|
|
sort_by |
|
|
|
end |
|
|
|
|
|
|
|
def issue_sort_direction |
|
|
|
sort_direction = params.fetch(:sort_direction, "desc").downcase |
|
|
|
sort_direction = %w(desc asc).include?(sort_direction) ? sort_direction : "desc" |
|
|
|
sort_direction |
|
|
|
end |
|
|
|
|
|
|
|
def tag_sort_by |
|
|
|
sort_by = params.fetch(:sort_by, "created_at") |
|
|
|
sort_by = IssueTag.column_names.include?(sort_by) ? sort_by : "created_at" |
|
|
|
|