Skip to content

Commit

Permalink
#234 - auto populate protocol, but wait for user to press next again …
Browse files Browse the repository at this point in the history
…so they can validate
  • Loading branch information
pliablepixels committed May 5, 2016
1 parent f3810d5 commit 065b6af
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions www/js/WizardCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
//--------------------------------------------------------------------------
Expand Down Expand Up @@ -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: <ion-radio-fix ng-repeat="item in portalproto" ng-value="item.value" ng-model="myproto.proto">{{item.text}}</ion-radio-fix>',
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);
}

}]

});
Expand Down

0 comments on commit 065b6af

Please sign in to comment.