Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make sure all vars--including lastAdaptedName--are set in the delete docs logic branches
  • Loading branch information
eb1 committed Feb 20, 2024
1 parent f92f1c0 commit 5a489d8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions www/js/views/SearchViews.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,20 @@ define(function (require) {
window.Application.currentProject.set('lastDocument', "");
window.Application.currentProject.set('lastAdaptedBookID', 0);
window.Application.currentProject.set('lastAdaptedChapterID', 0);
window.Application.currentProject.set('lastAdaptedName', "");
window.Application.currentProject.save();
} else if (deletedCurrentDoc === true) {
// We just deleted the current Document/book;
// reset the current chapter and book to the first book in our collection
// reset the current chapter and book to the first book in our collection
// fall back on clearing out the lastAdapted stuff
window.Application.currentProject.set('lastDocument', "");
window.Application.currentProject.set('lastAdaptedBookID', 0);
window.Application.currentProject.set('lastAdaptedChapterID', 0);
window.Application.currentProject.set('lastAdaptedName', "");
// now try to get the first book in the book list
var bk = window.Application.BookList.at(0);
if (bk) {
// got it -- set the lastAdapted stuff to the first chapter
var cid = bk.get("chapters")[0];
window.Application.currentProject.set('lastDocument', bk.get("name"));
window.Application.currentProject.set('lastAdaptedBookID', bk.get("bookid"));
Expand All @@ -184,8 +192,8 @@ define(function (require) {
// can't get the chapter -- just clear out the lastAdaptedName value
window.Application.currentProject.set('lastAdaptedName', "");
}
window.Application.currentProject.save();
}
window.Application.currentProject.save();
}
},
////////
Expand Down

0 comments on commit 5a489d8

Please sign in to comment.