2014-07-08 07:02:26 -04:00
|
|
|
define [
|
|
|
|
"base"
|
|
|
|
], (App) ->
|
2016-08-05 09:01:08 -04:00
|
|
|
App.controller "ShareController", ["$scope", "$modal", "ide", "projectInvites", "projectMembers", "event_tracking",
|
|
|
|
($scope, $modal, ide, projectInvites, projectMembers, event_tracking) ->
|
2018-08-31 10:33:56 -04:00
|
|
|
$scope.openShareProjectModal = (isAdmin) ->
|
2018-09-07 12:23:03 -04:00
|
|
|
$scope.isAdmin = isAdmin;
|
2016-08-15 05:29:21 -04:00
|
|
|
event_tracking.sendMBOnce "ide-open-share-modal-once"
|
2016-07-05 09:32:56 -04:00
|
|
|
|
2016-08-05 09:01:08 -04:00
|
|
|
$modal.open(
|
|
|
|
templateUrl: "shareProjectModalTemplate"
|
|
|
|
controller: "ShareProjectModalController"
|
|
|
|
scope: $scope
|
|
|
|
)
|
|
|
|
|
2017-10-04 11:31:24 -04:00
|
|
|
ide.socket.on 'project:tokens:changed', (data) =>
|
|
|
|
if data.tokens?
|
|
|
|
ide.$scope.project.tokens = data.tokens
|
|
|
|
$scope.$digest()
|
|
|
|
|
2016-08-05 09:01:08 -04:00
|
|
|
ide.socket.on 'project:membership:changed', (data) =>
|
|
|
|
if data.members
|
2016-08-05 09:09:37 -04:00
|
|
|
projectMembers.getMembers()
|
2017-06-20 11:27:05 -04:00
|
|
|
.then (response) =>
|
|
|
|
{ data } = response
|
|
|
|
if data.members
|
|
|
|
$scope.project.members = data.members
|
|
|
|
.catch () =>
|
2016-08-05 09:09:37 -04:00
|
|
|
console.error "Error fetching members for project"
|
2016-08-05 09:01:08 -04:00
|
|
|
if data.invites
|
2016-08-05 09:09:37 -04:00
|
|
|
projectInvites.getInvites()
|
2017-06-20 11:27:05 -04:00
|
|
|
.then (response) =>
|
|
|
|
{ data } = response
|
|
|
|
if data.invites
|
|
|
|
$scope.project.invites = data.invites
|
|
|
|
.catch () =>
|
2016-08-05 09:09:37 -04:00
|
|
|
console.error "Error fetching invites for project"
|
2014-07-08 07:02:26 -04:00
|
|
|
]
|