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
85e1fa8e
Commit
85e1fa8e
authored
Apr 03, 2017
by
Kushal Pandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ProtectedTagEdit class for edit protected tags
parent
553cf9ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
0 deletions
+54
-0
app/assets/javascripts/protected_tags/protected_tag_edit.js
app/assets/javascripts/protected_tags/protected_tag_edit.js
+54
-0
No files found.
app/assets/javascripts/protected_tags/protected_tag_edit.js
0 → 100644
View file @
85e1fa8e
/* eslint-disable no-new, arrow-parens, no-param-reassign, comma-dangle, max-len */
/* global Flash */
(
global
=>
{
global
.
gl
=
global
.
gl
||
{};
gl
.
ProtectedTagEdit
=
class
{
constructor
(
options
)
{
this
.
$wrap
=
options
.
$wrap
;
this
.
$allowedToPushDropdown
=
this
.
$wrap
.
find
(
'
.js-allowed-to-push
'
);
this
.
buildDropdowns
();
}
buildDropdowns
()
{
// Allowed to push dropdown
new
gl
.
ProtectedTagAccessDropdown
({
$dropdown
:
this
.
$allowedToPushDropdown
,
data
:
gon
.
push_access_levels
,
onSelect
:
this
.
onSelect
.
bind
(
this
)
});
}
onSelect
()
{
const
$allowedToPushInput
=
this
.
$wrap
.
find
(
`input[name="
${
this
.
$allowedToPushDropdown
.
data
(
'
fieldName
'
)}
"]`
);
// Do not update if one dropdown has not selected any option
if
(
!
$allowedToPushInput
.
length
)
return
;
this
.
$allowedToPushDropdown
.
disable
();
$
.
ajax
({
type
:
'
POST
'
,
url
:
this
.
$wrap
.
data
(
'
url
'
),
dataType
:
'
json
'
,
data
:
{
_method
:
'
PATCH
'
,
protected_tag
:
{
push_access_levels_attributes
:
[{
id
:
this
.
$allowedToPushDropdown
.
data
(
'
access-level-id
'
),
access_level
:
$allowedToPushInput
.
val
()
}]
}
},
error
()
{
$
.
scrollTo
(
0
);
new
Flash
(
'
Failed to update tag!
'
);
}
}).
always
(()
=>
{
this
.
$allowedToPushDropdown
.
enable
();
});
}
};
})(
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