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
Tatuya Kamada
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.
...
@@ -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)
v 8.6.0 (unreleased)
- Improve the formatting for the user page bio (Connor Shea)
- Improve the formatting for the user page bio (Connor Shea)
- Fix avatar stretching by providing a cropping feature (Johann Pardanaud)
- 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
- Use specialized system notes when MR is (un)marked as WIP
v 8.5.1
v 8.5.1
...
...
app/assets/javascripts/issuable_form.js.coffee
View file @
09ff9bc7
class
@
IssuableForm
class
@
IssuableForm
wipRegex
:
/^\[?WIP(\]|:| )\s*/i
constructor
:
(
@
form
)
->
constructor
:
(
@
form
)
->
GitLab
.
GfmAutoComplete
.
setup
()
GitLab
.
GfmAutoComplete
.
setup
()
new
UsersSelect
()
new
UsersSelect
()
...
@@ -14,6 +15,8 @@ class @IssuableForm
...
@@ -14,6 +15,8 @@ class @IssuableForm
@
form
.
on
"submit"
,
@
resetAutosave
@
form
.
on
"submit"
,
@
resetAutosave
@
form
.
on
"click"
,
".btn-cancel"
,
@
resetAutosave
@
form
.
on
"click"
,
".btn-cancel"
,
@
resetAutosave
@
initWip
()
initAutosave
:
->
initAutosave
:
->
new
Autosave
@
titleField
,
[
new
Autosave
@
titleField
,
[
document
.
location
.
pathname
,
document
.
location
.
pathname
,
...
@@ -30,3 +33,41 @@ class @IssuableForm
...
@@ -30,3 +33,41 @@ class @IssuableForm
resetAutosave
:
=>
resetAutosave
:
=>
@
titleField
.
data
(
"autosave"
).
reset
()
@
titleField
.
data
(
"autosave"
).
reset
()
@
descriptionField
.
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
...
@@ -2,7 +2,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
before_action
:module_enabled
before_action
:module_enabled
before_action
:merge_request
,
only:
[
before_action
:merge_request
,
only:
[
:edit
,
:update
,
:show
,
:diffs
,
:commits
,
:builds
,
:merge
,
:merge_check
,
: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
:closes_issues
,
only:
[
:edit
,
:update
,
:show
,
:diffs
,
:commits
,
:builds
]
before_action
:validates_merge_request
,
only:
[
:show
,
:diffs
,
:commits
,
:builds
]
before_action
:validates_merge_request
,
only:
[
:show
,
:diffs
,
:commits
,
:builds
]
...
@@ -17,7 +17,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -17,7 +17,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
before_action
:authorize_create_merge_request!
,
only:
[
:new
,
:create
]
before_action
:authorize_create_merge_request!
,
only:
[
:new
,
:create
]
# Allow modify merge_request
# 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
def
index
terms
=
params
[
'issue_search'
]
terms
=
params
[
'issue_search'
]
...
@@ -161,6 +161,13 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -161,6 +161,13 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end
end
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
def
merge_check
@merge_request
.
check_if_can_be_merged
@merge_request
.
check_if_can_be_merged
...
...
app/views/projects/merge_requests/widget/open/_wip.html.haml
View file @
09ff9bc7
...
@@ -2,4 +2,10 @@
...
@@ -2,4 +2,10 @@
This merge request is currently a Work In Progress
This merge request is currently a Work In Progress
%p
%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 @@
...
@@ -13,11 +13,15 @@
-
if
issuable
.
is_a?
(
MergeRequest
)
-
if
issuable
.
is_a?
(
MergeRequest
)
%p
.help-block
%p
.help-block
-
if
issuable
.
work_in_progress?
.js-wip-explanation
Remove the
<code>
WIP
</code>
prefix from the title to allow this
%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.
<strong>
Work In Progress
</strong>
merge request to be merged when it's ready.
-
else
.js-no-wip-explanation
Start the title with
<code>
[WIP]
</code>
or
<code>
WIP:
</code>
to prevent a
%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.
<strong>
Work In Progress
</strong>
merge request from being merged before it's ready.
.form-group.detail-page-description
.form-group.detail-page-description
=
f
.
label
:description
,
'Description'
,
class:
'control-label'
=
f
.
label
:description
,
'Description'
,
class:
'control-label'
...
...
config/routes.rb
View file @
09ff9bc7
...
@@ -599,6 +599,7 @@ Rails.application.routes.draw do
...
@@ -599,6 +599,7 @@ Rails.application.routes.draw do
post
:cancel_merge_when_build_succeeds
post
:cancel_merge_when_build_succeeds
get
:ci_status
get
:ci_status
post
:toggle_subscription
post
:toggle_subscription
post
:remove_wip
end
end
collection
do
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