Skip to content

Commit

Permalink
Update profiles on options import. Fix #120.
Browse files Browse the repository at this point in the history
  • Loading branch information
FelisCatus committed Jan 1, 2015
1 parent 8e56c4f commit 8cef8bd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
15 changes: 10 additions & 5 deletions omega-web/src/omega/controllers/io.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
13 changes: 11 additions & 2 deletions omega-web/src/omega/controllers/master.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) ->
Expand Down

0 comments on commit 8cef8bd

Please sign in to comment.