[refs #732] small refactoring
This commit is contained in:
parent
5899d5f28f
commit
bfa538e644
|
@ -3,11 +3,9 @@ class Api::V1::MaintainersController < Api::V1::BaseController
|
||||||
load_and_authorize_resource :platform
|
load_and_authorize_resource :platform
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@maintainers = BuildList::Package.actual.by_platform(@platform)
|
@maintainers = BuildList::Package.includes(:project)
|
||||||
.includes(:project)
|
.actual.by_platform(@platform)
|
||||||
if name = params[:filter].try(:[], :package_name)
|
.like_name(params[:filter].try(:[], :package_name))
|
||||||
@maintainers = @maintainers.like_name(name)
|
.paginate(paginate_params)
|
||||||
end
|
|
||||||
@maintainers = @maintainers.paginate(paginate_params)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,10 +5,9 @@ class Platforms::MaintainersController < ApplicationController
|
||||||
load_and_authorize_resource :platform
|
load_and_authorize_resource :platform
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@maintainers = BuildList::Package.actual.by_platform(@platform)
|
@maintainers = BuildList::Package.includes(:project)
|
||||||
.includes(:project)
|
.actual.by_platform(@platform)
|
||||||
@maintainers = @maintainers.like_name(params[:q]) if params[:q].present?
|
.like_name(params[:q])
|
||||||
@maintainers = @maintainers.paginate(:page => params[:page])
|
.paginate(:page => params[:page])
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,7 +19,7 @@ class BuildList::Package < ActiveRecord::Base
|
||||||
scope :by_platform, lambda {|platform| where(:platform_id => platform) }
|
scope :by_platform, lambda {|platform| where(:platform_id => platform) }
|
||||||
scope :by_name, lambda {|name| where(:name => name) }
|
scope :by_name, lambda {|name| where(:name => name) }
|
||||||
scope :by_package_type, lambda {|type| where(:package_type => type) }
|
scope :by_package_type, lambda {|type| where(:package_type => type) }
|
||||||
scope :like_name, lambda {|name| where('name ILIKE ?', "%#{name}%")}
|
scope :like_name, lambda {|name| where('name ILIKE ?', "%#{name}%") if name.present?}
|
||||||
|
|
||||||
def assignee
|
def assignee
|
||||||
project.maintainer
|
project.maintainer
|
||||||
|
|
Loading…
Reference in New Issue