func HandleHomeVari(w http.ResponseWriter, r *http.Request, successLandingURL, signoutLandingURL string) { format := ` <a href='%v?mode=select'>Signin with Redirect (Widget)</a><br><br> <a href='%v'>Signin Success Landing</a><br><br> <a href='%v'>Signout </a><br><br> <a href='%v'>Signout Landing</a><br> <a href='%v'>Branding for Account Chooser</a><br> ` str := fmt.Sprintf(format, WidgetSigninAuthorizedRedirectURL, successLandingURL, signOutURL, signoutLandingURL, accountChooserBrandingURL, ) bstpl := tplx.TemplateFromHugoPage(w, r) // the jQuery irritates fmt.Fprintf(w, tplx.ExecTplHelper(bstpl, map[string]interface{}{ "HtmlTitle": "Google Identity Toolkit Overview", "HtmlDescription": "", // reminder "HtmlContent": template.HTML(str), })) }
func GetHomeTpl(w http.ResponseWriter, r *http.Request, title, body string) *template.Template { if body == "" { body = IDCardHTML + UserInfoHTML } lg, _ := loghttp.BuffLoggerUniversal(w, r) bstpl := tplx.TemplateFromHugoPage(w, r) b := new(bytes.Buffer) fmt.Fprintf(b, tplx.ExecTplHelper(bstpl, map[string]interface{}{ // "HtmlTitle": "{{ .HtmlTitle }}", // this seems to cause problems sometimes. "HtmlTitle": title, "HtmlDescription": "", // reminder "HtmlHeaders": template.HTML(Headers), "HtmlContent": template.HTML(body), })) intHomeTemplate, err := template.New("home").Parse(b.String()) lg(err) return intHomeTemplate }
func handleSignOutLanding(w http.ResponseWriter, r *http.Request) { format := ` Signed out<br> <a href='%v'>Home</a><br> ` str := fmt.Sprintf(format, homeURL) bstpl := tplx.TemplateFromHugoPage(w, r) // the jQuery irritates fmt.Fprintf(w, tplx.ExecTplHelper(bstpl, map[string]interface{}{ "HtmlTitle": "Google Identity Toolkit Overview", "HtmlDescription": "", // reminder "HtmlContent": template.HTML(str), })) }
func getHomeTpl(w http.ResponseWriter, r *http.Request) *template.Template { lg, _ := loghttp.BuffLoggerUniversal(w, r) bstpl := tplx.TemplateFromHugoPage(w, r) b := new(bytes.Buffer) fmt.Fprintf(b, tplx.ExecTplHelper(bstpl, map[string]interface{}{ // "HtmlTitle": "{{ .HtmlTitle }}", // this seems to cause problems sometimes. "HtmlTitle": "Member Area", "HtmlDescription": "", // reminder "HtmlHeaders": template.HTML(Headers), "HtmlContent": template.HTML(home1 + "\n<br><br>\n" + home2), })) intHomeTemplate, err := template.New("home").Parse(b.String()) lg(err) return intHomeTemplate }
func GetWidgetTpl(w http.ResponseWriter, r *http.Request, title string) *template.Template { lg, _ := loghttp.BuffLoggerUniversal(w, r) bstpl := tplx.TemplateFromHugoPage(w, r) // the jQuery irritates // bstpl := tplx.HugoTplNoScript b := new(bytes.Buffer) fmt.Fprintf(b, tplx.ExecTplHelper(bstpl, map[string]interface{}{ // "HtmlTitle": "{{ .HtmlTitle }}", // it DOES cause some eternal loop. But why only here? "HtmlTitle": title, "HtmlDescription": "", // reminder "HtmlHeaders": template.HTML(Headers), "HtmlContent": template.HTML(widgetHTML), })) intGitkitTemplate, err := template.New("widg").Parse(b.String()) lg(err) return intGitkitTemplate }