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
ec8628fa
Commit
ec8628fa
authored
Feb 18, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/mr_context' into 'master'
Allow change assignee/milestone from MergeRequest show page
parents
9d637d57
70212889
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
138 additions
and
107 deletions
+138
-107
app/assets/javascripts/merge_request.js.coffee
app/assets/javascripts/merge_request.js.coffee
+103
-0
app/assets/javascripts/merge_requests.js.coffee
app/assets/javascripts/merge_requests.js.coffee
+0
-96
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+8
-1
app/views/projects/issues/_issue_context.html.haml
app/views/projects/issues/_issue_context.html.haml
+1
-1
app/views/projects/merge_requests/show/_context.html.haml
app/views/projects/merge_requests/show/_context.html.haml
+23
-0
app/views/projects/merge_requests/show/_mr_box.html.haml
app/views/projects/merge_requests/show/_mr_box.html.haml
+1
-9
app/views/projects/merge_requests/update.js.haml
app/views/projects/merge_requests/update.js.haml
+2
-0
No files found.
app/assets/javascripts/merge_request.js.coffee
0 → 100644
View file @
ec8628fa
class
MergeRequest
constructor
:
(
@
opts
)
->
@
initContextWidget
()
this
.
$el
=
$
(
'.merge-request'
)
@
diffs_loaded
=
if
@
opts
.
action
==
'diffs'
then
true
else
false
@
commits_loaded
=
false
this
.
activateTab
(
@
opts
.
action
)
this
.
bindEvents
()
this
.
initMergeWidget
()
this
.
$
(
'.show-all-commits'
).
on
'click'
,
=>
this
.
showAllCommits
()
modal
=
$
(
'#modal_merge_info'
).
modal
(
show
:
false
)
disableButtonIfEmptyField
'#merge_commit_message'
,
'.accept_merge_request'
# Local jQuery finder
$
:
(
selector
)
->
this
.
$el
.
find
(
selector
)
initContextWidget
:
->
$
(
'.edit-merge_request.inline-update input[type="submit"]'
).
hide
()
$
(
".issue-box .inline-update"
).
on
"change"
,
"select"
,
->
$
(
this
).
submit
()
$
(
".issue-box .inline-update"
).
on
"change"
,
"#merge_request_assignee_id"
,
->
$
(
this
).
submit
()
initMergeWidget
:
->
this
.
showState
(
@
opts
.
current_status
)
if
this
.
$
(
'.automerge_widget'
).
length
and
@
opts
.
check_enable
$
.
get
@
opts
.
url_to_automerge_check
,
(
data
)
=>
this
.
showState
(
data
.
merge_status
)
,
'json'
if
@
opts
.
ci_enable
$
.
get
@
opts
.
url_to_ci_check
,
(
data
)
=>
this
.
showCiState
data
.
status
,
'json'
bindEvents
:
->
this
.
$
(
'.nav-tabs'
).
on
'click'
,
'a'
,
(
event
)
=>
a
=
$
(
event
.
currentTarget
)
href
=
a
.
attr
(
'href'
)
History
.
replaceState
{
path
:
href
},
document
.
title
,
href
event
.
preventDefault
()
this
.
$
(
'.nav-tabs'
).
on
'click'
,
'li'
,
(
event
)
=>
this
.
activateTab
(
$
(
event
.
currentTarget
).
data
(
'action'
))
this
.
$
(
'.accept_merge_request'
).
on
'click'
,
->
$
(
'.automerge_widget.can_be_merged'
).
hide
()
$
(
'.merge-in-progress'
).
show
()
activateTab
:
(
action
)
->
this
.
$
(
'.nav-tabs li'
).
removeClass
'active'
this
.
$
(
'.tab-content'
).
hide
()
switch
action
when
'diffs'
this
.
$
(
'.nav-tabs .diffs-tab'
).
addClass
'active'
this
.
loadDiff
()
unless
@
diffs_loaded
this
.
$
(
'.diffs'
).
show
()
else
this
.
$
(
'.nav-tabs .notes-tab'
).
addClass
'active'
this
.
$
(
'.notes'
).
show
()
showState
:
(
state
)
->
$
(
'.automerge_widget'
).
hide
()
$
(
'.automerge_widget.'
+
state
).
show
()
showCiState
:
(
state
)
->
$
(
'.ci_widget'
).
hide
()
$
(
'.ci_widget.ci-'
+
state
).
show
()
loadDiff
:
(
event
)
->
$
.
ajax
type
:
'GET'
url
:
this
.
$
(
'.nav-tabs .diffs-tab a'
).
attr
(
'href'
)
beforeSend
:
=>
this
.
$
(
'.status'
).
addClass
'loading'
complete
:
=>
@
diffs_loaded
=
true
this
.
$
(
'.status'
).
removeClass
'loading'
success
:
(
data
)
=>
this
.
$
(
".diffs"
).
html
(
data
.
html
)
dataType
:
'json'
showAllCommits
:
->
this
.
$
(
'.first-commits'
).
remove
()
this
.
$
(
'.all-commits'
).
removeClass
'hide'
alreadyOrCannotBeMerged
:
->
this
.
$
(
'.automerge_widget'
).
hide
()
this
.
$
(
'.merge-in-progress'
).
hide
()
this
.
$
(
'.automerge_widget.already_cannot_be_merged'
).
show
()
this
.
MergeRequest
=
MergeRequest
app/assets/javascripts/merge_requests.js.coffee
View file @
ec8628fa
...
@@ -6,99 +6,3 @@
...
@@ -6,99 +6,3 @@
$
(
'#milestone_id'
).
select2
()
$
(
'#milestone_id'
).
select2
()
$
(
'#milestone_id, #assignee_id'
).
on
'change'
,
->
$
(
'#milestone_id, #assignee_id'
).
on
'change'
,
->
$
(
this
).
closest
(
'form'
).
submit
()
$
(
this
).
closest
(
'form'
).
submit
()
class
MergeRequest
constructor
:
(
@
opts
)
->
this
.
$el
=
$
(
'.merge-request'
)
@
diffs_loaded
=
if
@
opts
.
action
==
'diffs'
then
true
else
false
@
commits_loaded
=
false
this
.
activateTab
(
@
opts
.
action
)
this
.
bindEvents
()
this
.
initMergeWidget
()
this
.
$
(
'.show-all-commits'
).
on
'click'
,
=>
this
.
showAllCommits
()
modal
=
$
(
'#modal_merge_info'
).
modal
(
show
:
false
)
disableButtonIfEmptyField
'#merge_commit_message'
,
'.accept_merge_request'
# Local jQuery finder
$
:
(
selector
)
->
this
.
$el
.
find
(
selector
)
initMergeWidget
:
->
this
.
showState
(
@
opts
.
current_status
)
if
this
.
$
(
'.automerge_widget'
).
length
and
@
opts
.
check_enable
$
.
get
@
opts
.
url_to_automerge_check
,
(
data
)
=>
this
.
showState
(
data
.
merge_status
)
,
'json'
if
@
opts
.
ci_enable
$
.
get
@
opts
.
url_to_ci_check
,
(
data
)
=>
this
.
showCiState
data
.
status
,
'json'
bindEvents
:
->
this
.
$
(
'.nav-tabs'
).
on
'click'
,
'a'
,
(
event
)
=>
a
=
$
(
event
.
currentTarget
)
href
=
a
.
attr
(
'href'
)
History
.
replaceState
{
path
:
href
},
document
.
title
,
href
event
.
preventDefault
()
this
.
$
(
'.nav-tabs'
).
on
'click'
,
'li'
,
(
event
)
=>
this
.
activateTab
(
$
(
event
.
currentTarget
).
data
(
'action'
))
this
.
$
(
'.accept_merge_request'
).
on
'click'
,
->
$
(
'.automerge_widget.can_be_merged'
).
hide
()
$
(
'.merge-in-progress'
).
show
()
activateTab
:
(
action
)
->
this
.
$
(
'.nav-tabs li'
).
removeClass
'active'
this
.
$
(
'.tab-content'
).
hide
()
switch
action
when
'diffs'
this
.
$
(
'.nav-tabs .diffs-tab'
).
addClass
'active'
this
.
loadDiff
()
unless
@
diffs_loaded
this
.
$
(
'.diffs'
).
show
()
else
this
.
$
(
'.nav-tabs .notes-tab'
).
addClass
'active'
this
.
$
(
'.notes'
).
show
()
showState
:
(
state
)
->
$
(
'.automerge_widget'
).
hide
()
$
(
'.automerge_widget.'
+
state
).
show
()
showCiState
:
(
state
)
->
$
(
'.ci_widget'
).
hide
()
$
(
'.ci_widget.ci-'
+
state
).
show
()
loadDiff
:
(
event
)
->
$
.
ajax
type
:
'GET'
url
:
this
.
$
(
'.nav-tabs .diffs-tab a'
).
attr
(
'href'
)
beforeSend
:
=>
this
.
$
(
'.status'
).
addClass
'loading'
complete
:
=>
@
diffs_loaded
=
true
this
.
$
(
'.status'
).
removeClass
'loading'
success
:
(
data
)
=>
this
.
$
(
".diffs"
).
html
(
data
.
html
)
dataType
:
'json'
showAllCommits
:
->
this
.
$
(
'.first-commits'
).
remove
()
this
.
$
(
'.all-commits'
).
removeClass
'hide'
alreadyOrCannotBeMerged
:
->
this
.
$
(
'.automerge_widget'
).
hide
()
this
.
$
(
'.merge-in-progress'
).
hide
()
this
.
$
(
'.automerge_widget.already_cannot_be_merged'
).
show
()
this
.
MergeRequest
=
MergeRequest
app/controllers/projects/merge_requests_controller.rb
View file @
ec8628fa
...
@@ -108,8 +108,15 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -108,8 +108,15 @@ class Projects::MergeRequestsController < Projects::ApplicationController
if
@merge_request
.
update_attributes
(
params
[
:merge_request
].
merge
(
author_id_of_changes:
current_user
.
id
))
if
@merge_request
.
update_attributes
(
params
[
:merge_request
].
merge
(
author_id_of_changes:
current_user
.
id
))
@merge_request
.
reload_code
@merge_request
.
reload_code
@merge_request
.
mark_as_unchecked
@merge_request
.
mark_as_unchecked
@merge_request
.
reset_events_cache
@merge_request
.
reset_events_cache
redirect_to
[
@merge_request
.
target_project
,
@merge_request
],
notice:
'Merge request was successfully updated.'
respond_to
do
|
format
|
format
.
js
format
.
html
do
redirect_to
[
@merge_request
.
target_project
,
@merge_request
],
notice:
'Merge request was successfully updated.'
end
end
else
else
render
"edit"
render
"edit"
end
end
...
...
app/views/projects/issues/_issue_context.html.haml
View file @
ec8628fa
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
\ and currently assigned to
\ and currently assigned to
-
if
can?
(
current_user
,
:modify_issue
,
@issue
)
-
if
can?
(
current_user
,
:modify_issue
,
@issue
)
=
project_users_select_tag
(
'issue[assignee_id]'
,
placeholder:
'Select a
user
'
,
class:
'custom-form-control'
,
selected:
@issue
.
assignee_id
)
=
project_users_select_tag
(
'issue[assignee_id]'
,
placeholder:
'Select a
ssignee
'
,
class:
'custom-form-control'
,
selected:
@issue
.
assignee_id
)
-
elsif
issue
.
assignee
-
elsif
issue
.
assignee
=
link_to_member
(
@project
,
@issue
.
assignee
)
=
link_to_member
(
@project
,
@issue
.
assignee
)
...
...
app/views/projects/merge_requests/show/_context.html.haml
0 → 100644
View file @
ec8628fa
=
form_for
[
@project
,
@merge_request
],
remote:
true
,
html:
{
class:
'edit-merge_request inline-update'
}
do
|
f
|
Created by
#{
link_to_member
(
@project
,
merge_request
.
author
)
}
-
if
merge_request
.
assignee
\ and currently assigned to
-
if
can?
(
current_user
,
:modify_merge_request
,
@merge_request
)
=
project_users_select_tag
(
'merge_request[assignee_id]'
,
placeholder:
'Select assignee'
,
class:
'custom-form-control'
,
selected:
@merge_request
.
assignee_id
)
-
elsif
merge_request
.
assignee
=
link_to_member
(
@project
,
@merge_request
.
assignee
)
.pull-right.hidden-sm.hidden-xs
-
if
merge_request
.
milestone
-
milestone
=
merge_request
.
milestone
%cite
.cgray
Attached to milestone
-
if
can?
(
current_user
,
:modify_merge_request
,
@merge_request
)
=
f
.
select
(
:milestone_id
,
milestone_options
(
@merge_request
),
{
include_blank:
"Select milestone (none):"
},
{
class:
'select2 select2-compact'
})
=
hidden_field_tag
:merge_request_context
=
f
.
submit
class:
'btn'
-
elsif
merge_request
.
milestone
=
link_to
merge_request
.
milestone
.
title
,
project_milestone_path
app/views/projects/merge_requests/show/_mr_box.html.haml
View file @
ec8628fa
...
@@ -4,15 +4,7 @@
...
@@ -4,15 +4,7 @@
.context
.context
%cite
.cgray
%cite
.cgray
Created by
#{
link_to_member
(
@project
,
@merge_request
.
author
)
}
.
=
render
partial:
'projects/merge_requests/show/context'
,
locals:
{
merge_request:
@merge_request
}
-
if
@merge_request
.
assignee
Currently assigned to
#{
link_to_member
(
@project
,
@merge_request
.
assignee
)
}
.
-
if
@merge_request
.
milestone
.pull-right
-
milestone
=
@merge_request
.
milestone
%cite
.cgray
Attached to milestone
%strong
=
link_to_gfm
truncate
(
milestone
.
title
,
length:
20
),
project_milestone_path
(
milestone
.
project
,
milestone
)
-
if
@merge_request
.
description
.
present?
-
if
@merge_request
.
description
.
present?
.description
.description
...
...
app/views/projects/merge_requests/update.js.haml
0 → 100644
View file @
ec8628fa
-
if
params
[
:merge_request_context
]
$('.issue-box .context').effect('highlight');
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