diff --git a/rest-theme/src/main.js b/rest-theme/src/main.js index c0f2aa6..686ecc0 100644 --- a/rest-theme/src/main.js +++ b/rest-theme/src/main.js @@ -1,61 +1,73 @@ +/* global wp */ + +String.prototype.capitalize = function () { + return this.charAt(0).toUpperCase() + this.slice(1) +} + import Vue from 'vue' import VueRouter from 'vue-router' -Vue.use(require('vue-resource')); -Vue.use(VueRouter); +Vue.use(require('vue-resource')) +Vue.use(VueRouter) Vue.config.debug = true import Posts from './posts.vue' import Post from './post.vue' -Vue.component('Post', Post) import Page from './page.vue' -Vue.component('Page', Page) import Header from './theme-header.vue' -Vue.component('theme-header', Header) import Footer from './theme-footer.vue' + +Vue.component('Post', Post) +Vue.component('Page', Page) +Vue.component('theme-header', Header) Vue.component('theme-footer', Footer) -var App = Vue.extend({ - template: '' + - '
' + - '', +var + App = Vue.extend({ + template: ` +
+ +
+ +
+ +
`, ready() { - this.updateTitle(''); + this.updateTitle('') }, methods: { - updateTitle(pageTitle) { - document.title = (pageTitle ? pageTitle + ' - ' : '') + wp.site_name; - } + updateTitle(pageTitle) { + document.title = (pageTitle ? pageTitle + ' - ' : '') + wp.site_name + } }, events: { - 'page-title': function(pageTitle) { - this.updateTitle(pageTitle); - } + 'page-title': function (pageTitle) { + this.updateTitle(pageTitle) + } } -}); -var router = new VueRouter({ + }), + + router = new VueRouter({ hashbang: false, history: true -}); + }), + + key, route router.on(wp.base_path, { - component: Posts -}); - -for (var key in wp.routes) { - var route = wp.routes[key]; - router.on(wp.base_path + route.slug, { - component: Vue.component(capitalize(route.type)), - postId: route.id - }); -} + component: Posts +}) -router.start(App, '#app'); +for (key in wp.routes) { + route = wp.routes[key] + router.on(wp.base_path + route.slug, { + component: Vue.component(route.type.capitalize()), + postId: route.id + }) +} -function capitalize(string) { - return string.charAt(0).toUpperCase() + string.slice(1); -} \ No newline at end of file +router.start(App, '#app') diff --git a/rest-theme/src/page.vue b/rest-theme/src/page.vue index 723762c..03a9d1d 100644 --- a/rest-theme/src/page.vue +++ b/rest-theme/src/page.vue @@ -1,49 +1,52 @@ - - \ No newline at end of file + } +} + + + diff --git a/rest-theme/src/post.vue b/rest-theme/src/post.vue index a8a3433..d27853f 100644 --- a/rest-theme/src/post.vue +++ b/rest-theme/src/post.vue @@ -1,58 +1,63 @@ - - \ No newline at end of file + } +} + + + diff --git a/rest-theme/src/posts.vue b/rest-theme/src/posts.vue index 09d3644..cff5f24 100644 --- a/rest-theme/src/posts.vue +++ b/rest-theme/src/posts.vue @@ -1,34 +1,32 @@ - - \ No newline at end of file + } +} + + + diff --git a/rest-theme/src/theme-footer.vue b/rest-theme/src/theme-footer.vue index 7fb84e5..c6612cc 100644 --- a/rest-theme/src/theme-footer.vue +++ b/rest-theme/src/theme-footer.vue @@ -1,26 +1,27 @@ \ No newline at end of file + } +} + + diff --git a/rest-theme/src/theme-header.vue b/rest-theme/src/theme-header.vue index 32e7d90..c135519 100644 --- a/rest-theme/src/theme-header.vue +++ b/rest-theme/src/theme-header.vue @@ -1,61 +1,69 @@ \ No newline at end of file + } +} + + +