|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css" integrity="sha512-EZLkOqwILORob+p0BXZc+Vm3RgJBOe1Iq/0fiI7r/wJgzOFZMlsqTa29UEl6v6U6gsV4uIpsNZoV32YZqrCRCQ==" crossorigin="anonymous" />
|
|
|
|
<title>PodGrab</title>
|
|
|
|
{{template "commoncss"}}
|
|
|
|
<style>
|
|
|
|
.button-delete{
|
|
|
|
background-color: indianred;
|
|
|
|
color:wheat;
|
|
|
|
}
|
|
|
|
img{
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
/* Larger than tablet */
|
|
|
|
@media (min-width: 750px) {
|
|
|
|
img{
|
|
|
|
display: block
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div class="container">
|
|
|
|
<section class="header">
|
|
|
|
<h1>{{ .title }}</h1>
|
|
|
|
</section>
|
|
|
|
{{template "navbar"}}
|
|
|
|
<div class="row" style="display: none;">
|
|
|
|
<form action="/" method="post">
|
|
|
|
<div class="nine columns">
|
|
|
|
<input type="url" name="url" id="url" placeholder="Enter Podcast RSS feed to add" class="u-full-width">
|
|
|
|
</div><div class="three columns">
|
|
|
|
<input type="submit" value="Add Podcast" class="u-full-width button-primary">
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
<br>
|
|
|
|
|
|
|
|
{{range .podcasts}}
|
|
|
|
<div class="podcasts row" id="podcast-{{ .ID }}">
|
|
|
|
<div class="columns two">
|
|
|
|
<img class="u-full-width" src="{{ .Image }}" alt="{{ .Title }}">
|
|
|
|
</div>
|
|
|
|
<div class="columns ten">
|
|
|
|
<a style="text-decoration: none;" href="/podcasts/{{ .ID }}/view"> <h3>{{.Title}}</h3></a>
|
|
|
|
|
|
|
|
<p>{{ .Summary }}</p>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="columns four">
|
|
|
|
|
|
|
|
Last Episode : {{ latestEpisodeDate .PodcastItems}}
|
|
|
|
</div>
|
|
|
|
<div class="columns four">
|
|
|
|
{{ len .PodcastItems }} episodes
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="columns four">
|
|
|
|
<button class="button button-delete" onclick="deletePodcast('{{.ID}}')">Delete</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<hr>
|
|
|
|
{{else}}
|
|
|
|
<h5>You haven't added any podcasts yet. <a href="/add">Click here</a> to add a new podcast to start monitoring.</h5>
|
|
|
|
{{end}}
|
|
|
|
<!-- <div class="row">
|
|
|
|
<div class="columns twelve" style="text-align: center;">
|
|
|
|
<a href="/episodes" class="button button-primary">All Episodes</a>
|
|
|
|
</div>
|
|
|
|
</div> -->
|
|
|
|
</div>
|
|
|
|
{{template "scripts"}}
|
|
|
|
<script>
|
|
|
|
function deletePodcast(id){
|
|
|
|
console.log(id)
|
|
|
|
var confirmed= confirm("Are you sure you want to delete this podcast?");
|
|
|
|
if(!confirmed){
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
axios.delete("/podcasts/"+id)
|
|
|
|
.then(function(response){
|
|
|
|
Vue.toasted.show('Podcast deleted successfully.' ,{
|
|
|
|
theme: "bubble",
|
|
|
|
position: "top-right",
|
|
|
|
duration : 5000
|
|
|
|
});
|
|
|
|
var row = document.getElementById('podcast-'+id);
|
|
|
|
row.remove();
|
|
|
|
})
|
|
|
|
.catch(function(error){
|
|
|
|
if(error.response){
|
|
|
|
|
|
|
|
Vue.toasted.show(error.response.data?.message, {
|
|
|
|
theme: "bubble",
|
|
|
|
position: "top-right",
|
|
|
|
duration : 5000
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
}).
|
|
|
|
then(function(){
|
|
|
|
})
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|