mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-03 03:15:31 -04:00
Mark entry as read when exiting reader at the end
This commit is contained in:
parent
a91cf21aa9
commit
da0ca665a6
@ -257,9 +257,24 @@ const readerComponent = () => {
|
|||||||
* @param {string} nextUrl - URL of the next entry
|
* @param {string} nextUrl - URL of the next entry
|
||||||
*/
|
*/
|
||||||
nextEntry(nextUrl) {
|
nextEntry(nextUrl) {
|
||||||
this.saveProgress(items.length, () => {
|
this.saveProgress(this.items.length, () => {
|
||||||
this.redirect(nextUrl);
|
this.redirect(nextUrl);
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Exits the reader, and optionally sets the reading progress tp 100%
|
||||||
|
*
|
||||||
|
* @param {string} exitUrl - The Exit URL
|
||||||
|
* @param {boolean} [markCompleted] - Whether we should mark the
|
||||||
|
* reading progress to 100%
|
||||||
|
*/
|
||||||
|
exitReader(exitUrl, markCompleted = false) {
|
||||||
|
if (!markCompleted) {
|
||||||
|
return this.redirect(exitUrl);
|
||||||
|
}
|
||||||
|
this.saveProgress(this.items.length, () => {
|
||||||
|
this.redirect(exitUrl);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
<%- if next_entry_url -%>
|
<%- if next_entry_url -%>
|
||||||
<button id="next-btn" class="uk-align-center uk-button uk-button-primary" @click="nextEntry('<%= next_entry_url %>')">Next Entry</button>
|
<button id="next-btn" class="uk-align-center uk-button uk-button-primary" @click="nextEntry('<%= next_entry_url %>')">Next Entry</button>
|
||||||
<%- else -%>
|
<%- else -%>
|
||||||
<button id="next-btn" class="uk-align-center uk-button uk-button-primary" @click="redirect('<%= exit_url %>')">Exit Reader</button>
|
<button id="next-btn" class="uk-align-center uk-button uk-button-primary" @click="exitReader('<%= exit_url %>', true)">Exit Reader</button>
|
||||||
<%- end -%>
|
<%- end -%>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -91,7 +91,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-modal-footer uk-text-right">
|
<div class="uk-modal-footer uk-text-right">
|
||||||
<button class="uk-button uk-button-danger" type="button" @click="redirect('<%= exit_url %>')">Exit Reader</button>
|
<button class="uk-button uk-button-danger" type="button" @click="exitReader('<%= exit_url %>')">Exit Reader</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user