You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
asciinema.org/lib/asciinema_web/controllers/doc_controller.ex

28 lines
680 B
Elixir

defmodule AsciinemaWeb.DocController do
use AsciinemaWeb, :controller
alias AsciinemaWeb.{DocView, ErrorView}
@topics ["how-it-works", "getting-started", "installation", "usage", "config", "embedding", "faq"]
def index(conn, _params) do
redirect conn, to: doc_path(conn, :show, :"getting-started")
end
def show(conn, %{"topic" => topic}) when topic in @topics do
topic = String.to_atom(topic)
conn
|> assign(:topic, topic)
|> assign(:page_title, DocView.title_for(topic))
|> put_layout(:docs)
|> render("#{topic}.html")
end
def show(conn, _params) do
conn
|> put_status(404)
|> render(ErrorView, "404.html")
end
end