Spookie/assets/js/components/projects/index.vue

114 lines
2.4 KiB
Vue
Raw Normal View History

2022-05-06 13:52:18 +02:00
<template>
<div
v-if="isLoading"
class="circle"
>
2022-05-11 14:48:04 +02:00
<i class="fa fa-spinner fa-spin fa-3x fa-fw"/>
2022-05-06 13:52:18 +02:00
<span class="sr-only">Loading </span>
</div>
<div
v-else
class="container-fluid"
>
<div class="row">
<h2 class="mt-2">
This is an overview of my current public (and open source) projects.
</h2>
<!-- projects List -->
<div class="col-sm-12">
2022-05-11 14:48:04 +02:00
<div
2022-05-06 13:52:18 +02:00
v-for="project in projects"
:key="project.id"
>
<div class="project-container bg-dark my-4">
<div class="row">
<div class="col-sm-3">
2022-05-11 14:48:04 +02:00
<router-link :to="'/projects/' + project.id">
2022-05-06 13:52:18 +02:00
<img
v-if="project.teaserImage"
class="blog-img"
:src="'/uploads/projects/' + project.teaserImage"
alt="Teaser"
>
<img
v-else
class="blog-img"
src="/build/images/24unix/24_logo_bg_96x96.png"
alt="Teaser"
>
2022-05-11 14:48:04 +02:00
</router-link>
2022-05-06 13:52:18 +02:00
<br>
<div>
2022-05-11 14:48:04 +02:00
<div
2022-05-06 13:52:18 +02:00
v-for="developer in project.developer"
:key="developer"
2022-05-11 14:48:04 +02:00
class="col"
2022-05-06 13:52:18 +02:00
>
2022-05-11 14:48:04 +02:00
<user-card :author-iri="developer"/>
</div>
2022-05-06 13:52:18 +02:00
</div>
</div>
<div class="col-sm-8 mt-2">
2022-05-11 14:48:04 +02:00
<router-link :to="'/projects/' + project.id">
2022-05-06 13:52:18 +02:00
<div class="article-title d-inline-block pl-3 align-middle">
2022-05-11 14:48:04 +02:00
<h2 v-html="project.name"/>
2022-05-06 13:52:18 +02:00
</div>
2022-05-11 14:48:04 +02:00
</router-link>
2022-05-06 13:52:18 +02:00
<br>
<div class="blog-teaser mb-2 pb-2 text-xl-start">
2022-05-11 14:48:04 +02:00
<span v-html="project.description"/>
2022-05-06 13:52:18 +02:00
<br>
<br>
2022-05-11 14:48:04 +02:00
started: <span v-html="formatDate(project.createdAt)"/>
2022-05-06 13:52:18 +02:00
</div>
</div>
</div>
</div>
2022-05-11 14:48:04 +02:00
</div>
2022-05-06 13:52:18 +02:00
</div>
2022-05-11 14:48:04 +02:00
<!--
2022-05-06 13:52:18 +02:00
<div class="text-xl-start">
2022-05-11 14:48:04 +02:00
<router-link to="/add">
<i class="fa fa-plus-circle"/>
</router-link>
2022-05-06 13:52:18 +02:00
</div>
2022-05-11 14:48:04 +02:00
-->
2022-05-06 13:52:18 +02:00
</div>
</div>
</template>
<script>
2022-05-11 14:48:04 +02:00
import axios from 'axios'
2022-05-06 13:52:18 +02:00
2022-05-11 14:48:04 +02:00
import UserCard from '@/components/users/UserCard'
2022-05-06 13:52:18 +02:00
export default {
name: 'ProjectsList',
components: {
2022-05-11 14:48:04 +02:00
UserCard,
2022-05-06 13:52:18 +02:00
},
data: () => ({
projects: null,
isLoading: true
}),
mounted() {
2022-05-11 14:48:04 +02:00
this.getProjects()
2022-05-06 13:52:18 +02:00
},
methods: {
getProjects() {
axios
.get('/api/projects')
2022-05-11 14:48:04 +02:00
.then((response) => {
this.projects = response.data['hydra:member']
})
this.isLoading = false
console.log(this.projects)
},
formatDate(date) {
return new Date(date).toLocaleDateString('de-DE')
2022-05-06 13:52:18 +02:00
}
}
2022-05-11 14:48:04 +02:00
}
2022-05-06 13:52:18 +02:00
</script>