For automatic setup, see README.md
.
def deps do
[{:thesis, "~> 0.3.0"}]
end
def application do
[applications: [:thesis]]
end
Run mix deps.get
.
config :thesis,
store: Thesis.EctoStore,
authorization: <MyApp>.ThesisAuth,
uploader: Thesis.RepoUploader
config :thesis, Thesis.EctoStore, repo: <MyApp>.Repo
# If you want to allow creating dynamic pages:
# config :thesis, :dynamic_pages,
# view: <MyAppWeb>.PageView,
# templates: ["index.html", "otherview.html"],
# not_found_view: <MyAppWeb>.ErrorView,
# not_found_template: "404.html"
defmodule <MyApp>.ThesisAuth do
@behaviour Thesis.Auth
def page_is_editable?(conn) do
true # editable by the world
end
end
defmodule <MyApp>.Repo.Migrations.CreateThesisTables do
@moduledoc false
use Ecto.Migration
def change do
create table(:thesis_pages) do
add :slug, :string
add :title, :string
add :description, :string
timestamps
end
create table(:thesis_page_contents) do
add :page_id, :integer
add :name, :string, nil: false
add :content, :text, default: "Edit this content area"
add :content_type, :string, default: "html"
add :meta, :text
timestamps
end
end
end
<body>
<%= thesis_editor(@conn) %>
$ mix ecto.migrate
NOTE: This was located in web/web.ex in Phoenix 1.2 and prior.
def controller do
quote do
use Phoenix.Controller
use Thesis.Controller
# ...
end
end
def view do
quote do
use Phoenix.View, root: "web/templates"
use Thesis.View
# ...
end
end
def router do
quote do
use Phoenix.Router
use Thesis.Router
end
end
Now, start adding content areas. See the README.md
for further instructions.