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
6c47bcef
Commit
6c47bcef
authored
Dec 13, 2011
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'refactor_merge_requests'
parents
713802fd
e8860594
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
258 additions
and
122 deletions
+258
-122
app/assets/images/.directory
app/assets/images/.directory
+1
-1
app/assets/javascripts/merge_requests.js
app/assets/javascripts/merge_requests.js
+59
-0
app/assets/stylesheets/projects.css.scss
app/assets/stylesheets/projects.css.scss
+79
-36
app/assets/stylesheets/style.scss
app/assets/stylesheets/style.scss
+1
-1
app/controllers/merge_requests_controller.rb
app/controllers/merge_requests_controller.rb
+0
-3
app/models/project.rb
app/models/project.rb
+4
-0
app/views/merge_requests/_form.html.haml
app/views/merge_requests/_form.html.haml
+45
-30
app/views/merge_requests/_merge_request.html.haml
app/views/merge_requests/_merge_request.html.haml
+1
-1
app/views/merge_requests/commits.js.haml
app/views/merge_requests/commits.js.haml
+4
-0
app/views/merge_requests/diffs.js.haml
app/views/merge_requests/diffs.js.haml
+4
-0
app/views/merge_requests/show.html.haml
app/views/merge_requests/show.html.haml
+56
-46
spec/requests/merge_requests_spec.rb
spec/requests/merge_requests_spec.rb
+3
-3
vendor/assets/stylesheets/jquery-ui/jquery-ui.css
vendor/assets/stylesheets/jquery-ui/jquery-ui.css
+1
-1
No files found.
app/assets/images/.directory
View file @
6c47bcef
[Dolphin]
ShowPreview=true
Timestamp=2011,1
0,28,13,16,25
Timestamp=2011,1
2,13,12,22,12
Version=2
app/assets/javascripts/merge_requests.js
View file @
6c47bcef
var
MergeRequest
=
{
diffs_loaded
:
false
,
commits_loaded
:
false
,
init
:
function
()
{
$
(
"
.merge-tabs a
"
).
live
(
"
click
"
,
function
()
{
$
(
"
.merge-tabs a
"
).
removeClass
(
"
active
"
);
$
(
this
).
addClass
(
"
active
"
);
});
$
(
"
.merge-tabs a.merge-notes-tab
"
).
live
(
"
click
"
,
function
()
{
$
(
"
.merge-request-commits, .merge-request-diffs
"
).
hide
();
$
(
"
.merge-request-notes
"
).
show
();
});
$
(
"
.merge-tabs a.merge-commits-tab
"
).
live
(
"
click
"
,
function
()
{
if
(
!
MergeRequest
.
commits_loaded
)
{
MergeRequest
.
loadCommits
();
}
$
(
"
.merge-request-notes, .merge-request-diffs
"
).
hide
();
$
(
"
.merge-request-commits
"
).
show
();
});
$
(
"
.merge-tabs a.merge-diffs-tab
"
).
live
(
"
click
"
,
function
()
{
if
(
!
MergeRequest
.
diffs_loaded
)
{
MergeRequest
.
loadDiff
();
}
$
(
"
.merge-request-notes, .merge-request-commits
"
).
hide
();
$
(
"
.merge-request-diffs
"
).
show
();
});
},
loadCommits
:
function
()
{
$
(
"
.dashboard-loader
"
).
show
();
$
.
ajax
({
type
:
"
GET
"
,
url
:
$
(
"
.merge-commits-tab
"
).
attr
(
"
data-url
"
),
complete
:
function
(){
MergeRequest
.
commits_loaded
=
true
;
$
(
"
.merge-request-notes, .merge-request-diffs
"
).
hide
();
$
(
"
.dashboard-loader
"
).
hide
()},
dataType
:
"
script
"
});
},
loadDiff
:
function
()
{
$
(
"
.dashboard-loader
"
).
show
();
$
.
ajax
({
type
:
"
GET
"
,
url
:
$
(
"
.merge-diffs-tab
"
).
attr
(
"
data-url
"
),
complete
:
function
(){
MergeRequest
.
diffs_loaded
=
true
;
$
(
"
.merge-request-notes, .merge-request-commits
"
).
hide
();
$
(
"
.dashboard-loader
"
).
hide
()},
dataType
:
"
script
"
});
}
}
app/assets/stylesheets/projects.css.scss
View file @
6c47bcef
...
...
@@ -438,42 +438,6 @@ body.project-page table.no-borders td{
border
:none
;
}
#gitlab-tabs
{
.ui-tabs-nav
{
border-bottom
:
1px
solid
#DEDFE1
;
li
{
background
:
none
;
border
:none
;
font-size
:
16px
;
margin
:
0
;
padding
:
0
;
a
{
margin
:
0
;
padding
:
10px
16px
;
width
:
150px
;
}
&
.ui-tabs-selected
{
background-image
:
-webkit-gradient
(
linear
,
0
0
,
0
26
,
color-stop
(
0
.076
,
#fefefe
)
,
to
(
#F6F7F8
));
background-image
:
-webkit-linear-gradient
(
#fefefe
7
.6%
,
#F6F7F8
);
background-image
:
-moz-linear-gradient
(
#fefefe
7
.6%
,
#F6F7F8
);
background-image
:
-o-linear-gradient
(
#fefefe
7
.6%
,
#F6F7F8
);
font-weight
:
bold
;
border
:
1px
solid
#DEDFE1
;
border-bottom
:
1px
solid
#DEDFE1
;
-webkit-border-top-left-radius
:
5px
;
-webkit-border-top-right-radius
:
5px
;
-moz-border-radius-topleft
:
5px
;
-moz-border-radius-topright
:
5px
;
border-top-left-radius
:
5px
;
border-top-right-radius
:
5px
;
}
}
}
}
.ajax-tab-loading
{
padding
:
40px
;
display
:none
;
...
...
@@ -587,3 +551,82 @@ h4.middle-panel {
margin-right
:
30px
;
display
:none
;
}
.merge-tabs
{
margin
:
0
;
border
:
1px
solid
#ccc
;
padding
:
5px
;
font-size
:
12px
;
background
:
#F7F7F7
;
margin-bottom
:
20px
;
height
:
26px
;
.tab
{
font-weight
:
bold
;
text-transform
:
uppercase
;
border-right
:
1px
solid
#ddd
;
background
:none
;
padding
:
10px
;
width
:
60px
;
float
:left
;
position
:relative
;
top
:
-5px
;
left
:
-5px
;
height
:
16px
;
padding-left
:
34px
;
span
{
width
:
20px
;
height
:
20px
;
display
:
inline-block
;
position
:
absolute
;
left
:
8px
;
top
:
8px
;
}
&
.active
{
background
:
#eaeaea
;
}
}
}
.merge-notes-tab
span
{
background
:
url("images.png")
no-repeat
-161px
-1px
;
}
.merge-commits-tab
span
{
background
:
url("images.png")
no-repeat
-86px
1px
;
}
.merge-diffs-tab
span
{
background
:
url("images.png")
no-repeat
-118px
1px
;
}
.merge-tabs
.dashboard-loader
{
padding
:
8px
;
}
.user-mention
{
color
:
#2FA0BB
;
font-weight
:
bold
;
}
.author
{
color
:
#999
;
}
.red-button
{
border-radius
:
5px
;
font-size
:
12px
;
font-weight
:
bold
;
padding
:
5px
17px
;
border
:
1px
solid
#999
;
color
:
#666
;
display
:
inline-block
;
box-shadow
:
0
1px
2px
rgba
(
0
,
0
,
0
,.
3
);
background
:
#D12F19
;
color
:
white
;
}
.positive-button
{
border-radius
:
5px
;
font-size
:
12px
;
font-weight
:
bold
;
padding
:
5px
17px
;
border
:
1px
solid
#999
;
color
:
#666
;
display
:
inline-block
;
box-shadow
:
0
1px
2px
rgba
(
0
,
0
,
0
,.
3
);
background
:
#4A2
;
color
:
white
;
}
app/assets/stylesheets/style.scss
View file @
6c47bcef
...
...
@@ -130,7 +130,7 @@ table tr:hover, .listed_items tr.odd:hover{background-color:#FFFFCF}
border-radius
:
5px
;
font-size
:
12px
;
font-weight
:
bold
;
padding
:
6px
20
px
;
padding
:
5px
17
px
;
border
:
1px
solid
#999
;
color
:
#666
;
display
:
inline-block
;
...
...
app/controllers/merge_requests_controller.rb
View file @
6c47bcef
...
...
@@ -30,14 +30,11 @@ class MergeRequestsController < ApplicationController
def
commits
@commits
=
@project
.
repo
.
commits_between
(
@merge_request
.
target_branch
,
@merge_request
.
source_branch
).
map
{
|
c
|
Commit
.
new
(
c
)}
render
:template
=>
"merge_requests/_commits"
,
:layout
=>
false
end
def
diffs
@diffs
=
@merge_request
.
diffs
@commit
=
@merge_request
.
last_commit
render
:template
=>
"merge_requests/_diffs"
,
:layout
=>
false
end
def
new
...
...
app/models/project.rb
View file @
6c47bcef
...
...
@@ -90,6 +90,10 @@ class Project < ActiveRecord::Base
users_projects
.
find_by_user_id
(
user
.
id
)
if
user
end
def
team_member_by_id
(
user_id
)
users_projects
.
find_by_user_id
(
user_id
)
end
def
fresh_issues
(
n
)
issues
.
includes
(
:project
,
:author
).
order
(
"created_at desc"
).
first
(
n
)
end
...
...
app/views/merge_requests/_form.html.haml
View file @
6c47bcef
%div
.merge-request-form-holder
.ui-box.width-100p
%h3
=
@merge_request
.
new_record?
?
"New Merge Request"
:
"Edit Merge Request #
#{
@merge_request
.
id
}
"
=
form_for
[
@project
,
@merge_request
]
do
|
f
|
.data
=
form_for
[
@project
,
@merge_request
]
do
|
f
|
%div
%span
.entity-info
-
if
@merge_request
.
new_record?
=
link_to
project_merge_requests_path
(
@project
)
do
.entity-button
Back
%i
-
else
=
link_to
project_merge_request_path
(
@project
,
@merge_request
)
do
.entity-button
Back
%i
%h2
=
@merge_request
.
new_record?
?
"New Merge Request"
:
"Edit Merge Request #
#{
@merge_request
.
id
}
"
%hr
%table
.no-borders
-
if
@merge_request
.
errors
.
any?
%tr
%td
Errors
%td
%td
{
:colspan
=>
2
}
#error_explanation
-
@merge_request
.
errors
.
full_messages
.
each
do
|
msg
|
%span
=
msg
%br
%tr
%td
=
f
.
label
:title
%td
=
f
.
text_field
:title
%tr
%td
=
f
.
label
:source_branch
,
"From"
%td
=
f
.
select
(
:source_branch
,
@project
.
heads
.
map
(
&
:name
),
{
:include_blank
=>
"Select branch"
}
)
%td
=
f
.
select
(
:source_branch
,
@project
.
heads
.
map
(
&
:name
),
{
:include_blank
=>
"Select branch"
},
:style
=>
"width:250px"
)
%tr
%td
=
f
.
label
:target_branch
,
"To"
%td
=
f
.
select
(
:target_branch
,
@project
.
heads
.
map
(
&
:name
),
{
:include_blank
=>
"Select branch"
}
)
%td
=
f
.
select
(
:target_branch
,
@project
.
heads
.
map
(
&
:name
),
{
:include_blank
=>
"Select branch"
},
:style
=>
"width:250px"
)
%tr
%td
=
f
.
label
:assignee_id
,
"Assign to"
%td
=
f
.
select
(
:assignee_id
,
@project
.
users
.
all
.
collect
{
|
p
|
[
p
.
name
,
p
.
id
]
},
{
:include_blank
=>
"Select user"
})
.buttons
%td
=
f
.
select
(
:assignee_id
,
@project
.
users
.
all
.
collect
{
|
p
|
[
p
.
name
,
p
.
id
]
},
{
:include_blank
=>
"Select user"
},
:style
=>
"width:250px"
)
=
f
.
text_area
:title
,
:style
=>
"width:718px; height:100px"
,
:maxlength
=>
255
%br
%br
.merge-tabs
=
f
.
submit
'Save'
,
:class
=>
"grey-button"
.right
=
link_to
'Back'
,
project_merge_requests_path
(
@project
),
:class
=>
"grey-button"
-
unless
@merge_request
.
new_record?
.right
=
link_to
'Remove'
,
[
@project
,
@merge_request
],
:confirm
=>
'Are you sure?'
,
:method
=>
:delete
,
:class
=>
"red-button"
:javascript
$
(
function
(){
...
...
app/views/merge_requests/_merge_request.html.haml
View file @
6c47bcef
%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
=
truncate
(
merge_request
.
title
,
:length
=>
60
)
%span
.update-author
%strong
=
merge_request
.
author_name
authored
...
...
app/views/merge_requests/commits.js.haml
0 → 100644
View file @
6c47bcef
:plain
$(".merge-request-commits").html("
#{
escape_javascript
(
render
(
:partial
=>
"commits"
))
}
");
app/views/merge_requests/diffs.js.haml
0 → 100644
View file @
6c47bcef
:plain
$(".merge-request-diffs").html("
#{
escape_javascript
(
render
(
:partial
=>
"diffs"
))
}
");
app/views/merge_requests/show.html.haml
View file @
6c47bcef
.merge-request-show-holder.ui-box.width-100p
%h3
%div
%span
.entity-info
-
if
can?
(
current_user
,
:admin_project
,
@project
)
||
@merge_request
.
author
==
current_user
=
link_to
edit_project_merge_request_path
(
@project
,
@merge_request
)
do
.entity-button
Edit Merge Request
%i
=
image_tag
gravatar_icon
(
@merge_request
.
author_email
),
:class
=>
"left"
,
:width
=>
40
,
:style
=>
"padding-right:5px;"
%span
.commit-title
%strong
=
"Merge Request #
#{
@merge_request
.
id
}
:"
.tag.commit.inline
=
@merge_request
.
source_branch
→
.tag.commit.inline
=
@merge_request
.
target_branch
.right
-
if
@merge_request
.
closed
%span
.tag.high
Closed
-
else
%span
.tag.today
Open
.data
%p
=
@merge_request
.
title
-
if
@merge_request
.
author
==
@merge_request
.
assignee
=
image_tag
gravatar_icon
(
@merge_request
.
assignee_email
),
:width
=>
20
,
:style
=>
"padding:0 5px;"
=
@merge_request
.
assignee_name
-
else
=
image_tag
gravatar_icon
(
@merge_request
.
author_email
),
:width
=>
20
,
:style
=>
"padding:0 5px;"
=
@merge_request
.
author_name
%span
.commit-author
%strong
=
link_to
project_team_member_path
(
@project
,
@project
.
team_member_by_id
(
@merge_request
.
author
.
id
))
do
%span
.author
=
@merge_request
.
author_name
→
=
image_tag
gravatar_icon
(
@merge_request
.
assignee_email
),
:width
=>
20
,
:style
=>
"padding:0 5px;"
=
@merge_request
.
assignee_name
.right
%cite
.cgray
=
@merge_request
.
created_at
.
stamp
(
"21 Aug 2011, 11:15pm"
)
.clear
=
link_to
project_team_member_path
(
@project
,
@project
.
team_member_by_id
(
@merge_request
.
assignee
.
id
))
do
%span
.author
=
@merge_request
.
assignee_name
.buttons
-
if
can?
current_user
,
:write_project
,
@project
-
if
@merge_request
.
closed
=
link_to
'Reopen'
,
project_merge_request_path
(
@project
,
@merge_request
,
:merge_request
=>
{
:closed
=>
false
},
:status_only
=>
true
),
:method
=>
:put
,
:class
=>
"grey-button"
-
else
=
link_to
'Close'
,
project_merge_request_path
(
@project
,
@merge_request
,
:merge_request
=>
{
:closed
=>
true
},
:status_only
=>
true
),
:method
=>
:put
,
:class
=>
"grey-button"
.right
=
link_to
'Edit'
,
edit_project_merge_request_path
(
@project
,
@merge_request
),
:class
=>
"grey-button positive"
=
@merge_request
.
created_at
.
stamp
(
"Aug 21, 2011 9:23pm"
)
%hr
%br
%h3
=
simple_format
@merge_request
.
title
.clear
%br
%br
#gitlab-tabs
%ul
%li
=
link_to
"Notes"
,
"#merge-notes"
%li
=
link_to
"Commits"
,
commits_project_merge_request_path
(
@project
,
@merge_request
)
%li
=
link_to
"Diff"
,
diffs_project_merge_request_path
(
@project
,
@merge_request
)
.merge-tabs
=
link_to
"#notes"
,
:class
=>
"merge-notes-tab active tab"
do
%span
Notes
=
link_to
"#commits"
,
"data-url"
=>
commits_project_merge_request_path
(
@project
,
@merge_request
),
:class
=>
"merge-commits-tab tab"
do
%span
Commits
=
link_to
"#diffs"
,
"data-url"
=>
diffs_project_merge_request_path
(
@project
,
@merge_request
),
:class
=>
"merge-diffs-tab tab"
do
%span
Diff
#merge-notes
-
if
can?
(
current_user
,
:admin_project
,
@project
)
||
@merge_request
.
author
==
current_user
.right
-
if
@merge_request
.
closed
=
link_to
'Reopen'
,
project_merge_request_path
(
@project
,
@merge_request
,
:merge_request
=>
{
:closed
=>
false
},
:status_only
=>
true
),
:method
=>
:put
,
:class
=>
"red-button"
-
else
=
link_to
'Close'
,
project_merge_request_path
(
@project
,
@merge_request
,
:merge_request
=>
{
:closed
=>
true
},
:status_only
=>
true
),
:method
=>
:put
,
:class
=>
"positive-button"
,
:title
=>
"Close merge request"
%img
{
:src
=>
"/assets/ajax-loader-facebook.gif"
,
:class
=>
"dashboard-loader"
}
.merge-request-notes
.issue_notes
=
render
"notes/notes"
.loading
{
:style
=>
"display:none;"
}
%center
=
image_tag
"ajax-loader.gif"
.clear
.merge-request-commits
.merge-request-diffs
:javascript
$
(
function
(){
$
(
"
#gitlab-tabs
"
).
tabs
();
MergeRequest
.
init
();
})
spec/requests/merge_requests_spec.rb
View file @
6c47bcef
...
...
@@ -42,8 +42,8 @@ describe "MergeRequests" do
it
{
should
have_content
(
@merge_request
.
title
)
}
it
"Show page should inform user that merge request closed"
do
within
".merge-
request-show-holder h3
"
do
page
.
should
have_content
"
Closed
"
within
".merge-
tabs
"
do
page
.
should
have_content
"
Reopen
"
end
end
end
...
...
@@ -62,7 +62,7 @@ describe "MergeRequests" do
it
{
current_path
.
should
==
project_merge_request_path
(
project
,
project
.
merge_requests
.
last
)
}
it
"should create merge request"
do
page
.
should
have_content
"
Open
"
page
.
should
have_content
"
Close
"
page
.
should
have_content
@user
.
name
end
end
...
...
vendor/assets/stylesheets/jquery-ui/jquery-ui.css
View file @
6c47bcef
/*
* jQuery UI CSS Framework 1.8.16
* jQuery UI CSS Framework 1.8.16
Patched for GitLab HQ
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
...
...
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