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
Tatuya Kamada
gitlab-ce
Commits
cd5b36d0
Commit
cd5b36d0
authored
Apr 06, 2017
by
Kushal Pandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add constructor doc, toggle helper
parent
3c414a9f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
8 deletions
+18
-8
app/assets/javascripts/protected_tags/protected_tag_dropdown.js
...sets/javascripts/protected_tags/protected_tag_dropdown.js
+18
-8
No files found.
app/assets/javascripts/protected_tags/protected_tag_dropdown.js
View file @
cd5b36d0
export
default
class
ProtectedTagDropdown
{
/**
* @param {Object} options containing
* `$dropdown` target element
* `onSelect` event callback
* $dropdown must be an element created using `dropdown_tag()` rails helper
*/
constructor
(
options
)
{
this
.
onSelect
=
options
.
onSelect
;
this
.
$dropdown
=
options
.
$dropdown
;
...
...
@@ -10,7 +16,7 @@ export default class ProtectedTagDropdown {
this
.
bindEvents
();
// Hide footer
this
.
$dropdownFooter
.
addClass
(
'
hidden
'
);
this
.
toggleFooter
(
true
);
}
buildDropdown
()
{
...
...
@@ -58,18 +64,22 @@ export default class ProtectedTagDropdown {
}
toggleCreateNewButton
(
tagName
)
{
this
.
selectedTag
=
{
title
:
tagName
,
id
:
tagName
,
text
:
tagName
,
};
if
(
tagName
)
{
this
.
selectedTag
=
{
title
:
tagName
,
id
:
tagName
,
text
:
tagName
,
};
this
.
$dropdownContainer
.
find
(
'
.create-new-protected-tag code
'
)
.
text
(
tagName
);
}
this
.
$dropdownFooter
.
toggleClass
(
'
hidden
'
,
!
tagName
);
this
.
toggleFooter
(
!
tagName
);
}
toggleFooter
(
toggleState
)
{
this
.
$dropdownFooter
.
toggleClass
(
'
hidden
'
,
toggleState
);
}
}
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