|
|
|
@@ -4,8 +4,8 @@ class Api::V1::Issues::IssueTagsController < Api::V1::BaseController |
|
|
|
before_action :require_operate_above, only: [:create, :update, :destroy] |
|
|
|
|
|
|
|
def index |
|
|
|
@issue_tags = @project.issue_tags.order("#{order_by} #{order_direction}") |
|
|
|
@issue_tags = @issue_tags.ransack(name_cont: params[:keyword]).result if params[:keyword].present? |
|
|
|
@issue_tags = @project.issue_tags.reorder("#{sort_by} #{sort_direction}") |
|
|
|
if params[:only_name] |
|
|
|
@issue_tags = kaminary_select_paginate(@issue_tags.select(:id, :name, :color)) |
|
|
|
else |
|
|
|
@@ -43,16 +43,16 @@ class Api::V1::Issues::IssueTagsController < Api::V1::BaseController |
|
|
|
|
|
|
|
|
|
|
|
private |
|
|
|
def order_by |
|
|
|
order_by = params.fetch(:order_by, "created_at") |
|
|
|
order_by = IssueTag.column_names.include?(order_by) ? order_by : "created_at" |
|
|
|
order_by |
|
|
|
def 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 order_direction |
|
|
|
order_direction = params.fetch(:order_direction, "desc").downcase |
|
|
|
order_direction = %w(desc asc).include?(order_direction) ? order_direction : "desc" |
|
|
|
order_direction |
|
|
|
def 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 issue_tag_params |
|
|
|
|