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
2f39cc92
Commit
2f39cc92
authored
Jan 23, 2016
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move inlined approver CS into its own file
parent
707f6abd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
27 deletions
+26
-27
app/assets/javascripts/approvals.js.coffee
app/assets/javascripts/approvals.js.coffee
+26
-0
app/views/shared/issuable/_form.html.haml
app/views/shared/issuable/_form.html.haml
+0
-27
No files found.
app/assets/javascripts/approvals.js.coffee
0 → 100644
View file @
2f39cc92
$
->
$
(
".approver-list"
).
on
"click"
,
".project-approvers .btn-remove"
,
->
$
(
this
).
closest
(
"li"
).
remove
()
return
false
$
(
"form.merge-request-form"
).
submit
->
if
$
(
"input#merge_request_approver_ids"
).
length
approver_ids
=
$
.
map
$
(
"li.project-approvers"
).
not
(
".approver-template"
),
(
li
,
i
)
->
li
.
id
.
replace
(
"user_"
,
""
)
approvers_input
=
$
(
this
).
find
(
"input#merge_request_approver_ids"
)
approver_ids
=
approver_ids
.
concat
(
approvers_input
.
val
().
split
(
","
))
approvers_input
.
val
(
_
.
compact
(
approver_ids
).
join
(
","
))
$
(
".suggested-approvers a"
).
click
->
user_id
=
this
.
id
.
replace
(
"user_"
,
""
)
user_name
=
this
.
text
return
false
if
$
(
".approver-list #user_"
+
user_id
).
length
approver_item_html
=
$
(
".project-approvers.approver-template"
).
clone
().
removeClass
(
"hide approver-template"
)[
0
].
outerHTML
.
replace
(
/\{approver_name\}/g
,
user_name
).
replace
(
/\{user_id\}/g
,
user_id
)
$
(
".no-approvers"
).
remove
()
$
(
".approver-list"
).
append
(
approver_item_html
)
return
false
app/views/shared/issuable/_form.html.haml
View file @
2f39cc92
...
...
@@ -154,30 +154,3 @@
=
link_to
"#"
,
data:
{
confirm:
"Are you sure you want to remove approver {approver_name}"
},
class:
"btn-xs btn btn-remove"
,
title:
'Remove approver'
do
=
icon
(
"sign-out"
)
Remove
-
if
issuable
.
is_a?
(
MergeRequest
)
:coffeescript
$(".approver-list").on "click", ".project-approvers .btn-remove", ->
$(this).closest("li").remove()
return false
$("form.merge-request-form").submit ->
if $("input#merge_request_approver_ids").length
approver_ids = $.map $("li.project-approvers").not(".approver-template"), (li, i) ->
li.id.replace("user_", "")
approvers_input = $(this).find("input#merge_request_approver_ids")
approver_ids = approver_ids.concat(approvers_input.val().split(","))
approvers_input.val(_.compact(approver_ids).join(","))
$(".suggested-approvers a").click ->
user_id = this.id.replace("user_", "")
user_name = this.text
return false if $(".approver-list #user_" + user_id).length
approver_item_html = $(".project-approvers.approver-template").clone().
removeClass("hide approver-template")[0].
outerHTML.
replace(/\{approver_name\}/g, user_name).
replace(/\{user_id\}/g, user_id)
$(".no-approvers").remove()
$(".approver-list").append(approver_item_html)
return false
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