Redmine 4.1.1
This commit is contained in:
parent
33e7b881a5
commit
3d976f1b3b
1593 changed files with 36180 additions and 19489 deletions
|
@ -1,5 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2019 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
@ -23,20 +25,18 @@ class AutoCompletesController < ApplicationController
|
|||
q = (params[:q] || params[:term]).to_s.strip
|
||||
status = params[:status].to_s
|
||||
issue_id = params[:issue_id].to_s
|
||||
if q.present?
|
||||
scope = Issue.cross_project_scope(@project, params[:scope]).visible
|
||||
if status.present?
|
||||
scope = scope.open(status == 'o')
|
||||
end
|
||||
if issue_id.present?
|
||||
scope = scope.where.not(:id => issue_id.to_i)
|
||||
end
|
||||
if q.match(/\A#?(\d+)\z/)
|
||||
issues << scope.find_by_id($1.to_i)
|
||||
end
|
||||
|
||||
scope = Issue.cross_project_scope(@project, params[:scope]).visible
|
||||
scope = scope.open(status == 'o') if status.present?
|
||||
scope = scope.where.not(:id => issue_id.to_i) if issue_id.present?
|
||||
if q.present?
|
||||
if q =~ /\A#?(\d+)\z/
|
||||
issues << scope.find_by(:id => $1.to_i)
|
||||
end
|
||||
issues += scope.like(q).order(:id => :desc).limit(10).to_a
|
||||
issues.compact!
|
||||
else
|
||||
issues += scope.order(:id => :desc).limit(10).to_a
|
||||
end
|
||||
|
||||
render :json => format_issues_json(issues)
|
||||
|
@ -53,10 +53,11 @@ class AutoCompletesController < ApplicationController
|
|||
end
|
||||
|
||||
def format_issues_json(issues)
|
||||
issues.map {|issue| {
|
||||
'id' => issue.id,
|
||||
'label' => "#{issue.tracker} ##{issue.id}: #{issue.subject.to_s.truncate(60)}",
|
||||
'value' => issue.id
|
||||
issues.map {|issue|
|
||||
{
|
||||
'id' => issue.id,
|
||||
'label' => "#{issue.tracker} ##{issue.id}: #{issue.subject.to_s.truncate(60)}",
|
||||
'value' => issue.id
|
||||
}
|
||||
}
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue