From 5fe5125a5c41dce3552a4822808abd95c4f160d4 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Mon, 30 Oct 2017 13:48:25 +0000 Subject: [PATCH] Add ability to show/hide the new token-access ui --- .../Features/Project/ProjectController.coffee | 1 + services/web/app/views/project/editor.pug | 1 + .../web/app/views/project/editor/share.pug | 62 ++++++++++++++----- .../share/controllers/ShareController.coffee | 1 + 4 files changed, 48 insertions(+), 17 deletions(-) diff --git a/services/web/app/coffee/Features/Project/ProjectController.coffee b/services/web/app/coffee/Features/Project/ProjectController.coffee index a81ed3cd84..8b164fc05b 100644 --- a/services/web/app/coffee/Features/Project/ProjectController.coffee +++ b/services/web/app/coffee/Features/Project/ProjectController.coffee @@ -315,6 +315,7 @@ module.exports = ProjectController = languages: Settings.languages themes: THEME_LIST maxDocLength: Settings.max_doc_length + enableTokenAccessUI: true timer.done() _buildProjectList: (allProjects)-> diff --git a/services/web/app/views/project/editor.pug b/services/web/app/views/project/editor.pug index 6cc3b19ec9..7700d0dc6f 100644 --- a/services/web/app/views/project/editor.pug +++ b/services/web/app/views/project/editor.pug @@ -125,6 +125,7 @@ block requirejs window.showTrackChangesOnboarding = #{!!showTrackChangesOnboarding}; window.showPerUserTCNotice = #{!!showPerUserTCNotice}; window.wikiEnabled = #{!!(settings.apis.wiki && settings.apis.wiki.url)}; + window.enableTokenAccessUI = #{enableTokenAccessUI} window.requirejs = { "paths" : { "mathjax": "#{buildJsPath('/libs/mathjax/MathJax.js', {cdn:false, fingerprint:false, qs:{config:'TeX-AMS_HTML'}})}", diff --git a/services/web/app/views/project/editor/share.pug b/services/web/app/views/project/editor/share.pug index 509e179fca..311a006193 100644 --- a/services/web/app/views/project/editor/share.pug +++ b/services/web/app/views/project/editor/share.pug @@ -10,7 +10,17 @@ script(type='text/ng-template', id='shareProjectModalTemplate') .container-fluid //- Private - .row.public-access-level(ng-show="project.publicAccesLevel == 'private'") + .row.public-access-level(ng-show="project.publicAccesLevel == 'private' && __enableTokenAccessUI == false") + .col-xs-12.text-center + | #{translate("this_project_is_private")} + |    + a( + href + ng-click="openMakePublicModal()" + ) #{translate("make_public")} + + //- Private (with token-access available) + .row.public-access-level(ng-show="project.publicAccesLevel == 'private' && __enableTokenAccessUI == true") .col-xs-12.text-center | #{translate('link_sharing_is_off')}. |    @@ -244,22 +254,40 @@ script(type="text/ng-template", id="makeTokenBasedModalTemplate") ) #{translate('turn_on_link_sharing')} script(type="text/ng-template", id="makePrivateModalTemplate") - .modal-header - button.close( - type="button" - data-dismiss="modal" - ng-click="cancel()" - ) × - h3 #{translate("make_project_private")}? - .modal-body.modal-body-share - p #{translate('turn_off_link_sharing_consequences')} - .modal-footer - button.btn.btn-default( - ng-click="cancel()" - ) #{translate("cancel")} - button.btn.btn-info( - ng-click="makePrivate()" - ) #{translate("turn_off_link_sharing")} + div(ng-if="__enableTokenAccessUI") + .modal-header + button.close( + type="button" + data-dismiss="modal" + ng-click="cancel()" + ) × + h3 #{translate("make_project_private")}? + .modal-body.modal-body-share + p #{translate('turn_off_link_sharing_consequences')} + .modal-footer + button.btn.btn-default( + ng-click="cancel()" + ) #{translate("cancel")} + button.btn.btn-info( + ng-click="makePrivate()" + ) #{translate("turn_off_link_sharing")} + div(ng-if="!__enableTokenAccessUI") + .modal-header + button.close( + type="button" + data-dismiss="modal" + ng-click="cancel()" + ) × + h3 #{translate("make_project_private")}? + .modal-body.modal-body-share + p #{translate("make_project_private_consequences")} + .modal-footer + button.btn.btn-default( + ng-click="cancel()" + ) #{translate("cancel")} + button.btn.btn-info( + ng-click="makePrivate()" + ) #{translate("make_private")} script(type="text/ng-template", id="shareTagTemplate") .tag-template diff --git a/services/web/public/coffee/ide/share/controllers/ShareController.coffee b/services/web/public/coffee/ide/share/controllers/ShareController.coffee index b4a1d7652b..5e4518b5fa 100644 --- a/services/web/public/coffee/ide/share/controllers/ShareController.coffee +++ b/services/web/public/coffee/ide/share/controllers/ShareController.coffee @@ -3,6 +3,7 @@ define [ ], (App) -> App.controller "ShareController", ["$scope", "$modal", "ide", "projectInvites", "projectMembers", "event_tracking", ($scope, $modal, ide, projectInvites, projectMembers, event_tracking) -> + $scope.__enableTokenAccessUI = window.enableTokenAccessUI == true $scope.openShareProjectModal = () -> event_tracking.sendMBOnce "ide-open-share-modal-once"