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
iv
gitlab-ce
Commits
bd3b677b
Commit
bd3b677b
authored
Jan 27, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add projects page to dashboard. Remove projects pagination on dashboard
parent
b68bba44
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
71 additions
and
24 deletions
+71
-24
app/controllers/dashboard_controller.rb
app/controllers/dashboard_controller.rb
+17
-15
app/views/dashboard/_projects.html.haml
app/views/dashboard/_projects.html.haml
+4
-9
app/views/dashboard/projects.html.haml
app/views/dashboard/projects.html.haml
+46
-0
app/views/layouts/application.html.haml
app/views/layouts/application.html.haml
+3
-0
config/routes.rb
config/routes.rb
+1
-0
No files found.
app/controllers/dashboard_controller.rb
View file @
bd3b677b
class
DashboardController
<
ApplicationController
respond_to
:html
before_filter
:projects
before_filter
:
load_
projects
before_filter
:event_filter
,
only: :index
def
index
@groups
=
current_user
.
authorized_groups
@has_authorized_projects
=
@projects
.
count
>
0
@projects
=
case
params
[
:scope
]
when
'personal'
then
@projects
.
personal
(
current_user
)
when
'joined'
then
@projects
.
joined
(
current_user
)
else
@projects
end
@teams
=
current_user
.
authorized_teams
@projects
=
@projects
.
page
(
params
[
:page
]).
per
(
3
0
)
@projects_count
=
@projects
.
count
@projects
=
@projects
.
limit
(
2
0
)
@events
=
Event
.
in_projects
(
current_user
.
authorized_projects
.
pluck
(
:id
))
@events
=
@event_filter
.
apply_filter
(
@events
)
...
...
@@ -35,6 +24,19 @@ class DashboardController < ApplicationController
end
end
def
projects
@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
)
end
# Get authored or assigned open merge requests
def
merge_requests
@merge_requests
=
current_user
.
cared_merge_requests
...
...
@@ -57,7 +59,7 @@ class DashboardController < ApplicationController
protected
def
projects
def
load_
projects
@projects
=
current_user
.
authorized_projects
.
sorted_by_activity
end
...
...
app/views/dashboard/_projects.html.haml
View file @
bd3b677b
...
...
@@ -2,19 +2,12 @@
%h5
.title
Projects
%small
(
#{
projects
.
total
_count
}
)
(
#{
@projects
_count
}
)
-
if
current_user
.
can_create_project?
%span
.right
=
link_to
new_project_path
,
class:
"btn very_small info"
do
%i
.icon-plus
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
.well-list
-
projects
.
each
do
|
project
|
...
...
@@ -33,4 +26,6 @@
-
if
projects
.
blank?
%li
%h3
.nothing_here_message
There are no projects here.
.bottom
=
paginate
projects
,
theme:
"gitlab"
-
if
@projects_count
>
20
%li
.bottom
%strong
=
link_to
"show all projects"
,
dashboard_projects_path
app/views/dashboard/projects.html.haml
0 → 100644
View file @
bd3b677b
%h3
.page_title
Projects
%span
(
#{
@projects
.
total_count
}
)
-
if
current_user
.
can_create_project?
%span
.right
=
link_to
new_project_path
,
class:
"btn very_small info"
do
%i
.icon-plus
New Project
%hr
.row
.span3
%ul
.nav.nav-pills.nav-stacked
=
nav_tab
:scope
,
nil
do
=
link_to
"All"
,
dashboard_projects_path
=
nav_tab
:scope
,
'personal'
do
=
link_to
"Personal"
,
dashboard_projects_path
(
scope:
'personal'
)
=
nav_tab
:scope
,
'joined'
do
=
link_to
"Joined"
,
dashboard_projects_path
(
scope:
'joined'
)
.span9
=
form_tag
dashboard_projects_path
,
method:
'get'
do
%fieldset
.dashboard-search-filter
=
hidden_field_tag
"scope"
,
params
[
:scope
]
=
search_field_tag
"search"
,
params
[
:search
],
{
placeholder:
'Search'
,
class:
'left input-xxlarge'
}
=
button_tag
type:
'submit'
,
class:
'btn'
do
%i
.icon-search
%ul
.well-list
-
@projects
.
each
do
|
project
|
%li
=
link_to
project_path
(
project
),
class:
dom_class
(
project
)
do
-
if
project
.
namespace
=
project
.
namespace
.
human_name
\/
%strong
.well-title
=
truncate
(
project
.
name
,
length:
25
)
%span
.right.light
%strong
Last activity:
%span
=
project_last_activity
(
project
)
-
if
@projects
.
blank?
%li
%h3
.nothing_here_message
There are no projects here.
.bottom
=
paginate
@projects
,
theme:
"gitlab"
app/views/layouts/application.html.haml
View file @
bd3b677b
...
...
@@ -8,6 +8,9 @@
%ul
.main_menu
=
nav_link
(
path:
'dashboard#index'
,
html_options:
{
class:
'home'
})
do
=
link_to
"Home"
,
root_path
,
title:
"Home"
=
nav_link
(
path:
'dashboard#projects'
)
do
=
link_to
dashboard_projects_path
do
Projects
=
nav_link
(
path:
'dashboard#issues'
)
do
=
link_to
dashboard_issues_path
do
Issues
...
...
config/routes.rb
View file @
bd3b677b
...
...
@@ -119,6 +119,7 @@ Gitlab::Application.routes.draw do
# Dashboard Area
#
get
"dashboard"
=>
"dashboard#index"
get
"dashboard/projects"
=>
"dashboard#projects"
get
"dashboard/issues"
=>
"dashboard#issues"
get
"dashboard/merge_requests"
=>
"dashboard#merge_requests"
...
...
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