Rishabh 2021-11-19 19:34:17 +05:30
parent c35cdae491
commit 3b49732cbb
15 changed files with 179 additions and 2 deletions

View File

@ -65,6 +65,9 @@ export default Service.extend({
nftCard: feature('nftCard', {developer: true}),
accordionCard: feature('accordionCard', {developer: true}),
gifsCard: feature('gifsCard', {developer: true}),
fileCard: feature('fileCard', {developer: true}),
audioCard: feature('audioCard', {developer: true}),
videoCard: feature('videoCard', {developer: true}),
_user: null,

View File

@ -404,6 +404,45 @@
</div>
</div>
</div>
<div class="gh-expandable-block">
<div class="gh-expandable-header">
<div>
<h4 class="gh-expandable-title">Cardmageddon - File</h4>
<p class="gh-expandable-description">
Add a generic file
</p>
</div>
<div class="for-switch">
<GhFeatureFlag @flag="fileCard" />
</div>
</div>
</div>
<div class="gh-expandable-block">
<div class="gh-expandable-header">
<div>
<h4 class="gh-expandable-title">Cardmageddon - Video</h4>
<p class="gh-expandable-description">
Add a video file
</p>
</div>
<div class="for-switch">
<GhFeatureFlag @flag="videoCard" />
</div>
</div>
</div>
<div class="gh-expandable-block">
<div class="gh-expandable-header">
<div>
<h4 class="gh-expandable-title">Cardmageddon - Audio</h4>
<p class="gh-expandable-description">
Add an audio file
</p>
</div>
<div class="for-switch">
<GhFeatureFlag @flag="audioCard" />
</div>
</div>
</div>
</div>
</div>
{{/if}}

View File

@ -0,0 +1 @@
{{yield}}

View File

@ -0,0 +1,4 @@
import Component from '@glimmer/component';
export default class KoenigCardAudioComponent extends Component {
}

View File

@ -0,0 +1 @@
{{yield}}

View File

@ -0,0 +1,4 @@
import Component from '@glimmer/component';
export default class KoenigCardFileComponent extends Component {
}

View File

@ -0,0 +1 @@
{{yield}}

View File

@ -0,0 +1,4 @@
import Component from '@glimmer/component';
export default class KoenigCardVideoComponent extends Component {
}

View File

@ -17,7 +17,10 @@ export const CARD_COMPONENT_MAP = {
nft: 'koenig-card-nft',
toggle: 'koenig-card-accordion',
'email-cta': 'koenig-card-email-cta',
paywall: 'koenig-card-paywall'
paywall: 'koenig-card-paywall',
file: 'koenig-card-file',
audio: 'koenig-card-audio',
video: 'koenig-card-video'
};
// map card names to generic icons (used for ghost elements when dragging)
@ -37,7 +40,10 @@ export const CARD_ICON_MAP = {
nft: 'koenig/kg-card-type-gen-embed',
toggle: 'koenig/kg-card-type-accordion',
'email-cta': 'koenig/kg-card-type-gen-embed',
paywall: 'koenig/kg-card-type-divider'
paywall: 'koenig/kg-card-type-divider',
file: 'koenig/kg-card-type-divider',
audio: 'koenig/kg-card-type-divider',
video: 'koenig/kg-card-type-video'
};
// TODO: move koenigOptions directly into cards now that card components register
@ -58,6 +64,9 @@ export default [
createComponentCard('callout'),
createComponentCard('nft', {hasEditMode: false}),
createComponentCard('toggle'),
createComponentCard('file'),
createComponentCard('audio'),
createComponentCard('video'),
createComponentCard('paywall', {hasEditMode: false, selectAfterInsert: false})
];
@ -189,6 +198,33 @@ export const CARD_MENU = [
type: 'card',
replaceArg: 'toggle',
isAvailable: 'feature.accordionCard'
},
{
label: 'File',
icon: 'koenig/kg-card-type-accordion',
desc: 'Add a file',
matches: ['file'],
type: 'card',
replaceArg: 'file',
isAvailable: 'feature.fileCard'
},
{
label: 'Audio',
icon: 'koenig/kg-card-type-accordion',
desc: 'Add an audio file',
matches: ['audio'],
type: 'card',
replaceArg: 'audio',
isAvailable: 'feature.audioCard'
},
{
label: 'Video',
icon: 'koenig/kg-card-type-accordion',
desc: 'Add a video file',
matches: ['video'],
type: 'card',
replaceArg: 'video',
isAvailable: 'feature.videoCard'
}]
},
{

View File

@ -0,0 +1 @@
export { default } from 'koenig-editor/components/koenig-card-audio';

View File

@ -0,0 +1 @@
export {default} from 'koenig-editor/components/koenig-card-file';

View File

@ -0,0 +1 @@
export { default } from 'koenig-editor/components/koenig-card-video';

View File

@ -0,0 +1,27 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { setupRenderingTest } from 'ember-mocha';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
describe('Integration | Component | koenig-card-audio', function() {
setupRenderingTest();
it('renders', async function() {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.set('myAction', function(val) { ... });
await render(hbs`<KoenigCardAudio />`);
expect(this.element.textContent.trim()).to.equal('');
// Template block usage:
await render(hbs`
<KoenigCardAudio>
template block text
</KoenigCardAudio>
`);
expect(this.element.textContent.trim()).to.equal('template block text');
});
});

View File

@ -0,0 +1,27 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { setupRenderingTest } from 'ember-mocha';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
describe('Integration | Component | koenig-card-file', function() {
setupRenderingTest();
it('renders', async function() {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.set('myAction', function(val) { ... });
await render(hbs`<KoenigCardFile />`);
expect(this.element.textContent.trim()).to.equal('');
// Template block usage:
await render(hbs`
<KoenigCardFile>
template block text
</KoenigCardFile>
`);
expect(this.element.textContent.trim()).to.equal('template block text');
});
});

View File

@ -0,0 +1,27 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { setupRenderingTest } from 'ember-mocha';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
describe('Integration | Component | koenig-card-video', function() {
setupRenderingTest();
it('renders', async function() {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.set('myAction', function(val) { ... });
await render(hbs`<KoenigCardVideo />`);
expect(this.element.textContent.trim()).to.equal('');
// Template block usage:
await render(hbs`
<KoenigCardVideo>
template block text
</KoenigCardVideo>
`);
expect(this.element.textContent.trim()).to.equal('template block text');
});
});