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
Jérome Perrin
gitlab-ce
Commits
af9dc973
Commit
af9dc973
authored
Sep 07, 2016
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make merge requests bulk update working
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
f28ca293
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
121 additions
and
1 deletion
+121
-1
app/helpers/issuables_helper.rb
app/helpers/issuables_helper.rb
+8
-0
app/views/shared/issuable/_filter.html.haml
app/views/shared/issuable/_filter.html.haml
+1
-1
config/routes.rb
config/routes.rb
+1
-0
spec/features/merge_requests/update_merge_requests_spec.rb
spec/features/merge_requests/update_merge_requests_spec.rb
+111
-0
No files found.
app/helpers/issuables_helper.rb
View file @
af9dc973
...
...
@@ -111,4 +111,12 @@ module IssuablesHelper
issuable
.
open?
?
:opened
:
:closed
end
end
def
issuable_bulk_update_path
(
type
)
if
type
==
"issue"
bulk_update_namespace_project_issues_path
(
@project
.
namespace
,
@project
)
else
bulk_update_namespace_project_merge_requests_path
(
@project
.
namespace
,
@project
)
end
end
end
app/views/shared/issuable/_filter.html.haml
View file @
af9dc973
...
...
@@ -49,7 +49,7 @@
-
if
@bulk_edit
.issues_bulk_update.hide
=
form_tag
bulk_update_namespace_project_issues_path
(
@project
.
namespace
,
@project
),
method: :post
,
class:
'bulk-update'
do
=
form_tag
issuable_bulk_update_path
(
type
),
method: :post
,
class:
'bulk-update'
do
.filter-item.inline
=
dropdown_tag
(
"Status"
,
options:
{
toggle_class:
"js-issue-status"
,
title:
"Change status"
,
dropdown_class:
"dropdown-menu-status dropdown-menu-selectable"
,
data:
{
field_name:
"update[state_event]"
}
}
)
do
%ul
...
...
config/routes.rb
View file @
af9dc973
...
...
@@ -747,6 +747,7 @@ Rails.application.routes.draw do
get
:branch_to
get
:update_branches
get
:diff_for_path
post
:bulk_update
end
resources
:discussions
,
only:
[],
constraints:
{
id:
/\h{40}/
}
do
...
...
spec/features/merge_requests/update_merge_requests_spec.rb
0 → 100644
View file @
af9dc973
require
'rails_helper'
feature
'Multiple merge requests updating from merge_requests#index'
,
feature:
true
do
include
WaitForAjax
let!
(
:user
)
{
create
(
:user
)}
let!
(
:project
)
{
create
(
:project
)
}
let!
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
}
before
do
project
.
team
<<
[
user
,
:master
]
login_as
(
user
)
end
context
'status'
,
js:
true
do
it
'sets to closed'
do
visit
namespace_project_merge_requests_path
(
project
.
namespace
,
project
)
find
(
'#check_all_issues'
).
click
find
(
'.js-issue-status'
).
click
find
(
'.dropdown-menu-status a'
,
text:
'Closed'
).
click
click_update_merge_requests_button
expect
(
page
).
to
have_selector
(
'.merge-request'
,
count:
0
)
end
it
'sets to open'
do
merge_request
.
close
visit
namespace_project_merge_requests_path
(
project
.
namespace
,
project
,
state:
'closed'
)
find
(
'#check_all_issues'
).
click
find
(
'.js-issue-status'
).
click
find
(
'.dropdown-menu-status a'
,
text:
'Open'
).
click
click_update_merge_requests_button
expect
(
page
).
to
have_selector
(
'.merge-request'
,
count:
0
)
end
end
context
'assignee'
,
js:
true
do
it
'updates to current user'
do
visit
namespace_project_merge_requests_path
(
project
.
namespace
,
project
)
find
(
'#check_all_issues'
).
click
click_update_assignee_button
find
(
'.dropdown-menu-user-link'
,
text:
user
.
username
).
click
click_update_merge_requests_button
page
.
within
(
'.merge-request .controls'
)
do
expect
(
find
(
'.author_link'
)[
"title"
]).
to
have_content
(
user
.
name
)
end
end
it
'updates to unassigned'
do
merge_request
.
assignee
=
user
merge_request
.
save
visit
namespace_project_merge_requests_path
(
project
.
namespace
,
project
)
find
(
'#check_all_issues'
).
click
click_update_assignee_button
click_link
'Unassigned'
click_update_merge_requests_button
expect
(
find
(
'.merge-request:first-child .controls'
)).
not_to
have_css
(
'.author_link'
)
end
end
context
'milestone'
,
js:
true
do
let
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
it
'updates milestone'
do
visit
namespace_project_merge_requests_path
(
project
.
namespace
,
project
)
find
(
'#check_all_issues'
).
click
find
(
'.issues_bulk_update .js-milestone-select'
).
click
find
(
'.dropdown-menu-milestone a'
,
text:
milestone
.
title
).
click
click_update_merge_requests_button
expect
(
find
(
'.merge-request'
)).
to
have_content
milestone
.
title
end
it
'sets to no milestone'
do
merge_request
.
milestone
=
milestone
merge_request
.
save
visit
namespace_project_merge_requests_path
(
project
.
namespace
,
project
)
expect
(
first
(
'.merge-request'
)).
to
have_content
milestone
.
title
find
(
'#check_all_issues'
).
click
find
(
'.issues_bulk_update .js-milestone-select'
).
click
find
(
'.dropdown-menu-milestone a'
,
text:
"No Milestone"
).
click
click_update_merge_requests_button
expect
(
find
(
'.merge-request:first-child'
)).
not_to
have_content
milestone
.
title
end
end
def
click_update_assignee_button
find
(
'.js-update-assignee'
).
click
wait_for_ajax
end
def
click_update_merge_requests_button
find
(
'.update_selected_issues'
).
click
wait_for_ajax
end
end
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