profjects filter with_push to project model
This commit is contained in:
parent
8543313bf5
commit
f716c0a1dd
|
@ -5,7 +5,7 @@ class Admin::ProjectsController < AdminController
|
|||
@projects = Project.scoped
|
||||
@projects = @projects.where(namespace_id: params[:namespace_id]) if params[:namespace_id].present?
|
||||
@projects = @projects.where(public: true) if params[:public_only].present?
|
||||
@projects = @projects.joins(:events).where('events.action = ?', Event::Pushed) if params[:with_push].present?
|
||||
@projects = @projects.with_push if params[:with_push].present?
|
||||
@projects = @projects.abandoned if params[:abandoned].present?
|
||||
@projects = @projects.where(namespace_id: nil) if params[:namespace_id] == Namespace.global_id
|
||||
@projects = @projects.search(params[:name]) if params[:name].present?
|
||||
|
|
|
@ -92,6 +92,10 @@ class Project < ActiveRecord::Base
|
|||
where(id: project_ids)
|
||||
end
|
||||
|
||||
def with_push
|
||||
includes(:events).where('events.action = ?', Event::Pushed)
|
||||
end
|
||||
|
||||
def active
|
||||
joins(:issues, :notes, :merge_requests).order("issues.created_at, notes.created_at, merge_requests.created_at DESC")
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue