mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 03:32:06 +00:00
Privacy and terms pages with config-driven branding (#91)
* comment out begin with basics until lessons are on the way * route to footer link dead views * proposed >7 piece engame processing * basic privacy and terms pages with default text * add branding to config and reference across the site * disclose guest puzzle limit in privacy policy (#87)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
defmodule Chesstrainer.Accounts.UserNotifier do
|
||||
import Swoosh.Email
|
||||
|
||||
alias Chesstrainer.Branding
|
||||
alias Chesstrainer.Mailer
|
||||
|
||||
# Delivers the email using the application mailer.
|
||||
@@ -8,7 +9,7 @@ defmodule Chesstrainer.Accounts.UserNotifier do
|
||||
email =
|
||||
new()
|
||||
|> to(recipient)
|
||||
|> from({"Chesstrainer", "contact@example.com"})
|
||||
|> from({Branding.name(), Branding.support_email()})
|
||||
|> subject(subject)
|
||||
|> text_body(body)
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
defmodule Chesstrainer.Branding do
|
||||
@moduledoc """
|
||||
Public-facing branding, read from `config :chesstrainer, :branding`.
|
||||
|
||||
Keeps display names out of templates and controllers so the site can be
|
||||
renamed in one place. Values are read at runtime, so a deploy can override
|
||||
them without recompiling.
|
||||
"""
|
||||
|
||||
@defaults [
|
||||
name: "Lucid Chess",
|
||||
wordmark: "LUCID",
|
||||
tagline: "Endgame Trainer",
|
||||
support_email: "support@lucidchess.app"
|
||||
]
|
||||
|
||||
@doc "The display name, e.g. `\"Lucid Chess\"`."
|
||||
def name, do: get(:name)
|
||||
|
||||
@doc "The short wordmark used in the navbar and footer."
|
||||
def wordmark, do: get(:wordmark)
|
||||
|
||||
@doc "The tagline appended to the home title, e.g. `\"Endgame Trainer\"`."
|
||||
def tagline, do: get(:tagline)
|
||||
|
||||
@doc "The address shown in legal pages and used as the mailer `from`."
|
||||
def support_email, do: get(:support_email)
|
||||
|
||||
@doc "The home-page title, e.g. `\"Lucid Chess — Endgame Trainer\"`."
|
||||
def home_title, do: "#{name()} — #{tagline()}"
|
||||
|
||||
@doc "Builds a page title, e.g. `title(\"Privacy Policy\")`."
|
||||
def title(page), do: "#{page} — #{name()}"
|
||||
|
||||
defp get(key) do
|
||||
config = Application.get_env(:chesstrainer, :branding) || []
|
||||
Keyword.get(config, key, Keyword.fetch!(@defaults, key))
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user