Refactor modals into template

This commit is contained in:
Jakob Borg
2014-07-14 14:14:26 +02:00
parent d812f559ef
commit 35b5999cba
4 changed files with 90 additions and 131 deletions

View File

@@ -337,7 +337,7 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) {
$scope.restart = function () {
restarting = true;
$scope.restartingHeader = "Restarting"
$scope.restartingTitle = "Restarting"
$scope.restartingBody = "Syncthing is restarting."
$('#restarting').modal({backdrop: 'static', keyboard: false});
$http.post(urlbase + '/restart');
@@ -360,7 +360,7 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) {
};
$scope.upgrade = function () {
$scope.restartingHeader = "Upgrading"
$scope.restartingTitle = "Upgrading"
$scope.restartingBody = "Syncthing is upgrading."
$('#restarting').modal({backdrop: 'static', keyboard: false});
$http.post(urlbase + '/upgrade').success(function () {
@@ -886,3 +886,19 @@ syncthing.directive('validNodeid', function() {
}
};
});
syncthing.directive('modal', function () {
return {
restrict: 'E',
templateUrl: 'modal.html',
replace: true,
transclude: true,
scope: {
title: '@',
status: '@',
icon: '@',
close: '@',
large: '@',
},
}
});