Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/redisplay talks after drag over #693

Merged
merged 2 commits into from
Dec 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading