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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
f17ddeb3
Commit
f17ddeb3
authored
Nov 23, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make admin project list more useful
parent
552b3105
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
8 deletions
+30
-8
app/assets/stylesheets/gitlab_bootstrap/typography.scss
app/assets/stylesheets/gitlab_bootstrap/typography.scss
+4
-0
app/controllers/admin/projects_controller.rb
app/controllers/admin/projects_controller.rb
+2
-1
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+12
-3
app/models/namespace.rb
app/models/namespace.rb
+2
-0
app/models/project.rb
app/models/project.rb
+1
-1
app/views/admin/projects/index.html.haml
app/views/admin/projects/index.html.haml
+9
-3
No files found.
app/assets/stylesheets/gitlab_bootstrap/typography.scss
View file @
f17ddeb3
...
...
@@ -77,3 +77,7 @@ a {
a
:focus
{
outline
:
none
;
}
.monospace
{
font-family
:
'Menlo'
,
'Liberation Mono'
,
'Consolas'
,
'Courier New'
,
'andale mono'
,
'lucida console'
,
monospace
;
}
app/controllers/admin/projects_controller.rb
View file @
f17ddeb3
...
...
@@ -3,8 +3,9 @@ class Admin::ProjectsController < AdminController
def
index
@projects
=
Project
.
scoped
@projects
=
@projects
.
where
(
namespace_id:
params
[
:namespace_id
])
if
params
[
:namespace_id
].
present?
@projects
=
@projects
.
search
(
params
[
:name
])
if
params
[
:name
].
present?
@projects
=
@projects
.
order
(
"
name ASC"
).
page
(
params
[
:page
]).
per
(
20
)
@projects
=
@projects
.
includes
(
:namespace
).
order
(
"namespaces.code, projects.
name ASC"
).
page
(
params
[
:page
]).
per
(
20
)
end
def
show
...
...
app/helpers/application_helper.rb
View file @
f17ddeb3
...
...
@@ -74,16 +74,25 @@ module ApplicationHelper
grouped_options_for_select
(
options
,
@ref
||
@project
.
default_branch
)
end
def
namespaces_options
def
namespaces_options
(
selected
=
:current_user
,
scope
=
:default
)
groups
=
current_user
.
namespaces
.
select
{
|
n
|
n
.
type
==
'Group'
}
users
=
current_user
.
namespaces
.
reject
{
|
n
|
n
.
type
==
'Group'
}
users
=
if
scope
==
:all
Namespace
.
root
else
current_user
.
namespaces
.
reject
{
|
n
|
n
.
type
==
'Group'
}
end
options
=
[
[
"Groups"
,
groups
.
map
{
|
g
|
[
g
.
human_name
,
g
.
id
]}
],
[
"Users"
,
users
.
map
{
|
u
|
[
u
.
human_name
,
u
.
id
]}
]
]
grouped_options_for_select
(
options
,
current_user
.
namespace
.
id
)
if
selected
==
:current_user
selected
=
current_user
.
namespace
.
id
end
grouped_options_for_select
(
options
,
selected
)
end
def
search_autocomplete_source
...
...
app/models/namespace.rb
View file @
f17ddeb3
...
...
@@ -10,6 +10,8 @@ class Namespace < ActiveRecord::Base
delegate
:name
,
to: :owner
,
allow_nil:
true
,
prefix:
true
scope
:root
,
where
(
'type IS NULL'
)
def
self
.
search
query
where
(
"name LIKE :query OR code LIKE :query"
,
query:
"%
#{
query
}
%"
)
end
...
...
app/models/project.rb
View file @
f17ddeb3
...
...
@@ -80,7 +80,7 @@ class Project < ActiveRecord::Base
end
def
search
query
where
(
"
name LIKE :query OR code LIKE :query OR
path LIKE :query"
,
query:
"%
#{
query
}
%"
)
where
(
"
projects.name LIKE :query OR projects.code LIKE :query OR projects.
path LIKE :query"
,
query:
"%
#{
query
}
%"
)
end
def
create_by_user
(
params
,
user
)
...
...
app/views/admin/projects/index.html.haml
View file @
f17ddeb3
...
...
@@ -4,13 +4,14 @@
=
link_to
'New Project'
,
new_project_path
,
class:
"btn small right"
%br
=
form_tag
admin_projects_path
,
method: :get
,
class:
'form-inline'
do
=
select_tag
:namespace_id
,
namespaces_options
(
params
[
:namespace_id
],
:all
),
class:
"chosen xlarge"
,
include_blank:
true
=
text_field_tag
:name
,
params
[
:name
],
class:
"xlarge"
=
submit_tag
"Search"
,
class:
"btn submit primary"
%table
%thead
%th
Name
%th
P
ath
%th
P
roject
%th
Team Members
%th
Last Commit
%th
Edit
...
...
@@ -18,8 +19,13 @@
-
@projects
.
each
do
|
project
|
%tr
%td
=
link_to
project
.
name
,
[
:admin
,
project
]
%td
=
project
.
path
%td
-
if
project
.
namespace
=
link_to
project
.
namespace
.
human_name
,
[
:admin
,
project
]
→
=
link_to
project
.
name
,
[
:admin
,
project
]
%td
%span
.monospace
=
project
.
path_with_namespace
+
".git"
%td
=
project
.
users_projects
.
count
%td
=
last_commit
(
project
)
%td
=
link_to
'Edit'
,
edit_admin_project_path
(
project
),
id:
"edit_
#{
dom_id
(
project
)
}
"
,
class:
"btn small"
...
...
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