Start from page 1 if the entry has been completed

(#71)
This commit is contained in:
Alex Ling 2020-06-16 06:15:58 +00:00
parent ca8d9efcfd
commit 00fcc881ee
2 changed files with 6 additions and 3 deletions

View File

@ -8,12 +8,12 @@ function showModal(encodedPath, pages, percentage, encodedeTitle, encodedEntryTi
if (percentage === 0) {
$('#continue-btn').attr('hidden', '');
$('#unread-btn').attr('hidden', '');
} else if (percentage === 100) {
$('#read-btn').attr('hidden', '');
$('#continue-btn').attr('hidden', '');
} else {
$('#continue-btn').text('Continue from ' + percentage + '%');
}
if (percentage === 100) {
$('#read-btn').attr('hidden', '');
}
$('#modal-title-link').text(title);
$('#modal-title-link').attr('href', `${base_url}book/${titleID}`);

View File

@ -15,6 +15,9 @@ class ReaderRouter < Router
# might not have actually read them
page = [page - 2 * IMGS_PER_PAGE, 1].max
# start from page 1 if the user has finished reading the entry
page = 1 if entry.finished? username
redirect env, "/reader/#{title.id}/#{entry.id}/#{page}"
rescue e
@context.error e