From 19a59108f6e0d7544865580bdc85696b036ff3ec Mon Sep 17 00:00:00 2001 From: Hironsan Date: Thu, 23 Aug 2018 13:37:43 +0900 Subject: [PATCH] Add guideline.js --- app/server/static/js/guideline.js | 36 +++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 app/server/static/js/guideline.js diff --git a/app/server/static/js/guideline.js b/app/server/static/js/guideline.js new file mode 100644 index 00000000..d500f1c6 --- /dev/null +++ b/app/server/static/js/guideline.js @@ -0,0 +1,36 @@ +import Vue from 'vue'; +import HTTP from './http'; + +const vm = new Vue({ + el: '#editor', + data: { + input: '# hello', + project: Object, + }, + + computed: { + compiledMarkdown() { + return marked(this.input, { + sanitize: true, + }); + }, + }, + + created() { + HTTP.get().then((response) => { + this.input = response.data.guideline; + this.project = response.data; + }); + }, + + methods: { + update: _.debounce(function(e) { + this.input = e.target.value; + this.project.guideline = this.input; + HTTP.put('', this.project).then((response) => { + this.project = response.data; + }); + }, 300), + }, + +});