2015-05-22 08:57:15 -04:00
|
|
|
define [
|
|
|
|
"base"
|
|
|
|
], (App) ->
|
|
|
|
App.controller "GroupSubscriptionInviteController", ($scope, $http) ->
|
|
|
|
|
|
|
|
$scope.requestSent = false
|
|
|
|
|
|
|
|
$scope.joinGroup = ->
|
2015-05-27 16:45:29 -04:00
|
|
|
$scope.requestSent = true
|
2015-05-26 10:25:46 -04:00
|
|
|
request = $http.post "/user/subscription/#{subscription_id}/group/begin-join", {_csrf:window.csrfToken}
|
2015-05-22 08:57:15 -04:00
|
|
|
request.success (data, status)->
|
2015-05-27 16:45:29 -04:00
|
|
|
if status != 200 # assume request worked
|
|
|
|
$scope.requestSent = false
|
2015-05-22 08:57:15 -04:00
|
|
|
request.error (data, status)->
|
|
|
|
console.log "the request failed"
|