Skip to content

Commit

Permalink
Add conditional to fix exception
Browse files Browse the repository at this point in the history
  • Loading branch information
fosterfarrell9 committed Feb 24, 2025
1 parent ee29e58 commit 4f109ab
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions app/views/lectures/new.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ $('.admin-index-button').hide()

# make sure that there will always be a teacher selected
teacherSelector = document.getElementById('lecture_teacher_id')
sel = teacherSelector.tomselect
sel.on 'blur', ->
value = sel.getValue()
if value == ''
sel.setValue(teacherSelector.dataset.current)
return
if teacherSelector?
sel = teacherSelector.tomselect
sel.on 'blur', ->
value = sel.getValue()
if value == ''
sel.setValue(teacherSelector.dataset.current)
return

# show the modal if the new action was triggered from course edit page
<% if @from == 'course' %>
Expand Down

0 comments on commit 4f109ab

Please sign in to comment.