Update profiles on options import. Fix #120.

This commit is contained in:
FelisCatus 2015-01-01 21:55:33 +08:00
parent 8e56c4f883
commit 8cef8bd627
2 changed files with 21 additions and 7 deletions

View File

@ -6,13 +6,18 @@ angular.module('omega').controller 'IoCtrl', ($scope, $rootScope) ->
blob = new Blob [content], {type: "text/plain;charset=utf-8"}
saveAs(blob, "OmegaOptions.bak")
$scope.importSuccess = ->
$rootScope.showAlert(
type: 'success'
i18n: 'options_importSuccess'
message: 'Options imported.'
)
$scope.restoreLocal = (content) ->
$rootScope.resetOptions(content).then ( ->
$rootScope.showAlert(
type: 'success'
i18n: 'options_importSuccess'
message: 'Options imported.'
)
$scope.importSuccess()
$rootScope.updateProfile().finally ->
$scope.importSuccess()
), -> $scope.restoreLocalError()
$scope.restoreLocalError = ->
$rootScope.showAlert(

View File

@ -211,7 +211,13 @@ angular.module('omega').controller 'MasterCtrl', ($scope, $rootScope, $window,
$rootScope.updateProfile = (name) ->
$rootScope.applyOptionsConfirm().then(->
$scope.updatingProfile[name] = true
if name?
$scope.updatingProfile[name] = true
else
OmegaPac.Profiles.each $scope.options, (key, profile) ->
if not profile.builtin
$scope.updatingProfile[profile.name] = true
omegaTarget.updateProfile(name).then((results) ->
success = 0
error = 0
@ -233,7 +239,10 @@ angular.module('omega').controller 'MasterCtrl', ($scope, $rootScope, $window,
i18n: 'options_profileDownloadError'
)
).finally ->
$scope.updatingProfile[name] = false
if name?
$scope.updatingProfile[name] = false
else
$scope.updatingProfile = {}
)
onOptionChange = (options, oldOptions) ->