From c97be22854f641a619f3d7781f64ca00ec73a899 Mon Sep 17 00:00:00 2001 From: Rishabh Date: Mon, 28 Jun 2021 15:36:35 +0530 Subject: [PATCH] Added segmented post access setting to labs menu refs https://github.com/TryGhost/Team/issues/801 - adds the renewed product specific post access setting to new labs post settings sidebar --- .../components/gh-post-settings-menu-labs.hbs | 43 ++++++++++++++++--- .../components/gh-post-settings-menu-labs.js | 17 ++++++++ 2 files changed, 55 insertions(+), 5 deletions(-) diff --git a/ghost/admin/app/components/gh-post-settings-menu-labs.hbs b/ghost/admin/app/components/gh-post-settings-menu-labs.hbs index e8f48206a8..efd446283c 100644 --- a/ghost/admin/app/components/gh-post-settings-menu-labs.hbs +++ b/ghost/admin/app/components/gh-post-settings-menu-labs.hbs @@ -80,10 +80,43 @@ {{#if this.showVisibilityInput}} -
- - -
+ {{#if (feature "multipleProducts")}} + + +
+
+
+
Public
+
+
+
+
+
+
Members-only
+
+ +
+
+
+ +
+ {{else}} +
+ + +
+ {{/if}} {{/if}} @@ -439,4 +472,4 @@ {{/if}} - \ No newline at end of file + diff --git a/ghost/admin/app/components/gh-post-settings-menu-labs.js b/ghost/admin/app/components/gh-post-settings-menu-labs.js index 055555c9cf..07ce9689a5 100644 --- a/ghost/admin/app/components/gh-post-settings-menu-labs.js +++ b/ghost/admin/app/components/gh-post-settings-menu-labs.js @@ -146,6 +146,23 @@ export default Component.extend({ }); }, + async setVisibility(segment) { + this.post.set('visibility', segment); + try { + await this.post.validate({property: 'visibility'}); + if (this.post.changedAttributes().visibility) { + await this.savePostTask.perform(); + } + } catch (e) { + if (!e) { + // validation error + return; + } + + throw e; + } + }, + setPublishedAtBlogDate(date) { let post = this.post; let dateString = moment(date).format('YYYY-MM-DD');