From f2a6909cd3920d4197d0d73cae1ea670a89bfe57 Mon Sep 17 00:00:00 2001 From: FelisCatus Date: Fri, 24 Mar 2017 23:25:00 -0400 Subject: [PATCH] Show options guide only if there is a FixedProfile. --- omega-web/src/coffee/options_guide.coffee | 4 +- omega-web/src/omega/controllers/master.coffee | 48 ++++++++++++------- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/omega-web/src/coffee/options_guide.coffee b/omega-web/src/coffee/options_guide.coffee index a8303f4f..210b1517 100644 --- a/omega-web/src/coffee/options_guide.coffee +++ b/omega-web/src/coffee/options_guide.coffee @@ -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') diff --git a/omega-web/src/omega/controllers/master.coffee b/omega-web/src/omega/controllers/master.coffee index d0e852d6..4dbd3c63 100644 --- a/omega-web/src/omega/controllers/master.coffee +++ b/omega-web/src/omega/controllers/master.coffee @@ -16,6 +16,7 @@ angular.module('omega').controller 'MasterCtrl', ($scope, $rootScope, $window, $timeout -> $rootScope.optionsDirty = false + showFirstRun() $rootScope.revertOptions = -> $window.location.reload() @@ -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'