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
e3c3c67b
Commit
e3c3c67b
authored
Jan 27, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2787 from gitlabhq/features/projects_page
Feature: Projects page
parents
596442f7
d24fd32a
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
129 additions
and
49 deletions
+129
-49
app/controllers/dashboard_controller.rb
app/controllers/dashboard_controller.rb
+19
-17
app/helpers/dashboard_helper.rb
app/helpers/dashboard_helper.rb
+2
-2
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+3
-1
app/views/dashboard/_projects.html.haml
app/views/dashboard/_projects.html.haml
+4
-9
app/views/dashboard/issues.atom.builder
app/views/dashboard/issues.atom.builder
+3
-3
app/views/dashboard/projects.html.haml
app/views/dashboard/projects.html.haml
+56
-0
app/views/dashboard/show.atom.builder
app/views/dashboard/show.atom.builder
+0
-0
app/views/dashboard/show.html.haml
app/views/dashboard/show.html.haml
+0
-0
app/views/dashboard/show.js.haml
app/views/dashboard/show.js.haml
+0
-0
app/views/groups/issues.atom.builder
app/views/groups/issues.atom.builder
+3
-3
app/views/layouts/application.html.haml
app/views/layouts/application.html.haml
+6
-3
config/routes.rb
config/routes.rb
+8
-4
features/dashboard/projects.feature
features/dashboard/projects.feature
+8
-0
features/steps/dashboard/dashboard.rb
features/steps/dashboard/dashboard.rb
+6
-0
features/steps/shared/paths.rb
features/steps/shared/paths.rb
+6
-2
spec/requests/atom/dashboard_issues_spec.rb
spec/requests/atom/dashboard_issues_spec.rb
+1
-1
spec/routing/routing_spec.rb
spec/routing/routing_spec.rb
+4
-4
No files found.
app/controllers/dashboard_controller.rb
View file @
e3c3c67b
class
DashboardController
<
ApplicationController
respond_to
:html
before_filter
:projects
before_filter
:event_filter
,
only: :
index
before_filter
:
load_
projects
before_filter
:event_filter
,
only: :
show
def
index
def
show
@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/helpers/dashboard_helper.rb
View file @
e3c3c67b
...
...
@@ -9,9 +9,9 @@ module DashboardHelper
case
entity
when
'issue'
then
dashboard_issues
_path
(
options
)
issues_dashboard
_path
(
options
)
when
'merge_request'
dashboard_merge_requests
_path
(
options
)
merge_requests_dashboard
_path
(
options
)
end
end
...
...
app/helpers/projects_helper.rb
View file @
e3c3c67b
...
...
@@ -55,7 +55,9 @@ module ProjectsHelper
def
project_title
project
if
project
.
group
project
.
name_with_namespace
content_tag
:span
do
link_to
(
project
.
group
.
name
,
group_path
(
project
.
group
))
+
" / "
+
project
.
name
end
else
project
.
name
end
...
...
app/views/dashboard/_projects.html.haml
View file @
e3c3c67b
...
...
@@ -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"
,
projects_dashboard_path
app/views/dashboard/issues.atom.builder
View file @
e3c3c67b
xml.instruct!
xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do
xml.title "#{current_user.name} issues"
xml.link :href =>
dashboard_issues
_url(:atom, :private_token => current_user.private_token), :rel => "self", :type => "application/atom+xml"
xml.link :href =>
dashboard_issues
_url(:private_token => current_user.private_token), :rel => "alternate", :type => "text/html"
xml.id
dashboard_issues
_url(:private_token => current_user.private_token)
xml.link :href =>
issues_dashboard
_url(:atom, :private_token => current_user.private_token), :rel => "self", :type => "application/atom+xml"
xml.link :href =>
issues_dashboard
_url(:private_token => current_user.private_token), :rel => "alternate", :type => "text/html"
xml.id
issues_dashboard
_url(:private_token => current_user.private_token)
xml.updated @issues.first.created_at.strftime("%Y-%m-%dT%H:%M:%SZ") if @issues.any?
@issues.each do |issue|
...
...
app/views/dashboard/projects.html.haml
0 → 100644
View file @
e3c3c67b
%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"
,
projects_dashboard_path
=
nav_tab
:scope
,
'personal'
do
=
link_to
"Personal"
,
projects_dashboard_path
(
scope:
'personal'
)
=
nav_tab
:scope
,
'joined'
do
=
link_to
"Joined"
,
projects_dashboard_path
(
scope:
'joined'
)
.span9
=
form_tag
projects_dashboard_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
.clearfix
.left
=
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
)
%br
%small
.light
%strong
Last activity:
%span
=
project_last_activity
(
project
)
.right.light
-
if
project
.
owner
==
current_user
%i
.icon-wrench
-
tm
=
project
.
team
.
get_tm
(
current_user
.
id
)
-
if
tm
=
tm
.
project_access_human
-
if
@projects
.
blank?
%li
%h3
.nothing_here_message
There are no projects here.
.bottom
=
paginate
@projects
,
theme:
"gitlab"
app/views/dashboard/
index
.atom.builder
→
app/views/dashboard/
show
.atom.builder
View file @
e3c3c67b
File moved
app/views/dashboard/
index
.html.haml
→
app/views/dashboard/
show
.html.haml
View file @
e3c3c67b
File moved
app/views/dashboard/
index
.js.haml
→
app/views/dashboard/
show
.js.haml
View file @
e3c3c67b
File moved
app/views/groups/issues.atom.builder
View file @
e3c3c67b
xml.instruct!
xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do
xml.title "#{@user.name} issues"
xml.link :href =>
dashboard_issues
_url(:atom, :private_token => @user.private_token), :rel => "self", :type => "application/atom+xml"
xml.link :href =>
dashboard_issues
_url(:private_token => @user.private_token), :rel => "alternate", :type => "text/html"
xml.id
dashboard_issues
_url(:private_token => @user.private_token)
xml.link :href =>
issues_dashboard
_url(:atom, :private_token => @user.private_token), :rel => "self", :type => "application/atom+xml"
xml.link :href =>
issues_dashboard
_url(:private_token => @user.private_token), :rel => "alternate", :type => "text/html"
xml.id
issues_dashboard
_url(:private_token => @user.private_token)
xml.updated @issues.first.created_at.strftime("%Y-%m-%dT%H:%M:%SZ") if @issues.any?
@issues.each do |issue|
...
...
app/views/layouts/application.html.haml
View file @
e3c3c67b
...
...
@@ -6,14 +6,17 @@
=
render
"layouts/head_panel"
,
title:
"Dashboard"
.container
%ul
.main_menu
=
nav_link
(
path:
'dashboard#
index
'
,
html_options:
{
class:
'home'
})
do
=
nav_link
(
path:
'dashboard#
show
'
,
html_options:
{
class:
'home'
})
do
=
link_to
"Home"
,
root_path
,
title:
"Home"
=
nav_link
(
path:
'dashboard#projects'
)
do
=
link_to
projects_dashboard_path
do
Projects
=
nav_link
(
path:
'dashboard#issues'
)
do
=
link_to
dashboard_issues
_path
do
=
link_to
issues_dashboard
_path
do
Issues
%span
.count
=
current_user
.
assigned_issues
.
opened
.
count
=
nav_link
(
path:
'dashboard#merge_requests'
)
do
=
link_to
dashboard_merge_requests
_path
do
=
link_to
merge_requests_dashboard
_path
do
Merge Requests
%span
.count
=
current_user
.
cared_merge_requests
.
opened
.
count
=
nav_link
(
path:
'search#show'
)
do
...
...
config/routes.rb
View file @
e3c3c67b
...
...
@@ -118,9 +118,13 @@ Gitlab::Application.routes.draw do
#
# Dashboard Area
#
get
"dashboard"
=>
"dashboard#index"
get
"dashboard/issues"
=>
"dashboard#issues"
get
"dashboard/merge_requests"
=>
"dashboard#merge_requests"
resource
:dashboard
,
controller:
"dashboard"
do
member
do
get
:projects
get
:issues
get
:merge_requests
end
end
#
# Groups Area
...
...
@@ -284,5 +288,5 @@ Gitlab::Application.routes.draw do
end
end
root
to:
"dashboard#
index
"
root
to:
"dashboard#
show
"
end
features/dashboard/projects.feature
0 → 100644
View file @
e3c3c67b
Feature
:
Dashboard
Background
:
Given
I sign in as a user
And
I own project
"Shop"
And
I visit dashboard projects page
Scenario
:
I
should see issues list
Then
I should see projects list
features/steps/dashboard/dashboard.rb
View file @
e3c3c67b
...
...
@@ -63,6 +63,12 @@ class Dashboard < Spinach::FeatureSteps
@project
.
team
<<
[
current_user
,
:master
]
end
Then
'I should see projects list'
do
@user
.
authorized_projects
.
all
.
each
do
|
project
|
page
.
should
have_link
project
.
name_with_namespace
end
end
Then
'I should see groups list'
do
Group
.
all
.
each
do
|
group
|
page
.
should
have_link
group
.
name
...
...
features/steps/shared/paths.rb
View file @
e3c3c67b
...
...
@@ -33,12 +33,16 @@ module SharedPaths
visit
dashboard_path
end
Given
'I visit dashboard projects page'
do
visit
projects_dashboard_path
end
Given
'I visit dashboard issues page'
do
visit
dashboard_issues
_path
visit
issues_dashboard
_path
end
Given
'I visit dashboard merge requests page'
do
visit
dashboard_merge_requests
_path
visit
merge_requests_dashboard
_path
end
Given
'I visit dashboard search page'
do
...
...
spec/requests/atom/dashboard_issues_spec.rb
View file @
e3c3c67b
...
...
@@ -10,7 +10,7 @@ describe "Dashboard Issues Feed" do
describe
"atom feed"
do
it
"should render atom feed via private token"
do
visit
dashboard_issues
_path
(
:atom
,
private_token:
user
.
private_token
)
visit
issues_dashboard
_path
(
:atom
,
private_token:
user
.
private_token
)
page
.
response_headers
[
'Content-Type'
].
should
have_content
(
"application/atom+xml"
)
page
.
body
.
should
have_selector
(
"title"
,
text:
"
#{
user
.
name
}
issues"
)
...
...
spec/routing/routing_spec.rb
View file @
e3c3c67b
...
...
@@ -146,14 +146,14 @@ describe KeysController, "routing" do
end
end
# dashboard GET /dashboard(.:format) dashboard#
index
# dashboard GET /dashboard(.:format) dashboard#
show
# dashboard_issues GET /dashboard/issues(.:format) dashboard#issues
# dashboard_merge_requests GET /dashboard/merge_requests(.:format) dashboard#merge_requests
# root / dashboard#
index
# root / dashboard#
show
describe
DashboardController
,
"routing"
do
it
"to #index"
do
get
(
"/dashboard"
).
should
route_to
(
'dashboard#
index
'
)
get
(
"/"
).
should
route_to
(
'dashboard#
index
'
)
get
(
"/dashboard"
).
should
route_to
(
'dashboard#
show
'
)
get
(
"/"
).
should
route_to
(
'dashboard#
show
'
)
end
it
"to #issues"
do
...
...
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