Author JSON is now all lowercase
This commit is contained in:
parent
3d1a710ae0
commit
6f22a1a671
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div v-if="user.authenticated">
|
||||
<h1>{{ author.Forename }} {{ author.Lastname }}</h1>
|
||||
<h1>{{ author.forename }} {{ author.lastname }}</h1>
|
||||
|
||||
<div class="ui info message" v-if="loading">
|
||||
<icon name="refresh" spin></icon>
|
||||
|
@ -52,11 +52,11 @@
|
|||
this.authorList = [
|
||||
{
|
||||
header: this.translate('authors').forename,
|
||||
content: this.author.Forename
|
||||
content: this.author.forename
|
||||
},
|
||||
{
|
||||
header: this.translate('authors').lastname,
|
||||
content: this.author.Lastname
|
||||
content: this.author.lastname
|
||||
}
|
||||
]
|
||||
|
||||
|
|
|
@ -154,8 +154,8 @@ export default {
|
|||
// Loop throught the data we got from our API and prepare an array to display all authors
|
||||
for (const b in bs) {
|
||||
this.authors[i] = {
|
||||
ID: {content: bs[b].ID, hide: true}, // Don't show the ID
|
||||
Name: {content: bs[b].Forename + ' ' + bs[b].Lastname, link: '/authors/' + bs[b].ID} // Add a link to the element
|
||||
id: {content: bs[b].id, hide: true}, // Don't show the ID
|
||||
name: {content: bs[b].forename + ' ' + bs[b].lastname, link: '/authors/' + bs[b].id} // Add a link to the element
|
||||
}
|
||||
|
||||
// increment dat shit
|
||||
|
@ -180,7 +180,7 @@ export default {
|
|||
this.$on('delete-submit', function () {
|
||||
// Prevent deleting already deleted authors
|
||||
if (obj) {
|
||||
HTTP.delete('authors/' + obj.ID.content)
|
||||
HTTP.delete('authors/' + obj.id.content)
|
||||
.then(response => {
|
||||
if (response.status === 200 && response.data.Message === 'success') {
|
||||
// Fire a notification
|
||||
|
@ -202,7 +202,7 @@ export default {
|
|||
})
|
||||
},
|
||||
editauthor (author) {
|
||||
router.push({ name: 'author-edit', params: { id: author.ID.content } })
|
||||
router.push({ name: 'author-edit', params: { id: author.id.content } })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
<form class="ui form" v-bind:class="{ loading: loading }" v-if="!success" @submit.prevent="insertOrUpdateAuthor">
|
||||
<div class="field">
|
||||
<label v-lang.authors.forename></label>
|
||||
<input name="forename" :placeholder="langAuthors.forename" type="text" v-model="author.Forename" v-focus>
|
||||
<input name="forename" :placeholder="langAuthors.forename" type="text" v-model="author.forename" v-focus>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label v-lang.authors.lastname></label>
|
||||
<input name="lastname" :placeholder="langAuthors.lastname" type="text" v-model="author.Lastname" required>
|
||||
<input name="lastname" :placeholder="langAuthors.lastname" type="text" v-model="author.lastname" required>
|
||||
</div>
|
||||
|
||||
<button class="ui blue button" type="submit" v-lang.general.submit></button>
|
||||
|
@ -31,11 +31,11 @@
|
|||
return {
|
||||
success: '',
|
||||
loading: false,
|
||||
authorID: this.$route.params.id,
|
||||
authorid: this.$route.params.id,
|
||||
edit: false,
|
||||
author: {
|
||||
Forename: '',
|
||||
Lastname: ''
|
||||
forename: '',
|
||||
lastname: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -43,8 +43,8 @@
|
|||
this.loading = true
|
||||
|
||||
// Look if we're in edit mode and get the author infos if nessesary
|
||||
if (this.authorID) {
|
||||
HTTP.get('authors/' + this.authorID)
|
||||
if (this.authorid) {
|
||||
HTTP.get('authors/' + this.authorid)
|
||||
.then(response => {
|
||||
this.author = response.data
|
||||
this.edit = true
|
||||
|
@ -76,7 +76,7 @@
|
|||
})
|
||||
},
|
||||
insertOrUpdateAuthor: function () {
|
||||
if (this.author.Lastname === '') {
|
||||
if (this.author.lastname === '') {
|
||||
// Fire a notification
|
||||
this.$notify({
|
||||
type: 'warn',
|
||||
|
@ -88,7 +88,7 @@
|
|||
// Finally Send it
|
||||
// If we want to newly insert it, make a different request
|
||||
if (this.edit) {
|
||||
HTTP.post('authors/' + this.author.ID, {author: this.author})
|
||||
HTTP.post('authors/' + this.author.id, {author: this.author})
|
||||
.then(response => {
|
||||
this.loading = false
|
||||
|
||||
|
|
|
@ -2,11 +2,11 @@ package models
|
|||
|
||||
// Author holds infos about an author
|
||||
type Author struct {
|
||||
ID int64 `xorm:"int(11) autoincr not null unique pk"`
|
||||
Forename string `xorm:"varchar(250)"`
|
||||
Lastname string `xorm:"varchar(250) not null"`
|
||||
Created int64 `xorm:"created"`
|
||||
Updated int64 `xorm:"updated"`
|
||||
ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id"`
|
||||
Forename string `xorm:"varchar(250)" json:"forename"`
|
||||
Lastname string `xorm:"varchar(250) not null" json:"lastname"`
|
||||
Created int64 `xorm:"created" json:"created"`
|
||||
Updated int64 `xorm:"updated" json:"updated"`
|
||||
}
|
||||
|
||||
// TableName returns the table name for struct author
|
||||
|
|
Loading…
Reference in New Issue