mirror of
https://github.com/miniflux/v2.git
synced 2025-08-26 18:21:01 +00:00
refactor: Replace "Bookmarks" with "Starred"
Replaces usage of the word "bookmark" with "star"/"starred" in order to be more consistent with the UI and database models, and to reduce confusion with "bookmarklet" and integration features. This is in preparation of future work on read-it-later features. Which are also not called "bookmarks" to prevent any further confusion. https://github.com/orgs/miniflux/discussions/3719 Related-to: https://github.com/miniflux/v2/pull/2219
This commit is contained in:
parent
4d656d2739
commit
60cd7ffe88
37 changed files with 171 additions and 170 deletions
|
@ -10,9 +10,9 @@ import (
|
|||
"miniflux.app/v2/internal/http/response/json"
|
||||
)
|
||||
|
||||
func (h *handler) toggleBookmark(w http.ResponseWriter, r *http.Request) {
|
||||
func (h *handler) toggleStarred(w http.ResponseWriter, r *http.Request) {
|
||||
entryID := request.RouteInt64Param(r, "entryID")
|
||||
if err := h.store.ToggleBookmark(request.UserID(r), entryID); err != nil {
|
||||
if err := h.store.ToggleStarred(request.UserID(r), entryID); err != nil {
|
||||
json.ServerError(w, r, err)
|
||||
return
|
||||
}
|
|
@ -53,5 +53,5 @@ func (h *handler) showStarredPage(w http.ResponseWriter, r *http.Request) {
|
|||
view.Set("countErrorFeeds", h.store.CountUserFeedsWithErrors(user.ID))
|
||||
view.Set("hasSaveEntry", h.store.HasSaveEntry(user.ID))
|
||||
|
||||
html.OK(w, r, view.Render("bookmark_entries"))
|
||||
html.OK(w, r, view.Render("starred_entries"))
|
||||
}
|
|
@ -215,12 +215,12 @@ function setButtonToSavedState(buttonElement) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the bookmark button state.
|
||||
* Set the star button state.
|
||||
*
|
||||
* @param {Element} buttonElement - The button element to update.
|
||||
* @param {string} newState - The new state to set ("star" or "unstar").
|
||||
*/
|
||||
function setBookmarkButtonState(buttonElement, newState) {
|
||||
function setStarredButtonState(buttonElement, newState) {
|
||||
buttonElement.dataset.value = newState;
|
||||
const iconType = newState === "star" ? "unstar" : "star";
|
||||
setIconAndLabelElement(buttonElement, iconType, buttonElement.dataset[newState === "star" ? "labelUnstar" : "labelStar"]);
|
||||
|
@ -702,25 +702,25 @@ function handleSaveEntryAction(element = null) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Handle bookmarking an entry.
|
||||
* Handle starring an entry.
|
||||
*
|
||||
* @param {Element} element - The element that triggered the bookmark action.
|
||||
* @param {Element} element - The element that triggered the star action.
|
||||
*/
|
||||
function handleBookmarkAction(element) {
|
||||
function handleStarAction(element) {
|
||||
const currentEntry = findEntry(element);
|
||||
if (!currentEntry) return;
|
||||
|
||||
const buttonElement = currentEntry.querySelector(":is(a, button)[data-toggle-bookmark]");
|
||||
const buttonElement = currentEntry.querySelector(":is(a, button)[data-toggle-starred]");
|
||||
if (!buttonElement) return;
|
||||
|
||||
setButtonToLoadingState(buttonElement);
|
||||
|
||||
sendPOSTRequest(buttonElement.dataset.bookmarkUrl).then(() => {
|
||||
sendPOSTRequest(buttonElement.dataset.starUrl).then(() => {
|
||||
const currentState = buttonElement.dataset.value;
|
||||
const isStarred = currentState === "star";
|
||||
const newStarStatus = isStarred ? "unstar" : "star";
|
||||
|
||||
setBookmarkButtonState(buttonElement, newStarStatus);
|
||||
setStarredButtonState(buttonElement, newStarStatus);
|
||||
|
||||
if (isEntryView()) {
|
||||
showToastNotification(currentState, buttonElement.dataset[isStarred ? "toastUnstar" : "toastStar"]);
|
||||
|
@ -1192,7 +1192,7 @@ function initializeKeyboardShortcuts() {
|
|||
keyboardHandler.on("A", markPageAsReadAction);
|
||||
keyboardHandler.on("s", () => handleSaveEntryAction());
|
||||
keyboardHandler.on("d", handleFetchOriginalContentAction);
|
||||
keyboardHandler.on("f", () => handleBookmarkAction());
|
||||
keyboardHandler.on("f", () => handleStarAction());
|
||||
|
||||
// Feed actions
|
||||
keyboardHandler.on("F", goToFeedPage);
|
||||
|
@ -1227,7 +1227,7 @@ function initializeTouchHandler() {
|
|||
function initializeClickHandlers() {
|
||||
// Entry actions
|
||||
onClick(":is(a, button)[data-save-entry]", (event) => handleSaveEntryAction(event.target));
|
||||
onClick(":is(a, button)[data-toggle-bookmark]", (event) => handleBookmarkAction(event.target));
|
||||
onClick(":is(a, button)[data-toggle-starred]", (event) => handleStarAction(event.target));
|
||||
onClick(":is(a, button)[data-toggle-status]", (event) => handleEntryStatus("next", event.target));
|
||||
onClick(":is(a, button)[data-fetch-content-entry]", handleFetchOriginalContentAction);
|
||||
onClick(":is(a, button)[data-share-status]", handleEntryShareAction);
|
||||
|
|
|
@ -51,7 +51,7 @@ func Serve(router *mux.Router, store *storage.Storage, pool *worker.Pool) {
|
|||
uiRouter.HandleFunc("/history/entry/{entryID}", handler.showReadEntryPage).Name("readEntry").Methods(http.MethodGet)
|
||||
uiRouter.HandleFunc("/history/flush", handler.flushHistory).Name("flushHistory").Methods(http.MethodPost)
|
||||
|
||||
// Bookmark pages.
|
||||
// Starred pages.
|
||||
uiRouter.HandleFunc("/starred", handler.showStarredPage).Name("starred").Methods(http.MethodGet)
|
||||
uiRouter.HandleFunc("/starred/entry/{entryID}", handler.showStarredEntryPage).Name("starredEntry").Methods(http.MethodGet)
|
||||
|
||||
|
@ -104,7 +104,7 @@ func Serve(router *mux.Router, store *storage.Storage, pool *worker.Pool) {
|
|||
uiRouter.HandleFunc("/entry/enclosure/{enclosureID}/save-progression", handler.saveEnclosureProgression).Name("saveEnclosureProgression").Methods(http.MethodPost)
|
||||
uiRouter.HandleFunc("/entry/download/{entryID}", handler.fetchContent).Name("fetchContent").Methods(http.MethodPost)
|
||||
uiRouter.HandleFunc("/proxy/{encodedDigest}/{encodedURL}", handler.mediaProxy).Name("proxy").Methods(http.MethodGet)
|
||||
uiRouter.HandleFunc("/entry/bookmark/{entryID}", handler.toggleBookmark).Name("toggleBookmark").Methods(http.MethodPost)
|
||||
uiRouter.HandleFunc("/entry/star/{entryID}", handler.toggleStarred).Name("toggleStarred").Methods(http.MethodPost)
|
||||
|
||||
// Share pages.
|
||||
uiRouter.HandleFunc("/entry/share/{entryID}", handler.createSharedEntry).Name("shareEntry").Methods(http.MethodPost)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue