From 14bf9a2f52ec3bee4286e2c40d09364e3fcea978 Mon Sep 17 00:00:00 2001 From: pliablepixels Date: Thu, 5 May 2016 16:19:30 -0400 Subject: #234 - auto populate protocol, but wait for user to press next again so they can validate Former-commit-id: 5b5dd1c88b4d4a30e5f49313559ae190ee12c0f2 --- www/js/WizardCtrl.js | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/www/js/WizardCtrl.js b/www/js/WizardCtrl.js index ee95bf39..dd06fa91 100644 --- a/www/js/WizardCtrl.js +++ b/www/js/WizardCtrl.js @@ -134,6 +134,18 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$ } + //-------------------------------------------------------------------------- + // removes proto scheme from string + //-------------------------------------------------------------------------- + + function stripProto(u) + { + if (u.indexOf('://')) + return u.substr(u.indexOf('://')+3); + else + return u; + } + //-------------------------------------------------------------------------- // tries to detect cgi-bin //-------------------------------------------------------------------------- @@ -551,11 +563,24 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$ } if (!checkscheme($scope.wizard.portalurl)) { - $rootScope.zmPopup = SecuredPopups.show('show', { - title: 'Whoops!', - template: 'Please specify http:// or https:// in the url', + + $scope.portalproto = [ {text:"http",value:"http://"}, {text:"https",value:"https://"}]; + $scope.myproto = {proto:""}; + + + + $rootScope.zmPopup = $ionicPopup.show({ + title: 'No protocol specified', + scope: $scope, + template: 'Please select: {{item.text}}', buttons: [{ - text: 'Ok' + text: 'Ok', + onTap: function(e) + { + ZMDataModel.zmDebug ("Protocol selected:" + $scope.myproto.proto); + $scope.wizard.portalurl = $scope.myproto.proto+stripProto($scope.wizard.portalurl); + } + }] }); -- cgit v1.2.3