Skip to content

Commit

Permalink
BookInstance - improve selected option code
Browse files Browse the repository at this point in the history
  • Loading branch information
hamishwillee committed Oct 30, 2023
1 parent 1ac4b75 commit fa57a10
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion views/bookinstance_form.pug
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ block content
select#book.form-control(type='select' placeholder='Select book' name='book' required='true' )
- book_list.sort(function(a, b) {let textA = a.title.toUpperCase(); let textB = b.title.toUpperCase(); return (textA < textB) ? -1 : (textA > textB) ? 1 : 0;});
for book in book_list
option(value=book._id, selected=(selected_book==book._id.toString() ? 'selected' : false) ) #{book.title}
option(value=book._id, selected=(selected_book==book._id.toString() ? '' : false) ) #{book.title}

div.form-group
label(for='imprint') Imprint:
Expand Down

0 comments on commit fa57a10

Please sign in to comment.