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
var request = require("request"); | |
var options = { method: 'POST', | |
url: 'https://api.storyblok.com/v1/spaces/49233/stories', | |
headers: | |
{ Authorization: 'auth_token', | |
'Content-Type': 'application/json', | |
Accept: 'application/json' }, | |
body: | |
{ story: |
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
// example store | |
import Vuex from 'vuex' | |
const createStore = () => { | |
return new Vuex.Store({ | |
state: { | |
work_detail: null | |
}, | |
state: { | |
counter: 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 axios = require('axios') | |
// Using Links API | |
generate: { | |
routes: function (callback) { | |
const token = `YOUR_TOKEN` | |
const version = 'published' | |
let cache_version = 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
import requests | |
# Got from https://app.storyblok.com/#!/me/account (Personal access token) | |
auth_token = 'YOUR_TOKEN' | |
class Client: | |
def __init__(self, auth_token): | |
self.auth_token = auth_token | |
def create_space(self, name, domain, parent='', dup=''): |
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
import requests | |
auth_token = 'your_token' | |
url = "https://api.storyblok.com/v1/spaces" | |
payload = "{\"space\":{\"name\":\"Space B\",\"domain\":\"http://example.storyblok.com\"}}" | |
headers = { | |
'Accept': "application/json", | |
'Content-Type': "application/json", |
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
function forceDownload(blob, filename) { | |
var a = document.createElement('a'); | |
a.download = filename; | |
a.href = blob; | |
a.click(); | |
} | |
// Current blob size limit is around 500MB for browsers | |
function downloadResource(url, filename) { | |
if (!filename) |
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><button class="uk-button uk-width-1-1" v-on:click="publishToProduction">Publish to Production</button></div>`, | |
methods: { | |
initWith() { | |
return { | |
plugin: 'publish-to-production' | |
} | |
}, | |
pluginCreated() { |
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-grid"> | |
<div class="uk-width-1-3"> | |
<label class="uk-form-label">X-Small</label> | |
<select style="padding-right:15px" class="uk-width-1-1" v-model="model.xsmall"><option :value="option" v-for="option in options">{{ option }}</option></select> | |
</div> | |
<div class="uk-width-1-3"> | |
<label class="uk-form-label">Small</label> | |
<select style="padding-right:15px" class="uk-width-1-1" v-model="model.small"><option :value="option" v-for="option in options">{{ option }}</option></select> |
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 class="uk-clearfix"> | |
<input class="uk-hidden" type="file" multiple="multiple" @change="changeFiles($event)" /> | |
<div class="uk-flex uk-margin-small-bottom" v-for="(key, item) in model.files"> | |
<img class="image" :src="item.url.replace('a.storyblok.com', 'img2.storyblok.com/160x90/filters:fill(auto,0)')"> | |
<input type="text" class="uk-form-small uk-flex-item-auto" v-model=item.url> | |
<button @click.prevent="removeFile(key)" class="uk-button uk-button-small uk-margin-small-left"><i class="uk-icon-close"></i></button> |
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( |