- Give user names their own line to avoid being hidden by first day of week

- Fix bug showing first user's name when crossing the merge calendar limit
This commit is contained in:
Nathan Gray 2015-08-25 00:00:45 +00:00
parent f05a777215
commit c4758f1679
4 changed files with 33 additions and 8 deletions

View File

@ -1498,7 +1498,7 @@ app.classes.calendar = AppJS.extend(
id: ""+date.getUTCFullYear() + sprintf("%02d",date.getUTCMonth()) + sprintf("%02d",date.getUTCDate()), id: ""+date.getUTCFullYear() + sprintf("%02d",date.getUTCMonth()) + sprintf("%02d",date.getUTCDate()),
start_date: date, start_date: date,
end_date: end, end_date: end,
owner: state.state.owner[owner] || 0 owner: grid_count > 1 ? state.state.owner[owner] || 0 : state.state.owner
}); });
} }
break; break;
@ -1871,7 +1871,7 @@ app.classes.calendar = AppJS.extend(
// Determine if we're showing multiple owners seperate or consolidated // Determine if we're showing multiple owners seperate or consolidated
var seperate_owners = false; var seperate_owners = false;
var last_owner = value[0].owner; var last_owner = value.length ? value[0].owner || 0 : 0;
for(var i = 0; i < value.length && !seperate_owners; i++) for(var i = 0; i < value.length && !seperate_owners; i++)
{ {
seperate_owners = seperate_owners || (last_owner !== value[i].owner) seperate_owners = seperate_owners || (last_owner !== value[i].owner)
@ -2584,7 +2584,7 @@ jQuery.extend(app.classes.calendar,{
return d; return d;
}, },
granularity: function(state) { granularity: function(state) {
return 120; return (state.owner.length || 1) * app.calendar.View.granularity.call(this, state);
} }
}), }),
month: app.classes.calendar.prototype.View.extend({ month: app.classes.calendar.prototype.View.extend({

View File

@ -104,7 +104,8 @@ var et2_calendar_timegrid = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResiz
// Main container // Main container
this.div = $j(document.createElement("div")) this.div = $j(document.createElement("div"))
.addClass("calendar_calTimeGrid"); .addClass("calendar_calTimeGrid")
.addClass("calendar_TimeGridNoLabel");
// Contains times / rows // Contains times / rows
this.gridHeader = $j(document.createElement("div")) this.gridHeader = $j(document.createElement("div"))
@ -1013,7 +1014,8 @@ var et2_calendar_timegrid = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResiz
{ {
var old = this.options.owner || 0; var old = this.options.owner || 0;
this.owner.set_label(''); this.owner.set_label('');
this.div.removeClass('calendar_TimeGridNoLabel');
if(typeof _owner == 'string' && isNaN(_owner)) if(typeof _owner == 'string' && isNaN(_owner))
{ {
switch(_owner[0]) switch(_owner[0])
@ -1023,6 +1025,9 @@ var et2_calendar_timegrid = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResiz
this.owner.set_value(_owner.substr(1)); this.owner.set_value(_owner.substr(1));
break; break;
} }
// Label is empty, but give extra space for the owner name
this.div.removeClass('calendar_TimeGridNoLabel');
} }
else if (typeof _owner == 'object' && _owner.length) else if (typeof _owner == 'object' && _owner.length)
{ {
@ -1061,6 +1066,12 @@ var et2_calendar_timegrid = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResiz
{ {
this.options.label = label; this.options.label = label;
this.gridHeader.text(label); this.gridHeader.text(label);
debugger;
// If it's a short label (eg week number), don't give it an extra line
// but is empty, but give extra space for a single owner name
this.div.removeClass('calendar_TimeGridNoLabel');
this.div.toggleClass('calendar_TimeGridNoLabel', label.trim().length < 6 && typeof this.options.owner === 'object');
}, },
/** /**

View File

@ -142,6 +142,14 @@ e.g. the div with class calendar_calTimeGrid is generated by the timeGridWidget
*/ */
} }
.calendar_calTimeGrid.calendar_TimeGridNoLabel > .calendar_calDayCols {
top: 0em;
}
.calendar_calTimeGrid.calendar_TimeGridNoLabel > .calendar_calGridHeader {
top: 0em;
}
/* single row in the time-line, always used in conjunction with row_{on|off}, you dont need to set a bgcolor, but you can /* single row in the time-line, always used in conjunction with row_{on|off}, you dont need to set a bgcolor, but you can
*/ */
.calendar_calTimeRow { .calendar_calTimeRow {
@ -170,7 +178,7 @@ e.g. the div with class calendar_calTimeGrid is generated by the timeGridWidget
*/ */
.calendar_calDayCols,.calendar_calDayCols12h,.calendar_calDayColsNoGrid{ .calendar_calDayCols,.calendar_calDayCols12h,.calendar_calDayColsNoGrid{
position: absolute; position: absolute;
top: 0px; top: 2em;
/* bottom: 0px; does NOT work in IE, IE needs height: 100%! */ /* bottom: 0px; does NOT work in IE, IE needs height: 100%! */
height: 100%; height: 100%;
left: 45px; left: 45px;

View File

@ -11,7 +11,7 @@
* @package calendar * @package calendar
* @version $Id$ * @version $Id$
*/ */
/* $Id: app.css 53347 2015-08-11 15:35:54Z nathangray $ */ /* $Id: app.css 53459 2015-08-24 17:28:19Z nathangray $ */
/*Media print classes*/ /*Media print classes*/
@media print { @media print {
.th td, .th td,
@ -156,6 +156,12 @@ e.g. the div with class calendar_calTimeGrid is generated by the timeGridWidget
* height: * height:
*/ */
} }
.calendar_calTimeGrid.calendar_TimeGridNoLabel > .calendar_calDayCols {
top: 0em;
}
.calendar_calTimeGrid.calendar_TimeGridNoLabel > .calendar_calGridHeader {
top: 0em;
}
/* single row in the time-line, always used in conjunction with row_{on|off}, you dont need to set a bgcolor, but you can /* single row in the time-line, always used in conjunction with row_{on|off}, you dont need to set a bgcolor, but you can
*/ */
.calendar_calTimeRow { .calendar_calTimeRow {
@ -184,7 +190,7 @@ e.g. the div with class calendar_calTimeGrid is generated by the timeGridWidget
.calendar_calDayCols12h, .calendar_calDayCols12h,
.calendar_calDayColsNoGrid { .calendar_calDayColsNoGrid {
position: absolute; position: absolute;
top: 0px; top: 2em;
/* bottom: 0px; does NOT work in IE, IE needs height: 100%! */ /* bottom: 0px; does NOT work in IE, IE needs height: 100%! */
height: 100%; height: 100%;
left: 45px; left: 45px;