added navbar

pull/24/head
Akhil Gupta 4 years ago
parent 54791a98e2
commit c59ba5198d

@ -156,6 +156,7 @@ hr{
<h1>{{ .title }}</h1> <h1>{{ .title }}</h1>
</section> </section>
{{template "navbar"}}
<br> <br>
{{range .podcastItems}} {{range .podcastItems}}
<div class="podcasts row"> <div class="podcasts row">

@ -130,12 +130,13 @@
<section class="header"> <section class="header">
<h1>{{ .title }}</h1> <h1>{{ .title }}</h1>
</section> </section>
{{template "navbar"}}
<div class="row"> <div class="row">
<form action="/" method="post"> <form action="/" method="post">
<div class="ten columns"> <div class="nine columns">
<input type="url" name="url" id="url" placeholder="Enter Podcast RSS feed" class="u-full-width"> <input type="url" name="url" id="url" placeholder="Enter Podcast RSS feed to add" class="u-full-width">
</div><div class="two columns"> </div><div class="three columns">
<input type="submit" value="Save" class="u-full-width button-primary"> <input type="submit" value="Add Podcast" class="u-full-width button-primary">
</div> </div>
</form> </form>
</div> </div>
@ -147,6 +148,7 @@
</div> </div>
<div class="columns eight"> <div class="columns eight">
<h3>{{.Title}}</h3> <h3>{{.Title}}</h3>
<small>Last Epidsode : {{ latestEpisodeDate .PodcastItems}}</small>
<p>{{ .Summary }}</p> <p>{{ .Summary }}</p>
</div> </div>

@ -0,0 +1,58 @@
{{define "navbar"}}
<style>
/* Larger than tablet */
@media (min-width: 750px) {
.navbar + .docs-section {
border-top-width: 0; }
.navbar,
.navbar-spacer {
display: block;
width: 100%;
height: 6.5rem;
background: #fff;
z-index: 99;
border-top: 1px solid #eee;
border-bottom: 1px solid #eee; }
.navbar-spacer {
display: none; }
.navbar > .container {
width: 100%; }
.navbar-list {
list-style: none;
margin-bottom: 0; }
.navbar-item {
position: relative;
float: left;
margin-bottom: 0; }
.navbar-link {
text-transform: uppercase;
font-size: 11px;
font-weight: 600;
letter-spacing: .2rem;
margin-right: 35px;
text-decoration: none;
line-height: 6.5rem;
color: #222; }
.navbar-link.active {
color: #33C3F0; }
.has-docked-nav .navbar {
position: fixed;
top: 0;
left: 0; }
.has-docked-nav .navbar-spacer {
display: block; }
/* Re-overiding the width 100% declaration to match size of % based container */
.has-docked-nav .navbar > .container {
width: 80%; }
}
</style>
<nav class="navbar">
<div class="container">
<ul class="navbar-list">
<li class="navbar-item"><a class="navbar-link" href="/">Home</a></li>
<li class="navbar-item"><a class="navbar-link" href="/episodes">Episodes</a></li>
</ul>
</div>
</nav>
{{end}}

@ -131,6 +131,7 @@
<h1>{{ .title }}</h1> <h1>{{ .title }}</h1>
</section> </section>
{{template "navbar"}}
<br> <br>
{{range .podcast.PodcastItems}} {{range .podcast.PodcastItems}}
<div class="podcasts row"> <div class="podcasts row">

@ -36,6 +36,15 @@ func main() {
"formatDate": func(raw time.Time) string { "formatDate": func(raw time.Time) string {
return raw.Format("Jan 2 2006") return raw.Format("Jan 2 2006")
}, },
"latestEpisodeDate": func(podcastItems []db.PodcastItem) string {
var latest time.Time
for _, item := range podcastItems {
if item.PubDate.After(latest) {
latest = item.PubDate
}
}
return latest.Format("Jan 2 2006")
},
} }
tmpl := template.Must(template.New("main").Funcs(funcMap).ParseGlob("client/*")) tmpl := template.Must(template.New("main").Funcs(funcMap).ParseGlob("client/*"))

Loading…
Cancel
Save