rosa-build/app/controllers/home_controller.rb

36 lines
982 B
Ruby
Raw Permalink Normal View History

class HomeController < ApplicationController
2015-05-05 13:25:29 +01:00
before_action :authenticate_user!, except: [:root]
skip_after_action :verify_authorized
2016-04-29 15:10:30 +01:00
def index
2016-05-04 16:49:30 +01:00
redirect_to projects_path
2016-04-29 15:10:30 +01:00
end
2015-05-05 13:25:29 +01:00
def get_owners_list
if params[:term].present?
users = User.opened.search(params[:term]).first(5)
groups = Group.opened.search(params[:term]).first(5)
2015-05-05 13:25:29 +01:00
@owners = users | groups
end
respond_to do |format|
format.json {}
end
end
def get_project_names_list
if params[:term].present?
@projects = ProjectPolicy::Scope.new(current_user, Project).membered
@projects = @projects.where(owner_uname: params[:owner_uname]) if params[:owner_uname].present?
@projects = @projects.by_name("%#{params[:term]}%")
.distinct
.pluck(:name)
.first(10)
end
respond_to do |format|
format.json {}
end
end
2015-03-26 00:26:24 +00:00
end