mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-08 22:31:04 +00:00
This commit is contained in:
parent
325c3c1fa7
commit
633ddba2b2
@ -67,7 +67,7 @@
|
||||
<span class="caret"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="" ng-click="editSettings()"><span class="fas fa-fw fa-cog"></span> <span translate>Settings</span></a></li>
|
||||
<li><a href="" ng-click="showSettings()"><span class="fas fa-fw fa-cog"></span> <span translate>Settings</span></a></li>
|
||||
<li><a href="" data-toggle="modal" data-target="#idqr" ng-click="currentDevice=thisDevice()"><span class="fas fa-fw fa-qrcode"></span> <span translate>Show ID</span></a></li>
|
||||
<li class="divider" aria-hidden="true"></li>
|
||||
<li><a href="" ng-click="shutdown()"><span class="fas fa-fw fa-power-off"></span> <span translate>Shutdown</span></a></li>
|
||||
@ -113,7 +113,7 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<button type="button" class="btn btn-sm btn-default pull-right" ng-click="editSettings()">
|
||||
<button type="button" class="btn btn-sm btn-default pull-right" ng-click="showSettings()">
|
||||
<span class="fas fa-cog"></span> <span translate>Settings</span>
|
||||
</button>
|
||||
<div class="clearfix"></div>
|
||||
|
@ -31,7 +31,7 @@
|
||||
<p><a href="https://docs.syncthing.net/users/releases.html"><span class="fas fa-info-circle"></span> <span translate>Learn more</span></a></p>
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<button type="button" class="btn btn-sm btn-default pull-right" ng-click="editSettings(); dismissNotification('channelNotification')">
|
||||
<button type="button" class="btn btn-sm btn-default pull-right" ng-click="showSettings(); dismissNotification('channelNotification')">
|
||||
<span class="fas fa-cog"></span> <span translate>Settings</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-default" ng-click="dismissNotification('channelNotification')">
|
||||
|
@ -1220,7 +1220,12 @@ angular.module('syncthing.core')
|
||||
}
|
||||
};
|
||||
|
||||
$scope.editSettings = function () {
|
||||
$scope.discardChangedSettings = function () {
|
||||
$("#discard-changes-confirmation").modal("hide");
|
||||
$("#settings").off("hide.bs.modal").modal("hide");
|
||||
};
|
||||
|
||||
$scope.showSettings = function () {
|
||||
// Make a working copy
|
||||
$scope.tmpOptions = angular.copy($scope.config.options);
|
||||
$scope.tmpOptions.deviceName = $scope.thisDevice().name;
|
||||
@ -1234,26 +1239,19 @@ angular.module('syncthing.core')
|
||||
$scope.tmpGUI = angular.copy($scope.config.gui);
|
||||
$scope.tmpRemoteIgnoredDevices = angular.copy($scope.config.remoteIgnoredDevices);
|
||||
$scope.tmpDevices = angular.copy($scope.config.devices);
|
||||
var settingsModal = $('#settings').modal();
|
||||
settingsModal.one('hidden.bs.modal', function () {
|
||||
$('.nav-tabs a[href="#settings-general"]').tab('show');
|
||||
window.location.hash = "";
|
||||
settingsModal.off('hide.bs.modal');
|
||||
}).on('hide.bs.modal', function (e) {
|
||||
$('#settings').modal("show");
|
||||
$("#settings a[href='#settings-general']").tab("show");
|
||||
$("#settings").on('hide.bs.modal', function (event) {
|
||||
if ($scope.settingsModified()) {
|
||||
$("#discard-changes-confirmation").modal().one('hidden.bs.modal', function () {
|
||||
if (!$scope.settingsModified()) {
|
||||
settingsModal.modal('hide');
|
||||
}
|
||||
});
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
return false;
|
||||
event.preventDefault();
|
||||
$("#discard-changes-confirmation").modal("show");
|
||||
} else {
|
||||
$("#settings").off("hide.bs.modal");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.saveConfig = function (cb) {
|
||||
$scope.saveConfig = function (callback) {
|
||||
var cfg = JSON.stringify($scope.config);
|
||||
var opts = {
|
||||
headers: {
|
||||
@ -1262,8 +1260,9 @@ angular.module('syncthing.core')
|
||||
};
|
||||
$http.post(urlbase + '/system/config', cfg, opts).success(function () {
|
||||
refreshConfig();
|
||||
if (cb) {
|
||||
cb();
|
||||
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
}).error(function (data, status, headers, config) {
|
||||
refreshConfig();
|
||||
@ -1320,6 +1319,7 @@ angular.module('syncthing.core')
|
||||
$scope.tmpOptions.upgradeToPreReleases = false;
|
||||
} else {
|
||||
$scope.tmpOptions.autoUpgradeIntervalH = 0;
|
||||
$scope.tmpOptions.upgradeToPreReleases = false;
|
||||
}
|
||||
|
||||
// Check if protocol will need to be changed on restart
|
||||
@ -1354,7 +1354,7 @@ angular.module('syncthing.core')
|
||||
});
|
||||
}
|
||||
|
||||
$('#settings').modal("hide");
|
||||
$("#settings").off("hide.bs.modal").modal("hide");
|
||||
};
|
||||
|
||||
$scope.saveAdvanced = function () {
|
||||
|
@ -5,8 +5,8 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<!-- editSettings() repopulates temp variables, which then makes the settingsModified() check pass -->
|
||||
<button type="button" class="btn btn-warning pull-left btn-sm" data-dismiss="modal" ng-click="editSettings()">
|
||||
<!-- showSettings() repopulates temp variables, which then makes the settingsModified() check pass -->
|
||||
<button type="button" class="btn btn-warning pull-left btn-sm" ng-click="discardChangedSettings()">
|
||||
<span class="fas fa-check"></span> <span translate>Discard</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">
|
||||
|
Loading…
Reference in New Issue
Block a user