mirror of
https://github.com/frappe/air-datepicker.git
synced 2026-01-14 11:01:22 +08:00
fix onRenderCell implementation, disable navTitle when years view
This commit is contained in:
parent
7a2508384b
commit
8b2feab2d0
3
dist/css/datepicker.css
vendored
3
dist/css/datepicker.css
vendored
@ -53,6 +53,9 @@
|
||||
border-radius: 2px; }
|
||||
.datepicker--nav-title:hover {
|
||||
background: #eee; }
|
||||
.datepicker--nav-title.-disabled- {
|
||||
cursor: default;
|
||||
background: none; }
|
||||
|
||||
/* -------------------------------------------------
|
||||
Datepicker cells
|
||||
|
||||
9
dist/js/datepicker.js
vendored
9
dist/js/datepicker.js
vendored
@ -413,6 +413,9 @@ var Datepicker;
|
||||
html = Datepicker.template(template, $.extend({title: title}, this.opts));
|
||||
|
||||
this.d.$nav.html(html);
|
||||
if (this.d.view == 'years') {
|
||||
$('.datepicker--nav-title', this.d.$nav).addClass('-disabled-');
|
||||
}
|
||||
this.setNavStatus();
|
||||
},
|
||||
|
||||
@ -436,7 +439,9 @@ var Datepicker;
|
||||
this.d[action]();
|
||||
},
|
||||
|
||||
_onClickNavTitle: function () {
|
||||
_onClickNavTitle: function (e) {
|
||||
if ($(e.target).hasClass('-disabled-')) return;
|
||||
|
||||
if (this.d.view == 'days') {
|
||||
return this.d.view = 'months'
|
||||
}
|
||||
@ -585,7 +590,7 @@ Datepicker.Cell = function () {
|
||||
var _class = "datepicker--cell datepicker--cell-day",
|
||||
currentDate = new Date(),
|
||||
d = Datepicker.getParsedDate(date),
|
||||
render,
|
||||
render = {},
|
||||
html = d.date;
|
||||
|
||||
if (this.opts.onRenderCell) {
|
||||
|
||||
@ -88,7 +88,7 @@
|
||||
var _class = "datepicker--cell datepicker--cell-day",
|
||||
currentDate = new Date(),
|
||||
d = Datepicker.getParsedDate(date),
|
||||
render,
|
||||
render = {},
|
||||
html = d.date;
|
||||
|
||||
if (this.opts.onRenderCell) {
|
||||
|
||||
@ -32,6 +32,9 @@
|
||||
html = Datepicker.template(template, $.extend({title: title}, this.opts));
|
||||
|
||||
this.d.$nav.html(html);
|
||||
if (this.d.view == 'years') {
|
||||
$('.datepicker--nav-title', this.d.$nav).addClass('-disabled-');
|
||||
}
|
||||
this.setNavStatus();
|
||||
},
|
||||
|
||||
@ -55,7 +58,9 @@
|
||||
this.d[action]();
|
||||
},
|
||||
|
||||
_onClickNavTitle: function () {
|
||||
_onClickNavTitle: function (e) {
|
||||
if ($(e.target).hasClass('-disabled-')) return;
|
||||
|
||||
if (this.d.view == 'days') {
|
||||
return this.d.view = 'months'
|
||||
}
|
||||
|
||||
@ -39,4 +39,9 @@
|
||||
&:hover {
|
||||
background: $colorCellHover;
|
||||
}
|
||||
|
||||
&.-disabled- {
|
||||
cursor: default;
|
||||
background: none;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user