Skip to content

Commit

Permalink
Show options guide only if there is a FixedProfile.
Browse files Browse the repository at this point in the history
  • Loading branch information
FelisCatus committed Mar 25, 2017
1 parent 0a7f4fc commit f2a6909
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 20 deletions.
4 changes: 1 addition & 3 deletions omega-web/src/coffee/options_guide.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ $script 'lib/tether/tether.js', ->
text: tr('options_guideNext')
action: tour.next
]
).on 'show', ->
location.href = document.querySelector(
'.nav-profile[data-profile-type="FixedProfile"] a').href
)

tour.addStep 'fixed-servers-step',
text: tr('options_guide_fixedServersStep')
Expand Down
48 changes: 31 additions & 17 deletions omega-web/src/omega/controllers/master.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ angular.module('omega').controller 'MasterCtrl', ($scope, $rootScope, $window,

$timeout ->
$rootScope.optionsDirty = false
showFirstRun()

$rootScope.revertOptions = ->
$window.location.reload()
Expand Down Expand Up @@ -308,22 +309,35 @@ angular.module('omega').controller 'MasterCtrl', ($scope, $rootScope, $window,

$scope.openShortcutConfig = omegaTarget.openShortcutConfig.bind(omegaTarget)

showFirstRunOnce = true
showFirstRun = ->
return unless showFirstRunOnce
showFirstRunOnce = false
omegaTarget.state('firstRun').then (firstRun) ->
return unless firstRun
omegaTarget.state('firstRun', '')

profileName = null
OmegaPac.Profiles.each $rootScope.options, (key, profile) ->
if not profileName and profile.profileType == 'FixedProfile'
profileName = profile.name
return unless profileName

scope = $rootScope.$new('isolate')
scope.upgrade = (firstRun == 'upgrade')
$modal.open(
templateUrl: 'partials/options_welcome.html'
keyboard: false
scope: scope
backdrop: 'static'
backdropClass: 'opacity-half'
).result.then (r) ->
switch r
when 'later'
return
when 'show'
$state.go('profile', {name: profileName}).then ->
$script 'js/options_guide.js'

omegaTarget.refresh()

omegaTarget.state('firstRun').then (firstRun) ->
return unless firstRun
scope = $rootScope.$new('isolate')
scope.upgrade = (firstRun == 'upgrade')
omegaTarget.state('firstRun', '')
$modal.open(
templateUrl: 'partials/options_welcome.html'
keyboard: false
scope: scope
backdrop: 'static'
backdropClass: 'opacity-half'
).result.then (r) ->
switch r
when 'later'
return
when 'show'
$script 'js/options_guide.js'

0 comments on commit f2a6909

Please sign in to comment.