move generic sales modal to use new support endpoint

This commit is contained in:
Henry Oswald 2017-11-27 12:49:12 +00:00
parent 5ef7bad60f
commit 7eb2f0d917
2 changed files with 8 additions and 8 deletions

View file

@ -228,7 +228,7 @@ block content
.form-group
input#Field13.field.text.medium.span8.form-control(ng-model="form.position", name='Field13', type='text', value='', maxlength='255', tabindex='4', onkeyup='')
.form-group
input(ng-model="form.source", type="hidden", ng-init="form.source = '__ref__'; form.subject = 'ShareLaTeX for Universities';")
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")

View file

@ -74,7 +74,7 @@ define [
$modalInstance.close()
App.controller 'UniverstiesContactController', ($scope, $modal) ->
App.controller 'UniverstiesContactController', ($scope, $modal, $http) ->
$scope.form = {}
$scope.sent = false
@ -85,16 +85,16 @@ define [
return
$scope.sending = true
ticketNumber = Math.floor((1 + Math.random()) * 0x10000).toString(32)
params =
data =
_csrf : window.csrfToken
name: $scope.form.name || $scope.form.email
email: $scope.form.email
labels: "#{$scope.form.source} accounts"
message: "Please contact me with more details"
subject: $scope.form.subject + " - [#{ticketNumber}]"
about : "#{$scope.form.position || ''} #{$scope.form.university || ''}"
subject: "#{$scope.form.subject} - #{$scope.form.position} #{$scope.form.university}"
inbox: "accounts"
Groove.createTicket params, (err, json)->
request = $http.post "/support", data
request.then (response)->
$scope.sent = true
$scope.$apply()