Selaa lähdekoodia

Add '+' shortcut for new subscription page

Thiago Perrotta 4 vuotta sitten
vanhempi
commit
1e357d3ced
3 muutettua tiedostoa jossa 8 lisäystä ja 0 poistoa
  1. 2 0
      template/templates/common/layout.html
  2. 5 0
      ui/static/js/app.js
  3. 1 0
      ui/static/js/bootstrap.js

+ 2 - 0
template/templates/common/layout.html

@@ -47,6 +47,7 @@
 </head>
 <body
     {{ if .csrf }}data-csrf-token="{{ .csrf }}"{{ end }}
+    data-add-subscription-url="{{ route "addSubscription" }}"
     data-entries-status-url="{{ route "updateEntriesStatus" }}"
     data-refresh-all-feeds-url="{{ route "refreshAllFeeds" }}"
     {{ if .user }}{{ if not .user.KeyboardShortcuts }}data-disable-keyboard-shortcuts="true"{{ end }}{{ end }}>
@@ -128,6 +129,7 @@
                     <li>{{ t "page.keyboard_shortcuts.go_to_categories" }} = <strong>g + c</strong></li>
                     <li>{{ t "page.keyboard_shortcuts.go_to_settings" }} = <strong>g + s</strong></li>
                     <li>{{ t "page.keyboard_shortcuts.show_keyboard_shortcuts" }} = <strong>?</strong></li>
+                    <li>{{ t "menu.add_feed" }} = <strong>+</strong></li>
                 </ul>
 
                 <p>{{ t "page.keyboard_shortcuts.subtitle.items" }}</p>

+ 5 - 0
ui/static/js/app.js

@@ -612,3 +612,8 @@ function showToast(label, iconElement) {
         }
     }
 }
+
+/** Navigate to the new subscription page. */
+function goToAddSubscription() {
+    window.location.href = document.body.dataset.addSubscriptionUrl;
+}

+ 1 - 0
ui/static/js/bootstrap.js

@@ -32,6 +32,7 @@ document.addEventListener("DOMContentLoaded", function () {
         keyboardHandler.on("F", () => goToFeed());
         keyboardHandler.on("R", () => handleRefreshAllFeeds());
         keyboardHandler.on("?", () => showKeyboardShortcuts());
+        keyboardHandler.on("+", () => goToAddSubscription());
         keyboardHandler.on("#", () => unsubscribeFromFeed());
         keyboardHandler.on("/", (e) => setFocusToSearchInput(e));
         keyboardHandler.on("Escape", () => ModalHandler.close());