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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
5c0bfc17
Commit
5c0bfc17
authored
Jun 09, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Approve widget with users who approved
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
a2726dc3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
6 deletions
+32
-6
app/assets/stylesheets/pages/merge_requests.scss
app/assets/stylesheets/pages/merge_requests.scss
+4
-0
app/models/merge_request.rb
app/models/merge_request.rb
+12
-2
app/views/projects/merge_requests/show/_approve.html.haml
app/views/projects/merge_requests/show/_approve.html.haml
+14
-0
app/views/projects/merge_requests/show/_mr_accept.html.haml
app/views/projects/merge_requests/show/_mr_accept.html.haml
+2
-4
No files found.
app/assets/stylesheets/pages/merge_requests.scss
View file @
5c0bfc17
...
...
@@ -188,3 +188,7 @@
.merge-request-form
.select2-container
{
width
:
250px
!
important
;
}
.approved-by-users
{
padding
:
5px
12px
;
}
app/models/merge_request.rb
View file @
5c0bfc17
...
...
@@ -419,8 +419,18 @@ class MergeRequest < ActiveRecord::Base
end
def
requires_approve?
return
false
if
approvals_required
.
zero?
!
approvals_required
.
zero?
end
def
approved?
approvals
.
count
>=
approvals_required
end
def
approved_by?
(
user
)
approved_by_users
.
include?
(
user
)
end
approvals_required
>
approvals
.
count
def
approved_by_users
approvals
.
map
(
&
:user
)
end
end
app/views/projects/merge_requests/show/_approve.html.haml
0 → 100644
View file @
5c0bfc17
.clearfix
-
unless
@merge_request
.
approved_by?
(
current_user
)
.pull-left
=
form_for
[
:approve
,
@project
.
namespace
.
becomes
(
Namespace
),
@project
,
@merge_request
],
method: :post
do
|
f
|
=
f
.
submit
"Approve Merge Request"
,
class:
"btn btn-reopen"
-
if
@merge_request
.
approvals
.
any?
.pull-left.approved-by-users
Approved by
-
@merge_request
.
approved_by_users
.
each
do
|
user
|
=
link_to_member
(
@project
,
user
,
name:
false
,
size:
24
)
%br
%p
This merge request must be approved by
#{
pluralize
(
@merge_request
.
approvals_required
,
'user'
)
}
before it can be merged
app/views/projects/merge_requests/show/_mr_accept.html.haml
View file @
5c0bfc17
...
...
@@ -17,10 +17,8 @@
-
if
@show_merge_controls
.automerge_widget.can_be_merged.hide
.clearfix
-
if
@merge_request
.
requires_approve?
=
form_for
[
:approve
,
@project
.
namespace
.
becomes
(
Namespace
),
@project
,
@merge_request
],
method: :post
do
|
f
|
%p
This merge request must be approved by
#{
pluralize
(
@merge_request
.
approvals_left
,
'user'
)
}
before it can be merged
=
f
.
submit
"Approve Merge Request"
,
class:
"btn btn-reopen"
-
if
@merge_request
.
requires_approve?
&&
!
@merge_request
.
approved?
=
render
'projects/merge_requests/show/approve'
-
else
=
form_for
[
:automerge
,
@project
.
namespace
.
becomes
(
Namespace
),
@project
,
@merge_request
],
remote:
true
,
method: :post
do
|
f
|
.accept-merge-holder.clearfix.js-toggle-container
...
...
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