Skip to content

Commit

Permalink
Merge pull request #693 from drnlm/bugfix/redisplay_talks_after_drag_…
Browse files Browse the repository at this point in the history
…over

Bugfix/redisplay talks after drag over
  • Loading branch information
drnlm authored Dec 2, 2023
2 parents 3c1ea8e + 90add49 commit 55e4d8c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
3 changes: 0 additions & 3 deletions wafer/schedule/tests/test_schedule_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,8 @@ def test_swicth_day(self):
with self.assertRaises(NoSuchElementException):
self.driver.find_element(By.ID, f"scheduleItem{item2.pk}")

@expectedFailure
def test_drag_over_talk(self):
"""Test that dragging over an item replaces it"""
# Expected to fail - see https://github.com/CTPUG/wafer/issues/689
# Create a schedule with a single item
item1 = ScheduleItem.objects.create(venue=self.venues[0],
talk_id=self.talk1.pk)
Expand Down Expand Up @@ -403,7 +401,6 @@ def test_drag_over_talk(self):
if self.talk2.title in x.text:
found2 = True
self.assertFalse(found2)
# FIXME: The schedule editor doesn't do this correctly
self.assertTrue(found1)

def test_drag_over_page(self):
Expand Down
13 changes: 13 additions & 0 deletions wafer/static/js/edit_schedule.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,19 @@
e.dataTransfer.getData('text/plain'));
var scheduleItemId = data.getAttribute('data-scheduleitem-id');
var scheduleItemType = data.getAttribute('data-type');

var curScheduleItemId = e.target.getAttribute('data-scheduleitem-id');
if (curScheduleItemId)
{
var curType = e.target.getAttribute('data-type');
if (curType == 'talk')
{
// Need to redisplay the talk we're removing
var curId = e.target.getAttribute('data-talk-id');
var oldUnassigned = document.getElementById("talk" + curId);
oldUnassigned.hidden = false;
}
}
e.target.innerHTML = data.getAttribute('title');
e.target.setAttribute('data-scheduleitem-id', scheduleItemId);
e.target.setAttribute('data-type', scheduleItemType);
Expand Down

0 comments on commit 55e4d8c

Please sign in to comment.