2016-02-01 09:33:32 -05:00
|
|
|
define [
|
|
|
|
"base"
|
|
|
|
], (App) ->
|
|
|
|
|
|
|
|
App.controller 'UniverstiesContactController', ($scope, $modal) ->
|
|
|
|
|
|
|
|
$scope.form = {}
|
2016-02-01 10:22:22 -05:00
|
|
|
$scope.sent = false
|
|
|
|
$scope.sending = false
|
2016-02-01 09:33:32 -05:00
|
|
|
$scope.contactUs = ->
|
2016-02-01 10:22:22 -05:00
|
|
|
if !$scope.form.email?
|
|
|
|
console.log "email not set"
|
|
|
|
return
|
|
|
|
$scope.sending = true
|
2016-03-02 07:23:51 -05:00
|
|
|
ticketNumber = Math.floor((1 + Math.random()) * 0x10000).toString(32)
|
2016-02-01 09:33:32 -05:00
|
|
|
params =
|
|
|
|
name: $scope.form.name || $scope.form.email
|
|
|
|
email: $scope.form.email
|
2016-02-01 10:22:22 -05:00
|
|
|
labels: $scope.form.source
|
2016-02-01 09:33:32 -05:00
|
|
|
message: "Please contact me with more details"
|
2016-03-02 07:23:51 -05:00
|
|
|
subject: $scope.form.subject + " - [#{ticketNumber}]"
|
2016-02-01 10:22:22 -05:00
|
|
|
about : "#{$scope.form.position || ''} #{$scope.form.university || ''}"
|
2016-02-01 09:33:32 -05:00
|
|
|
|
|
|
|
Groove.createTicket params, (err, json)->
|
2016-02-01 10:22:22 -05:00
|
|
|
$scope.sent = true
|
2016-02-01 10:41:43 -05:00
|
|
|
$scope.$apply()
|