mirror of
https://github.com/gmemstr/pogo.git
synced 2024-09-20 01:31:09 +01:00
Fully implement episode editing
TODO is implement proper function into backend but frontend rendering works as intended.
This commit is contained in:
parent
182a381f23
commit
72b90d8ddc
|
@ -3,7 +3,7 @@ const episodepublishform = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const episodemanagement = {
|
const episodemanagement = {
|
||||||
template: '<div><table style="width:100%"><tr><th>Title</th><th>URL</th><th>Actions</th></tr><tr v-for="item in items"><td>{{ item.title }}</td><td>{{ item.url }}</td><td><router-link :to="\'edit/\' + item.id">Edit</router-link></td></tr></table></div>',
|
template: '<div><table style="width:100%"><tr><th>Title</th><th>URL</th><th>Actions</th></tr><tr v-for="item in items"><td>{{ item.id }}: {{ item.title }}</td><td>{{ item.url }}</td><td><router-link :to="\'edit/\' + item.id">Edit</router-link></td></tr></table></div>',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@ -30,7 +30,7 @@ const episodemanagement = {
|
||||||
if (err) {
|
if (err) {
|
||||||
this.error = err.toString()
|
this.error = err.toString()
|
||||||
} else {
|
} else {
|
||||||
console.log(items);
|
console.log(items);
|
||||||
var t = JSON.parse(items).items
|
var t = JSON.parse(items).items
|
||||||
for (var i = t.length - 1; i >= 0; i--) {
|
for (var i = t.length - 1; i >= 0; i--) {
|
||||||
this.items.push({
|
this.items.push({
|
||||||
|
@ -46,8 +46,8 @@ const episodemanagement = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const episodeedit = {
|
const episodeedit = {
|
||||||
template: '<div><div><h3>Edit Episode</h3><form enctype="multipart/form-data" action="/admin/edit" method="post"><label for="title">Episode Title</label><input type="text" id="title" name="title"><label for="description">Episode Description</label><textarea name="description" id="description" cols="100" rows="20" style="resize: none;"></textarea><label for="date">Publish Date</label><input type="date" id="date" name="date"><input type="submit" value="Publish"></form></div></div>',
|
template: '<div><div><h3>Edit Episode</h3><form enctype="multipart/form-data" action="/admin/edit" method="post"><label for="title">Episode Title</label><input type="text" id="title" name="title" :value="episode.title"><label for="description">Episode Description</label><textarea name="description" id="description" cols="100" rows="20" style="resize: none;">{{ episode.description }}</textarea><label for="date">Publish Date</label><input type="date" id="date" name="date"><input type="submit" value="Publish"></form></div></div>',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
episode: null,
|
episode: null,
|
||||||
|
@ -65,7 +65,7 @@ const episodeedit = {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
fetchData() {
|
fetchData() {
|
||||||
this.error = this.items = []
|
this.error = this.episode = {}
|
||||||
this.loading = true
|
this.loading = true
|
||||||
|
|
||||||
getEpisodes((err, items) => {
|
getEpisodes((err, items) => {
|
||||||
|
@ -75,14 +75,17 @@ const episodeedit = {
|
||||||
} else {
|
} else {
|
||||||
var t = JSON.parse(items).items
|
var t = JSON.parse(items).items
|
||||||
for (var i = t.length - 1; i >= 0; i--) {
|
for (var i = t.length - 1; i >= 0; i--) {
|
||||||
if (t[i].id == route.params.id)
|
if (t[i].id == this.$route.params.id) {
|
||||||
this.items.push({
|
this.episode = {
|
||||||
title: t[i].title,
|
title: t[i].title,
|
||||||
url: t[i].url
|
description: t[i].summary,
|
||||||
})
|
url: t[i].url,
|
||||||
|
id: t[i].id
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(this.items)
|
console.log(this.episode)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,7 +130,7 @@ const routes = [
|
||||||
{ path: '/publish', component: episodepublishform },
|
{ path: '/publish', component: episodepublishform },
|
||||||
{ path: '/manage', component: episodemanagement },
|
{ path: '/manage', component: episodemanagement },
|
||||||
{ path: '/theme', component: customcss },
|
{ path: '/theme', component: customcss },
|
||||||
{ path: '/edit/:id', component: episodeedit}
|
{ path: '/edit/:id', component: episodeedit }
|
||||||
]
|
]
|
||||||
|
|
||||||
const router = new VueRouter({
|
const router = new VueRouter({
|
||||||
|
|
|
@ -12,6 +12,7 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"strings"
|
"strings"
|
||||||
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
|
@ -110,7 +111,7 @@ func GenerateRss() {
|
||||||
link := podcasturl + "/download/" + file.Name()
|
link := podcasturl + "/download/" + file.Name()
|
||||||
feed.Add(
|
feed.Add(
|
||||||
&feeds.Item{
|
&feeds.Item{
|
||||||
Id: string(i),
|
Id: strconv.Itoa(i),
|
||||||
Title: title,
|
Title: title,
|
||||||
Link: &feeds.Link{Href: link, Length: size, Type: "audio/mpeg"},
|
Link: &feeds.Link{Href: link, Length: size, Type: "audio/mpeg"},
|
||||||
Enclosure: &feeds.Enclosure{Url: link, Length: size, Type: "audio/mpeg"},
|
Enclosure: &feeds.Enclosure{Url: link, Length: size, Type: "audio/mpeg"},
|
||||||
|
|
Loading…
Reference in a new issue