[FIX] web: centered event name while dragging in month mode

before this commit, the name of the event and hour is not
correctly centered while dragging the pill in month mode.

This commit fixes the issue by adding the CSS property.
after this commit, the name of the event and hour should be
correctly centered while dragging the pill in month mode.

TaskID-2506060

closes odoo/odoo#73553

X-original-commit: 59156daa150bf285626600f0a999dfe9838e1344
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
This commit is contained in:
Hardik Prajapati
2021-07-12 13:08:45 +00:00
parent 9240ac8eb5
commit c3e12ee644
3 changed files with 15 additions and 1 deletions
@@ -518,6 +518,7 @@ return AbstractRenderer.extend({
$(self.calendarElement).find(self._computeEventSelector(mouseLeaveInfo)).removeClass('o_cw_custom_hover');
},
eventDragStart: function (mouseDragInfo) {
mouseDragInfo.el.classList.add(mouseDragInfo.view.type);
$(self.calendarElement).find(`[data-event-id=${mouseDragInfo.event.id}]`).addClass('o_cw_custom_hover');
self._unselectEvent();
},
@@ -37,6 +37,11 @@ $o-cw-filter-avatar-size: 20px;
color: $body-color;
}
&.fc-dragging.fc-day-grid-event.dayGridMonth .fc-content {
@include text-truncate();
margin: 4px 4px 3px;
}
.fc-bg {
background-color: mix(theme-color('primary'), white); // Used for placeholder events only (on creation)
@include size(101%); // Compensate border
@@ -3060,7 +3060,7 @@ QUnit.module('Views', {
});
QUnit.test("drag and drop on month mode", async function (assert) {
assert.expect(2);
assert.expect(3);
const calendar = await createCalendarView({
arch:
@@ -3085,6 +3085,14 @@ QUnit.module('Views', {
await testUtils.dom.click($('.modal button.btn-primary'));
await testUtils.nextTick();
await testUtils.dom.dragAndDrop(
calendar.$('.fc-event:contains("event 1")'),
calendar.$('.fc-day-grid .fc-row:eq(3) .fc-day-top:eq(1)'),
{ disableDrop: true },
);
assert.hasClass(calendar.$('.o_calendar_widget > [data-event-id="1"]'), 'dayGridMonth',
"should have dayGridMonth class");
// Move event to another day (on 19 december)
await testUtils.dom.dragAndDrop(
calendar.$('.fc-event:contains("An event")'),