Skip to content

Commit

Permalink
feat(location): modal uses loading indicator
Browse files Browse the repository at this point in the history
This commit makes the bhLocationModal use a loading indicator while an
HTTP request is in progress.
  • Loading branch information
Jonathan Niles committed Aug 25, 2016
1 parent a259917 commit c0ba7e6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion client/src/js/components/bhLocationSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function LocationSelectController(Locations, $scope, $timeout) {
* variable.
*
* This is a convenience method as the controller is available to the $scope
* thorugh the $ctrl variable. It translates the template from:
* through the $ctrl variable. It translates the template from:
*
* `this[$ctrl.name].formVariable`
*
Expand Down
14 changes: 6 additions & 8 deletions client/src/partials/templates/modals/location.modal.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<ng-form name="LocationModalForm" data-location-modal bh-form-defaults novalidate>
<form name="LocationModalForm" bh-submit="LocationModalCtrl.submit(LocationModalForm.$invalid)" data-location-modal bh-form-defaults novalidate>
<div class="modal-header">
<h4>{{ "FORM.LABELS.CONFIRMATION" | translate }}</h4>
</div>
Expand Down Expand Up @@ -114,22 +114,20 @@ <h4>{{ "FORM.LABELS.CONFIRMATION" | translate }}</h4>
</div>

<p class="text-danger" ng-show="LocationModalForm.$submitted && LocationModalForm.$invalid">
<span class="glyphicon glyphicon-exclamation-sign"></span>
<span class="fa fa-warning"></span>
{{ "FORM.ERRORS.GENERIC" | translate }}
</p>
</div>


<div class="modal-footer">
<!-- @todo - why does this not set the submitted state automatically? -->
<button
type="submit"
class="btn btn-primary"
ng-click="LocationModalCtrl.submit(LocationModalForm.$invalid); LocationModalForm.$setSubmitted();">
<bh-loading-button
loading-state="LocationModalForm.$loading">
{{ "FORM.BUTTONS.SUBMIT" | translate }}
</button>
</bh-loading-button>
<button type="button" ng-click="LocationModalCtrl.dismiss()" class="btn btn-default">
{{ "FORM.BUTTONS.CANCEL" | translate }}
</button>
</div>
</ng-form>
</form>
4 changes: 2 additions & 2 deletions client/src/partials/templates/modals/location.modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ function LocationModalController(Locations, Instance, AppCache) {
return;
}

promise.then(function (data) {
Instance.close(data);
return promise.then(function (data) {
return Instance.close(data);
})
.catch(function (error) {
vm.error = error;
Expand Down
1 change: 0 additions & 1 deletion test/end-to-end/patient/registration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ describe('Patient Registration', function () {
FU.validation.error('PatientRegCtrl.medical.dob');

// first name and title are optional
FU.validation.ok('PatientRegCtrl.medical.first_name');
FU.validation.ok('PatientRegCtrl.medical.title');

components.notification.hasDanger();
Expand Down

0 comments on commit c0ba7e6

Please sign in to comment.