fix onRenderCell implementation, disable navTitle when years view

This commit is contained in:
t1m0n 2015-11-09 11:50:57 +03:00
parent 7a2508384b
commit 8b2feab2d0
5 changed files with 22 additions and 4 deletions

View File

@ -53,6 +53,9 @@
border-radius: 2px; }
.datepicker--nav-title:hover {
background: #eee; }
.datepicker--nav-title.-disabled- {
cursor: default;
background: none; }
/* -------------------------------------------------
Datepicker cells

View File

@ -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) {

View File

@ -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) {

View File

@ -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'
}

View File

@ -39,4 +39,9 @@
&:hover {
background: $colorCellHover;
}
&.-disabled- {
cursor: default;
background: none;
}
}