From f821dbaac49b6a08989c8034160171ab7ff57d7c Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Fri, 9 Aug 2019 12:00:46 -0400 Subject: [PATCH] Support dedicated signup page in chorus mode This adds a Sign Up link to site navigation and shows the otherwise-landing page on /signup when in chorus mode. Ref T681 --- app.go | 6 ++++++ routes.go | 1 + templates/base.tmpl | 1 + templates/user/include/header.tmpl | 1 + 4 files changed, 9 insertions(+) diff --git a/app.go b/app.go index 002bd6e..8b630df 100644 --- a/app.go +++ b/app.go @@ -213,6 +213,12 @@ func handleViewHome(app *App, w http.ResponseWriter, r *http.Request) error { } } + return handleViewLanding(app, w, r) +} + +func handleViewLanding(app *App, w http.ResponseWriter, r *http.Request) error { + forceLanding := r.FormValue("landing") == "1" + p := struct { page.StaticPage Flashes []template.HTML diff --git a/routes.go b/routes.go index 724c532..777492b 100644 --- a/routes.go +++ b/routes.go @@ -150,6 +150,7 @@ func InitRoutes(apper Apper, r *mux.Router) *mux.Router { // Handle special pages first write.HandleFunc("/login", handler.Web(viewLogin, UserLevelNoneRequired)) + write.HandleFunc("/signup", handler.Web(handleViewLanding, UserLevelNoneRequired)) write.HandleFunc("/invite/{code}", handler.Web(handleViewInvite, UserLevelNoneRequired)).Methods("GET") // TODO: show a reader-specific 404 page if the function is disabled write.HandleFunc("/read", handler.Web(viewLocalTimeline, UserLevelReader)) diff --git a/templates/base.tmpl b/templates/base.tmpl index 41b0f2a..34fcf22 100644 --- a/templates/base.tmpl +++ b/templates/base.tmpl @@ -38,6 +38,7 @@ {{if .SimpleNav}}{{if .Username}}
diff --git a/templates/user/include/header.tmpl b/templates/user/include/header.tmpl index 1ebc6ac..2b522a8 100644 --- a/templates/user/include/header.tmpl +++ b/templates/user/include/header.tmpl @@ -47,6 +47,7 @@ {{if .SimpleNav}} About {{if and (and (not .SingleUser) .LocalTimeline) .CanViewReader}}Reader{{end}} + {{if and (and (and (not .SingleUser) .Chorus) .OpenRegistration) (not .Username)}}Sign up{{end}} {{if .Username}}Log out{{else}}Log in{{end}} {{else}} Blogs