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
e4b1f38c
Commit
e4b1f38c
authored
Dec 08, 2011
by
Ariejan de Vroom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added merge request dashboard, showing all merge requests assigned to
you across projects.
parent
1a3af33f
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
90 additions
and
2 deletions
+90
-2
app/controllers/user_merge_requests_controller.rb
app/controllers/user_merge_requests_controller.rb
+9
-0
app/helpers/user_merge_requests_helper.rb
app/helpers/user_merge_requests_helper.rb
+3
-0
app/models/user.rb
app/models/user.rb
+9
-0
app/views/layouts/user.html.haml
app/views/layouts/user.html.haml
+4
-0
app/views/merge_requests/_merge_request.html.haml
app/views/merge_requests/_merge_request.html.haml
+4
-1
app/views/user_merge_requests/index.html.haml
app/views/user_merge_requests/index.html.haml
+10
-0
config/routes.rb
config/routes.rb
+1
-0
spec/models/user_spec.rb
spec/models/user_spec.rb
+2
-0
spec/requests/merge_requests_spec.rb
spec/requests/merge_requests_spec.rb
+1
-1
spec/requests/user_merge_requests_spec.rb
spec/requests/user_merge_requests_spec.rb
+47
-0
No files found.
app/controllers/user_merge_requests_controller.rb
0 → 100644
View file @
e4b1f38c
class
UserMergeRequestsController
<
ApplicationController
before_filter
:authenticate_user!
layout
"user"
def
index
@merge_requests
=
current_user
.
assigned_merge_requests
end
end
app/helpers/user_merge_requests_helper.rb
0 → 100644
View file @
e4b1f38c
module
UserMergeRequestsHelper
end
app/models/user.rb
View file @
e4b1f38c
...
@@ -25,6 +25,15 @@ class User < ActiveRecord::Base
...
@@ -25,6 +25,15 @@ class User < ActiveRecord::Base
:foreign_key
=>
:assignee_id
,
:foreign_key
=>
:assignee_id
,
:dependent
=>
:destroy
:dependent
=>
:destroy
has_many
:merge_requests
,
:foreign_key
=>
:author_id
,
:dependent
=>
:destroy
has_many
:assigned_merge_requests
,
:class_name
=>
"MergeRequest"
,
:foreign_key
=>
:assignee_id
,
:dependent
=>
:destroy
before_create
:ensure_authentication_token
before_create
:ensure_authentication_token
alias_attribute
:private_token
,
:authentication_token
alias_attribute
:private_token
,
:authentication_token
scope
:not_in_project
,
lambda
{
|
project
|
where
(
"id not in (:ids)"
,
:ids
=>
project
.
users
.
map
(
&
:id
)
)
}
scope
:not_in_project
,
lambda
{
|
project
|
where
(
"id not in (:ids)"
,
:ids
=>
project
.
users
.
map
(
&
:id
)
)
}
...
...
app/views/layouts/user.html.haml
View file @
e4b1f38c
...
@@ -21,6 +21,10 @@
...
@@ -21,6 +21,10 @@
Issues
Issues
-
unless
current_user
.
assigned_issues
.
empty?
-
unless
current_user
.
assigned_issues
.
empty?
%span
{
:class
=>
"number"
}=
current_user
.
assigned_issues
.
count
%span
{
:class
=>
"number"
}=
current_user
.
assigned_issues
.
count
=
link_to
merge_requests_path
,
:class
=>
current_page?
(
:controller
=>
"user_merge_requests"
,
:action
=>
"index"
)
?
"current"
:
nil
do
Merge Requests
-
unless
current_user
.
assigned_merge_requests
.
empty?
%span
{
:class
=>
"number"
}=
current_user
.
assigned_merge_requests
.
count
.project-content
.project-content
=
yield
=
yield
...
...
app/views/merge_requests/_merge_request.html.haml
View file @
e4b1f38c
%a
.update-item
{
:href
=>
project_merge_request_path
(
@
project
,
merge_request
)}
%a
.update-item
{
:href
=>
project_merge_request_path
(
merge_request
.
project
,
merge_request
)}
=
image_tag
gravatar_icon
(
merge_request
.
author_email
),
:class
=>
"left"
,
:width
=>
40
=
image_tag
gravatar_icon
(
merge_request
.
author_email
),
:class
=>
"left"
,
:width
=>
40
%span
.update-title
%span
.update-title
=
merge_request
.
title
=
merge_request
.
title
%span
.update-author
%span
.update-author
-
if
not
@project
.
present?
%strong
=
merge_request
.
project
.
name
=
'-'
%strong
=
merge_request
.
author_name
%strong
=
merge_request
.
author_name
authored
authored
=
time_ago_in_words
(
merge_request
.
created_at
)
=
time_ago_in_words
(
merge_request
.
created_at
)
...
...
app/views/user_merge_requests/index.html.haml
0 → 100644
View file @
e4b1f38c
-
if
@merge_requests
.
opened
.
count
>
0
%div
{
:class
=>
"update-data ui-box ui-box-small ui-box-big"
}
%h3
%span
.tag.open
Open
.data
=
render
@merge_requests
.
opened
.clear
%br
config/routes.rb
View file @
e4b1f38c
...
@@ -24,6 +24,7 @@ Gitlab::Application.routes.draw do
...
@@ -24,6 +24,7 @@ Gitlab::Application.routes.draw do
get
"profile"
,
:to
=>
"profile#show"
get
"profile"
,
:to
=>
"profile#show"
get
"dashboard"
,
:to
=>
"dashboard#index"
get
"dashboard"
,
:to
=>
"dashboard#index"
get
"issues"
,
:to
=>
"user_issues#index"
,
:as
=>
"issues"
get
"issues"
,
:to
=>
"user_issues#index"
,
:as
=>
"issues"
get
"merge_requests"
,
:to
=>
"user_merge_requests#index"
,
:as
=>
"merge_requests"
#get "profile/:id", :to => "profile#show"
#get "profile/:id", :to => "profile#show"
...
...
spec/models/user_spec.rb
View file @
e4b1f38c
...
@@ -6,6 +6,8 @@ describe User do
...
@@ -6,6 +6,8 @@ describe User do
it
{
should
have_many
(
:users_projects
)
}
it
{
should
have_many
(
:users_projects
)
}
it
{
should
have_many
(
:issues
)
}
it
{
should
have_many
(
:issues
)
}
it
{
should
have_many
(
:assigned_issues
)
}
it
{
should
have_many
(
:assigned_issues
)
}
it
{
should
have_many
(
:merge_requests
)
}
it
{
should
have_many
(
:assigned_merge_requests
)
}
end
end
describe
"Respond to"
do
describe
"Respond to"
do
...
...
spec/requests/merge_requests_spec.rb
View file @
e4b1f38c
...
@@ -50,7 +50,7 @@ describe "MergeRequests" do
...
@@ -50,7 +50,7 @@ describe "MergeRequests" do
end
end
describe
"GET /merge_requests/new"
do
describe
"GET /merge_requests/new"
do
before
do
before
do
visit
new_project_merge_request_path
(
project
)
visit
new_project_merge_request_path
(
project
)
fill_in
"merge_request_title"
,
:with
=>
"Merge Request Title"
fill_in
"merge_request_title"
,
:with
=>
"Merge Request Title"
select
"master"
,
:from
=>
"merge_request_source_branch"
select
"master"
,
:from
=>
"merge_request_source_branch"
...
...
spec/requests/user_merge_requests_spec.rb
0 → 100644
View file @
e4b1f38c
require
'spec_helper'
describe
"User MergeRequests"
do
describe
"GET /issues"
do
before
do
login_as
:user
@project1
=
Factory
:project
,
:path
=>
"project1"
,
:code
=>
"TEST1"
@project2
=
Factory
:project
,
:path
=>
"project2"
,
:code
=>
"TEST2"
@project1
.
add_access
(
@user
,
:read
,
:write
)
@project2
.
add_access
(
@user
,
:read
,
:write
)
@merge_request1
=
Factory
:merge_request
,
:author
=>
@user
,
:assignee
=>
@user
,
:project
=>
@project1
@merge_request2
=
Factory
:merge_request
,
:author
=>
@user
,
:assignee
=>
@user
,
:project
=>
@project2
visit
merge_requests_path
end
subject
{
page
}
it
{
should
have_content
(
@merge_request1
.
title
)
}
it
{
should
have_content
(
@merge_request1
.
project
.
name
)
}
it
{
should
have_content
(
@merge_request1
.
target_branch
)
}
it
{
should
have_content
(
@merge_request1
.
source_branch
)
}
it
{
should
have_content
(
@merge_request1
.
assignee
.
name
)
}
it
{
should
have_content
(
@merge_request2
.
title
)
}
it
{
should
have_content
(
@merge_request2
.
project
.
name
)
}
it
{
should
have_content
(
@merge_request2
.
target_branch
)
}
it
{
should
have_content
(
@merge_request2
.
source_branch
)
}
it
{
should
have_content
(
@merge_request2
.
assignee
.
name
)
}
end
end
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