mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 03:32:06 +00:00
* 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)
53 lines
1.7 KiB
Elixir
53 lines
1.7 KiB
Elixir
defmodule ChesstrainerWeb.PageController do
|
|
use ChesstrainerWeb, :controller
|
|
|
|
alias Chesstrainer.Attempts
|
|
alias Chesstrainer.Branding
|
|
alias Chesstrainer.DailyPuzzles
|
|
alias Chesstrainer.Endgames
|
|
|
|
@description "Short, focused endgame puzzles against tablebase-perfect defence. " <>
|
|
"Learn to see the winning move and make the endgame your strongest phase."
|
|
|
|
def home(conn, _params) do
|
|
endgames = Endgames.curated_endgames()
|
|
|
|
conn
|
|
|> assign(:js_entry, ~p"/assets/js/marketing.js")
|
|
|> assign(:page_title, Branding.home_title())
|
|
|> assign(:title_suffix, "")
|
|
|> assign(:meta_description, @description)
|
|
|> assign(:canonical_url, current_url(conn))
|
|
|> render(:home,
|
|
endgames: endgames,
|
|
active_endgame: DailyPuzzles.today(),
|
|
puzzle_count: Endgames.count_endgames(),
|
|
user_count: Attempts.count_users_with_attempts(),
|
|
today: Date.utc_today()
|
|
)
|
|
end
|
|
|
|
def privacy(conn, _params) do
|
|
conn
|
|
|> assign(:js_entry, ~p"/assets/js/marketing.js")
|
|
|> assign(:page_title, Branding.title("Privacy Policy"))
|
|
|> assign(:title_suffix, "")
|
|
|> assign(
|
|
:meta_description,
|
|
"How #{Branding.name()} collects, uses, and protects your personal data."
|
|
)
|
|
|> assign(:canonical_url, current_url(conn))
|
|
|> render(:privacy)
|
|
end
|
|
|
|
def terms_conditions(conn, _params) do
|
|
conn
|
|
|> assign(:js_entry, ~p"/assets/js/marketing.js")
|
|
|> assign(:page_title, Branding.title("Terms & Conditions"))
|
|
|> assign(:title_suffix, "")
|
|
|> assign(:meta_description, "The terms that apply when you use #{Branding.name()}.")
|
|
|> assign(:canonical_url, current_url(conn))
|
|
|> render(:terms_conditions)
|
|
end
|
|
end
|