This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Fieldtype = { | |
mixins: [window.Storyblok.plugin], | |
template: `<div> | |
<div class="uk-form-label">Do you have a headset?</div> | |
<label><input type="radio" v-model="model.has_headset" :value="true" /> Yes</label> | |
<label><input type="radio" v-model="model.has_headset" :value="false" class="uk-margin-small-left" /> No</label> | |
<div v-if="model.has_headset" class="uk-margin-small-top"> | |
<div class="uk-form-label">How many?</div> | |
<input class="uk-width-1-1" v-model="model.number_of_headsets" type="number" /> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const StoryblokClient = require('storyblok-js-client') | |
// Insert your oauth token and folder id | |
const Storyblok = new StoryblokClient({ | |
oauthToken: 'YOUR_OAUTH_TOKEN' | |
}) | |
// Insert your source space and folder id | |
const spaceId = 'YOUR_SPACE_ID' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Fieldtype = { | |
mixins: [window.Storyblok.plugin], | |
template: `<div><input class="uk-width-1-1" v-model="model.number" /></div>`, | |
methods: { | |
initWith() { | |
return { | |
plugin: 'number-plugin', | |
number: '0' | |
} | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Fieldtype = { | |
mixins: [window.Storyblok.plugin], | |
template: ` | |
<div>Google snippet preview: | |
<div style="margin:5px 0 15px;padding:10px;color:#000;background:#fff"> | |
<div style="color:blue;text-decoration:underline">{{ model.title }}</div> | |
<div style="color:green">yoursite.com/example</div> | |
<div>{{ model.description }}</div> | |
</div> | |
<div class=uk-form-row> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Fieldtype = { | |
mixins: [window.Storyblok.plugin], | |
template: `<div> | |
<div v-if="modalIsOpen">Modal is open</div> | |
<div v-if="!modalIsOpen">Modal is closed</div> | |
<a @click="doOpen">Open modal</a> | |
<a @click="doClose">Close modal</a> | |
<select v-model="options"><option value="1"></option></select> | |
</div>`, | |
data() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Fieldtype = { | |
mixins: [window.Storyblok.plugin], | |
template: `<div> | |
<div v-if="modalIsOpen">Modal is open</div> | |
<div v-if="!modalIsOpen">Modal is closed</div> | |
<a @click="doOpen">Open modal</a> | |
<a @click="doClose">Close modal</a> | |
</div>`, | |
data() { | |
return { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fetch('https://api.storyblok.com/v1/cdn/datasource_entries?datasource=github-repositories&token=' + window.storyblok.config.accessToken) | |
.then(response => response.json()) | |
.then(myJson => { | |
console.log(myJson) | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Promise = require('bluebird') | |
const path = require('path') | |
exports.createPages = ({ graphql, boundActionCreators }) => { | |
const { createPage } = boundActionCreators | |
return new Promise((resolve, reject) => { | |
const storyblokEntry = path.resolve('src/templates/storyblok-entry.js') | |
graphql( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Instructions: | |
1. Install the dependencies with "npm init" and "npm install storyblok-js-client http" | |
1. Create a content type with a "message" field type | |
2. Exchange oauthToken (from the my account section of Storyblok) and spaceId | |
3. Start the server with "node index.js" and execute following curl request | |
curl -X POST \ | |
http://127.0.0.1:3020 \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Fieldtype = { | |
mixins: [window.Storyblok.plugin], | |
template: `<div><textarea class="uk-width-1-1" v-model="model.rte_content" ref="mytextarea" id="mytextarea">Hello, World!</textarea></div>`, | |
methods: { | |
initWith() { | |
return { | |
plugin: 'atlas_rte', | |
rte_content: 'Hello world!' | |
} | |
}, |