mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-10 17:36:33 +08:00
Add support for filtering projects in experiment controller clone and move actions SCI-[10419]
This commit is contained in:
parent
ba5c0aba57
commit
5b5f593537
1 changed files with 6 additions and 1 deletions
|
@ -180,12 +180,17 @@ class ExperimentsController < ApplicationController
|
|||
def projects_to_clone
|
||||
projects = @experiment.project.team.projects.active
|
||||
.with_user_permission(current_user, ProjectPermissions::EXPERIMENTS_CREATE)
|
||||
.where('trim_html_tags(projects.name) ILIKE ?',
|
||||
"%#{ActiveRecord::Base.sanitize_sql_like(params['query'])}%")
|
||||
.map { |p| [p.id, p.name] }
|
||||
render json: { data: projects }, status: :ok
|
||||
end
|
||||
|
||||
def projects_to_move
|
||||
projects = @experiment.movable_projects(current_user).map { |p| [p.id, p.name] }
|
||||
projects = @experiment.movable_projects(current_user)
|
||||
.where('trim_html_tags(projects.name) ILIKE ?',
|
||||
"%#{ActiveRecord::Base.sanitize_sql_like(params['query'])}%")
|
||||
.map { |p| [p.id, p.name] }
|
||||
render json: { data: projects }, status: :ok
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue