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