2016-03-18 08:55:35 -04:00
|
|
|
define [
|
|
|
|
"base"
|
|
|
|
], (App) ->
|
|
|
|
|
|
|
|
|
|
|
|
App.controller 'ContactModal', ($scope, $modal) ->
|
|
|
|
$scope.contactUsModal = () ->
|
|
|
|
modalInstance = $modal.open(
|
|
|
|
templateUrl: "supportModalTemplate"
|
|
|
|
controller: "SupportModalController"
|
|
|
|
)
|
|
|
|
|
2016-03-22 08:28:37 -04:00
|
|
|
App.controller 'SupportModalController', ($scope, $modalInstance) ->
|
2016-03-18 08:55:35 -04:00
|
|
|
$scope.form = {}
|
|
|
|
$scope.sent = false
|
|
|
|
$scope.sending = false
|
|
|
|
$scope.contactUs = ->
|
|
|
|
if !$scope.form.email?
|
|
|
|
console.log "email not set"
|
|
|
|
return
|
|
|
|
$scope.sending = true
|
|
|
|
ticketNumber = Math.floor((1 + Math.random()) * 0x10000).toString(32)
|
2016-03-24 10:23:18 -04:00
|
|
|
message = $scope.form.message
|
|
|
|
if $scope.form.project_url
|
|
|
|
message = "#{message}\n\n project_url = #{$scope.form.project_url}"
|
2016-03-18 08:55:35 -04:00
|
|
|
params =
|
|
|
|
email: $scope.form.email
|
2016-03-24 10:23:18 -04:00
|
|
|
message: message or ""
|
2016-03-18 08:55:35 -04:00
|
|
|
subject: $scope.form.subject + " - [#{ticketNumber}]"
|
2016-03-21 07:41:05 -04:00
|
|
|
labels: "support"
|
2016-03-18 08:55:35 -04:00
|
|
|
|
|
|
|
Groove.createTicket params, (err, json)->
|
|
|
|
$scope.sent = true
|
|
|
|
$scope.$apply()
|
|
|
|
|
|
|
|
$scope.close = () ->
|
|
|
|
$modalInstance.close()
|
|
|
|
|
|
|
|
|
|
|
|
App.controller 'UniverstiesContactController', ($scope, $modal) ->
|
|
|
|
|
|
|
|
$scope.form = {}
|
|
|
|
$scope.sent = false
|
|
|
|
$scope.sending = false
|
|
|
|
$scope.contactUs = ->
|
|
|
|
if !$scope.form.email?
|
|
|
|
console.log "email not set"
|
|
|
|
return
|
|
|
|
$scope.sending = true
|
|
|
|
ticketNumber = Math.floor((1 + Math.random()) * 0x10000).toString(32)
|
|
|
|
params =
|
|
|
|
name: $scope.form.name || $scope.form.email
|
|
|
|
email: $scope.form.email
|
2016-03-21 07:41:05 -04:00
|
|
|
labels: "#{$scope.form.source} accounts"
|
2016-03-18 08:55:35 -04:00
|
|
|
message: "Please contact me with more details"
|
|
|
|
subject: $scope.form.subject + " - [#{ticketNumber}]"
|
|
|
|
about : "#{$scope.form.position || ''} #{$scope.form.university || ''}"
|
|
|
|
|
|
|
|
Groove.createTicket params, (err, json)->
|
|
|
|
$scope.sent = true
|
|
|
|
$scope.$apply()
|