Browse Source

gui: Use versioned link to documentation in bottom bar (#8204)

Jakob Borg 3 years ago
parent
commit
a3a4da6e3e
2 changed files with 13 additions and 11 deletions
  1. 1 1
      gui/default/index.html
  2. 12 10
      gui/default/syncthing/core/syncthingController.js

+ 1 - 1
gui/default/index.html

@@ -892,7 +892,7 @@
     <div class="container">
       <ul class="nav navbar-nav">
         <li><a class="navbar-link" href="https://syncthing.net/" target="_blank"><span class="fas fa-home"></span>&nbsp;<span translate>Home page</span></a></li>
-        <li><a class="navbar-link" href="https://docs.syncthing.net/" target="_blank"><span class="fas fa-book"></span>&nbsp;<span translate>Documentation</span></a></li>
+        <li><a class="navbar-link" href="{{docsURL()}}" target="_blank"><span class="fas fa-book"></span>&nbsp;<span translate>Documentation</span></a></li>
         <li><a class="navbar-link" href="https://forum.syncthing.net" target="_blank"><span class="fas fa-question-circle"></span>&nbsp;<span translate>Support</span></a></li>
         <li><a class="navbar-link" href="https://data.syncthing.net/" target="_blank"><span class="fas fa-bar-chart"></span>&nbsp;<span translate>Statistics</span></a></li>
         <li><a class="navbar-link" href="https://github.com/syncthing/syncthing/releases" target="_blank"><span class="far fa-file-alt"></span>&nbsp;<span translate>Changelog</span></a></li>

+ 12 - 10
gui/default/syncthing/core/syncthingController.js

@@ -2921,16 +2921,18 @@ angular.module('syncthing.core')
 
         $scope.docsURL = function (path) {
             var url = 'https://docs.syncthing.net';
-            if (path) {
-                var hash = path.indexOf('#');
-                if (hash != -1) {
-                    url += '/' + path.slice(0, hash);
-                    url += '?version=' + $scope.versionBase();
-                    url += path.slice(hash);
-                } else {
-                    url += '/' + path;
-                    url += '?version=' + $scope.versionBase();
-                }
+            if (!path) {
+                // Undefined or null should become a valid string.
+                path = '';
+            }
+            var hash = path.indexOf('#');
+            if (hash != -1) {
+                url += '/' + path.slice(0, hash);
+                url += '?version=' + $scope.versionBase();
+                url += path.slice(hash);
+            } else {
+                url += '/' + path;
+                url += '?version=' + $scope.versionBase();
             }
             return url;
         };