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
Léo-Paul Géneau
gitlab-ce
Commits
c38b9a2f
Commit
c38b9a2f
authored
Nov 30, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Filter projects on dashboard
parent
a03f3189
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
0 deletions
+46
-0
app/assets/stylesheets/gitlab_bootstrap/common.scss
app/assets/stylesheets/gitlab_bootstrap/common.scss
+14
-0
app/controllers/dashboard_controller.rb
app/controllers/dashboard_controller.rb
+9
-0
app/helpers/tab_helper.rb
app/helpers/tab_helper.rb
+13
-0
app/models/project.rb
app/models/project.rb
+2
-0
app/views/dashboard/_projects.html.haml
app/views/dashboard/_projects.html.haml
+8
-0
No files found.
app/assets/stylesheets/gitlab_bootstrap/common.scss
View file @
c38b9a2f
...
@@ -100,3 +100,17 @@ input[type='search'].search-text-input {
...
@@ -100,3 +100,17 @@ input[type='search'].search-text-input {
}
}
fieldset
legend
{
font-size
:
17px
;
}
fieldset
legend
{
font-size
:
17px
;
}
ul
.nav.nav-projects-tabs
{
@extend
.nav-tabs
;
padding-left
:
8px
;
li
{
a
{
padding
:
4px
20px
;
margin-top
:
2px
;
border-color
:
#DDD
;
}
}
}
app/controllers/dashboard_controller.rb
View file @
c38b9a2f
...
@@ -7,6 +7,15 @@ class DashboardController < ApplicationController
...
@@ -7,6 +7,15 @@ class DashboardController < ApplicationController
def
index
def
index
@groups
=
current_user
.
authorized_groups
@groups
=
current_user
.
authorized_groups
@projects
=
case
params
[
:scope
]
when
'personal'
then
@projects
.
personal
(
current_user
)
when
'joined'
then
@projects
.
joined
(
current_user
)
else
@projects
end
@projects
=
@projects
.
page
(
params
[
:page
]).
per
(
30
)
@projects
=
@projects
.
page
(
params
[
:page
]).
per
(
30
)
@events
=
Event
.
in_projects
(
current_user
.
project_ids
)
@events
=
Event
.
in_projects
(
current_user
.
project_ids
)
...
...
app/helpers/tab_helper.rb
View file @
c38b9a2f
...
@@ -84,4 +84,17 @@ module TabHelper
...
@@ -84,4 +84,17 @@ module TabHelper
'active'
'active'
end
end
end
end
# Use nav_tab for save controller/action but different params
def
nav_tab
key
,
value
,
&
block
o
=
{}
o
[
:class
]
=
""
o
[
:class
]
<<
" active"
if
params
[
key
]
==
value
if
block_given?
content_tag
(
:li
,
capture
(
&
block
),
o
)
else
content_tag
(
:li
,
nil
,
o
)
end
end
end
end
app/models/project.rb
View file @
c38b9a2f
...
@@ -74,6 +74,8 @@ class Project < ActiveRecord::Base
...
@@ -74,6 +74,8 @@ class Project < ActiveRecord::Base
scope
:without_user
,
->
(
user
)
{
where
(
"id NOT IN (:ids)"
,
ids:
user
.
projects
.
map
(
&
:id
)
)
}
scope
:without_user
,
->
(
user
)
{
where
(
"id NOT IN (:ids)"
,
ids:
user
.
projects
.
map
(
&
:id
)
)
}
scope
:not_in_group
,
->
(
group
)
{
where
(
"id NOT IN (:ids)"
,
ids:
group
.
project_ids
)
}
scope
:not_in_group
,
->
(
group
)
{
where
(
"id NOT IN (:ids)"
,
ids:
group
.
project_ids
)
}
scope
:sorted_by_activity
,
->
()
{
order
(
"(SELECT max(events.created_at) FROM events WHERE events.project_id = projects.id) DESC"
)
}
scope
:sorted_by_activity
,
->
()
{
order
(
"(SELECT max(events.created_at) FROM events WHERE events.project_id = projects.id) DESC"
)
}
scope
:personal
,
->
(
user
)
{
where
(
namespace_id:
user
.
namespace_id
)
}
scope
:joined
,
->
(
user
)
{
where
(
"namespace_id != ?"
,
user
.
namespace_id
)
}
class
<<
self
class
<<
self
def
authorized_for
user
def
authorized_for
user
...
...
app/views/dashboard/_projects.html.haml
View file @
c38b9a2f
...
@@ -8,6 +8,14 @@
...
@@ -8,6 +8,14 @@
=
link_to
new_project_path
,
class:
"btn very_small info"
do
=
link_to
new_project_path
,
class:
"btn very_small info"
do
%i
.icon-plus
%i
.icon-plus
New Project
New Project
%ul
.nav.nav-projects-tabs
=
nav_tab
:scope
,
nil
do
=
link_to
"All"
,
dashboard_path
=
nav_tab
:scope
,
'personal'
do
=
link_to
"Personal"
,
dashboard_path
(
scope:
'personal'
)
=
nav_tab
:scope
,
'joined'
do
=
link_to
"Joined"
,
dashboard_path
(
scope:
'joined'
)
%ul
.unstyled
%ul
.unstyled
-
projects
.
each
do
|
project
|
-
projects
.
each
do
|
project
|
%li
.wll
%li
.wll
...
...
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