Added show a single publisher
the build was successful
Details
the build was successful
Details
This commit is contained in:
parent
8a8bd44a21
commit
8767737ee4
|
@ -0,0 +1,77 @@
|
||||||
|
<template>
|
||||||
|
<div v-if="user.authenticated">
|
||||||
|
<h1>{{ publisher.Name }}</h1>
|
||||||
|
|
||||||
|
<div class="ui info message" v-if="loading">
|
||||||
|
<icon name="refresh" spin></icon>
|
||||||
|
Loading...
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ui negative message" v-if="error">
|
||||||
|
<div class="header">
|
||||||
|
An error occured.
|
||||||
|
</div>
|
||||||
|
{{ error.message }}
|
||||||
|
<p v-if="error.response.data">
|
||||||
|
{{ error.response.data.Message }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="!loading && !error">
|
||||||
|
|
||||||
|
<router-link :to="{ name: 'publisher-edit', params: { id: publisherID} }" class="ui teal labeled icon button" style="float: right;">
|
||||||
|
<i class="edit icon"></i>
|
||||||
|
Edit
|
||||||
|
</router-link>
|
||||||
|
|
||||||
|
<div class="ui list">
|
||||||
|
<div class="item">
|
||||||
|
<div class="header">
|
||||||
|
Name
|
||||||
|
</div>
|
||||||
|
{{ publisher.Name }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import auth from '../auth'
|
||||||
|
import {HTTP} from '../http-common'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'Publisher',
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
user: auth.user,
|
||||||
|
publisher: {},
|
||||||
|
error: '',
|
||||||
|
success: '',
|
||||||
|
publisherID: this.$route.params.id
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created () {
|
||||||
|
this.loadPublisher()
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
// call again the method if the route changes
|
||||||
|
'$route': 'loadPublisher'
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
loadPublisher () {
|
||||||
|
this.loading = true
|
||||||
|
this.publisher = {}
|
||||||
|
HTTP.get(`publishers/` + this.publisherID)
|
||||||
|
.then(response => {
|
||||||
|
this.publisher = response.data
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
.catch(e => {
|
||||||
|
this.loading = false
|
||||||
|
this.error = e
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -156,7 +156,7 @@ export default {
|
||||||
for (const b in bs) {
|
for (const b in bs) {
|
||||||
this.publishers[i] = {
|
this.publishers[i] = {
|
||||||
ID: {content: bs[b].ID, hide: true}, // Don't show the ID
|
ID: {content: bs[b].ID, hide: true}, // Don't show the ID
|
||||||
Name: {content: bs[b].Name, link: '/publisher/' + bs[b].ID} // Add a link to the element
|
Name: {content: bs[b].Name, link: '/publishers/' + bs[b].ID} // Add a link to the element
|
||||||
}
|
}
|
||||||
|
|
||||||
// increment dat shit
|
// increment dat shit
|
||||||
|
|
|
@ -10,6 +10,7 @@ import AuthorsAddEdit from '@/components/AuthorsAddEdit'
|
||||||
import AuthorOverview from '@/components/AuthorOverview'
|
import AuthorOverview from '@/components/AuthorOverview'
|
||||||
import Publishers from '@/components/Publishers'
|
import Publishers from '@/components/Publishers'
|
||||||
import PublishersAddEdit from '@/components/PublishersAddEdit'
|
import PublishersAddEdit from '@/components/PublishersAddEdit'
|
||||||
|
import PublisherOverview from '@/components/PublisherOverview'
|
||||||
|
|
||||||
Vue.use(Router)
|
Vue.use(Router)
|
||||||
|
|
||||||
|
@ -75,6 +76,11 @@ export default new Router({
|
||||||
name: 'publishers-add',
|
name: 'publishers-add',
|
||||||
component: PublishersAddEdit
|
component: PublishersAddEdit
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/publishers/:id',
|
||||||
|
name: 'publisher-show',
|
||||||
|
component: PublisherOverview
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/publishers/:id/edit',
|
path: '/publishers/:id/edit',
|
||||||
name: 'publisher-edit',
|
name: 'publisher-edit',
|
||||||
|
|
Loading…
Reference in New Issue