From a6b38f335eccca5d09fbaee6a955d9197d383444 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 18 Jan 2016 20:32:33 +0000 Subject: [PATCH] If timegrid is too small (< 180px) automatically switch to gridlist view --- calendar/js/et2_widget_timegrid.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/calendar/js/et2_widget_timegrid.js b/calendar/js/et2_widget_timegrid.js index 73ed572575..7a2448fe9d 100644 --- a/calendar/js/et2_widget_timegrid.js +++ b/calendar/js/et2_widget_timegrid.js @@ -1665,6 +1665,15 @@ var et2_calendar_timegrid = et2_calendar_view.extend([et2_IDetachedDOM, et2_IRes // Allow for borders & padding this.options.height -= 2*((this.div.outerWidth(true) - this.div.innerWidth()) + parseInt(this.div.parent().css('padding-top'))); + + // If too small, switch to list view automatically + // Set rather arbitrarily at 180 px. + if(this.options.granularity && this.options.height < 180) + { + this._parent.iterateOver(function(widget) { + if(!widget.disabled) widget.set_granularity(0); + },this, et2_calendar_timegrid); + } if(this.options.height+"px" !== this.div.css('height')) { this.div.css('height', this.options.height);