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
Boxiang Sun
gitlab-ce
Commits
05e63fe0
Commit
05e63fe0
authored
May 08, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MergeRequest#new 2 step process
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
23de3551
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
133 additions
and
3 deletions
+133
-3
app/views/projects/merge_requests/_new_compare.html.haml
app/views/projects/merge_requests/_new_compare.html.haml
+69
-0
app/views/projects/merge_requests/_new_submit.html.haml
app/views/projects/merge_requests/_new_submit.html.haml
+60
-0
app/views/projects/merge_requests/new.html.haml
app/views/projects/merge_requests/new.html.haml
+4
-3
No files found.
app/views/projects/merge_requests/_new_compare.html.haml
0 → 100644
View file @
05e63fe0
%h3
.page-title
Compare changes for new merge request
%hr
=
form_for
[
@project
,
@merge_request
],
url:
new_project_merge_request_path
(
@project
),
method: :get
,
html:
{
class:
"merge-request-form form-inline"
}
do
|
f
|
.merge-request-branches.row
.col-md-6
.panel.panel-default
.panel-heading
From
.panel-body
=
f
.
select
(
:source_project_id
,
[[
@merge_request
.
source_project_path
,
@merge_request
.
source_project
.
id
]]
,
{},
{
class:
'source_project select2 span3'
,
disabled:
@merge_request
.
persisted?
})
=
f
.
select
(
:source_branch
,
@merge_request
.
source_branches
,
{
include_blank:
"Select branch"
},
{
class:
'source_branch select2 span2'
})
.panel-footer
.mr_source_commit
.col-md-6
.panel.panel-default
.panel-heading
To
.panel-body
-
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?
})
=
f
.
select
(
:target_branch
,
@merge_request
.
target_branches
,
{
include_blank:
"Select branch"
},
{
class:
'target_branch select2 span2'
})
.panel-footer
.mr_target_commit
-
if
@merge_request
.
errors
.
any?
.alert.alert-danger
-
@merge_request
.
errors
.
full_messages
.
each
do
|
msg
|
%div
=
msg
-
if
@merge_request
.
source_branch
.
present?
&&
@merge_request
.
target_branch
.
present?
.light-well
%center
%h4
There isn't anything to merge.
%p
.slead
-
if
@merge_request
.
source_branch
==
@merge_request
.
target_branch
You'll need to use different branch names to get a valid comparison.
-
else
%span
.label-branch
#{
@merge_request
.
source_branch
}
and
%span
.label-branch
#{
@merge_request
.
target_branch
}
are the same.
.form-actions
=
f
.
submit
'Compare branches'
,
class:
"btn btn-primary"
:javascript
var
source_branch
=
$
(
"
#merge_request_source_branch
"
)
,
target_branch
=
$
(
"
#merge_request_target_branch
"
)
,
target_project
=
$
(
"
#merge_request_target_project_id
"
);
$
.
get
(
"
#{
branch_from_project_merge_requests_path
(
@source_project
)
}
"
,
{
ref
:
source_branch
.
val
()
});
$
.
get
(
"
#{
branch_to_project_merge_requests_path
(
@source_project
)
}
"
,
{
target_project_id
:
target_project
.
val
(),
ref
:
target_branch
.
val
()
});
target_project
.
on
(
"
change
"
,
function
()
{
$
.
get
(
"
#{
update_branches_project_merge_requests_path
(
@source_project
)
}
"
,
{
target_project_id
:
$
(
this
).
val
()
});
});
source_branch
.
on
(
"
change
"
,
function
()
{
$
.
get
(
"
#{
branch_from_project_merge_requests_path
(
@source_project
)
}
"
,
{
ref
:
$
(
this
).
val
()
});
});
target_branch
.
on
(
"
change
"
,
function
()
{
$
.
get
(
"
#{
branch_to_project_merge_requests_path
(
@source_project
)
}
"
,
{
target_project_id
:
target_project
.
val
(),
ref
:
$
(
this
).
val
()
});
});
app/views/projects/merge_requests/_new_submit.html.haml
0 → 100644
View file @
05e63fe0
%h3
.page-title
New merge request
%p
.slead
From
%strong
.monospace
#{
@merge_request
.
source_project_namespace
}
:
#{
@merge_request
.
source_branch
}
into
%strong
.monospace
#{
@merge_request
.
target_project_namespace
}
:
#{
@merge_request
.
target_branch
}
%span
.pull-right
=
link_to
'Change branches'
,
new_project_merge_request_path
(
@project
)
=
form_for
[
@project
,
@merge_request
],
html:
{
class:
"merge-request-form"
}
do
|
f
|
.panel.panel-default
.panel-body
.form-group
.light
=
f
.
label
:title
do
=
"Title *"
=
f
.
text_field
:title
,
class:
"form-control input-lg js-gfm-input"
,
maxlength:
255
,
rows:
5
,
required:
true
.form-group
.light
=
f
.
label
:description
,
"Description"
=
f
.
text_area
:description
,
class:
"form-control js-gfm-input"
,
rows:
10
%p
.hint
Description is parsed with
#{
link_to
"GitLab Flavored Markdown"
,
help_markdown_path
,
target:
'_blank'
}
.
.panel-footer
-
if
@target_repo
.
contribution_guide
-
contribution_guide_url
=
project_blob_path
(
@target_project
,
tree_join
(
@target_repo
.
root_ref
,
@target_repo
.
contribution_guide
.
name
))
%p
Please review the
%strong
#{
link_to
"guidelines for contribution"
,
contribution_guide_url
}
to this repository.
=
f
.
hidden_field
:source_project_id
=
f
.
hidden_field
:target_project_id
=
f
.
hidden_field
:target_branch
=
f
.
hidden_field
:source_branch
=
f
.
submit
'Submit a merge request'
,
class:
"btn btn-create"
.mr-compare
%div
.ui-box
.title
Commits (
#{
@commits
.
count
}
)
-
if
@commits
.
size
>
MergeRequestDiff
::
COMMITS_SAFE_SIZE
%ul
.well-list
-
Commit
.
decorate
(
@commits
.
first
(
MergeRequestDiff
::
COMMITS_SAFE_SIZE
)).
each
do
|
commit
|
=
render
"projects/commits/inline_commit"
,
commit:
commit
,
project:
@project
%li
.warning-row.unstyled
other
#{
@commits
.
size
-
MergeRequestDiff
::
COMMITS_SAFE_SIZE
}
commits hidden to prevent performance issues.
-
else
%ul
.well-list
=
render
Commit
.
decorate
(
@commits
),
project:
@project
%h4
Changes
-
if
@diffs
.
present?
=
render
"projects/commits/diffs"
,
diffs:
@diffs
,
project:
@project
-
elsif
@commits
.
size
>
MergeRequestDiff
::
COMMITS_SAFE_SIZE
.bs-callout.bs-callout-danger
%h4
This comparison includes more than
#{
MergeRequestDiff
::
COMMITS_SAFE_SIZE
}
commits.
%p
To preserve performance the line changes are not shown.
app/views/projects/merge_requests/new.html.haml
View file @
05e63fe0
%h3
.page-title
New Merge Request
%hr
=
render
'form'
-
if
@commits
.
present?
=
render
'new_submit'
-
else
=
render
'new_compare'
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