mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
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
This commit is contained in:
parent
f9a25d4e41
commit
c97be22854
2 changed files with 55 additions and 5 deletions
|
@ -80,11 +80,44 @@
|
|||
|
||||
|
||||
{{#if this.showVisibilityInput}}
|
||||
{{#if (feature "multipleProducts")}}
|
||||
<GhFormGroup @errors={{this.post.errors}} @hasValidated={{this.post.hasValidated}} @property="visibility">
|
||||
<label for="visibility-input">Post access</label>
|
||||
<div
|
||||
class="gh-radio {{if this.post.isPublic "active"}}"
|
||||
{{on "click" (action "setVisibility" "public")}}
|
||||
>
|
||||
<div class="gh-radio-button"></div>
|
||||
<div class="gh-radio-content">
|
||||
<div class="gh-radio-label">Public</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="gh-radio {{if (not this.post.isPublic) "active"}}"
|
||||
{{on "click" (action "setVisibility" this.post.visibilitySegment)}}
|
||||
>
|
||||
<div class="gh-radio-button"></div>
|
||||
<div class="gh-radio-content">
|
||||
<div class="gh-radio-label">Members-only</div>
|
||||
<div class="gh-radio-desc">
|
||||
<GhMembersSegmentSelect
|
||||
@segment={{this.post.visibilitySegment}}
|
||||
@onChange={{action "setVisibility"}}
|
||||
@renderInPlace={{true}}
|
||||
@hideOptionsWhenAllSelected={{true}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<GhErrorMessage @errors={{this.post.errors}} @property="visibility" class="no-selection" data-test-error="visibility" />
|
||||
</GhFormGroup>
|
||||
{{else}}
|
||||
<div class="form-group">
|
||||
<label for="visibility-input">Post access</label>
|
||||
<GhPsmVisibilityInput @post={{this.post}} @triggerId="visibility-input" />
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
|
||||
<GhFormGroup @errors={{this.post.errors}} @hasValidated={{this.post.hasValidated}} @property="customExcerpt">
|
||||
|
|
|
@ -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');
|
||||
|
|
Loading…
Add table
Reference in a new issue