(js) Improve display of dragging ghost in Calendar

This commit is contained in:
Francis Lachapelle
2016-09-21 15:04:09 -04:00
parent 1e2238534b
commit 908c29d67c
5 changed files with 60 additions and 39 deletions
@@ -325,6 +325,7 @@
associateComponent = function(block) {
this[block.nbr].blocks.push(block); // Associate block to component
block.component = this[block.nbr]; // Associate component to block
block.isFirst = (this[block.nbr].blocks.length == 1);
};
Component.$views = [];
@@ -83,7 +83,7 @@
function updateGhost() {
// From SOGoEventDragGhostController._updateGhosts
var showGhost, isRelative, currentDay,
var showGhost, isRelative, isAllDay, currentDay,
start, duration, durationLeft, maxDuration;
showGhost = false;
@@ -92,6 +92,7 @@
// The view of the dragging block is the scrolling view of this ghost block
isRelative = scrollViewCtrl.type === 'multiday-allday';
isAllDay = scope.block.component.c_isallday;
currentDay = scope.block.pointerHandler.currentEventCoordinates.dayNumber;
start = scope.block.pointerHandler.currentEventCoordinates.start;
durationLeft = scope.block.pointerHandler.currentEventCoordinates.duration;
@@ -114,8 +115,9 @@
// This ghost block (day) is the first of the dragging event
showGhost = true;
if (!isRelative) {
// Show start hour and set the vertical position
scope.block.startHour = getStartTime(start);
if (!isAllDay)
// Show start hour and set the vertical position
scope.block.startHour = getStartTime(start);
// Set the height
if (Calendar.$view.quarterHeight) {
iElement.css('top', (start * Calendar.$view.quarterHeight) + 'px');
@@ -127,6 +129,7 @@
iElement.removeClass('fg-folder' + scope.block.component.pid);
iElement.removeClass('sg-event--ghost--last');
iElement.addClass('sg-event--ghost--first');
scope.block.isFirst = true;
}
durationLeft -= duration;
@@ -161,7 +164,7 @@
if (isRelative) {
iElement.addClass('sg-event--ghost--last');
}
else {
else if (!isAllDay) {
// Set the end date
scope.block.endHour = getEndTime(start, duration);
}
@@ -35,7 +35,7 @@
// Add a class while dragging
' ng-class="{\'sg-event--dragging\': block.dragging}"',
' ng-click="clickBlock({clickEvent: $event, clickComponent: block.component})">',
' <span class="secondary" ng-if="'+p+'!block.component.c_isallday">{{ '+p+'block.starthour }}</span>',
' <span class="secondary" ng-if="'+p+'(!block.component.c_isallday && block.isFirst)">{{ '+p+'block.component.startHour }}</span>',
// Priority
' <span ng-show="'+p+'block.component.c_priority" class="sg-priority">{{'+p+'block.component.c_priority}}</span>',
// Summary