mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
* Calendar: Current time line now spans all columns in single day view
This commit is contained in:
parent
313a378539
commit
829bcf4602
@ -510,20 +510,34 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
|
|||||||
* Update the 'now' line
|
* Update the 'now' line
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
|
// @ts-ignore
|
||||||
et2_calendar_timegrid.prototype._updateNow = function () {
|
et2_calendar_timegrid.prototype._updateNow = function () {
|
||||||
var now = _super.prototype._updateNow.call(this);
|
var now = _super.prototype._updateNow.call(this);
|
||||||
if (now === false || this.options.granularity == 0) {
|
if (now === false || this.options.granularity == 0 || !this.div.is(':visible')) {
|
||||||
this.now_div.hide();
|
this.now_div.hide();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// Position & show line
|
||||||
|
var set_line = function (line, now, day) {
|
||||||
|
line.appendTo(day.getDOMNode()).show();
|
||||||
|
var pos = day._time_to_position(now.getUTCHours() * 60 + now.getUTCMinutes());
|
||||||
|
//this.now_div.position({my: 'left', at: 'left', of: day.getDOMNode()});
|
||||||
|
line.css('top', pos + '%');
|
||||||
|
};
|
||||||
|
// Showing just 1 day, multiple owners - span all
|
||||||
|
if (this.daily_owner && this.day_list.length == 1) {
|
||||||
|
var day = this.day_widgets[0];
|
||||||
|
set_line(this.now_div, now, day);
|
||||||
|
this.now_div.css('width', (this.day_widgets.length * 100) + '%');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// Find the day of the week
|
||||||
for (var i = 0; i < this.day_widgets.length; i++) {
|
for (var i = 0; i < this.day_widgets.length; i++) {
|
||||||
var day = this.day_widgets[i];
|
var day = this.day_widgets[i];
|
||||||
if (day.getDate() >= now) {
|
if (day.getDate() >= now) {
|
||||||
day = this.day_widgets[i - 1];
|
day = this.day_widgets[i - 1];
|
||||||
this.now_div.appendTo(day.getDOMNode()).show();
|
set_line(this.now_div, now, day);
|
||||||
var pos = day._time_to_position(now.getUTCHours() * 60 + now.getUTCMinutes());
|
this.now_div.css('width', '100%');
|
||||||
//this.now_div.position({my: 'left', at: 'left', of: day.getDOMNode()});
|
|
||||||
this.now_div.css('top', pos + '%');
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -699,24 +699,43 @@ export class et2_calendar_timegrid extends et2_calendar_view implements et2_IDet
|
|||||||
* Update the 'now' line
|
* Update the 'now' line
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
|
// @ts-ignore
|
||||||
public _updateNow()
|
public _updateNow()
|
||||||
{
|
{
|
||||||
let now = super._updateNow();
|
let now = super._updateNow();
|
||||||
if(now === false || this.options.granularity == 0)
|
if(now === false || this.options.granularity == 0 || !this.div.is(':visible'))
|
||||||
{
|
{
|
||||||
this.now_div.hide();
|
this.now_div.hide();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Position & show line
|
||||||
|
let set_line = function(line, now, day)
|
||||||
|
{
|
||||||
|
line.appendTo(day.getDOMNode()).show();
|
||||||
|
let pos = day._time_to_position(now.getUTCHours() * 60 + now.getUTCMinutes());
|
||||||
|
//this.now_div.position({my: 'left', at: 'left', of: day.getDOMNode()});
|
||||||
|
line.css('top', pos + '%');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Showing just 1 day, multiple owners - span all
|
||||||
|
if(this.daily_owner && this.day_list.length == 1)
|
||||||
|
{
|
||||||
|
let day = this.day_widgets[0];
|
||||||
|
set_line(this.now_div, now, day);
|
||||||
|
this.now_div.css('width', (this.day_widgets.length * 100) + '%');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find the day of the week
|
||||||
for(var i = 0; i < this.day_widgets.length; i++)
|
for(var i = 0; i < this.day_widgets.length; i++)
|
||||||
{
|
{
|
||||||
let day = this.day_widgets[i];
|
let day = this.day_widgets[i];
|
||||||
if(day.getDate() >= now)
|
if(day.getDate() >= now)
|
||||||
{
|
{
|
||||||
day = this.day_widgets[i-1];
|
day = this.day_widgets[i-1];
|
||||||
this.now_div.appendTo(day.getDOMNode()).show();
|
set_line(this.now_div, now, day);
|
||||||
let pos = day._time_to_position(now.getUTCHours() * 60 + now.getUTCMinutes());
|
this.now_div.css('width','100%');
|
||||||
//this.now_div.position({my: 'left', at: 'left', of: day.getDOMNode()});
|
|
||||||
this.now_div.css('top', pos + '%');
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user