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
Boxiang Sun
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
Show 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
{
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
)
{
constructor
(
options
)
{
this
.
onSelect
=
options
.
onSelect
;
this
.
onSelect
=
options
.
onSelect
;
this
.
$dropdown
=
options
.
$dropdown
;
this
.
$dropdown
=
options
.
$dropdown
;
...
@@ -10,7 +16,7 @@ export default class ProtectedTagDropdown {
...
@@ -10,7 +16,7 @@ export default class ProtectedTagDropdown {
this
.
bindEvents
();
this
.
bindEvents
();
// Hide footer
// Hide footer
this
.
$dropdownFooter
.
addClass
(
'
hidden
'
);
this
.
toggleFooter
(
true
);
}
}
buildDropdown
()
{
buildDropdown
()
{
...
@@ -58,18 +64,22 @@ export default class ProtectedTagDropdown {
...
@@ -58,18 +64,22 @@ export default class ProtectedTagDropdown {
}
}
toggleCreateNewButton
(
tagName
)
{
toggleCreateNewButton
(
tagName
)
{
if
(
tagName
)
{
this
.
selectedTag
=
{
this
.
selectedTag
=
{
title
:
tagName
,
title
:
tagName
,
id
:
tagName
,
id
:
tagName
,
text
:
tagName
,
text
:
tagName
,
};
};
if
(
tagName
)
{
this
.
$dropdownContainer
this
.
$dropdownContainer
.
find
(
'
.create-new-protected-tag code
'
)
.
find
(
'
.create-new-protected-tag code
'
)
.
text
(
tagName
);
.
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