BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
e0503130
Commit
e0503130
authored
Sep 07, 2017
by
Jacopo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide close MR button after merge without reloading page
After merging a MR the close button is hidden, without reloading the page.
parent
e2b195b2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
67 additions
and
1 deletion
+67
-1
merge_request.js
app/assets/javascripts/merge_request.js
+15
-0
mr_widget_ready_to_merge.js
...uest_widget/components/states/mr_widget_ready_to_merge.js
+1
-0
_mr_title.html.haml
app/views/projects/merge_requests/_mr_title.html.haml
+1
-1
36742-hide-close-mr-button-on-merge.yml
...gelogs/unreleased/36742-hide-close-mr-button-on-merge.yml
+5
-0
merge_requests.rb
spec/javascripts/fixtures/merge_requests.rb
+6
-0
merge_request_spec.js
spec/javascripts/merge_request_spec.js
+39
-0
No files found.
app/assets/javascripts/merge_request.js
View file @
e0503130
...
...
@@ -127,6 +127,21 @@ import IssuablesHelper from './helpers/issuables_helper';
$el
.
text
(
gl
.
text
.
addDelimiter
(
count
));
};
MergeRequest
.
prototype
.
hideCloseButton
=
function
()
{
const
el
=
document
.
querySelector
(
'.merge-request .issuable-actions'
);
const
closeDropdownItem
=
el
.
querySelector
(
'li.close-item'
);
if
(
closeDropdownItem
)
{
closeDropdownItem
.
classList
.
add
(
'hidden'
);
// Selects the next dropdown item
el
.
querySelector
(
'li.report-item'
).
click
();
}
else
{
// No dropdown just hide the Close button
el
.
querySelector
(
'.btn-close'
).
classList
.
add
(
'hidden'
);
}
// Dropdown for mobile screen
el
.
querySelector
(
'li.js-close-item'
).
classList
.
add
(
'hidden'
);
};
return
MergeRequest
;
})();
}).
call
(
window
);
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_ready_to_merge.js
View file @
e0503130
...
...
@@ -156,6 +156,7 @@ export default {
eventHub
.
$emit
(
'FetchActionsContent'
);
if
(
window
.
mergeRequest
)
{
window
.
mergeRequest
.
updateStatusText
(
'status-box-open'
,
'status-box-merged'
,
'Merged'
);
window
.
mergeRequest
.
hideCloseButton
();
window
.
mergeRequest
.
decreaseCounter
();
}
stopPolling
();
...
...
app/views/projects/merge_requests/_mr_title.html.haml
View file @
e0503130
...
...
@@ -29,7 +29,7 @@
-
unless
current_user
==
@merge_request
.
author
%li
=
link_to
'Report abuse'
,
new_abuse_report_path
(
user_id:
@merge_request
.
author
.
id
,
ref_url:
merge_request_url
(
@merge_request
))
-
if
can_update_merge_request
%li
{
class:
merge_request_button_visibility
(
@merge_request
,
true
)
}
%li
{
class:
[
merge_request_button_visibility
(
@merge_request
,
true
),
'js-close-item'
]
}
=
link_to
'Close'
,
merge_request_path
(
@merge_request
,
merge_request:
{
state_event: :close
}),
method: :put
,
title:
'Close merge request'
%li
{
class:
merge_request_button_visibility
(
@merge_request
,
false
)
}
=
link_to
'Reopen'
,
merge_request_path
(
@merge_request
,
merge_request:
{
state_event: :reopen
}),
method: :put
,
class:
'reopen-mr-link'
,
title:
'Reopen merge request'
...
...
changelogs/unreleased/36742-hide-close-mr-button-on-merge.yml
0 → 100644
View file @
e0503130
---
title
:
Hide close MR button after merge without reloading page
merge_request
:
14122
author
:
Jacopo Beschi @jacopo-beschi
type
:
added
spec/javascripts/fixtures/merge_requests.rb
View file @
e0503130
...
...
@@ -41,6 +41,12 @@ describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: :cont
remove_repository
(
project
)
end
it
'merge_requests/merge_request_of_current_user.html.raw'
do
|
example
|
merge_request
.
update
(
author:
admin
)
render_merge_request
(
example
.
description
,
merge_request
)
end
it
'merge_requests/merge_request_with_task_list.html.raw'
do
|
example
|
create
(
:ci_build
,
:pending
,
pipeline:
pipeline
)
...
...
spec/javascripts/merge_request_spec.js
View file @
e0503130
...
...
@@ -58,5 +58,44 @@ import IssuablesHelper from '~/helpers/issuables_helper';
expect
(
CloseReopenReportToggle
.
prototype
.
initDroplab
).
toHaveBeenCalled
();
});
});
describe
(
'hideCloseButton'
,
()
=>
{
describe
(
'merge request of another user'
,
()
=>
{
beforeEach
(()
=>
{
loadFixtures
(
'merge_requests/merge_request_with_task_list.html.raw'
);
this
.
el
=
document
.
querySelector
(
'.merge-request .issuable-actions'
);
const
merge
=
new
MergeRequest
();
merge
.
hideCloseButton
();
});
it
(
'hides the dropdown close item and selects the next item'
,
()
=>
{
const
closeItem
=
this
.
el
.
querySelector
(
'li.close-item'
);
const
smallCloseItem
=
this
.
el
.
querySelector
(
'.js-close-item'
);
const
reportItem
=
this
.
el
.
querySelector
(
'li.report-item'
);
expect
(
closeItem
).
toHaveClass
(
'hidden'
);
expect
(
smallCloseItem
).
toHaveClass
(
'hidden'
);
expect
(
reportItem
).
toHaveClass
(
'droplab-item-selected'
);
expect
(
reportItem
).
not
.
toHaveClass
(
'hidden'
);
});
});
describe
(
'merge request of current_user'
,
()
=>
{
beforeEach
(()
=>
{
loadFixtures
(
'merge_requests/merge_request_of_current_user.html.raw'
);
this
.
el
=
document
.
querySelector
(
'.merge-request .issuable-actions'
);
const
merge
=
new
MergeRequest
();
merge
.
hideCloseButton
();
});
it
(
'hides the close button'
,
()
=>
{
const
closeButton
=
this
.
el
.
querySelector
(
'.btn-close'
);
const
smallCloseItem
=
this
.
el
.
querySelector
(
'.js-close-item'
);
expect
(
closeButton
).
toHaveClass
(
'hidden'
);
expect
(
smallCloseItem
).
toHaveClass
(
'hidden'
);
});
});
});
});
}).
call
(
window
);
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