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
c5c05f6a
Commit
c5c05f6a
authored
Mar 15, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated UI for new merge request
Closes #2540
parent
f76bfed9
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
138 additions
and
61 deletions
+138
-61
app/assets/javascripts/compare.js.coffee
app/assets/javascripts/compare.js.coffee
+61
-0
app/assets/stylesheets/pages/merge_requests.scss
app/assets/stylesheets/pages/merge_requests.scss
+47
-4
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+2
-0
app/helpers/commits_helper.rb
app/helpers/commits_helper.rb
+2
-2
app/views/projects/commits/_commit.html.haml
app/views/projects/commits/_commit.html.haml
+1
-1
app/views/projects/merge_requests/_new_compare.html.haml
app/views/projects/merge_requests/_new_compare.html.haml
+23
-48
app/views/projects/merge_requests/branch_from.html.haml
app/views/projects/merge_requests/branch_from.html.haml
+1
-0
app/views/projects/merge_requests/branch_from.js.haml
app/views/projects/merge_requests/branch_from.js.haml
+0
-3
app/views/projects/merge_requests/branch_to.html.haml
app/views/projects/merge_requests/branch_to.html.haml
+1
-0
app/views/projects/merge_requests/branch_to.js.haml
app/views/projects/merge_requests/branch_to.js.haml
+0
-3
No files found.
app/assets/javascripts/compare.js.coffee
0 → 100644
View file @
c5c05f6a
class
@
Compare
constructor
:
(
@
opts
)
->
@
source_loading
=
$
".js-source-loading"
@
target_loading
=
$
".js-target-loading"
@
source_branch
=
$
"#merge_request_source_branch"
@
target_branch
=
$
"#merge_request_target_branch"
@
target_project
=
$
"#merge_request_target_project_id"
@
initialState
()
@
cleanBinding
()
@
addBinding
()
cleanBinding
:
->
@
source_branch
.
off
"change"
@
target_branch
.
off
"change"
@
target_project
.
off
"change"
addBinding
:
->
@
source_branch
.
on
"change"
,
=>
@
getSourceHtml
()
@
target_branch
.
on
"change"
,
=>
@
getTargetHtml
()
@
target_project
.
on
"change"
,
=>
@
getTargetProject
()
initialState
:
->
@
getSourceHtml
()
@
getTargetHtml
()
getTargetProject
:
->
$
.
get
@
opts
.
targetProjectUrl
,
target_project_id
:
@
target_project
.
val
()
getSourceHtml
:
->
$
.
ajax
(
url
:
@
opts
.
sourceBranchUrl
data
:
ref
:
@
source_branch
.
val
()
beforeSend
:
=>
@
source_loading
.
show
()
$
(
".mr_source_commit"
).
html
""
success
:
(
html
)
=>
@
source_loading
.
hide
()
$
(
".mr_source_commit"
).
html
html
$
(
".mr_source_commit .js-timeago"
).
timeago
()
)
getTargetHtml
:
->
$
.
ajax
(
url
:
@
opts
.
targetBranchUrl
data
:
target_project_id
:
@
target_project
.
val
()
ref
:
@
target_branch
.
val
()
beforeSend
:
=>
@
target_loading
.
show
()
$
(
".mr_target_commit"
).
html
""
success
:
(
html
)
=>
@
target_loading
.
hide
()
$
(
".mr_target_commit"
).
html
html
$
(
".mr_target_commit .js-timeago"
).
timeago
()
)
app/assets/stylesheets/pages/merge_requests.scss
View file @
c5c05f6a
...
@@ -123,6 +123,8 @@
...
@@ -123,6 +123,8 @@
.mr_source_commit
,
.mr_source_commit
,
.mr_target_commit
{
.mr_target_commit
{
margin-bottom
:
0
;
.commit
{
.commit
{
margin
:
0
;
margin
:
0
;
padding
:
2px
0
;
padding
:
2px
0
;
...
@@ -174,10 +176,6 @@
...
@@ -174,10 +176,6 @@
display
:
none
;
display
:
none
;
}
}
.merge-request-form
.select2-container
{
width
:
250px
!
important
;
}
#modal_merge_info
.modal-dialog
{
#modal_merge_info
.modal-dialog
{
width
:
600px
;
width
:
600px
;
...
@@ -200,3 +198,48 @@
...
@@ -200,3 +198,48 @@
overflow-x
:
scroll
;
overflow-x
:
scroll
;
}
}
}
}
.panel-new-merge-request
{
.panel-heading
{
padding
:
5px
10px
;
font-weight
:
600
;
line-height
:
25px
;
}
.panel-body
{
padding
:
10px
5px
;
}
.panel-footer
{
padding
:
10px
10px
;
}
.commit
{
.commit-row-title
{
margin-bottom
:
4px
;
}
.avatar
{
width
:
20px
;
height
:
20px
;
margin-right
:
5px
;
}
.commit-row-info
{
line-height
:
20px
;
}
}
.btn-clipboard
{
margin-right
:
5px
;
padding
:
0
;
background
:
transparent
;
}
}
.merge-request-select
{
float
:
left
;
width
:
50%
;
padding-left
:
5px
;
padding-right
:
5px
;
}
app/controllers/projects/merge_requests_controller.rb
View file @
c5c05f6a
...
@@ -207,11 +207,13 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -207,11 +207,13 @@ class Projects::MergeRequestsController < Projects::ApplicationController
#This is always source
#This is always source
@source_project
=
@merge_request
.
nil?
?
@project
:
@merge_request
.
source_project
@source_project
=
@merge_request
.
nil?
?
@project
:
@merge_request
.
source_project
@commit
=
@repository
.
commit
(
params
[
:ref
])
if
params
[
:ref
].
present?
@commit
=
@repository
.
commit
(
params
[
:ref
])
if
params
[
:ref
].
present?
render
layout:
false
end
end
def
branch_to
def
branch_to
@target_project
=
selected_target_project
@target_project
=
selected_target_project
@commit
=
@target_project
.
commit
(
params
[
:ref
])
if
params
[
:ref
].
present?
@commit
=
@target_project
.
commit
(
params
[
:ref
])
if
params
[
:ref
].
present?
render
layout:
false
end
end
def
update_branches
def
update_branches
...
...
app/helpers/commits_helper.rb
View file @
c5c05f6a
...
@@ -28,7 +28,7 @@ module CommitsHelper
...
@@ -28,7 +28,7 @@ module CommitsHelper
def
commit_to_html
(
commit
,
project
,
inline
=
true
)
def
commit_to_html
(
commit
,
project
,
inline
=
true
)
template
=
inline
?
"inline_commit"
:
"commit"
template
=
inline
?
"inline_commit"
:
"commit"
escape_javascript
(
render
"projects/commits/
#{
template
}
"
,
commit:
commit
,
project:
project
)
unless
commit
.
nil?
render
"projects/commits/
#{
template
}
"
,
commit:
commit
,
project:
project
unless
commit
.
nil?
end
end
# Breadcrumb links for a Project and, if applicable, a tree path
# Breadcrumb links for a Project and, if applicable, a tree path
...
@@ -117,7 +117,7 @@ module CommitsHelper
...
@@ -117,7 +117,7 @@ module CommitsHelper
end
end
end
end
link_to
(
link_to
(
"Browse Files
»
"
,
"Browse Files"
,
namespace_project_tree_path
(
project
.
namespace
,
project
,
commit
),
namespace_project_tree_path
(
project
.
namespace
,
project
,
commit
),
class:
"pull-right"
class:
"pull-right"
)
)
...
...
app/views/projects/commits/_commit.html.haml
View file @
c5c05f6a
...
@@ -35,8 +35,8 @@
...
@@ -35,8 +35,8 @@
=
preserve
(
markdown
(
escape_once
(
commit
.
description
),
pipeline: :single_line
))
=
preserve
(
markdown
(
escape_once
(
commit
.
description
),
pipeline: :single_line
))
.commit-row-info
.commit-row-info
by
=
commit_author_link
(
commit
,
avatar:
true
,
size:
24
)
=
commit_author_link
(
commit
,
avatar:
true
,
size:
24
)
authored
.committed_ago
.committed_ago
#{
time_ago_with_tooltip
(
commit
.
committed_date
,
skip_js:
true
)
}
#{
time_ago_with_tooltip
(
commit
.
committed_date
,
skip_js:
true
)
}
=
link_to_browse_code
(
project
,
commit
)
=
link_to_browse_code
(
project
,
commit
)
app/views/projects/merge_requests/_new_compare.html.haml
View file @
c5c05f6a
...
@@ -5,27 +5,31 @@
...
@@ -5,27 +5,31 @@
.hide.alert.alert-danger.mr-compare-errors
.hide.alert.alert-danger.mr-compare-errors
.merge-request-branches.row
.merge-request-branches.row
.col-md-6
.col-md-6
.panel.panel-default
.panel.panel-default
.panel-new-merge-request
.panel-heading
.panel-heading
%strong
Source branch
Source branch
.panel-body
.panel-body.clearfix
=
f
.
select
(
:source_project_id
,
[[
@merge_request
.
source_project_path
,
@merge_request
.
source_project
.
id
]]
,
{},
{
class:
'source_project select2 span3'
,
disabled:
@merge_request
.
persisted?
,
required:
true
})
.merge-request-select
=
f
.
select
(
:source_project_id
,
[[
@merge_request
.
source_project_path
,
@merge_request
.
source_project
.
id
]]
,
{},
{
class:
'source_project select2'
,
disabled:
@merge_request
.
persisted?
,
required:
true
})
=
f
.
select
(
:source_branch
,
@merge_request
.
source_branches
,
{
include_blank:
true
},
{
class:
'source_branch select2 span2'
,
required:
true
,
data:
{
placeholder:
"Select source branch"
}
})
.merge-request-select
=
f
.
select
(
:source_branch
,
@merge_request
.
source_branches
,
{
include_blank:
true
},
{
class:
'source_branch select2'
,
required:
true
,
data:
{
placeholder:
"Select source branch"
}
})
.panel-footer
.panel-footer
.mr_source_commit
=
icon
(
'spinner spin'
,
class:
"js-source-loading"
)
%ul
.list-unstyled.mr_source_commit
.col-md-6
.col-md-6
.panel.panel-default
.panel.panel-default
.panel-new-merge-request
.panel-heading
.panel-heading
%strong
Target branch
Target branch
.panel-body
.panel-body
.clearfix
-
projects
=
@project
.
forked_from_project
.
nil?
?
[
@project
]
:
[
@project
,
@project
.
forked_from_project
]
-
projects
=
@project
.
forked_from_project
.
nil?
?
[
@project
]
:
[
@project
,
@project
.
forked_from_project
]
=
f
.
select
(
:target_project_id
,
options_from_collection_for_select
(
projects
,
'id'
,
'path_with_namespace'
,
f
.
object
.
target_project_id
),
{},
{
class:
'target_project select2 span3'
,
disabled:
@merge_request
.
persisted?
,
required:
true
})
.merge-request-select
=
f
.
select
(
:target_project_id
,
options_from_collection_for_select
(
projects
,
'id'
,
'path_with_namespace'
,
f
.
object
.
target_project_id
),
{},
{
class:
'target_project select2'
,
disabled:
@merge_request
.
persisted?
,
required:
true
})
=
f
.
select
(
:target_branch
,
@merge_request
.
target_branches
,
{
include_blank:
true
},
{
class:
'target_branch select2 span2'
,
required:
true
,
data:
{
placeholder:
"Select target branch"
}
})
.merge-request-select
=
f
.
select
(
:target_branch
,
@merge_request
.
target_branches
,
{
include_blank:
true
},
{
class:
'target_branch select2'
,
required:
true
,
data:
{
placeholder:
"Select target branch"
}
})
.panel-footer
.panel-footer
.mr_target_commit
=
icon
(
'spinner spin'
,
class:
"js-target-loading"
)
%ul
.list-unstyled.mr_target_commit
-
if
@merge_request
.
errors
.
any?
-
if
@merge_request
.
errors
.
any?
.alert.alert-danger
.alert.alert-danger
...
@@ -45,40 +49,11 @@
...
@@ -45,40 +49,11 @@
and
and
%span
.label-branch
#{
@merge_request
.
target_branch
}
%span
.label-branch
#{
@merge_request
.
target_branch
}
are the same.
are the same.
=
f
.
submit
'Compare branches and continue'
,
class:
"btn btn-new mr-compare-btn"
.form-actions
=
f
.
submit
'Compare branches and continue'
,
class:
"btn btn-new mr-compare-btn"
:javascript
var
source_branch
=
$
(
"
#merge_request_source_branch
"
)
,
target_branch
=
$
(
"
#merge_request_target_branch
"
)
,
target_project
=
$
(
"
#merge_request_target_project_id
"
);
$
.
get
(
"
#{
branch_from_namespace_project_merge_requests_path
(
@source_project
.
namespace
,
@source_project
)
}
"
,
{
ref
:
source_branch
.
val
()
});
$
.
get
(
"
#{
branch_to_namespace_project_merge_requests_path
(
@source_project
.
namespace
,
@source_project
)
}
"
,
{
target_project_id
:
target_project
.
val
(),
ref
:
target_branch
.
val
()
});
target_project
.
on
(
"
change
"
,
function
()
{
$
.
get
(
"
#{
update_branches_namespace_project_merge_requests_path
(
@source_project
.
namespace
,
@source_project
)
}
"
,
{
target_project_id
:
$
(
this
).
val
()
});
});
source_branch
.
on
(
"
change
"
,
function
()
{
$
.
get
(
"
#{
branch_from_namespace_project_merge_requests_path
(
@source_project
.
namespace
,
@source_project
)
}
"
,
{
ref
:
$
(
this
).
val
()
});
$
(
"
.mr-compare-errors
"
).
fadeOut
();
$
(
"
.mr-compare-btn
"
).
enable
();
});
target_branch
.
on
(
"
change
"
,
function
()
{
$
.
get
(
"
#{
branch_to_namespace_project_merge_requests_path
(
@source_project
.
namespace
,
@source_project
)
}
"
,
{
target_project_id
:
target_project
.
val
(),
ref
:
$
(
this
).
val
()
});
$
(
"
.mr-compare-errors
"
).
fadeOut
();
$
(
"
.mr-compare-btn
"
).
enable
();
});
:javascript
:javascript
$
(
"
.merge-request-form
"
).
on
(
'
submit
'
,
function
()
{
new
Compare
({
if
(
$
(
"
#merge_request_source_branch
"
).
val
()
===
""
||
$
(
'
#merge_request_target_branch
'
).
val
()
===
""
)
{
targetProjectUrl
:
"
#{
update_branches_namespace_project_merge_requests_path
(
@source_project
.
namespace
,
@source_project
)
}
"
,
$
(
"
.mr-compare-errors
"
).
html
(
"
You must select source and target branch to proceed
"
);
sourceBranchUrl
:
"
#{
branch_from_namespace_project_merge_requests_path
(
@source_project
.
namespace
,
@source_project
)
}
"
,
$
(
"
.mr-compare-errors
"
).
fadeIn
();
targetBranchUrl
:
"
#{
branch_to_namespace_project_merge_requests_path
(
@source_project
.
namespace
,
@source_project
)
}
"
event
.
preventDefault
();
return
;
}
});
});
app/views/projects/merge_requests/branch_from.html.haml
0 → 100644
View file @
c5c05f6a
=
commit_to_html
(
@commit
,
@source_project
,
false
)
app/views/projects/merge_requests/branch_from.js.haml
deleted
100644 → 0
View file @
f76bfed9
:plain
$(".mr_source_commit").html("
#{
commit_to_html
(
@commit
,
@source_project
,
false
)
}
");
$('.js-timeago').timeago()
app/views/projects/merge_requests/branch_to.html.haml
0 → 100644
View file @
c5c05f6a
=
commit_to_html
(
@commit
,
@target_project
,
false
)
app/views/projects/merge_requests/branch_to.js.haml
deleted
100644 → 0
View file @
f76bfed9
:plain
$(".mr_target_commit").html("
#{
commit_to_html
(
@commit
,
@target_project
,
false
)
}
");
$('.js-timeago').timeago()
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