From 46eadfada44515650c008666d78885fe929d1d8d Mon Sep 17 00:00:00 2001 From: Chrystal Griffiths Date: Fri, 7 Sep 2018 17:23:03 +0100 Subject: [PATCH] Conditionally show sharing bits --- services/web/app/views/project/editor/share.pug | 14 +++++++------- .../ide/share/controllers/ShareController.coffee | 4 +--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/services/web/app/views/project/editor/share.pug b/services/web/app/views/project/editor/share.pug index d2aa1cc173..cb46cb9a5f 100644 --- a/services/web/app/views/project/editor/share.pug +++ b/services/web/app/views/project/editor/share.pug @@ -8,9 +8,8 @@ script(type='text/ng-template', id='shareProjectModalTemplate') h3 #{translate("share_project")} .modal-body.modal-body-share .container-fluid - //- Private (with token-access available) - .row.public-access-level(ng-show="project.publicAccesLevel == 'private'") + .row.public-access-level(ng-show="isAdmin && project.publicAccesLevel == 'private'") .col-xs-12.text-center | #{translate('link_sharing_is_off')} |    @@ -28,7 +27,7 @@ script(type='text/ng-template', id='shareProjectModalTemplate') ) //- Token-based access - .row.public-access-level(ng-show="project.publicAccesLevel == 'tokenBased'") + .row.public-access-level(ng-show="isAdmin && project.publicAccesLevel == 'tokenBased'") .col-xs-12.text-center strong | #{translate('link_sharing_is_on')}. @@ -57,7 +56,7 @@ script(type='text/ng-template', id='shareProjectModalTemplate') pre.access-token(ng-hide="readOnlyTokenLink") #{translate('loading')}... //- legacy public-access - .row.public-access-level(ng-show="project.publicAccesLevel == 'readAndWrite' || project.publicAccesLevel == 'readOnly'") + .row.public-access-level(ng-show="isAdmin && (project.publicAccesLevel == 'readAndWrite' || project.publicAccesLevel == 'readOnly')") .col-xs-12.text-center strong(ng-if="project.publicAccesLevel == 'readAndWrite'") #{translate("this_project_is_public")} strong(ng-if="project.publicAccesLevel == 'readOnly'") #{translate("this_project_is_public_read_only")} @@ -102,7 +101,7 @@ script(type='text/ng-template', id='shareProjectModalTemplate') ng-click="revokeInvite(invite)" ) i.fa.fa-times - .row.invite-controls + .row.invite-controls(ng-show="isAdmin") form(ng-show="canAddCollaborators") .small #{translate("share_with_your_collabs")} .form-group @@ -177,8 +176,9 @@ script(type='text/ng-template', id='shareProjectModalTemplate') ) #{translate("start_free_trial")} p.small(ng-show="startedFreeTrial") - | #{translate("refresh_page_after_starting_free_trial")}. - + | #{translate("refresh_page_after_starting_free_trial")} + .row.public-access-level(ng-show="!isAdmin") + .col-xs-12.text-center To add more collaborators, please ask the project owner .modal-footer.modal-footer-share .modal-footer-left i.fa.fa-refresh.fa-spin(ng-show="state.inflight") diff --git a/services/web/public/coffee/ide/share/controllers/ShareController.coffee b/services/web/public/coffee/ide/share/controllers/ShareController.coffee index e729b92f08..3f71a63fdc 100644 --- a/services/web/public/coffee/ide/share/controllers/ShareController.coffee +++ b/services/web/public/coffee/ide/share/controllers/ShareController.coffee @@ -4,9 +4,7 @@ define [ App.controller "ShareController", ["$scope", "$modal", "ide", "projectInvites", "projectMembers", "event_tracking", ($scope, $modal, ide, projectInvites, projectMembers, event_tracking) -> $scope.openShareProjectModal = (isAdmin) -> - if !isAdmin - return - + $scope.isAdmin = isAdmin; event_tracking.sendMBOnce "ide-open-share-modal-once" $modal.open(