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
09ff9bc7
Commit
09ff9bc7
authored
Feb 26, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Easily (un)mark merge request as WIP using link
Fixes #3768
parent
acf9778e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
67 additions
and
7 deletions
+67
-7
CHANGELOG
CHANGELOG
+1
-0
app/assets/javascripts/issuable_form.js.coffee
app/assets/javascripts/issuable_form.js.coffee
+41
-0
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+9
-2
app/views/projects/merge_requests/widget/open/_wip.html.haml
app/views/projects/merge_requests/widget/open/_wip.html.haml
+7
-1
app/views/shared/issuable/_form.html.haml
app/views/shared/issuable/_form.html.haml
+8
-4
config/routes.rb
config/routes.rb
+1
-0
No files found.
CHANGELOG
View file @
09ff9bc7
...
...
@@ -3,6 +3,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.6.0 (unreleased)
- Improve the formatting for the user page bio (Connor Shea)
- Fix avatar stretching by providing a cropping feature (Johann Pardanaud)
- Easily (un)mark merge request as WIP using link
- Use specialized system notes when MR is (un)marked as WIP
v 8.5.1
...
...
app/assets/javascripts/issuable_form.js.coffee
View file @
09ff9bc7
class
@
IssuableForm
wipRegex
:
/^\[?WIP(\]|:| )\s*/i
constructor
:
(
@
form
)
->
GitLab
.
GfmAutoComplete
.
setup
()
new
UsersSelect
()
...
...
@@ -14,6 +15,8 @@ class @IssuableForm
@
form
.
on
"submit"
,
@
resetAutosave
@
form
.
on
"click"
,
".btn-cancel"
,
@
resetAutosave
@
initWip
()
initAutosave
:
->
new
Autosave
@
titleField
,
[
document
.
location
.
pathname
,
...
...
@@ -30,3 +33,41 @@ class @IssuableForm
resetAutosave
:
=>
@
titleField
.
data
(
"autosave"
).
reset
()
@
descriptionField
.
data
(
"autosave"
).
reset
()
initWip
:
->
return
unless
@
form
.
find
(
".js-wip-explanation"
).
length
@
form
.
on
"click"
,
".js-remove-wip"
,
@
removeWip
@
form
.
on
"click"
,
".js-add-wip"
,
@
addWip
@
titleField
.
on
"change"
,
@
renderWipExplanation
@
renderWipExplanation
()
workInProgress
:
->
@
titleField
.
val
().
match
(
@
wipRegex
)
renderWipExplanation
:
=>
if
@
workInProgress
()
@
form
.
find
(
".js-wip-explanation"
).
show
()
@
form
.
find
(
".js-no-wip-explanation"
).
hide
()
else
@
form
.
find
(
".js-wip-explanation"
).
hide
()
@
form
.
find
(
".js-no-wip-explanation"
).
show
()
removeWip
:
(
event
)
=>
event
.
preventDefault
()
return
unless
@
workInProgress
()
@
titleField
.
val
@
titleField
.
val
().
replace
(
@
wipRegex
,
""
)
@
renderWipExplanation
()
addWip
:
(
event
)
=>
event
.
preventDefault
()
return
if
@
workInProgress
()
@
titleField
.
val
"WIP:
#{
@
titleField
.
val
()
}
"
@
renderWipExplanation
()
app/controllers/projects/merge_requests_controller.rb
View file @
09ff9bc7
...
...
@@ -2,7 +2,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
before_action
:module_enabled
before_action
:merge_request
,
only:
[
:edit
,
:update
,
:show
,
:diffs
,
:commits
,
:builds
,
:merge
,
:merge_check
,
:ci_status
,
:toggle_subscription
,
:cancel_merge_when_build_succeeds
:ci_status
,
:toggle_subscription
,
:cancel_merge_when_build_succeeds
,
:remove_wip
]
before_action
:closes_issues
,
only:
[
:edit
,
:update
,
:show
,
:diffs
,
:commits
,
:builds
]
before_action
:validates_merge_request
,
only:
[
:show
,
:diffs
,
:commits
,
:builds
]
...
...
@@ -17,7 +17,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
before_action
:authorize_create_merge_request!
,
only:
[
:new
,
:create
]
# Allow modify merge_request
before_action
:authorize_update_merge_request!
,
only:
[
:close
,
:edit
,
:update
,
:sort
]
before_action
:authorize_update_merge_request!
,
only:
[
:close
,
:edit
,
:update
,
:
remove_wip
,
:
sort
]
def
index
terms
=
params
[
'issue_search'
]
...
...
@@ -161,6 +161,13 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end
end
def
remove_wip
MergeRequests
::
UpdateService
.
new
(
project
,
current_user
,
title:
@merge_request
.
wipless_title
).
execute
(
@merge_request
)
redirect_to
namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
notice:
"The merge request can now be merged."
end
def
merge_check
@merge_request
.
check_if_can_be_merged
...
...
app/views/projects/merge_requests/widget/open/_wip.html.haml
View file @
09ff9bc7
...
...
@@ -2,4 +2,10 @@
This merge request is currently a Work In Progress
%p
When this merge request is ready, remove the "WIP" prefix from the title to allow it to be merged.
When this merge request is ready,
-
text
=
'remove the "WIP" prefix from the title'
-
if
can?
(
current_user
,
:update_merge_request
,
@merge_request
)
=
link_to
text
,
remove_wip_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
method: :post
-
else
=
text
to allow it to be merged.
app/views/shared/issuable/_form.html.haml
View file @
09ff9bc7
...
...
@@ -13,11 +13,15 @@
-
if
issuable
.
is_a?
(
MergeRequest
)
%p
.help-block
-
if
issuable
.
work_in_progress?
Remove the
<code>
WIP
</code>
prefix from the title to allow this
.js-wip-explanation
%a
{
href:
"#"
,
class:
"js-remove-wip"
,
data:
{
}}
Remove the
<code>
WIP
</code>
prefix from the title
to allow this
<strong>
Work In Progress
</strong>
merge request to be merged when it's ready.
-
else
Start the title with
<code>
[WIP]
</code>
or
<code>
WIP:
</code>
to prevent a
.js-no-wip-explanation
%a
{
href:
"#"
,
class:
"js-add-wip"
}
Start the title with
<code>
[WIP]
</code>
or
<code>
WIP:
</code>
to prevent a
<strong>
Work In Progress
</strong>
merge request from being merged before it's ready.
.form-group.detail-page-description
=
f
.
label
:description
,
'Description'
,
class:
'control-label'
...
...
config/routes.rb
View file @
09ff9bc7
...
...
@@ -599,6 +599,7 @@ Rails.application.routes.draw do
post
:cancel_merge_when_build_succeeds
get
:ci_status
post
:toggle_subscription
post
:remove_wip
end
collection
do
...
...
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