|
15 | 15 | ng-show="datastoreInitialized"> |
16 | 16 | <div ng-form="frmMain"> |
17 | 17 |
|
18 | | - <div class="item clearfix row margi |
19 | | - n-bottom-fifteen"> |
| 18 | + <div class="item clearfix row margin-bottom-fifteen"> |
20 | 19 | <div class="labels col-md-3 padding-right-zero pull-left"> |
21 | 20 | <span>URL to your PDF</span> |
22 | 21 | </div> |
23 | 22 | <div class="main col-md-9 pull-right clearfix"> |
24 | 23 | <div class="col-md-9 pull-left padding-left-zero"> |
25 | | - <input id="url" name="url" type="text" class="form-control" |
26 | | - ng-model="data.content.url" ng-change="clearUrl()" |
27 | | - required |
28 | | - pattern="[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?!?\/?\w\/?&//=]*)?"> |
| 24 | + <input id="url" name="url" type="url" class="form-control" |
| 25 | + ng-model="data.content.url" |
| 26 | + required> |
29 | 27 | </div> |
30 | 28 | <div class="col-md-3 pull-right padding-zero"> |
31 | 29 | <button class="btn btn-success stretch" ng-click="validateUrl()" |
|
102 | 100 | } else { |
103 | 101 | dataChanged = true; |
104 | 102 | } |
| 103 | + if (dataChanged && newObj.content && !newObj.content.url) { |
| 104 | + $scope.clearUrl(); |
| 105 | + } |
105 | 106 | }, true); |
106 | 107 |
|
107 | 108 | if (!$scope.$$phase && !$scope.$root.$$phase) { |
|
155 | 156 | }; |
156 | 157 |
|
157 | 158 | $scope.clearUrl = function () { |
158 | | - if (!$scope.data.content.url) { |
159 | | - $scope.data.content.url = null; |
160 | | - var data = $scope.data; |
161 | | - buildfire.datastore.save(data, function (err, result) { |
162 | | - if (err || !result) { |
163 | | - $log.error('Error saving the widget details: ', err); |
164 | | - } |
165 | | - else { |
166 | | - $log.info('Widget details saved'); |
167 | | - } |
168 | | - }); |
169 | | - } |
| 159 | + $scope.data.content.url = undefined; |
| 160 | + var data = $scope.data; |
| 161 | + buildfire.datastore.save(data, function (err, result) { |
| 162 | + if (err || !result) { |
| 163 | + $log.error('Error saving the widget details: ', err); |
| 164 | + } |
| 165 | + else { |
| 166 | + $log.info('Widget details saved'); |
| 167 | + } |
| 168 | + }); |
170 | 169 | }; |
171 | 170 |
|
172 | 171 | $scope.openMethodChanged = function () { |
|
0 commit comments