Fix and refactor modals

This commit is contained in:
Audrius Butkevicius 2014-08-10 23:28:04 +01:00
parent 528cbf62ec
commit b41590ce38
4 changed files with 22 additions and 20 deletions

File diff suppressed because one or more lines are too long

View File

@ -128,7 +128,7 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http, $translate, $loca
$scope.$on('UIOffline', function (event, arg) { $scope.$on('UIOffline', function (event, arg) {
console.log('UIOffline'); console.log('UIOffline');
if (!restarting) { if (!restarting) {
$('#networkError').modal({backdrop: 'static', keyboard: false}); $('#networkError').modal();
} }
}); });
@ -188,7 +188,7 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http, $translate, $loca
document.cookie = "firstVisit=" + Date.now() + ";max-age=" + 30*24*3600; document.cookie = "firstVisit=" + Date.now() + ";max-age=" + 30*24*3600;
} else { } else {
if (+firstVisit < Date.now() - 4*3600*1000){ if (+firstVisit < Date.now() - 4*3600*1000){
$('#ur').modal({backdrop: 'static', keyboard: false}); $('#ur').modal();
} }
} }
} }
@ -471,7 +471,7 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http, $translate, $loca
$scope.tmpOptions = angular.copy($scope.config.Options); $scope.tmpOptions = angular.copy($scope.config.Options);
$scope.tmpOptions.UREnabled = ($scope.tmpOptions.URAccepted > 0); $scope.tmpOptions.UREnabled = ($scope.tmpOptions.URAccepted > 0);
$scope.tmpGUI = angular.copy($scope.config.GUI); $scope.tmpGUI = angular.copy($scope.config.GUI);
$('#settings').modal({backdrop: 'static', keyboard: true}); $('#settings').modal();
}; };
$scope.saveConfig = function() { $scope.saveConfig = function() {
@ -514,7 +514,7 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http, $translate, $loca
$scope.restart = function () { $scope.restart = function () {
restarting = true; restarting = true;
$('#restarting').modal({backdrop: 'static', keyboard: false}); $('#restarting').modal();
$http.post(urlbase + '/restart'); $http.post(urlbase + '/restart');
$scope.configInSync = true; $scope.configInSync = true;
@ -536,9 +536,9 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http, $translate, $loca
$scope.upgrade = function () { $scope.upgrade = function () {
restarting = true; restarting = true;
$('#upgrading').modal({backdrop: 'static', keyboard: false}); $('#upgrading').modal();
$http.post(urlbase + '/upgrade').success(function () { $http.post(urlbase + '/upgrade').success(function () {
$('#restarting').modal({backdrop: 'static', keyboard: false}); $('#restarting').modal();
$('#upgrading').modal('hide'); $('#upgrading').modal('hide');
}).error(function () { }).error(function () {
$('#upgrading').modal('hide'); $('#upgrading').modal('hide');
@ -548,7 +548,7 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http, $translate, $loca
$scope.shutdown = function () { $scope.shutdown = function () {
restarting = true; restarting = true;
$http.post(urlbase + '/shutdown').success(function () { $http.post(urlbase + '/shutdown').success(function () {
$('#shutdown').modal({backdrop: 'static', keyboard: false}); $('#shutdown').modal();
}); });
$scope.configInSync = true; $scope.configInSync = true;
}; };
@ -559,7 +559,7 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http, $translate, $loca
$scope.editingSelf = (nodeCfg.NodeID == $scope.myID); $scope.editingSelf = (nodeCfg.NodeID == $scope.myID);
$scope.currentNode.AddressesStr = nodeCfg.Addresses.join(', '); $scope.currentNode.AddressesStr = nodeCfg.Addresses.join(', ');
$scope.nodeEditor.$setPristine(); $scope.nodeEditor.$setPristine();
$('#editNode').modal({backdrop: 'static', keyboard: true}); $('#editNode').modal();
}; };
$scope.idNode = function () { $scope.idNode = function () {
@ -571,7 +571,7 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http, $translate, $loca
$scope.editingExisting = false; $scope.editingExisting = false;
$scope.editingSelf = false; $scope.editingSelf = false;
$scope.nodeEditor.$setPristine(); $scope.nodeEditor.$setPristine();
$('#editNode').modal({backdrop: 'static', keyboard: true}); $('#editNode').modal();
}; };
$scope.deleteNode = function () { $scope.deleteNode = function () {
@ -679,14 +679,14 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http, $translate, $loca
$scope.currentRepo.simpleKeep = $scope.currentRepo.simpleKeep || 5; $scope.currentRepo.simpleKeep = $scope.currentRepo.simpleKeep || 5;
$scope.editingExisting = true; $scope.editingExisting = true;
$scope.repoEditor.$setPristine(); $scope.repoEditor.$setPristine();
$('#editRepo').modal({backdrop: 'static', keyboard: true}); $('#editRepo').modal();
}; };
$scope.addRepo = function () { $scope.addRepo = function () {
$scope.currentRepo = {selectedNodes: {}}; $scope.currentRepo = {selectedNodes: {}};
$scope.editingExisting = false; $scope.editingExisting = false;
$scope.repoEditor.$setPristine(); $scope.repoEditor.$setPristine();
$('#editRepo').modal({backdrop: 'static', keyboard: true}); $('#editRepo').modal();
}; };
$scope.saveRepo = function () { $scope.saveRepo = function () {
@ -763,7 +763,7 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http, $translate, $loca
$scope.showNeed = function (repo) { $scope.showNeed = function (repo) {
$scope.neededLoaded = false; $scope.neededLoaded = false;
$('#needed').modal({backdrop: 'static', keyboard: true}); $('#needed').modal();
$http.get(urlbase + "/need?repo=" + encodeURIComponent(repo)).success(function (data) { $http.get(urlbase + "/need?repo=" + encodeURIComponent(repo)).success(function (data) {
$scope.needed = data; $scope.needed = data;
$scope.neededLoaded = true; $scope.neededLoaded = true;

View File

@ -395,6 +395,8 @@
<p><span translate>Syncthing is restarting.</span> <span translate>Please wait</span>...</p> <p><span translate>Syncthing is restarting.</span> <span translate>Please wait</span>...</p>
</modal> </modal>
<!-- Upgrading modal -->
<modal id="upgrading" icon="refresh" title="{{'Upgrading' | translate}}" status="info"> <modal id="upgrading" icon="refresh" title="{{'Upgrading' | translate}}" status="info">
<p><span translate>Syncthing is upgrading.</span> <span translate>Please wait</span>...</p> <p><span translate>Syncthing is upgrading.</span> <span translate>Please wait</span>...</p>
</modal> </modal>
@ -414,7 +416,7 @@
<!-- Node editor modal --> <!-- Node editor modal -->
<div id="editNode" class="modal fade"> <div id="editNode" class="modal fade" tabindex="-1">
<div class="modal-dialog modal-lg"> <div class="modal-dialog modal-lg">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@ -464,7 +466,7 @@
<!-- Repo editor modal --> <!-- Repo editor modal -->
<div id="editRepo" class="modal fade"> <div id="editRepo" class="modal fade" tabindex="-1">
<div class="modal-dialog modal-lg"> <div class="modal-dialog modal-lg">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@ -558,7 +560,7 @@
<!-- Settings modal --> <!-- Settings modal -->
<div id="settings" class="modal fade"> <div id="settings" class="modal fade" tabindex="-1">
<div class="modal-dialog modal-lg"> <div class="modal-dialog modal-lg">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@ -684,7 +686,7 @@
<!-- Usage report modal --> <!-- Usage report modal -->
<div id="ur" class="modal fade"> <div id="ur" class="modal fade" data-backdrop="static" data-keyboard="false" tabindex="-1">
<div class="modal-dialog modal-lg"> <div class="modal-dialog modal-lg">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header alert alert-success"> <div class="modal-header alert alert-success">

View File

@ -1,4 +1,4 @@
<div class="modal fade"> <div class="modal fade" tabindex="-1" ng-attr-data-backdrop="{{ close ? true : 'static' }}" ng-attr-data-keyboard="{{ Boolean(close) }}">
<div class="modal-dialog" ng-class="{'modal-lg': large}"> <div class="modal-dialog" ng-class="{'modal-lg': large}">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header alert alert-{{status}}"> <div class="modal-header alert alert-{{status}}">