Skip to content

Commit

Permalink
Merge pull request #29 from sakshityagi/master
Browse files Browse the repository at this point in the history
Removed restriction for valid url and just showed a message in case invalid
  • Loading branch information
DanielHindi authored Jun 23, 2016
2 parents e76d73b + 9440c32 commit c7d9d8a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
4 changes: 4 additions & 0 deletions control/content/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,8 @@ webviewPluginApp.controller("webviewPluginCtrl", ["$scope", "$log", "$timeout",
}
});
};

$scope.isUrlValid = function (url) {
return /[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,6}\b(\/[-a-zA-Z0-9@:%_\+.~#?!?\/?\w\/?&//=]*)?/.test(url);
};
}]);
16 changes: 14 additions & 2 deletions control/content/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
<div class="main col-md-9 pull-right clearfix">
<div class="col-md-9 pull-left padding-left-zero">
<input id="url" name="url" type="text" class="form-control"
ng-model="data.content.url" required
pattern="[-a-zA-Z0-9@:%_\+.~#?&amp;//=]{2,256}\.[a-z]{2,6}\b(\/[-a-zA-Z0-9@:%_\+.~#?!?\/?\w\/?&amp;//=]*)?">
ng-model="data.content.url">
</div>
<div class="col-md-3 pull-right padding-zero">
<button class="btn btn-success stretch" ng-click="validateUrl()"
Expand All @@ -41,6 +40,19 @@
</div>
</div>

<div class="item clearfix row"
ng-if="data.content.url && !isUrlValid(data.content.url)">
<div class="main pull-right col-md-9">
<p style="color: #ff7164">Seems like
your url is not valid ! But if you
want,
you can
still
add it
to your plugin.</p>
</div>
</div>

<div class="item clearfix row">
<div class="main pull-right col-md-9">
<div class="alert alert-success alert-sm text-center" ng-if="urlValid">Url
Expand Down
2 changes: 1 addition & 1 deletion widget/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ <h2>Success!</h2>
};

$scope.iframeLoadedCallBack = function () {
$scope.loading = 0
$scope.loading = 0;
$scope.$apply();
var webviewIframe = document.getElementById("webviewIframe");
buildfire.spinner.hide();
Expand Down

0 comments on commit c7d9d8a

Please sign in to comment.