Browse Source

Show device ID QR code from edit dialog (fixes #1494)

Kevin Allen 10 years ago
parent
commit
ffc4a60bc6

+ 1 - 1
gui/index.html

@@ -52,7 +52,7 @@
           <a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="fa fa-cog"></span>&nbsp;<span translate>Actions</span> <span class="caret"></span></a>
           <ul class="dropdown-menu">
             <li><a href="" ng-click="editSettings()"><span class="fa fa-fw fa-cog"></span>&nbsp;<span translate>Settings</span></a></li>
-            <li><a href="" ng-click="idDevice()"><span class="fa fa-fw fa-qrcode"></span>&nbsp;<span translate>Show ID</span></a></li>
+            <li><a href="" ng-click="idDevice(thisDevice())"><span class="fa fa-fw fa-qrcode"></span>&nbsp;<span translate>Show ID</span></a></li>
             <li class="divider"></li>
             <li><a href="" ng-click="shutdown()"><span class="fa fa-fw fa-power-off"></span>&nbsp;<span translate>Shutdown</span></a></li>
             <li><a href="" ng-click="restart()"><span class="fa fa-fw fa-refresh"></span>&nbsp;<span translate>Restart</span></a></li>

+ 3 - 1
gui/syncthing/core/syncthingController.js

@@ -966,7 +966,9 @@ angular.module('syncthing.core')
             $('#editDevice').modal();
         };
 
-        $scope.idDevice = function () {
+        $scope.idDevice = function (deviceCfg) {
+            $scope.currentDevice = deviceCfg;
+            $('#editDevice').modal('hide');
             $('#idqr').modal('show');
         };
 

+ 3 - 0
gui/syncthing/device/editDeviceModalView.html

@@ -76,6 +76,9 @@
         <button type="button" class="btn btn-primary btn-sm" ng-click="saveDevice()" ng-disabled="deviceEditor.$invalid">
           <span class="fa fa-check"></span>&nbsp;<span translate>Save</span>
         </button>
+        <button type="button" class="btn btn-default btn-sm" ng-click="idDevice(currentDevice)" ng-if="editingExisting || deviceEditor.deviceID.$valid">
+          <span class="fa fa-qrcode"></span>&nbsp;<span translate>Show QR</span>
+        </button>
         <button type="button" class="btn btn-default btn-sm" data-dismiss="modal">
           <span class="fa fa-times"></span>&nbsp;<span translate>Close</span>
         </button>

+ 3 - 3
gui/syncthing/device/idqrModalView.html

@@ -1,4 +1,4 @@
-<modal id="idqr" status="info" icon="qrcode" title="{{'Device Identification' | translate}} - {{deviceName(thisDevice())}}" large="yes" close="yes">
-  <div class="well well-sm text-monospace text-center" select-on-click>{{myID}}</div>
-  <img ng-if="myID" class="center-block img-thumbnail" ng-src="qr/?text={{myID}}"/>
+<modal id="idqr" status="info" icon="qrcode" title="{{'Device Identification' | translate}} - {{deviceName(currentDevice)}}" large="yes" close="yes">
+  <div class="well well-sm text-monospace text-center" select-on-click>{{currentDevice.deviceID}}</div>
+  <img ng-if="currentDevice.deviceID" class="center-block img-thumbnail" ng-src="qr/?text={{currentDevice.deviceID}}"/>
 </modal>

File diff suppressed because it is too large
+ 1 - 1
lib/auto/gui.files.go


Some files were not shown because too many files changed in this diff