Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
framadate
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nounous
framadate
Commits
e4fbed48
Commit
e4fbed48
authored
9 years ago
by
Olivier PEREZ
Browse files
Options
Downloads
Patches
Plain Diff
Fix: date picker that doesn't appear when clicking on calendar icon
parent
d8c70a5f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
js/app/framadatepicker.js
+21
-8
21 additions, 8 deletions
js/app/framadatepicker.js
js/core.js
+0
-22
0 additions, 22 deletions
js/core.js
with
21 additions
and
30 deletions
js/app/framadatepicker.js
+
21
−
8
View file @
e4fbed48
...
...
@@ -15,7 +15,7 @@
* Auteurs de STUdS (projet initial) : Guilhem BORGHESI (borghesi@unistra.fr) et Raphaël DROZ
* Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft)
*/
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
var
init_datepicker
=
function
()
{
$
(
'
.input-group.date
'
).
datepicker
({
format
:
"
dd/mm/yyyy
"
,
...
...
@@ -25,16 +25,19 @@ $(document).ready(function() {
language
:
lang
,
todayHighlight
:
true
,
beforeShowDay
:
function
(
date
)
{
var
$selected_days
=
[];
// Retrieve selected dates from text fields
var
selected_days
=
[];
$
(
'
#selected-days
'
).
find
(
'
input[id^="day"]
'
).
each
(
function
()
{
if
(
$
(
this
).
val
()
!=
''
)
{
$
selected_days
.
push
(
$
(
this
).
val
());
selected_days
.
push
(
$
(
this
).
val
());
}
});
for
(
var
i
=
0
;
i
<
$selected_days
.
length
;
i
++
)
{
var
$selected_date
=
$selected_days
[
i
].
split
(
'
/
'
);
if
(
date
.
getFullYear
()
==
$selected_date
[
2
]
&&
(
date
.
getMonth
()
+
1
)
==
$selected_date
[
1
]
&&
date
.
getDate
()
==
$selected_date
[
0
])
{
// Disable selected dates in DatePicker
for
(
var
i
=
0
;
i
<
selected_days
.
length
;
i
++
)
{
var
selected_date
=
selected_days
[
i
].
split
(
'
/
'
);
if
(
date
.
getFullYear
()
==
selected_date
[
2
]
&&
(
date
.
getMonth
()
+
1
)
==
selected_date
[
1
]
&&
date
.
getDate
()
==
selected_date
[
0
])
{
return
{
classes
:
'
disabled selected
'
};
...
...
@@ -44,16 +47,26 @@ $(document).ready(function() {
});
};
$
(
document
).
on
(
'
click
'
,
'
.input-group.date .input-group-addon
'
,
function
()
{
// Re-init datepicker config before displaying
init_datepicker
();
$
(
this
).
parent
().
datepicker
(
'
show
'
);
// Trick to refresh calendar
$
(
'
.datepicker-days .prev
'
).
trigger
(
'
click
'
);
$
(
'
.datepicker-days .next
'
).
trigger
(
'
click
'
);
});
// Complete the date fields when use partialy fill it (eg: 15/01 could become 15/01/2016)
var
leftPad
=
function
(
text
,
pad
)
{
var
leftPad
=
function
(
text
,
pad
)
{
return
text
?
pad
.
substring
(
0
,
pad
.
length
-
text
.
length
)
+
text
:
text
;
};
$
(
document
).
on
(
'
change
'
,
'
.input-group.date input
'
,
function
()
{
// Complete field if needed
var
val
=
$
(
this
).
val
();
var
capture
=
/
([
0-9
]
+
)(?:\/([
0-9
]
+
))?
/
.
exec
(
val
);
var
capture
=
/
^
([
0-9
]
+
)(?:\/([
0-9
]
+
))?
$
/
.
exec
(
val
);
if
(
capture
)
{
var
inputDay
=
leftPad
(
capture
[
1
],
"
00
"
);
// 5->05, 15->15
...
...
This diff is collapsed.
Click to expand it.
js/core.js
+
0
−
22
View file @
e4fbed48
...
...
@@ -2,28 +2,6 @@ $(document).ready(function() {
window
.
lang
=
$
(
'
html
'
).
attr
(
'
lang
'
);
var
datepickerfocus
=
false
;
// a11y : datepicker not display on focus until there is one click on the button
$
(
document
).
on
(
'
click
'
,
'
.input-group.date .input-group-addon
'
,
function
()
{
datepickerfocus
=
true
;
// Re-init datepicker config before displaying
$
(
this
).
parent
().
datepicker
(
init_datepicker
());
$
(
this
).
parent
().
datepicker
(
'
show
'
);
// Trick to refresh calendar
$
(
'
.datepicker-days .prev
'
).
trigger
(
'
click
'
);
$
(
'
.datepicker-days .next
'
).
trigger
(
'
click
'
);
// .active must be clicable in order to unfill the form
$
(
'
.datepicker-days .active
'
).
removeClass
(
'
disabled
'
);
});
$
(
document
).
on
(
'
focus
'
,
'
.input-group.date input
'
,
function
()
{
if
(
datepickerfocus
)
{
$
(
this
).
parent
(
'
.input-group.date
'
).
datepicker
(
init_datepicker
());
$
(
this
).
parent
(
'
.input-group.date
'
).
datepicker
(
'
show
'
);
}
});
/**
* adminstuds.php
**/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment