Do not panic is there is no home slogan yet
This commit is contained in:
parent
33100a6149
commit
036c3bc9ce
|
@ -53,7 +53,11 @@ func (p *homePage) MustRender(w http.ResponseWriter, r *http.Request, user *auth
|
||||||
p.CampsiteTypes = mustCollectCampsiteTypes(r.Context(), company, conn, user.Locale)
|
p.CampsiteTypes = mustCollectCampsiteTypes(r.Context(), company, conn, user.Locale)
|
||||||
p.Cover = carousel.MustCollectSlides(r.Context(), company, conn, user.Locale, coverName)
|
p.Cover = carousel.MustCollectSlides(r.Context(), company, conn, user.Locale, coverName)
|
||||||
p.Carousel = carousel.MustCollectSlides(r.Context(), company, conn, user.Locale, carouselName)
|
p.Carousel = carousel.MustCollectSlides(r.Context(), company, conn, user.Locale, carouselName)
|
||||||
p.Slogan = conn.MustGetText(r.Context(), "select coalesce(i18n.slogan, home.slogan) from home left join camper.home_i18n as i18n on i18n.company_id = home.company_id and i18n.lang_tag = $1 where home.company_id = $2", user.Locale.Language, company.ID)
|
var err error
|
||||||
|
p.Slogan, err = conn.GetText(r.Context(), "select coalesce(i18n.slogan, home.slogan) from home left join camper.home_i18n as i18n on i18n.company_id = home.company_id and i18n.lang_tag = $1 where home.company_id = $2", user.Locale.Language, company.ID)
|
||||||
|
if err != nil && !database.ErrorIsNotFound(err) {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
template.MustRenderPublic(w, r, user, company, "home.gohtml", p)
|
template.MustRenderPublic(w, r, user, company, "home.gohtml", p)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue