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
5e004719
Commit
5e004719
authored
Jan 31, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bug/broken_mr_select' into 'master'
Fix broken merge request select Fixes #991
parents
9e181d36
f416b2f5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
4 deletions
+27
-4
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+5
-2
app/models/merge_request.rb
app/models/merge_request.rb
+20
-0
app/views/projects/merge_requests/_form.html.haml
app/views/projects/merge_requests/_form.html.haml
+2
-2
No files found.
app/controllers/projects/merge_requests_controller.rb
View file @
5e004719
...
...
@@ -60,7 +60,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@merge_request
=
MergeRequest
.
new
(
params
[
:merge_request
])
@merge_request
.
source_project
=
@project
unless
@merge_request
.
source_project
@merge_request
.
target_project
=
@project
unless
@merge_request
.
target_project
@target_branches
=
@merge_request
.
target_project
.
nil?
?
[]
:
@merge_request
.
target_project
.
repository
.
branch_names
@source_project
=
@merge_request
.
source_project
@merge_request
end
...
...
@@ -167,7 +166,11 @@ class Projects::MergeRequestsController < Projects::ApplicationController
protected
def
selected_target_project
((
@project
.
id
.
to_s
==
params
[
:target_project_id
])
||
@project
.
forked_project_link
.
nil?
)
?
@project
:
@project
.
forked_project_link
.
forked_from_project
if
@project
.
id
.
to_s
==
params
[
:target_project_id
]
||
@project
.
forked_project_link
.
nil?
@project
else
@project
.
forked_project_link
.
forked_from_project
end
end
def
merge_request
...
...
app/models/merge_request.rb
View file @
5e004719
...
...
@@ -253,4 +253,24 @@ class MergeRequest < ActiveRecord::Base
message
<<
description
.
to_s
message
end
# Return array of possible target branches
# dependes on target project of MR
def
target_branches
if
target_project
.
nil?
[]
else
target_project
.
repository
.
branch_names
end
end
# Return array of possible source branches
# dependes on source project of MR
def
source_branches
if
source_project
.
nil?
[]
else
source_project
.
repository
.
branch_names
end
end
end
app/views/projects/merge_requests/_form.html.haml
View file @
5e004719
...
...
@@ -13,7 +13,7 @@
=
f
.
select
(
:source_project_id
,
[[
@merge_request
.
source_project_path
,
@merge_request
.
source_project
.
id
]]
,
{},
{
class:
'source_project select2 span3'
,
disabled:
@merge_request
.
persisted?
})
.pull-left
=
f
.
select
(
:source_branch
,
@merge_request
.
source_
project
.
repository
.
branch_nam
es
,
{
include_blank:
"Select branch"
},
{
class:
'source_branch select2 span2'
})
=
f
.
select
(
:source_branch
,
@merge_request
.
source_
branch
es
,
{
include_blank:
"Select branch"
},
{
class:
'source_branch select2 span2'
})
.mr_source_commit.prepend-top-10
.col-md-2
.merge-request-angle
...
...
@@ -25,7 +25,7 @@
=
f
.
select
(
:target_project_id
,
options_from_collection_for_select
(
projects
,
'id'
,
'path_with_namespace'
),
{},
{
class:
'target_project select2 span3'
,
disabled:
@merge_request
.
persisted?
})
.pull-left
=
f
.
select
(
:target_branch
,
@target_branches
,
{
include_blank:
"Select branch"
},
{
class:
'target_branch select2 span2'
})
=
f
.
select
(
:target_branch
,
@
merge_request
.
target_branches
,
{
include_blank:
"Select branch"
},
{
class:
'target_branch select2 span2'
})
.mr_target_commit.prepend-top-10
%hr
...
...
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