Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
8543313b
Commit
8543313b
authored
Jan 14, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Few more filters for admin / projects
parent
68bfcd05
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
1 deletion
+25
-1
app/controllers/admin/projects_controller.rb
app/controllers/admin/projects_controller.rb
+2
-0
app/models/project.rb
app/models/project.rb
+8
-0
app/views/admin/projects/index.html.haml
app/views/admin/projects/index.html.haml
+15
-1
No files found.
app/controllers/admin/projects_controller.rb
View file @
8543313b
...
...
@@ -5,6 +5,8 @@ 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
.
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?
@projects
=
@projects
.
includes
(
:namespace
).
order
(
"namespaces.path, projects.name ASC"
).
page
(
params
[
:page
]).
per
(
20
)
...
...
app/models/project.rb
View file @
8543313b
...
...
@@ -84,6 +84,14 @@ class Project < ActiveRecord::Base
scope
:public
,
where
(
public:
true
)
class
<<
self
def
abandoned
project_ids
=
Event
.
select
(
'max(created_at) as latest_date, project_id'
).
group
(
'project_id'
).
having
(
'latest_date < ?'
,
6
.
months
.
ago
).
map
(
&
:project_id
)
where
(
id:
project_ids
)
end
def
active
joins
(
:issues
,
:notes
,
:merge_requests
).
order
(
"issues.created_at, notes.created_at, merge_requests.created_at DESC"
)
end
...
...
app/views/admin/projects/index.html.haml
View file @
8543313b
...
...
@@ -21,6 +21,20 @@
=
label_tag
:public_only
,
'Public Only'
,
class:
'control-label'
.controls
=
check_box_tag
:public_only
,
1
,
params
[
:public_only
]
.control-group
=
label_tag
:with_push
,
'Not empty'
,
class:
'control-label'
.controls
=
check_box_tag
:with_push
,
1
,
params
[
:with_push
]
%span
.light
Projects with push events
.control-group
=
label_tag
:abandoned
,
'Abandoned'
,
class:
'control-label'
.controls
=
check_box_tag
:abandoned
,
1
,
params
[
:abandoned
]
%span
.light
No activity over 6 month
.form-actions
=
submit_tag
"Search"
,
class:
"btn submit primary"
...
...
@@ -44,4 +58,4 @@
%p
.nothing_here_message
0 projects matches
-
else
%li
.bottom
=
paginate
@projects
,
theme:
"
admin
"
=
paginate
@projects
,
theme:
"
gitlab
"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment