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="row"
|
|
|
|
>
|
|
|
|
<div class="col-sm-12">
|
|
|
|
<!-- {% if is_granted('ROLE_ADMIN') %}
|
|
|
|
<div class="d-flex justify-content-end">
|
|
|
|
<a :to="id"><i class="fa fa-3x fa-fw fa-edit"></i></a>
|
|
|
|
<a :to="project.id"><i class="fa fa-3x fa-fw fa-trash"></i></a>
|
|
|
|
</div>
|
|
|
|
{% endif %}-->
|
|
|
|
|
|
|
|
<div class="show-article-container p-3 mt-4">
|
|
|
|
<div class="show-article-title-container d-inline-block pl-3 align-middle">
|
|
|
|
<h2>{{ project.name }}</h2>
|
|
|
|
</div>
|
|
|
|
<div>
|
2022-05-11 14:48:04 +02:00
|
|
|
Source:
|
|
|
|
<a
|
|
|
|
:href="project.url"
|
2022-05-06 13:52:18 +02:00
|
|
|
target="_blank"
|
|
|
|
>
|
|
|
|
{{ project.url }}
|
2022-05-11 14:48:04 +02:00
|
|
|
</a>
|
|
|
|
|
2022-05-06 13:52:18 +02:00
|
|
|
<i
|
|
|
|
class="fa fa-external-link"
|
|
|
|
aria-hidden="true"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div class="row mt-5">
|
|
|
|
<div class="col-sm-12">
|
2022-05-11 14:48:04 +02:00
|
|
|
<!-- eslint-disable vue/no-v-html -->
|
2022-05-06 13:52:18 +02:00
|
|
|
<div
|
|
|
|
class="article-text"
|
|
|
|
v-html="readmeToHtml"
|
2022-05-11 14:48:04 +02:00
|
|
|
/>
|
|
|
|
<!-- eslint-enable -->
|
2022-05-06 13:52:18 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
import axios from 'axios'
|
2022-05-11 14:48:04 +02:00
|
|
|
import { marked } from 'marked'
|
2022-05-06 13:52:18 +02:00
|
|
|
import Author from '@/components/users/UserCard'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
Name: 'ProjectDetails',
|
|
|
|
components: {
|
|
|
|
Author,
|
|
|
|
marked
|
|
|
|
},
|
|
|
|
data: () => ({
|
|
|
|
project: null,
|
|
|
|
readme: null,
|
|
|
|
isLoading: true
|
|
|
|
}),
|
|
|
|
computed: {
|
|
|
|
readmeToHtml() {
|
|
|
|
if (!this.isLoading) {
|
|
|
|
return marked(this.readme)
|
|
|
|
}
|
2022-05-11 14:48:04 +02:00
|
|
|
return ''
|
2022-05-06 13:52:18 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
const { id } = this.$route.params
|
|
|
|
console.log(id)
|
|
|
|
axios
|
|
|
|
.get(`/api/projects/${id}`)
|
2022-05-11 14:48:04 +02:00
|
|
|
.then((projectResponse) => {
|
|
|
|
this.project = projectResponse.data
|
|
|
|
console.log(this.project)
|
2022-05-06 13:52:18 +02:00
|
|
|
axios
|
|
|
|
.get(`${this.project.url}/raw/branch/master/README.md`)
|
|
|
|
.then((response) => {
|
|
|
|
this.readme = response.data
|
2022-05-11 14:48:04 +02:00
|
|
|
this.isLoading = false
|
2022-05-06 13:52:18 +02:00
|
|
|
console.log(response)
|
|
|
|
})
|
|
|
|
.catch((error) => {
|
|
|
|
console.log(error)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catch((error) => {
|
|
|
|
console.log(error)
|
|
|
|
})
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
getProjects() {
|
|
|
|
}
|
|
|
|
}
|
2022-05-11 14:48:04 +02:00
|
|
|
}
|
2022-05-06 13:52:18 +02:00
|
|
|
</script>
|