[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taldir] branch master updated: Footer in separate template file
From: |
gnunet |
Subject: |
[taler-taldir] branch master updated: Footer in separate template file |
Date: |
Sat, 11 Jan 2025 13:33:52 +0100 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository taldir.
The following commit(s) were added to refs/heads/master by this push:
new db7f57e Footer in separate template file
db7f57e is described below
commit db7f57e6f535fbf5a26b0fc777b2f3cf3e914164
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Sat Jan 11 13:33:49 2025 +0100
Footer in separate template file
---
pkg/rest/taldir.go | 13 +++++++++----
web/templates/footer.html | 4 ++++
web/templates/landing.html | 5 +----
web/templates/landing_email.html | 1 +
web/templates/landing_phone.html | 1 +
web/templates/lookup_result.html | 1 +
web/templates/validation_landing.html | 1 +
7 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/pkg/rest/taldir.go b/pkg/rest/taldir.go
index 895b693..968101c 100644
--- a/pkg/rest/taldir.go
+++ b/pkg/rest/taldir.go
@@ -618,6 +618,7 @@ func (t *Taldir) validationPage(w http.ResponseWriter, r
*http.Request) {
encodedPng := base64.StdEncoding.EncodeToString(png)
fullData := map[string]interface{}{
+ "version": t.Version,
"QRCode": template.URL("data:image/png;base64," +
encodedPng),
"WalletLink": template.URL(walletLink),
}
@@ -625,6 +626,7 @@ func (t *Taldir) validationPage(w http.ResponseWriter, r
*http.Request) {
} else {
expectedSolution := util.GenerateSolution(validation.TargetUri,
validation.Challenge)
fullData := map[string]interface{}{
+ "version": t.Version,
"error": r.URL.Query().Get("error"),
"target_uri": template.URL(validation.TargetUri),
"address": template.URL(address),
@@ -689,6 +691,7 @@ func (t *Taldir) methodLookupResultPage(w
http.ResponseWriter, r *http.Request)
found = true
}
fullData := map[string]interface{}{
+ "version": t.Version,
"available": !found,
"method": val.Name,
"address": r.URL.Query().Get("address"),
@@ -713,6 +716,7 @@ func (t *Taldir) methodLandingPage(w http.ResponseWriter, r
*http.Request) {
return
}
fullData := map[string]interface{}{
+ "version": t.Version,
"error": r.URL.Query().Get("error"),
}
err := val.LandingPageTpl.Execute(w, fullData)
@@ -775,6 +779,7 @@ func (t *Taldir) Initialize(cfgfile string, version string)
{
fmt.Println("Production mode enabled")
}
+ footerTplFile :=
t.Cfg.Section("taldir").Key("footer").MustString("web/templates/footer.html")
t.Version = version
t.BaseUrl =
t.Cfg.Section("taldir").Key("base_url").MustString("http://localhost:11000")
t.Validators = make(map[string]Validator)
@@ -788,7 +793,7 @@ func (t *Taldir) Initialize(cfgfile string, version string)
{
}
vname := strings.TrimPrefix(sec.Name(), "taldir-validator-")
vlandingPageTplFile :=
sec.Key("registration_page").MustString("web/templates/landing_" + vname +
".html")
- vlandingPageTpl, err := template.ParseFiles(vlandingPageTplFile)
+ vlandingPageTpl, err :=
template.ParseFiles(vlandingPageTplFile, footerTplFile)
if err != nil {
log.Printf("`%s` template not found, disabling
validator `%s`.\n", vlandingPageTplFile, vname)
continue
@@ -859,19 +864,19 @@ func (t *Taldir) Initialize(cfgfile string, version
string) {
}
}()
validationLandingTplFile :=
t.Cfg.Section("taldir").Key("validation_landing").MustString("web/templates/validation_landing.html")
- t.ValidationTpl, err = template.ParseFiles(validationLandingTplFile)
+ t.ValidationTpl, err = template.ParseFiles(validationLandingTplFile,
footerTplFile)
if err != nil {
log.Fatal(err)
os.Exit(1)
}
landingTplFile :=
t.Cfg.Section("taldir").Key("landing_page").MustString("web/templates/landing.html")
- t.LandingPageTpl, err = template.ParseFiles(landingTplFile)
+ t.LandingPageTpl, err = template.ParseFiles(landingTplFile,
footerTplFile)
if err != nil {
log.Fatal(err)
os.Exit(1)
}
lookupResultTplFile :=
t.Cfg.Section("taldir").Key("lookup_result_page").MustString("web/templates/lookup_result.html")
- t.LookupResultPageTpl, err = template.ParseFiles(lookupResultTplFile)
+ t.LookupResultPageTpl, err = template.ParseFiles(lookupResultTplFile,
footerTplFile)
if err != nil {
log.Fatal(err)
os.Exit(1)
diff --git a/web/templates/footer.html b/web/templates/footer.html
new file mode 100644
index 0000000..5d9c669
--- /dev/null
+++ b/web/templates/footer.html
@@ -0,0 +1,4 @@
+<footer class="fs-6 text-sm-end mt-4 me-2">
+ <span>Version: {{.version}}</span><br/>
+ <span>Source: <a href="https://git.taler.net/taldir.git">Browse Git
Repository</a></span>
+</footer>
diff --git a/web/templates/landing.html b/web/templates/landing.html
index 04cdeeb..7c51db6 100644
--- a/web/templates/landing.html
+++ b/web/templates/landing.html
@@ -33,9 +33,6 @@
</div>
{{end}}
</div>
+ {{ template "footer.html" . }}
</body>
- <footer class="fs-6 text-sm-end mt-4 me-2">
- <span>Version: {{.version}}</span><br/>
- <span>Source: <a href="https://git.taler.net/taldir.git">Browse Git
Repository</a></span>
- </footer>
</html>
diff --git a/web/templates/landing_email.html b/web/templates/landing_email.html
index bcdcd55..92de1db 100644
--- a/web/templates/landing_email.html
+++ b/web/templates/landing_email.html
@@ -41,5 +41,6 @@
</div>
</form>
</div>
+ {{ template "footer.html" . }}
</body>
</html>
diff --git a/web/templates/landing_phone.html b/web/templates/landing_phone.html
index e572197..68a19e9 100644
--- a/web/templates/landing_phone.html
+++ b/web/templates/landing_phone.html
@@ -40,5 +40,6 @@
</div>
</form>
</div>
+ {{ template "footer.html" . }}
</body>
</html>
diff --git a/web/templates/lookup_result.html b/web/templates/lookup_result.html
index c711b3a..3ff3955 100644
--- a/web/templates/lookup_result.html
+++ b/web/templates/lookup_result.html
@@ -73,6 +73,7 @@
</div>
{{end}}
</div>
+ {{ template "footer.html" . }}
</body>
<script>
var form = document.getElementById('regform');
diff --git a/web/templates/validation_landing.html
b/web/templates/validation_landing.html
index fc03cec..580d034 100644
--- a/web/templates/validation_landing.html
+++ b/web/templates/validation_landing.html
@@ -50,6 +50,7 @@
</div>
</div>
{{end}}
+ {{ template "footer.html" . }}
</body>
<script>
var form = document.getElementById('regform');
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-taldir] branch master updated: Footer in separate template file,
gnunet <=