Hid email specific cards from card menus when editing pages
no issue Pages can not be sent by email so by hiding email-specific cards when editing pages we can reduce confusion and clutter. - added a `@postType` argument to editor components that can be passed through to sub components - set `@postType` to `post.displayName` which is either `post` or `page` - updated `{{card-is-available}}` helper to compare a `postType` property on card menu items to the passed in `postType`
This commit is contained in:
parent
4a8ab905a2
commit
0af27d56e7
|
@ -52,6 +52,7 @@
|
||||||
@updateSnippet={{@updateSnippet}}
|
@updateSnippet={{@updateSnippet}}
|
||||||
@deleteSnippet={{@deleteSnippet}}
|
@deleteSnippet={{@deleteSnippet}}
|
||||||
@cardOptions={{@cardOptions}}
|
@cardOptions={{@cardOptions}}
|
||||||
|
@postType={{@postType}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -92,6 +92,7 @@
|
||||||
@cardOptions={{hash
|
@cardOptions={{hash
|
||||||
post=this.post
|
post=this.post
|
||||||
}}
|
}}
|
||||||
|
@postType={{this.post.displayName}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="gh-editor-wordcount-container">
|
<div class="gh-editor-wordcount-container">
|
||||||
|
|
|
@ -56,6 +56,7 @@
|
||||||
@deleteSnippet={{this.deleteSnippet}}
|
@deleteSnippet={{this.deleteSnippet}}
|
||||||
@replaceWithCardSection={{action "replaceWithCardSection"}}
|
@replaceWithCardSection={{action "replaceWithCardSection"}}
|
||||||
@replaceWithPost={{action "replaceWithPost"}}
|
@replaceWithPost={{action "replaceWithPost"}}
|
||||||
|
@postType={{@postType}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{{!-- slash menu popup --}}
|
{{!-- slash menu popup --}}
|
||||||
|
@ -66,6 +67,7 @@
|
||||||
@deleteSnippet={{this.deleteSnippet}}
|
@deleteSnippet={{this.deleteSnippet}}
|
||||||
@replaceWithCardSection={{action "replaceWithCardSection"}}
|
@replaceWithCardSection={{action "replaceWithCardSection"}}
|
||||||
@replaceWithPost={{action "replaceWithPost"}}
|
@replaceWithPost={{action "replaceWithPost"}}
|
||||||
|
@postType={{@postType}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{{!-- all component cards wormholed into the editor canvas --}}
|
{{!-- all component cards wormholed into the editor canvas --}}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
{{section.title}}
|
{{section.title}}
|
||||||
</div>
|
</div>
|
||||||
{{#each section.items as |item|}}
|
{{#each section.items as |item|}}
|
||||||
{{#if (card-is-available item)}}
|
{{#if (card-is-available item postType=@postType)}}
|
||||||
<div
|
<div
|
||||||
class="{{if (eq item @selectedItem) "kg-cardmenu-card-selected"}} {{kg-style "cardmenu-card"}}"
|
class="{{if (eq item @selectedItem) "kg-cardmenu-card-selected"}} {{kg-style "cardmenu-card"}}"
|
||||||
data-kg="cardmenu-card"
|
data-kg="cardmenu-card"
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
<KoenigMenuContent
|
<KoenigMenuContent
|
||||||
@itemSections={{this.itemSections}}
|
@itemSections={{this.itemSections}}
|
||||||
@itemClicked={{action "itemClicked"}}
|
@itemClicked={{action "itemClicked"}}
|
||||||
|
@postType={{@postType}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
|
@ -6,7 +6,7 @@ export default class CardIsAvailableHelper extends Helper {
|
||||||
@service config;
|
@service config;
|
||||||
@service feature;
|
@service feature;
|
||||||
|
|
||||||
compute([card]) {
|
compute([card], {postType} = {}) {
|
||||||
let cardIsAvailable = true;
|
let cardIsAvailable = true;
|
||||||
|
|
||||||
if (card.developerExperiment) {
|
if (card.developerExperiment) {
|
||||||
|
@ -17,6 +17,10 @@ export default class CardIsAvailableHelper extends Helper {
|
||||||
cardIsAvailable = get(this.feature, card.feature);
|
cardIsAvailable = get(this.feature, card.feature);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (postType && card.postType) {
|
||||||
|
cardIsAvailable = card.postType === postType;
|
||||||
|
}
|
||||||
|
|
||||||
return cardIsAvailable;
|
return cardIsAvailable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,8 @@ export const CARD_MENU = [
|
||||||
desc: 'Only visible when delivered by email',
|
desc: 'Only visible when delivered by email',
|
||||||
matches: ['email'],
|
matches: ['email'],
|
||||||
type: 'card',
|
type: 'card',
|
||||||
replaceArg: 'email'
|
replaceArg: 'email',
|
||||||
|
postType: 'post'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Email call to action',
|
label: 'Email call to action',
|
||||||
|
@ -129,7 +130,8 @@ export const CARD_MENU = [
|
||||||
desc: 'Target free or paid members with a CTA',
|
desc: 'Target free or paid members with a CTA',
|
||||||
matches: ['email', 'cta'],
|
matches: ['email', 'cta'],
|
||||||
type: 'card',
|
type: 'card',
|
||||||
replaceArg: 'email-cta'
|
replaceArg: 'email-cta',
|
||||||
|
postType: 'post'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Public preview',
|
label: 'Public preview',
|
||||||
|
|
Loading…
Reference in New Issue