-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
201 additions
and
40 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<template> | ||
<router-link class="card" :to="`${post.category.name}/${post.slug}`"> | ||
<div class="card-img" | ||
:class="[post.cover !== 'uploads/images/cover-default.png' ? 'cover-img' : '']"> | ||
<img class="card-img-top img-responsive" :src="post.cover" :alt="post.title"> | ||
</div> | ||
<div class="card-body"> | ||
<h3 class="card-title post-title">{{ post.title }}</h3> | ||
<h5 class="card-text">{{ limitWords(post.stripped_body, 35) }}</h5> | ||
<p class="card-text"> | ||
<small class="text-muted card-caps"> | ||
{{ toWord(post.category.name) }} / {{ post.created_at }} | ||
</small> | ||
</p> | ||
</div> | ||
</router-link> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: ['post'], | ||
methods: { | ||
limitWords(textToLimit, wordLimit) { | ||
let finalText = ""; | ||
let text2 = textToLimit.replace(/\s+/g, ' '); | ||
let text3 = text2.split(' '); | ||
let numberOfWords = text3.length; | ||
let i = 0; | ||
if (numberOfWords > wordLimit) { | ||
for (i = 0; i < wordLimit; i++) { | ||
finalText = finalText + " " + text3[i] + " "; | ||
} | ||
return finalText + "..."; | ||
} | ||
return textToLimit; | ||
}, | ||
toWord(str) { | ||
return helper.toWord(str); | ||
} | ||
} | ||
} | ||
</script> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<template> | ||
<div v-if="post"> | ||
<section id="wrapper"> | ||
<div class="page-wrapper" style="margin-left:0"> | ||
<div class="container-fluid"> | ||
<div class="row"> | ||
<div class="col-12 m-t-30"> | ||
<div class="card"> | ||
<div class="card-body"> | ||
<div class="row"> | ||
<div class="col-9 col-md-9"> | ||
<h1 class="card-title post-title">{{ post.title }}</h1> | ||
<span class="text-muted card-caps"> | ||
{{ toWord(categoryName) }} / {{ post.created_at }} | ||
</span> | ||
<hr> | ||
<div class="card-text" v-html="post.body"></div> | ||
</div> | ||
<div class="col-3 col-md-3"> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
</div> | ||
<div v-else> | ||
<page-not-found></page-not-found> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import pageNotFound from '../errors/PageNotFound' | ||
export default { | ||
components: { | ||
pageNotFound, | ||
}, | ||
data() { | ||
return { | ||
category: '', | ||
categoryName: '', | ||
slug: '', | ||
post: {} | ||
}; | ||
}, | ||
mounted() { | ||
this.category = this.$route.params.category; | ||
this.slug = this.$route.params.slug; | ||
axios.get('/api/posts/' + this.category + '/' + this.slug) | ||
.then(response => response.data) | ||
.then(response => { | ||
this.post = response.post; | ||
this.categoryName = response.post.category.name; | ||
if (this.post) { | ||
document.title = `${helper.getConfig('company_name')} | ${this.post.title}`; | ||
} else { | ||
document.title = `${helper.getConfig('company_name')} | ${i18n.general.page_not_found_heading}`; | ||
} | ||
}) | ||
.catch(error => { | ||
helper.showDataErrorMsg(error); | ||
}); | ||
}, | ||
methods: { | ||
toWord(str) { | ||
return helper.toWord(str); | ||
} | ||
} | ||
} | ||
</script> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2559,4 +2559,8 @@ samp { | |
|
||
.cover-img { | ||
background-color: #fff !important; | ||
} | ||
|
||
.card-caps { | ||
text-transform: uppercase; | ||
} |
This file contains 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