refactor code

This commit is contained in:
MaysWind 2016-05-23 22:56:39 +08:00
parent 92bf8352d0
commit f12965dd6b
4 changed files with 18 additions and 4 deletions

View file

@ -242,6 +242,7 @@
<script src="scripts/filters/substring.js"></script> <script src="scripts/filters/substring.js"></script>
<script src="scripts/filters/taskOrderBy.js"></script> <script src="scripts/filters/taskOrderBy.js"></script>
<script src="scripts/filters/volumn.js"></script> <script src="scripts/filters/volumn.js"></script>
<script src="scripts/langs/config.js"></script>
<script src="scripts/langs/en-US.js"></script> <script src="scripts/langs/en-US.js"></script>
<script src="scripts/langs/zh-CN.js"></script> <script src="scripts/langs/zh-CN.js"></script>
<script src="scripts/services/aria2HttpRpcService.js"></script> <script src="scripts/services/aria2HttpRpcService.js"></script>

View file

@ -1,7 +1,8 @@
(function () { (function () {
'use strict'; 'use strict';
angular.module('ariaNg').controller('AriaNgSettingsController', ['$scope', 'SweetAlert', 'ariaNgSettingService', function ($scope, SweetAlert, ariaNgSettingService) { angular.module('ariaNg').controller('AriaNgSettingsController', ['$scope', 'ariaNgLanguages', 'ariaNgSettingService', function ($scope, ariaNgLanguages, ariaNgSettingService) {
$scope.languages = ariaNgLanguages;
$scope.settings = ariaNgSettingService.getAllOptions(); $scope.settings = ariaNgSettingService.getAllOptions();
$scope.settingService = ariaNgSettingService; $scope.settingService = ariaNgSettingService;
}]); }]);

View file

@ -0,0 +1,12 @@
(function () {
'use strict';
angular.module('ariaNg').constant('ariaNgLanguages', {
'en-US': {
name: 'English'
},
'zh-CN': {
name: 'Simplified Chinese'
}
});
})();

View file

@ -5,9 +5,9 @@
<span translate>Language</span> <span translate>Language</span>
</div> </div>
<div class="setting-value col-sm-8"> <div class="setting-value col-sm-8">
<select class="form-control" style="width: 100%;" ng-model="settings.language" ng-change="settingService.setLanguage(settings.language)"> <select class="form-control" style="width: 100%;" ng-model="settings.language"
<option value="en-US" translate translate-language="en-US">English</option> ng-options="type as (language.name | translate) for (type, language) in languages"
<option value="zh-CN" translate translate-language="zh-CN">Simplified Chinese</option> ng-change="settingService.setLanguage(settings.language)">
</select> </select>
</div> </div>
</div> </div>