BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
8 deletions
+18
-8
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
)
{
this
.
selectedTag
=
{
title
:
tagName
,
id
:
tagName
,
text
:
tagName
,
};
if
(
tagName
)
{
if
(
tagName
)
{
this
.
selectedTag
=
{
title
:
tagName
,
id
:
tagName
,
text
:
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