Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Commit

Permalink
added on tap to index
Browse files Browse the repository at this point in the history
  • Loading branch information
alyxbb committed Nov 3, 2023
1 parent 03dcb97 commit 5d8e5af
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
7 changes: 5 additions & 2 deletions controllers/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type RenderData struct {
CurrentAndNext *myradio.CurrentAndNext
Banners []myradio.Banner
Teams []myradio.Team
Timeslots []myradio.Timeslot
Podcasts []myradio.Podcast
MsgBoxError bool
ShowOnAir bool
Expand All @@ -36,7 +37,7 @@ func (ic *IndexController) Get(w http.ResponseWriter, r *http.Request) {
// This is where any form params would be parsed
model := models.NewIndexModel(ic.session)

currentAndNext, banners, teams, podcasts, showOnAir, err := model.Get()
currentAndNext, banners, teams, timeslots, podcasts, showOnAir, err := model.Get()

if err != nil {
log.Println(err)
Expand All @@ -47,6 +48,7 @@ func (ic *IndexController) Get(w http.ResponseWriter, r *http.Request) {
CurrentAndNext: currentAndNext,
Banners: banners,
Teams: teams,
Timeslots: timeslots,
Podcasts: podcasts,
ShowOnAir: showOnAir,
MsgBoxError: false,
Expand All @@ -64,7 +66,7 @@ func (ic *IndexController) Post(w http.ResponseWriter, r *http.Request) {
// Get all the data for the webpage
model := models.NewIndexModel(ic.session)

currentAndNext, banners, teams, podcasts, showOnAir, err := model.Get()
currentAndNext, banners, teams, timeslots, podcasts, showOnAir, err := model.Get()

if err != nil {
log.Println(err)
Expand All @@ -75,6 +77,7 @@ func (ic *IndexController) Post(w http.ResponseWriter, r *http.Request) {
CurrentAndNext: currentAndNext,
Banners: banners,
Teams: teams,
Timeslots: timeslots,
Podcasts: podcasts,
ShowOnAir: showOnAir,
MsgBoxError: false,
Expand Down
10 changes: 9 additions & 1 deletion models/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func NewIndexModel(s *myradio.Session) *IndexModel {
//
// On success, it returns the current and next show, and nil.
// Otherwise, it returns undefined data and the error causing failure.
func (m *IndexModel) Get() (currentAndNext *myradio.CurrentAndNext, banners []myradio.Banner, teams []myradio.Team, podcasts []myradio.Podcast, showOnAir bool, err error) {
func (m *IndexModel) Get() (currentAndNext *myradio.CurrentAndNext, banners []myradio.Banner, teams []myradio.Team, timeslots []myradio.Timeslot, podcasts []myradio.Podcast, showOnAir bool, err error) {
currentAndNext, err = m.session.GetCurrentAndNext()
if err != nil {
return
Expand All @@ -34,6 +34,14 @@ func (m *IndexModel) Get() (currentAndNext *myradio.CurrentAndNext, banners []my
return
}

timeslots, err = m.session.GetPreviousTimeslots(11)
if err != nil {
return
}
// If show currently on air, remove it from previous timeslots
if currentAndNext.Current.Id != 0 {
timeslots = timeslots[1:11]
}
//Get 10 podcasts from page 0 (the latest podcasts)
allpodcasts, err := m.session.GetAllPodcasts(10, 0, false)
if err != nil {
Expand Down
29 changes: 29 additions & 0 deletions views/index.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,35 @@
</div>
{{end}}
{{with .PageData}}
<div id="index-just-missed" class="container-fluid container-padded bg-primary pb-0">
<h2>You just missed...</h2>
<div class="row custom-scrollbar scroll-horiz scroll-none-xl thumbnail-slider">
{{range .Timeslots}}
<div class="col-8 col-sm-7 col-md-4 col-lg-3 col-xl-2 p-3 thumbnail-container">
<a class="ury-card " href="/schedule/shows/timeslots/{{.TimeslotID}}/" title="URY Podcast: {{.Title}}">
<div class="ury-card-img" style="background: url('
{{- if .Season.ShowMeta.Photo -}}
{{$.PageContext.FullURL}}{{.Season.ShowMeta.Photo}}
{{- else -}}
{{url "/images/default_show_profile.png"}}
{{- end -}}');
" alt="{{.Title}} Logo"></div>
<div class="ury-card-body">
<div class="ury-card-title">{{.Title}}</div>
<span class="ury-card-date">{{.StartTime.Format "15:04 - Mon"}} • {{formatDuration .Duration}}</span>
</div>
</a>
</div>
{{end}}
<div class="col-8 col-sm-7 col-md-4 col-lg-3 col-xl-2 p-3 thumbnail-container">
<a class="ury-card link" href="//mixcloud.com/ury1350/">
<div class="ury-card-body">
<div class="ury-card-lg-title">See more on Mixcloud...</div>
</div>
</a>
</div>
</div>
</div>
{{if .Podcasts}}
<div id="index-podcasts" class="container-fluid container-padded pb-0 bg-podcasts">
<div class="row">
Expand Down

0 comments on commit 5d8e5af

Please sign in to comment.