提交 f716c0a1 编写于 作者: D Dmitriy Zaporozhets

profjects filter with_push to project model

上级 8543313b
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册