mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-05 20:23:16 +08:00
Merge pull request #7292 from wandji20/wb-SCI-10419
Add support for filtering projects in experiment controller clone and move actions SCI-[10419]
This commit is contained in:
commit
8a9c4e6cb9
1 changed files with 6 additions and 1 deletions
|
@ -182,12 +182,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