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
4d07319b
Commit
4d07319b
authored
Aug 18, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don’t add events in loop
parent
41529b92
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
19 deletions
+17
-19
app/assets/javascripts/member_expiration_date.js
app/assets/javascripts/member_expiration_date.js
+17
-19
No files found.
app/assets/javascripts/member_expiration_date.js
View file @
4d07319b
...
...
@@ -5,30 +5,28 @@
// datepicker, and make clicking on that element clear the field.
//
gl
.
MemberExpirationDate
=
function
()
{
$
(
'
.js-access-expiration-date
'
).
each
(
function
(
i
,
element
)
{
var
expirationDateInput
=
$
(
element
);
function
toggleClearInput
()
{
$
(
this
).
closest
(
'
.clearable-input
'
).
toggleClass
(
'
has-value
'
,
$
(
this
).
val
()
!==
''
);
}
if
(
expirationDateInput
.
hasClass
(
'
hasDatepicker
'
))
{
return
;
}
var
inputs
=
$
(
'
.js-access-expiration-date
'
);
function
toggleClearInput
()
{
expirationDateInput
.
closest
(
'
.clearable-input
'
).
toggleClass
(
'
has-value
'
,
expirationDateInput
.
val
()
!==
''
);
}
inputs
.
datepicker
({
dateFormat
:
'
yy-mm-dd
'
,
minDate
:
1
,
onSelect
:
toggleClearInput
});
expirationDateInput
.
datepicker
({
dateFormat
:
'
yy-mm-dd
'
,
minDate
:
1
,
onSelect
:
toggleClearInput
});
inputs
.
next
(
'
.js-clear-input
'
).
on
(
'
click
'
,
function
(
event
)
{
event
.
preventDefault
();
expirationDateInput
.
on
(
'
blur
'
,
toggleClearInput
);
var
input
=
$
(
this
).
closest
(
'
.clearable-input
'
).
find
(
'
.js-access-expiration-date
'
);
input
.
datepicker
(
'
setDate
'
,
null
);
toggleClearInput
.
call
(
input
);
});
toggleClearInput
(
);
inputs
.
on
(
'
blur
'
,
toggleClearInput
);
expirationDateInput
.
next
(
'
.js-clear-input
'
).
on
(
'
click
'
,
function
(
event
)
{
event
.
preventDefault
();
expirationDateInput
.
datepicker
(
'
setDate
'
,
null
);
toggleClearInput
();
});
});
inputs
.
each
(
toggleClearInput
);
};
}).
call
(
this
);
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