diff --git a/app/scripts/controllers/list.js b/app/scripts/controllers/list.js
index edf358f..a816f30 100644
--- a/app/scripts/controllers/list.js
+++ b/app/scripts/controllers/list.js
@@ -71,7 +71,7 @@
dragulaService.options($scope, 'task-list', {
revertOnSpill: true,
- moves: function (el, container, handle) {
+ moves: function () {
return $scope.isSupportDragTask();
}
});
diff --git a/app/scripts/controllers/new.js b/app/scripts/controllers/new.js
index 745b362..f9f9e3e 100644
--- a/app/scripts/controllers/new.js
+++ b/app/scripts/controllers/new.js
@@ -7,17 +7,15 @@
$scope.context = {
currentTab: 'download',
urls: '',
+ availableOptions: (function () {
+ var keys = aria2SettingService.getNewTaskOptionKeys();
+
+ return aria2SettingService.getSpecifiedOptions(keys);
+ })(),
globalOptions: null,
- availableOptions: [],
options: {}
};
- $scope.context.availableOptions = (function () {
- var keys = aria2SettingService.getNewTaskOptionKeys();
-
- return aria2SettingService.getSpecifiedOptions(keys);
- })();
-
$scope.changeTab = function (tabName) {
if (tabName == 'options') {
$scope.loadDefaultOption();
diff --git a/app/scripts/controllers/settings-aria2.js b/app/scripts/controllers/settings-aria2.js
index 3e3297a..acc6dc6 100644
--- a/app/scripts/controllers/settings-aria2.js
+++ b/app/scripts/controllers/settings-aria2.js
@@ -4,16 +4,19 @@
angular.module('ariaNg').controller('Aria2SettingsController', ['$rootScope', '$scope', '$location', 'ariaNgConstants', 'ariaNgCommonService', 'aria2SettingService', function ($rootScope, $scope, $location, ariaNgConstants, ariaNgCommonService, aria2SettingService) {
var location = $location.path().substring($location.path().lastIndexOf('/') + 1);
- $scope.availableOptions = (function (type) {
- var keys = aria2SettingService.getAvailableGlobalOptionsKeys(type);
+ $scope.context = {
+ availableOptions: (function (type) {
+ var keys = aria2SettingService.getAvailableGlobalOptionsKeys(type);
- if (!keys) {
- ariaNgCommonService.showError('Type is illegal!');
- return;
- }
+ if (!keys) {
+ ariaNgCommonService.showError('Type is illegal!');
+ return;
+ }
- return aria2SettingService.getSpecifiedOptions(keys);
- })(location);
+ return aria2SettingService.getSpecifiedOptions(keys);
+ })(location),
+ globalOptions: []
+ };
$scope.setGlobalOption = function (key, value, optionStatus) {
return aria2SettingService.setGlobalOption(key, value, function (response) {
@@ -28,7 +31,7 @@
$rootScope.loadPromise = (function () {
return aria2SettingService.getGlobalOption(function (response) {
if (response.success) {
- $scope.globalOptions = response.data;
+ $scope.context.globalOptions = response.data;
}
});
})();
diff --git a/app/scripts/controllers/settings-ariang.js b/app/scripts/controllers/settings-ariang.js
index 9218009..8fc9e04 100644
--- a/app/scripts/controllers/settings-ariang.js
+++ b/app/scripts/controllers/settings-ariang.js
@@ -2,9 +2,12 @@
'use strict';
angular.module('ariaNg').controller('AriaNgSettingsController', ['$scope', 'ariaNgLanguages', 'ariaNgCommonService', 'ariaNgSettingService', function ($scope, ariaNgLanguages, ariaNgCommonService, ariaNgSettingService) {
- $scope.languages = ariaNgLanguages;
- $scope.availableTime = ariaNgCommonService.getTimeOptions([1000, 2000, 3000, 5000, 10000, 30000, 60000], true);
- $scope.settings = ariaNgSettingService.getAllOptions();
+ $scope.context = {
+ languages: ariaNgLanguages,
+ availableTime: ariaNgCommonService.getTimeOptions([1000, 2000, 3000, 5000, 10000, 30000, 60000], true),
+ settings: ariaNgSettingService.getAllOptions()
+ };
+
$scope.settingService = ariaNgSettingService;
}]);
})();
diff --git a/app/scripts/controllers/status.js b/app/scripts/controllers/status.js
index 41036ff..957339b 100644
--- a/app/scripts/controllers/status.js
+++ b/app/scripts/controllers/status.js
@@ -2,6 +2,10 @@
'use strict';
angular.module('ariaNg').controller('Aria2StatusController', ['$rootScope', '$scope', 'ariaNgCommonService', 'aria2SettingService', function ($rootScope, $scope, ariaNgCommonService, aria2SettingService) {
+ $scope.context = {
+ aria2Status: null
+ };
+
$scope.saveSession = function () {
return aria2SettingService.saveSession(function (response) {
if (response.success && response.data == 'OK') {
@@ -23,7 +27,7 @@
$rootScope.loadPromise = (function () {
return aria2SettingService.getAria2Status(function (response) {
if (response.success) {
- $scope.aria2Status = response.data;
+ $scope.context.aria2Status = response.data;
}
});
})();
diff --git a/app/scripts/controllers/task-detail.js b/app/scripts/controllers/task-detail.js
index 74cc1d9..6c5c3cb 100644
--- a/app/scripts/controllers/task-detail.js
+++ b/app/scripts/controllers/task-detail.js
@@ -28,11 +28,11 @@
var peers = response.data;
- if (!ariaNgCommonService.extendArray(peers, $scope.peers, 'peerId')) {
- $scope.peers = peers;
+ if (!ariaNgCommonService.extendArray(peers, $scope.context.btPeers, 'peerId')) {
+ $scope.context.btPeers = peers;
}
- $scope.context.healthPercent = aria2TaskService.estimateHealthPercentFromPeers(task, $scope.peers);
+ $scope.context.healthPercent = aria2TaskService.estimateHealthPercentFromPeers(task, $scope.context.btPeers);
}, silent, true);
};
@@ -76,9 +76,11 @@
$scope.context = {
currentTab: 'overview',
+ btPeers: [],
healthPercent: 0,
statusData: ariaNgMonitorService.getEmptyStatsData($routeParams.gid),
- availableOptions: []
+ availableOptions: [],
+ options: []
};
$scope.changeTab = function (tabName) {
@@ -185,7 +187,7 @@
$scope.loadTaskOption = function (task) {
$rootScope.loadPromise = aria2TaskService.getTaskOptions(task.gid, function (response) {
if (response.success) {
- $scope.options = response.data;
+ $scope.context.options = response.data;
}
});
};
diff --git a/app/views/settings-aria2.html b/app/views/settings-aria2.html
index 74e1169..da1d293 100644
--- a/app/views/settings-aria2.html
+++ b/app/views/settings-aria2.html
@@ -1,6 +1,6 @@