mirror of
https://github.com/gmemstr/pogo.git
synced 2024-09-20 01:31:09 +01:00
Starting on episode editing interface
This commit is contained in:
parent
1c836ccaa9
commit
6795c5cd0a
|
@ -3,7 +3,7 @@ const episodepublishform = {
|
|||
}
|
||||
|
||||
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>Remove Edit</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.title }}</td><td>{{ item.url }}</td><td><router-link :to="\'edit/\' + item.id">Edit</router-link></td></tr></table></div>',
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
|
@ -30,8 +30,52 @@ const episodemanagement = {
|
|||
if (err) {
|
||||
this.error = err.toString()
|
||||
} else {
|
||||
console.log(items);
|
||||
var t = JSON.parse(items).items
|
||||
for (var i = t.length - 1; i >= 0; i--) {
|
||||
this.items.push({
|
||||
title: t[i].title,
|
||||
url: t[i].url,
|
||||
id: t[i].id
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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>',
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
episode: null,
|
||||
error: null
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// fetch the data when the view is created and the data is
|
||||
// already being observed
|
||||
this.fetchData()
|
||||
},
|
||||
watch: {
|
||||
// call again the method if the route changes
|
||||
'$route': 'fetchData'
|
||||
},
|
||||
methods: {
|
||||
fetchData() {
|
||||
this.error = this.items = []
|
||||
this.loading = true
|
||||
|
||||
getEpisodes((err, items) => {
|
||||
this.loading = false
|
||||
if (err) {
|
||||
this.error = err.toString()
|
||||
} else {
|
||||
var t = JSON.parse(items).items
|
||||
for (var i = t.length - 1; i >= 0; i--) {
|
||||
if (t[i].id == route.params.id)
|
||||
this.items.push({
|
||||
title: t[i].title,
|
||||
url: t[i].url
|
||||
|
@ -82,7 +126,8 @@ const customcss = {
|
|||
const routes = [
|
||||
{ path: '/publish', component: episodepublishform },
|
||||
{ path: '/manage', component: episodemanagement },
|
||||
{ path: '/theme', component: customcss }
|
||||
{ path: '/theme', component: customcss },
|
||||
{ path: '/edit/:id', component: episodeedit}
|
||||
]
|
||||
|
||||
const router = new VueRouter({
|
||||
|
|
|
@ -92,7 +92,7 @@ func GenerateRss() {
|
|||
Created: now,
|
||||
Image: &feeds.Image{Url: config.Image},
|
||||
}
|
||||
|
||||
i := 0
|
||||
for _, file := range files {
|
||||
if strings.Contains(file.Name(), ".mp3") {
|
||||
s := strings.Split(file.Name(), "_")
|
||||
|
@ -110,6 +110,7 @@ func GenerateRss() {
|
|||
link := podcasturl + "/download/" + file.Name()
|
||||
feed.Add(
|
||||
&feeds.Item{
|
||||
Id: string(i),
|
||||
Title: title,
|
||||
Link: &feeds.Link{Href: link, Length: size, Type: "audio/mpeg"},
|
||||
Enclosure: &feeds.Enclosure{Url: link, Length: size, Type: "audio/mpeg"},
|
||||
|
@ -119,6 +120,7 @@ func GenerateRss() {
|
|||
},
|
||||
)
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
|
||||
// Translate the feed to both RSS and JSON,
|
||||
|
|
Loading…
Reference in a new issue