Skip to content

Commit

Permalink
Theming with WP REST API - Part 10 - Making Previews Pretty
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Doric committed Apr 9, 2016
1 parent a2ca594 commit fad5fb4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

<template id="post-list-template">

<div class="overlay" v-if="show" transition="overlayshow"></div>

<header class="main-header">
<img class="hero" src="<?php bloginfo('template_url'); ?>/images/hero.jpg" alt="">
</header>
Expand Down Expand Up @@ -62,7 +64,7 @@
</div>
</div>

<div class="single-preview">
<div class="single-preview" v-if="show" transition="postshow">
<h2>{{ post[0].title.rendered }}</h2>

<div class="image">
Expand All @@ -80,8 +82,12 @@
<a v-on:click="getThePost(post[0].previous_post)" v-if="post[0].previous_post" class="post-nav prev">
<span class="icon-left"></span>
</a>

<button class="close-button" v-on:click="closePost()">&#215;</button>
</div>



</template>

<?php get_footer(); ?>
8 changes: 7 additions & 1 deletion js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ var postList = Vue.extend({
showFilter: false,
filterBtnOpen: true,
filterBtnClose: false,
post:''
post:'',
show: false
}
},

Expand All @@ -32,13 +33,18 @@ var postList = Vue.extend({
getThePost: function(id){
var posts = this.posts;

this.$set('show', true);

function filterPosts(el){
return el.id == id;
}

this.$set('post', posts.filter(filterPosts));
},

closePost: function(){
this.$set('show', false);
},

openFilter: function(){
this.$set('showFilter', true);
Expand Down

0 comments on commit fad5fb4

Please sign in to comment.