mirror of
https://github.com/zero-peak/ZeroOmega.git
synced 2025-01-22 15:08:12 -05:00
Rename attached rulelist when renaming a profile. Fix #40.
This commit is contained in:
parent
817528ef21
commit
546f6ab6e4
@ -24,8 +24,9 @@ angular.module('omega').config ($stateProvider, $urlRouterProvider,
|
||||
$animateProvider.classNameFilter(/angular-animate/)
|
||||
|
||||
$urlRouterProvider.otherwise '/ui'
|
||||
|
||||
$urlRouterProvider.otherwise ($injector, $location) ->
|
||||
if $location.path() == '' or $location.path() == '/'
|
||||
if $location.path() == ''
|
||||
$injector.get('omegaTarget').lastUrl()
|
||||
else
|
||||
'/ui'
|
||||
|
@ -1,6 +1,6 @@
|
||||
angular.module('omega').controller 'MasterCtrl', ($scope, $rootScope, $window,
|
||||
$modal, $state, builtinProfiles, profileColors, profileIcons, omegaTarget, $q,
|
||||
$timeout, $location, $filter) ->
|
||||
$timeout, $location, $filter, getAttachedName) ->
|
||||
|
||||
tr = $filter('tr')
|
||||
|
||||
@ -136,7 +136,28 @@ angular.module('omega').controller 'MasterCtrl', ($scope, $rootScope, $window,
|
||||
scope: scope
|
||||
).result.then (toName) ->
|
||||
if toName != fromName
|
||||
omegaTarget.renameProfile(fromName, toName).then(->
|
||||
rename = omegaTarget.renameProfile(fromName, toName)
|
||||
attachedName = getAttachedName(fromName)
|
||||
if $rootScope.profileByName(attachedName)
|
||||
toAttachedName = getAttachedName(toName)
|
||||
defaultProfileName = undefined
|
||||
if $rootScope.profileByName(toAttachedName)
|
||||
defaultProfileName = profile.defaultProfileName
|
||||
rename = rename.then ->
|
||||
toAttachedKey = OmegaPac.Profiles.nameAsKey(toAttachedName)
|
||||
profile = $rootScope.profileByName(toName)
|
||||
profile.defaultProfileName = 'direct'
|
||||
OmegaPac.Profiles.updateRevision(profile)
|
||||
delete $rootScope.options[toAttachedKey]
|
||||
$rootScope.applyOptions()
|
||||
rename = rename.then ->
|
||||
omegaTarget.renameProfile(attachedName, toAttachedName)
|
||||
if defaultProfileName
|
||||
rename = rename.then ->
|
||||
profile = $rootScope.profileByName(toName)
|
||||
profile.defaultProfileName = defaultProfileName
|
||||
$rootScope.applyOptions()
|
||||
rename.then(->
|
||||
$state.go('profile', {name: toName})
|
||||
).catch (err) ->
|
||||
$rootScope.showAlert(
|
||||
|
Loading…
Reference in New Issue
Block a user