');
+ // Inject the HTML for each slide into the DOM.
+ $.each(slides, function(index, slide) {
+ slide.DisplayTimeMs = slide.DisplayTimeSec * 1000;
+ slide.First = index === 0;
+ var slideHtml;
+ if (slide.Image) {
+ slideHtml = sponsorImageTemplate(slide);
+ } else {
+ slideHtml = sponsorTextTemplate(slide);
+ }
+ $("#sponsorContainer").append(slideHtml);
});
// Start Carousel
@@ -416,8 +421,6 @@ $(function() {
scorePosted: function(event) { handleScorePosted(event.data); }
});
- initializeSponsorDisplay();
-
// Map how to transition from one screen to another. Missing links between screens indicate that first we
// must transition to the blank screen and then to the target screen.
transitionMap = {
diff --git a/templates/audience_display.html b/templates/audience_display.html
index d8cdcd3..6897d42 100644
--- a/templates/audience_display.html
+++ b/templates/audience_display.html
@@ -167,6 +167,20 @@
{{"{{/each}}"}}
+
+
diff --git a/templates/setup_sponsor_slides.html b/templates/setup_sponsor_slides.html
index 4e3ac0c..a9888ea 100644
--- a/templates/setup_sponsor_slides.html
+++ b/templates/setup_sponsor_slides.html
@@ -57,52 +57,11 @@
-
+
{{end}}
-
diff --git a/web/api.go b/web/api.go
index 95b061a..d2551db 100644
--- a/web/api.go
+++ b/web/api.go
@@ -85,6 +85,10 @@ func (web *Web) sponsorSlidesApiHandler(w http.ResponseWriter, r *http.Request)
return
}
+ if sponsors == nil {
+ // Go marshals an empty slice to null, so explicitly create it so that it appears as an empty JSON array.
+ sponsors = make([]model.SponsorSlide, 0)
+ }
jsonData, err := json.MarshalIndent(sponsors, "", " ")
if err != nil {
handleWebErr(w, err)
diff --git a/web/setup_sponsor_slides.go b/web/setup_sponsor_slides.go
index 41f0d17..d3401e9 100644
--- a/web/setup_sponsor_slides.go
+++ b/web/setup_sponsor_slides.go
@@ -27,6 +27,10 @@ func (web *Web) sponsorSlidesGetHandler(w http.ResponseWriter, r *http.Request)
handleWebErr(w, err)
return
}
+
+ // Append a blank slide to the end that can be used to add a new one.
+ sponsorSlides = append(sponsorSlides, model.SponsorSlide{DisplayTimeSec: 10})
+
data := struct {
*model.EventSettings
SponsorSlides []model.SponsorSlide