2014-07-08 11:02:26 +00:00
|
|
|
define [
|
|
|
|
"base"
|
|
|
|
], (App) ->
|
2016-08-05 13:01:08 +00:00
|
|
|
App.controller "ShareController", ["$scope", "$modal", "ide", "projectInvites", "projectMembers", "event_tracking",
|
|
|
|
($scope, $modal, ide, projectInvites, projectMembers, event_tracking) ->
|
|
|
|
$scope.openShareProjectModal = () ->
|
2016-08-15 09:29:21 +00:00
|
|
|
event_tracking.sendMBOnce "ide-open-share-modal-once"
|
2016-07-05 13:32:56 +00:00
|
|
|
|
2016-08-05 13:01:08 +00:00
|
|
|
$modal.open(
|
|
|
|
templateUrl: "shareProjectModalTemplate"
|
|
|
|
controller: "ShareProjectModalController"
|
|
|
|
scope: $scope
|
|
|
|
)
|
|
|
|
|
|
|
|
ide.socket.on 'project:membership:changed', (data) =>
|
|
|
|
if data.members
|
2016-08-05 13:09:37 +00:00
|
|
|
projectMembers.getMembers()
|
|
|
|
.success (responseData) =>
|
|
|
|
if responseData.members
|
|
|
|
$scope.project.members = responseData.members
|
|
|
|
.error (responseDate) =>
|
|
|
|
console.error "Error fetching members for project"
|
2016-08-05 13:01:08 +00:00
|
|
|
if data.invites
|
2016-08-05 13:09:37 +00:00
|
|
|
projectInvites.getInvites()
|
|
|
|
.success (responseData) =>
|
|
|
|
if responseData.invites
|
|
|
|
$scope.project.invites = responseData.invites
|
|
|
|
.error (responseDate) =>
|
|
|
|
console.error "Error fetching invites for project"
|
2014-07-08 11:02:26 +00:00
|
|
|
]
|