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
b433d1ab
Commit
b433d1ab
authored
Apr 03, 2017
by
Simon Knox
Committed by
Jose Ivan Vargas
Apr 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move setup code out of constructor
parent
7c54a34b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
29 deletions
+29
-29
app/assets/javascripts/project_new.js
app/assets/javascripts/project_new.js
+29
-29
No files found.
app/assets/javascripts/project_new.js
View file @
b433d1ab
...
...
@@ -26,6 +26,10 @@
$
(
'
.js-approvers
'
).
on
(
'
click
'
,
this
.
addApprover
.
bind
(
this
));
$
(
document
).
on
(
'
click
'
,
'
.js-approver-remove
'
,
this
.
removeApprover
.
bind
(
this
));
this
.
initApproverSelect
();
}
ProjectNew
.
prototype
.
initApproverSelect
=
function
()
{
$
(
'
.js-select-user-and-group
'
).
select2
({
placeholder
:
'
Search for users or groups
'
,
multiple
:
true
,
...
...
@@ -72,7 +76,7 @@
}
}
});
}
}
;
ProjectNew
.
prototype
.
formatResult
=
function
(
group
)
{
if
(
group
.
username
)
{
...
...
@@ -101,34 +105,6 @@
return
group
.
full_name
||
group
.
name
;
};
ProjectNew
.
prototype
.
removeApprover
=
function
(
evt
)
{
evt
.
preventDefault
();
const
target
=
evt
.
currentTarget
;
$
(
'
.load-wrapper
'
).
removeClass
(
'
hidden
'
);
$
.
ajax
({
url
:
target
.
href
,
type
:
'
POST
'
,
data
:
{
_method
:
'
DELETE
'
,
},
success
(
res
)
{
const
fakeEl
=
document
.
createElement
(
'
template
'
);
fakeEl
.
innerHTML
=
res
;
document
.
querySelector
(
'
.well-list.approver-list
'
).
innerHTML
=
fakeEl
.
content
.
querySelector
(
'
.well-list.approver-list
'
).
innerHTML
;
},
complete
:
()
=>
$
(
'
.load-wrapper
'
).
addClass
(
'
hidden
'
),
error
(
err
)
{
window
.
Flash
(
'
Failed to remove Approver
'
,
'
alert
'
);
},
});
};
ProjectNew
.
prototype
.
updateApproverList
=
function
(
html
)
{
const
fakeEl
=
document
.
createElement
(
'
template
'
);
fakeEl
.
innerHTML
=
html
;
document
.
querySelector
(
'
.well-list.approver-list
'
).
innerHTML
=
fakeEl
.
content
.
querySelector
(
'
.well-list.approver-list
'
).
innerHTML
;
};
ProjectNew
.
prototype
.
addApprover
=
function
(
evt
)
{
const
fieldNames
=
[
'
project[approver_ids]
'
,
'
project[approver_group_ids]
'
];
fieldNames
.
forEach
((
fieldName
)
=>
{
...
...
@@ -162,6 +138,30 @@
});
};
ProjectNew
.
prototype
.
removeApprover
=
function
(
evt
)
{
evt
.
preventDefault
();
const
target
=
evt
.
currentTarget
;
$
(
'
.load-wrapper
'
).
removeClass
(
'
hidden
'
);
$
.
ajax
({
url
:
target
.
href
,
type
:
'
POST
'
,
data
:
{
_method
:
'
DELETE
'
,
},
success
:
this
.
updateApproverList
,
complete
:
()
=>
$
(
'
.load-wrapper
'
).
addClass
(
'
hidden
'
),
error
(
err
)
{
window
.
Flash
(
'
Failed to remove Approver
'
,
'
alert
'
);
},
});
};
ProjectNew
.
prototype
.
updateApproverList
=
function
(
html
)
{
const
fakeEl
=
document
.
createElement
(
'
template
'
);
fakeEl
.
innerHTML
=
html
;
document
.
querySelector
(
'
.well-list.approver-list
'
).
innerHTML
=
fakeEl
.
content
.
querySelector
(
'
.well-list.approver-list
'
).
innerHTML
;
};
ProjectNew
.
prototype
.
initVisibilitySelect
=
function
()
{
const
visibilityContainer
=
document
.
querySelector
(
'
.js-visibility-select
'
);
if
(
!
visibilityContainer
)
return
;
...
...
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