From 709668d811c8b36c2692582706d0f3d12ba2437b Mon Sep 17 00:00:00 2001 From: Kailash Nadh Date: Sun, 8 Mar 2020 00:25:53 +0530 Subject: [PATCH] Move static assets to 'static' dir --- init.go | 8 +- .../email-templates}/base.html | 0 .../email-templates}/campaign-status.html | 0 .../email-templates}/default.tpl | 0 .../email-templates}/import-status.html | 0 .../email-templates}/subscriber-data.html | 0 .../subscriber-optin-campaign.html | 0 .../email-templates}/subscriber-optin.html | 0 static/public/base.html | 98 ++++++++++++++++++ static/public/campaign-status.html | 25 +++++ static/public/default.tpl | 84 +++++++++++++++ static/public/import-status.html | 19 ++++ {public => static/public}/static/logo.png | Bin {public => static/public}/static/logo.svg | 0 {public => static/public}/static/script.js | 0 {public => static/public}/static/style.css | 0 static/public/subscriber-data.html | 9 ++ static/public/subscriber-optin-campaign.html | 17 +++ static/public/subscriber-optin.html | 21 ++++ .../public}/templates/index.html | 0 .../public}/templates/message.html | 0 .../public}/templates/optin.html | 0 .../public}/templates/subscription.html | 0 23 files changed, 278 insertions(+), 3 deletions(-) rename {email-templates => static/email-templates}/base.html (100%) rename {email-templates => static/email-templates}/campaign-status.html (100%) rename {email-templates => static/email-templates}/default.tpl (100%) rename {email-templates => static/email-templates}/import-status.html (100%) rename {email-templates => static/email-templates}/subscriber-data.html (100%) rename {email-templates => static/email-templates}/subscriber-optin-campaign.html (100%) rename {email-templates => static/email-templates}/subscriber-optin.html (100%) create mode 100644 static/public/base.html create mode 100644 static/public/campaign-status.html create mode 100644 static/public/default.tpl create mode 100644 static/public/import-status.html rename {public => static/public}/static/logo.png (100%) rename {public => static/public}/static/logo.svg (100%) rename {public => static/public}/static/script.js (100%) rename {public => static/public}/static/style.css (100%) create mode 100644 static/public/subscriber-data.html create mode 100644 static/public/subscriber-optin-campaign.html create mode 100644 static/public/subscriber-optin.html rename {public => static/public}/templates/index.html (100%) rename {public => static/public}/templates/message.html (100%) rename {public => static/public}/templates/optin.html (100%) rename {public => static/public}/templates/subscription.html (100%) diff --git a/init.go b/init.go index 769a579..699f30c 100644 --- a/init.go +++ b/init.go @@ -50,8 +50,10 @@ func initFS() stuffbin.FileSystem { "config.toml.sample", "queries.sql", "schema.sql", - "email-templates", - "public", + "static/email-templates", + + // Alias /static/public to /public for the HTTP fileserver. + "static/public:/public", // The frontend app's static assets are aliased to /frontend // so that they are accessible at localhost:port/frontend/static/ ... @@ -261,7 +263,7 @@ func initNotifTemplates(path string, fs stuffbin.FileSystem, cs *constants) *tem return cs.LogoURL }} - tpl, err := stuffbin.ParseTemplatesGlob(funcs, fs, "/email-templates/*.html") + tpl, err := stuffbin.ParseTemplatesGlob(funcs, fs, "/static/email-templates/*.html") if err != nil { lo.Fatalf("error parsing e-mail notif templates: %v", err) } diff --git a/email-templates/base.html b/static/email-templates/base.html similarity index 100% rename from email-templates/base.html rename to static/email-templates/base.html diff --git a/email-templates/campaign-status.html b/static/email-templates/campaign-status.html similarity index 100% rename from email-templates/campaign-status.html rename to static/email-templates/campaign-status.html diff --git a/email-templates/default.tpl b/static/email-templates/default.tpl similarity index 100% rename from email-templates/default.tpl rename to static/email-templates/default.tpl diff --git a/email-templates/import-status.html b/static/email-templates/import-status.html similarity index 100% rename from email-templates/import-status.html rename to static/email-templates/import-status.html diff --git a/email-templates/subscriber-data.html b/static/email-templates/subscriber-data.html similarity index 100% rename from email-templates/subscriber-data.html rename to static/email-templates/subscriber-data.html diff --git a/email-templates/subscriber-optin-campaign.html b/static/email-templates/subscriber-optin-campaign.html similarity index 100% rename from email-templates/subscriber-optin-campaign.html rename to static/email-templates/subscriber-optin-campaign.html diff --git a/email-templates/subscriber-optin.html b/static/email-templates/subscriber-optin.html similarity index 100% rename from email-templates/subscriber-optin.html rename to static/email-templates/subscriber-optin.html diff --git a/static/public/base.html b/static/public/base.html new file mode 100644 index 0000000..0f47897 --- /dev/null +++ b/static/public/base.html @@ -0,0 +1,98 @@ +{{ define "header" }} + + + + + + + + + + +
 
+
+
+ {{ if ne LogoURL "" }} + listmonk + {{ end }} +
+{{ end }} + +{{ define "footer" }} +
+ + +
 
+ + +{{ end }} diff --git a/static/public/campaign-status.html b/static/public/campaign-status.html new file mode 100644 index 0000000..d174c02 --- /dev/null +++ b/static/public/campaign-status.html @@ -0,0 +1,25 @@ +{{ define "campaign-status" }} +{{ template "header" . }} +

Campaign update

+ + + + + + + + + + + + + + {{ if ne (index . "Reason") "" }} + + + + + {{ end }} +
Campaign{{ index . "Name" }}
Status{{ index . "Status" }}
Sent{{ index . "Sent" }} / {{ index . "ToSend" }}
Reason{{ index . "Reason" }}
+{{ template "footer" }} +{{ end }} \ No newline at end of file diff --git a/static/public/default.tpl b/static/public/default.tpl new file mode 100644 index 0000000..810a42b --- /dev/null +++ b/static/public/default.tpl @@ -0,0 +1,84 @@ + + + + + + + + + + +
 
+
+ {{ template "content" . }} +
+ + +
 {{ TrackView }}
+ + diff --git a/static/public/import-status.html b/static/public/import-status.html new file mode 100644 index 0000000..3fa6e08 --- /dev/null +++ b/static/public/import-status.html @@ -0,0 +1,19 @@ +{{ define "import-status" }} +{{ template "header" . }} +

Import update

+ + + + + + + + + + + + + +
File{{ .Name }}
Status{{ .Status }}
Records{{ .Imported }} / {{ .Total }}
+{{ template "footer" }} +{{ end }} \ No newline at end of file diff --git a/public/static/logo.png b/static/public/static/logo.png similarity index 100% rename from public/static/logo.png rename to static/public/static/logo.png diff --git a/public/static/logo.svg b/static/public/static/logo.svg similarity index 100% rename from public/static/logo.svg rename to static/public/static/logo.svg diff --git a/public/static/script.js b/static/public/static/script.js similarity index 100% rename from public/static/script.js rename to static/public/static/script.js diff --git a/public/static/style.css b/static/public/static/style.css similarity index 100% rename from public/static/style.css rename to static/public/static/style.css diff --git a/static/public/subscriber-data.html b/static/public/subscriber-data.html new file mode 100644 index 0000000..3873aba --- /dev/null +++ b/static/public/subscriber-data.html @@ -0,0 +1,9 @@ +{{ define "subscriber-data" }} +{{ template "header" . }} +

Your data

+

+ A copy of all data recorded on you is attached as a file in the JSON format. + It can be viewed in a text editor. +

+{{ template "footer" }} +{{ end }} diff --git a/static/public/subscriber-optin-campaign.html b/static/public/subscriber-optin-campaign.html new file mode 100644 index 0000000..fbdaab6 --- /dev/null +++ b/static/public/subscriber-optin-campaign.html @@ -0,0 +1,17 @@ +{{ define "optin-campaign" }} + +

Hi {{`{{ .Subscriber.FirstName }}`}},

+

You have been added to the following mailing lists:

+ +

+ Confirm subscription(s) +

+{{ end }} diff --git a/static/public/subscriber-optin.html b/static/public/subscriber-optin.html new file mode 100644 index 0000000..f81bff3 --- /dev/null +++ b/static/public/subscriber-optin.html @@ -0,0 +1,21 @@ +{{ define "subscriber-optin" }} +{{ template "header" . }} +

Confirm subscription

+

Hi {{ .Subscriber.FirstName }},

+

You have been added to the following mailing lists:

+ +

Confirm your subscription by clicking the below button.

+

+ Confirm subscription +

+ +{{ template "footer" }} +{{ end }} diff --git a/public/templates/index.html b/static/public/templates/index.html similarity index 100% rename from public/templates/index.html rename to static/public/templates/index.html diff --git a/public/templates/message.html b/static/public/templates/message.html similarity index 100% rename from public/templates/message.html rename to static/public/templates/message.html diff --git a/public/templates/optin.html b/static/public/templates/optin.html similarity index 100% rename from public/templates/optin.html rename to static/public/templates/optin.html diff --git a/public/templates/subscription.html b/static/public/templates/subscription.html similarity index 100% rename from public/templates/subscription.html rename to static/public/templates/subscription.html