Commit e4b1f38c authored by Ariejan de Vroom's avatar Ariejan de Vroom

Added merge request dashboard, showing all merge requests assigned to

you across projects.
parent 1a3af33f
class UserMergeRequestsController < ApplicationController
before_filter :authenticate_user!
layout "user"
def index
@merge_requests = current_user.assigned_merge_requests
end
end
module UserMergeRequestsHelper
end
......@@ -25,6 +25,15 @@ class User < ActiveRecord::Base
:foreign_key => :assignee_id,
: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
alias_attribute :private_token, :authentication_token
scope :not_in_project, lambda { |project| where("id not in (:ids)", :ids => project.users.map(&:id) ) }
......
......@@ -21,6 +21,10 @@
Issues
- unless current_user.assigned_issues.empty?
%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
= yield
......
%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
%span.update-title
= merge_request.title
%span.update-author
- if not @project.present?
%strong= merge_request.project.name
= '-'
%strong= merge_request.author_name
authored
= time_ago_in_words(merge_request.created_at)
......
- 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
......@@ -24,6 +24,7 @@ Gitlab::Application.routes.draw do
get "profile", :to => "profile#show"
get "dashboard", :to => "dashboard#index"
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"
......
......@@ -6,6 +6,8 @@ describe User do
it { should have_many(:users_projects) }
it { should have_many(:issues) }
it { should have_many(:assigned_issues) }
it { should have_many(:merge_requests) }
it { should have_many(:assigned_merge_requests) }
end
describe "Respond to" do
......
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment