From 7ce56aa3b63c9b9f44f6bff0c31b1b62877cf172 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 28 Nov 2017 10:13:54 +0000 Subject: [PATCH] add http catch onto form --- services/web/app/views/subscriptions/plans.pug | 8 ++++---- services/web/public/coffee/main/contact-us.coffee | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/services/web/app/views/subscriptions/plans.pug b/services/web/app/views/subscriptions/plans.pug index 8a179fa323..89a07abe1c 100644 --- a/services/web/app/views/subscriptions/plans.pug +++ b/services/web/app/views/subscriptions/plans.pug @@ -210,7 +210,7 @@ block content h3 #{translate("group_plan_enquiry")} .modal-body form.text-left.form(ng-controller="UniverstiesContactController", ng-submit="contactUs()", ng-cloak) - span(ng-show="sent == false") + span(ng-show="sent == false && error == false") .form-group label#title9(for='Field9') | Name @@ -231,10 +231,10 @@ block content input(ng-model="form.source", type="hidden", ng-init="form.source = '__ref__'; form.subject = 'General enquiry for larger ShareLaTeX use';") .form-group.text-center input#saveForm.btn-success.btn.btn-lg(name='saveForm', type='submit', ng-disabled="sending", value='Request a quote') - span(ng-show="sent && error") - p Error sending request. - span(ng-show="sent && error == false") + span(ng-show="sent == true && error == false") p Request Sent, Thank you. + span(ng-show="error") + p Error sending request. .row .col-md-12 diff --git a/services/web/public/coffee/main/contact-us.coffee b/services/web/public/coffee/main/contact-us.coffee index 1eb67145e5..138f459890 100644 --- a/services/web/public/coffee/main/contact-us.coffee +++ b/services/web/public/coffee/main/contact-us.coffee @@ -96,6 +96,11 @@ define [ inbox: "accounts" request = $http.post "/support", data + + request.catch ()-> + $scope.error = true + $scope.$apply() + request.then (response)-> $scope.sent = true $scope.error = (response.status != 200)