Add relative date range selector to calendars and widgets

This commit is contained in:
Brian Miyaji
2017-11-08 16:40:17 +11:00
parent 9d6ecf28bd
commit 04fbbdfc7f
10 changed files with 246 additions and 35 deletions

View File

@@ -604,6 +604,21 @@ jQuery(document).ready(function($){
});
$(".sp-date-selector select").trigger("change");
// Toggle date range selectors
$(".sp-date-relative input").change(function() {
$relative = $(this).closest(".sp-date-relative").siblings(".sp-date-range-relative").toggle(0, $(this).attr("checked"));
$absolute = $(this).closest(".sp-date-relative").siblings(".sp-date-range-absolute").toggle(0, $(this).attr("checked"));
if ($(this).attr("checked")) {
$relative.show();
$absolute.hide();
} else {
$absolute.show();
$relative.hide();
}
});
$(".sp-date-selector input").trigger("change");
// Apply color scheme
$(".sp-color-option").on("click", function() {
colors = $(this).find("label").data("sp-colors").split(",");