From edb7ccf18f59a15cddb1fb761851bd0ad42254e1 Mon Sep 17 00:00:00 2001
From: Jamon Holmgren page_is_editable?(arg0)
whether to load and display the Thesis editor and also whether to allow
updates to Thesis.Page and Thesis.PageContent areas.
Typical example:
-defmodule MyApp.ThesisAuth do
+defmodule MyApp.ThesisAuth do
@behaviour Thesis.Auth
- def page_is_editable?(conn) do
+ def page_is_editable?(conn) do
conn
- |> MyApp.AuthController.current_user_is_admin?(conn)
- end
-end
+ |> MyApp.AuthController.current_user_is_admin?(conn)
+ end
+end
diff --git a/doc/Thesis.Backup.html b/doc/Thesis.Backup.html
index e2b68a2..2321e96 100644
--- a/doc/Thesis.Backup.html
+++ b/doc/Thesis.Backup.html
@@ -7,6 +7,7 @@
Provides a plug that preloads any Thesis content for a page.
Typically, you'll add this to your web/web.ex
file, under the controller
function:
def controller do
- quote do
+def controller do
+ quote do
use Phoenix.Controller
use Thesis.Controller
# ...
- end
-end
+ end
+end
If you'd prefer to only use Thesis in certain controllers, remove it from
web/web.ex
and add it to the specific controllers by doing this:
defmodule MyApp.MyController do
+defmodule MyApp.MyController do
use Thesis.Controller
# ...
diff --git a/doc/Thesis.EctoStore.html b/doc/Thesis.EctoStore.html
index d8d89d3..f3c2f27 100644
--- a/doc/Thesis.EctoStore.html
+++ b/doc/Thesis.EctoStore.html
@@ -7,6 +7,7 @@
Thesis.EctoStore — thesis v0.3.2
+
@@ -170,7 +171,7 @@ backups(page_slug)
Retrieves all backups for a given slug. Returns the backup.
-backups(slug)
+backups(slug)
Callback implementation for Thesis.Store.backups/1
.
@@ -260,7 +261,7 @@ restore(id)
Retrieves a given backup (identified by its id). Returns the backup.
-restore(backup_id)
+restore(backup_id)
Callback implementation for Thesis.Store.restore/1
.
diff --git a/doc/Thesis.File.html b/doc/Thesis.File.html
index 746d272..f447a04 100644
--- a/doc/Thesis.File.html
+++ b/doc/Thesis.File.html
@@ -7,6 +7,7 @@
Thesis.File — thesis v0.3.2
+
diff --git a/doc/Thesis.Notifications.html b/doc/Thesis.Notifications.html
index 64bcb84..9a202e1 100644
--- a/doc/Thesis.Notifications.html
+++ b/doc/Thesis.Notifications.html
@@ -7,6 +7,7 @@
Thesis.Notifications — thesis v0.3.2
+
@@ -148,16 +149,16 @@ notifications_from_host_app(acc, conn, notifications)
Adds notifications provided by the host app to the accumulator.
-iex> notifications_from_host_app(%{"page-settings" => []}, nil, [page_settings: ["notif"]])
-%{"page-settings" => ["notif"]}
-iex> notifications_from_host_app(%{"page-settings" => []}, nil, [page_settings: :invalid])
-%{"page-settings" => []}
-iex> notifications_from_host_app(%{"page-settings" => ["notif1"]}, nil, [page_settings: ["notif2"]])
-%{"page-settings" => ["notif2", "notif1"]}
-iex> notifications_from_host_app(%{"other" => [], "add-page" => ["notif"]}, nil, [other: ["notif"]])
-%{"other" => ["notif"], "add-page" => ["notif"]}
-iex> notifications_from_host_app(%{"other" => []}, nil, nil)
-%{"other" => []}
+iex> notifications_from_host_app(%{"page-settings" => []}, nil, [page_settings: ["notif"]])
+%{"page-settings" => ["notif"]}
+iex> notifications_from_host_app(%{"page-settings" => []}, nil, [page_settings: :invalid])
+%{"page-settings" => []}
+iex> notifications_from_host_app(%{"page-settings" => ["notif1"]}, nil, [page_settings: ["notif2"]])
+%{"page-settings" => ["notif2", "notif1"]}
+iex> notifications_from_host_app(%{"other" => [], "add-page" => ["notif"]}, nil, [other: ["notif"]])
+%{"other" => ["notif"], "add-page" => ["notif"]}
+iex> notifications_from_host_app(%{"other" => []}, nil, nil)
+%{"other" => []}
@@ -192,17 +193,17 @@ verify_notifications_structure(conn, notifications)
Verifies that the notifications provided by the host app are in the correct format.
-iex> verify_notifications_structure(nil, [:invalid])
+iex> verify_notifications_structure(nil, [:invalid])
false
-iex> verify_notifications_structure(nil, %{})
+iex> verify_notifications_structure(nil, %{})
false
-iex> verify_notifications_structure(nil, %{invalid_key: []})
+iex> verify_notifications_structure(nil, %{invalid_key: []})
false
-iex> verify_notifications_structure(nil, %{add_page: "invalid value"})
+iex> verify_notifications_structure(nil, %{add_page: "invalid value"})
false
-iex> verify_notifications_structure(nil, %{add_page: ["notif", "notif", :atom]})
+iex> verify_notifications_structure(nil, %{add_page: ["notif", "notif", :atom]})
false
-iex> verify_notifications_structure(nil, [add_page: [], page_settings: ["notif"]])
+iex> verify_notifications_structure(nil, [add_page: [], page_settings: ["notif"]])
false
diff --git a/doc/Thesis.Page.html b/doc/Thesis.Page.html
index 85a2801..fd2a215 100644
--- a/doc/Thesis.Page.html
+++ b/doc/Thesis.Page.html
@@ -7,6 +7,7 @@
Thesis.Page — thesis v0.3.2
+
@@ -174,11 +175,11 @@ redirected?(arg1)
Returns whether the page redirects to another page.
Examples:
-iex> Thesis.Page.redirected?(%Thesis.Page{slug: "", redirect_url: nil})
+iex> Thesis.Page.redirected?(%Thesis.Page{slug: "", redirect_url: nil})
false
-iex> Thesis.Page.redirected?(%Thesis.Page{slug: "", redirect_url: ""})
+iex> Thesis.Page.redirected?(%Thesis.Page{slug: "", redirect_url: ""})
false
-iex> Thesis.Page.redirected?(%Thesis.Page{slug: "", redirect_url: "/asdf"})
+iex> Thesis.Page.redirected?(%Thesis.Page{slug: "", redirect_url: "/asdf"})
true
diff --git a/doc/Thesis.PageContent.html b/doc/Thesis.PageContent.html
index bc218c4..6d5936d 100644
--- a/doc/Thesis.PageContent.html
+++ b/doc/Thesis.PageContent.html
@@ -7,6 +7,7 @@
Thesis.PageContent — thesis v0.3.2
+
@@ -189,18 +190,18 @@ find(contents, page_id, name)
Selects the right page content from a list.
-iex> foo = [%Thesis.PageContent{id: 1, page_id: nil, name: "Test"},%Thesis.PageContent{id: 2, page_id: 1, name: "Test"},%Thesis.PageContent{id: 3, page_id: 2, name: "Test"},%Thesis.PageContent{id: 4, page_id: nil, name: "Test2"},%Thesis.PageContent{id: 5, page_id: 1, name: "Test2"}]
-iex> Thesis.PageContent.find(foo, nil, "Test").id == 1
+iex> foo = [%Thesis.PageContent{id: 1, page_id: nil, name: "Test"},%Thesis.PageContent{id: 2, page_id: 1, name: "Test"},%Thesis.PageContent{id: 3, page_id: 2, name: "Test"},%Thesis.PageContent{id: 4, page_id: nil, name: "Test2"},%Thesis.PageContent{id: 5, page_id: 1, name: "Test2"}]
+iex> Thesis.PageContent.find(foo, nil, "Test").id == 1
true
-iex> Thesis.PageContent.find(foo, 1, "Test").id == 2
+iex> Thesis.PageContent.find(foo, 1, "Test").id == 2
true
-iex> Thesis.PageContent.find(foo, 2, "Test").id == 3
+iex> Thesis.PageContent.find(foo, 2, "Test").id == 3
true
-iex> Thesis.PageContent.find(foo, nil, "Test2").id == 4
+iex> Thesis.PageContent.find(foo, nil, "Test2").id == 4
true
-iex> Thesis.PageContent.find(foo, 1, "Test2").id == 5
+iex> Thesis.PageContent.find(foo, 1, "Test2").id == 5
true
-iex> Thesis.PageContent.find(foo, 1, "Test7")
+iex> Thesis.PageContent.find(foo, 1, "Test7")
nil
@@ -219,9 +220,9 @@
Doctests:
-iex> m = %Thesis.PageContent{meta: ~S({"test":"Thing", "test2":"123"})}
-iex> Thesis.PageContent.meta_attributes(m)
-%{test: "Thing", test2: "123"}
+iex> m = %Thesis.PageContent{meta: ~S({"test":"Thing", "test2":"123"})}
+iex> Thesis.PageContent.meta_attributes(m)
+%{test: "Thing", test2: "123"}
@@ -239,8 +240,8 @@
Doctests:
-iex> m = %{test: "Thing", test2: "123"}
-iex> Thesis.PageContent.meta_serialize(m)
+iex> m = %{test: "Thing", test2: "123"}
+iex> Thesis.PageContent.meta_serialize(m)
~S({"test2":"123","test":"Thing"})
diff --git a/doc/Thesis.Render.html b/doc/Thesis.Render.html
index 6eb2367..dcc51ac 100644
--- a/doc/Thesis.Render.html
+++ b/doc/Thesis.Render.html
@@ -7,6 +7,7 @@
Thesis.Render — thesis v0.3.2
+
diff --git a/doc/Thesis.RepoUploader.html b/doc/Thesis.RepoUploader.html
index 0aa54c3..ea13d30 100644
--- a/doc/Thesis.RepoUploader.html
+++ b/doc/Thesis.RepoUploader.html
@@ -7,6 +7,7 @@
Thesis.RepoUploader — thesis v0.3.2
+
diff --git a/doc/Thesis.Router.html b/doc/Thesis.Router.html
index 841f8ba..36b194d 100644
--- a/doc/Thesis.Router.html
+++ b/doc/Thesis.Router.html
@@ -7,6 +7,7 @@
Thesis.Router — thesis v0.3.2
+
@@ -67,16 +68,16 @@
editor client as well as static assets.
Typically, you'll add this to your web/web.ex
file, under the router
function:
-def router do
- quote do
+def router do
+ quote do
use Phoenix.Router
use Thesis.Router
# ...
- end
-end
+ end
+end
If you'd prefer, you can remove it from web/web.ex
and add it to the router
yourself:
-defmodule MyApp.Router do
+defmodule MyApp.Router do
use Thesis.Router
# ...
diff --git a/doc/Thesis.S3Uploader.html b/doc/Thesis.S3Uploader.html
index cd484a4..89208e0 100644
--- a/doc/Thesis.S3Uploader.html
+++ b/doc/Thesis.S3Uploader.html
@@ -7,6 +7,7 @@
Thesis.S3Uploader — thesis v0.3.2
+
diff --git a/doc/Thesis.Store.html b/doc/Thesis.Store.html
index e081b47..6ffca1d 100644
--- a/doc/Thesis.Store.html
+++ b/doc/Thesis.Store.html
@@ -7,6 +7,7 @@
Thesis.Store — thesis v0.3.2
+
@@ -152,7 +153,7 @@ backups(arg0)
Retrieves all backups for a given slug. Returns the backup.
-backups(slug)
+backups(slug)
@@ -170,7 +171,7 @@ delete(%{})
Deletes the given page (identified by its slug).
Returns {:ok, page}
or {:error, changeset}
.
-delete(%{"slug" => "/asdf"})
+delete(%{"slug" => "/asdf"})
@@ -221,7 +222,7 @@ restore(arg0)
Retrieves a given backup (identified by its id). Returns the backup.
-restore(backup_id)
+restore(backup_id)
@@ -240,7 +241,7 @@ update(%{}, map)
Updates the given page (identified by its slug) with the given map of
string keys and Thesis.PageContent structs.
Returns {:ok, page}
or {:error, changeset}
.
-update(%{"slug" => "/"}, %{"Heading" => "My Heading Content"})
+update(%{"slug" => "/"}, %{"Heading" => "My Heading Content"})
diff --git a/doc/Thesis.Uploader.html b/doc/Thesis.Uploader.html
index 13701be..0f4c468 100644
--- a/doc/Thesis.Uploader.html
+++ b/doc/Thesis.Uploader.html
@@ -7,6 +7,7 @@
Thesis.Uploader — thesis v0.3.2
+
diff --git a/doc/Thesis.Utilities.html b/doc/Thesis.Utilities.html
index 83fc7c8..37d3e2f 100644
--- a/doc/Thesis.Utilities.html
+++ b/doc/Thesis.Utilities.html
@@ -7,6 +7,7 @@
Thesis.Utilities — thesis v0.3.2
+
@@ -143,11 +144,11 @@ normalize_path(path)
Takes a URL and strips unnecessary characters.
iex> import Thesis.Utilities
-iex> normalize_path("//ignite//foo")
+iex> normalize_path("//ignite//foo")
"/ignite/foo"
-iex> normalize_path("/ignite/foo/")
+iex> normalize_path("/ignite/foo/")
"/ignite/foo"
-iex> normalize_path("/")
+iex> normalize_path("/")
"/"
@@ -163,11 +164,11 @@ parameterize(str)
Removes special characters, keeps dashes and underscores, and replaces spaces
with dashes. Also downcases the entire string.
iex> import Thesis.Utilities
-iex> parameterize("Jamon is so cool!")
+iex> parameterize("Jamon is so cool!")
"jamon-is-so-cool"
-iex> parameterize("%#d50SDF dfsJ FDS lkdsf f dfka a")
+iex> parameterize("%#d50SDF dfsJ FDS lkdsf f dfka a")
"d50sdf-dfsj-fds--lkdsf-f-dfka---a"
-iex> parameterize(:this_is_a_test)
+iex> parameterize(:this_is_a_test)
"this-is-a-test"
@@ -182,9 +183,9 @@ random_string(length)
Generates a random string of letters of a given length.
iex> import Thesis.Utilities
-iex> String.length(random_string(15))
+iex> String.length(random_string(15))
15
-iex> random_string(15) != random_string(15)
+iex> random_string(15) != random_string(15)
true
@@ -199,11 +200,11 @@ random_string(length, atom)
Generates a random string of digits of a given length.
iex> import Thesis.Utilities
-iex> String.length(random_string(15, :numeric))
+iex> String.length(random_string(15, :numeric))
15
-iex> random_string(15, :numeric) != random_string(15, :numeric)
+iex> random_string(15, :numeric) != random_string(15, :numeric)
true
-iex> String.to_integer(random_string(15, :numeric)) > 0
+iex> String.to_integer(random_string(15, :numeric)) > 0
true
@@ -218,9 +219,9 @@ to_s(arg)
Shorthand to_string
.
iex> import Thesis.Utilities
-iex> to_s(000001)
+iex> to_s(000001)
"1"
-iex> to_s(123)
+iex> to_s(123)
"123"
@@ -235,9 +236,9 @@ typeof(x)
Returns the data type for the provided data using guard functions.
iex> import Thesis.Utilities
-iex> typeof(000001)
+iex> typeof(000001)
"integer"
-iex> typeof([1,2,3])
+iex> typeof([1,2,3])
"list"
diff --git a/doc/Thesis.View.html b/doc/Thesis.View.html
index 3e26b58..d47413f 100644
--- a/doc/Thesis.View.html
+++ b/doc/Thesis.View.html
@@ -7,6 +7,7 @@
Thesis.View — thesis v0.3.2
+
@@ -67,15 +68,15 @@
function. Look at individual function documentation to learn more about them.
Typically, you'll add this to your web/web.ex
file, under the view
function:
-def view do
- quote do
+def view do
+ quote do
use Thesis.View
# ...
- end
-end
+ end
+end
If you'd prefer, you can remove it from web/web.ex
and add it to your views
yourself:
-defmodule MyApp.MyView do
+defmodule MyApp.MyView do
use Thesis.View
# ...
@@ -181,14 +182,14 @@
Examples
-<%= content(@conn, "Title", :text, do: "Default Title") %>
-<%= content(@conn, "Description", :html) do %>
+<%= content(@conn, "Title", :text, do: "Default Title") %>
+<%= content(@conn, "Description", :html) do %>
<p>Default description</p>
<p>Another paragraph</p>
-<% end %>
-<%= content(@conn, "Description", :html, classes: "more classes") do %>
+<% end %>
+<%= content(@conn, "Description", :html, classes: "more classes") do %>
<p>Default description</p>
-<% end %>
+<% end %>
@@ -221,8 +222,8 @@ current_page(conn)
Returns the current page as a Thesis.Page{} struct.
-iex> Thesis.View.current_page(%Plug.Conn{request_path: "/test"})
-%Thesis.Page{slug: "/test"}
+iex> Thesis.View.current_page(%Plug.Conn{request_path: "/test"})
+%Thesis.Page{slug: "/test"}
@@ -248,14 +249,14 @@
Examples
-<%= global_content(@conn, "Title", :text, do: "Default Title") %>
-<%= global_content(@conn, "Description", :html) do %>
+<%= global_content(@conn, "Title", :text, do: "Default Title") %>
+<%= global_content(@conn, "Description", :html) do %>
<p>Default description</p>
<p>Another paragraph</p>
-<% end %>
-<%= global_content(@conn, "Description", :html, classes: "more classes") do %>
+<% end %>
+<%= global_content(@conn, "Description", :html, classes: "more classes") do %>
<p>Default description</p>
-<% end %>
+<% end %>
@@ -285,13 +286,13 @@ page_description(conn, default)
Outputs the page title or a provided default.
Doctests:
-iex> page = %Thesis.Page{description: "Test Description"}
-iex> conn = %Plug.Conn{assigns: %{thesis_page: page}}
-iex> Thesis.View.page_description(conn, "Default Description")
+iex> page = %Thesis.Page{description: "Test Description"}
+iex> conn = %Plug.Conn{assigns: %{thesis_page: page}}
+iex> Thesis.View.page_description(conn, "Default Description")
"Test Description"
-iex> page = %Thesis.Page{}
-iex> conn = %Plug.Conn{assigns: %{thesis_page: page}}
-iex> Thesis.View.page_description(conn, "Default Description")
+iex> page = %Thesis.Page{}
+iex> conn = %Plug.Conn{assigns: %{thesis_page: page}}
+iex> Thesis.View.page_description(conn, "Default Description")
"Default Description"
@@ -306,13 +307,13 @@ page_title(conn, default)
Outputs the page title or a provided default.
Doctests:
-iex> page = %Thesis.Page{title: "Test Title"}
-iex> conn = %Plug.Conn{assigns: %{thesis_page: page}}
-iex> Thesis.View.page_title(conn, "Default Title")
+iex> page = %Thesis.Page{title: "Test Title"}
+iex> conn = %Plug.Conn{assigns: %{thesis_page: page}}
+iex> Thesis.View.page_title(conn, "Default Title")
"Test Title"
-iex> page = %Thesis.Page{}
-iex> conn = %Plug.Conn{assigns: %{thesis_page: page}}
-iex> Thesis.View.page_title(conn, "Default Title")
+iex> page = %Thesis.Page{}
+iex> conn = %Plug.Conn{assigns: %{thesis_page: page}}
+iex> Thesis.View.page_title(conn, "Default Title")
"Default Title"
@@ -333,16 +334,16 @@ thesis_editor(conn)
current user, and then renders the editor, style tag, and bootstrap js.
If not editable, simply returns an empty string.
Doctests:
-iex> {:safe, editor} = Thesis.View.thesis_editor(%Plug.Conn{assigns: %{thesis_editable: true}})
-iex> String.contains?(editor, "/thesis/thesis.css")
+iex> {:safe, editor} = Thesis.View.thesis_editor(%Plug.Conn{assigns: %{thesis_editable: true}})
+iex> String.contains?(editor, "/thesis/thesis.css")
true
-iex> String.contains?(editor, "thesis-container")
+iex> String.contains?(editor, "thesis-container")
true
-iex> String.contains?(editor, "<script>")
+iex> String.contains?(editor, "<script>")
true
-iex> Thesis.View.thesis_editor(%Plug.Conn{assigns: %{thesis_editable: false}})
-{:safe, ""}
+iex> Thesis.View.thesis_editor(%Plug.Conn{assigns: %{thesis_editable: false}})
+{:safe, ""}
diff --git a/doc/Thesis.html b/doc/Thesis.html
index 7206d87..00f6302 100644
--- a/doc/Thesis.html
+++ b/doc/Thesis.html
@@ -7,6 +7,7 @@
Thesis — thesis v0.3.2
+
diff --git a/doc/api-reference.html b/doc/api-reference.html
index fc7d152..c571a15 100644
--- a/doc/api-reference.html
+++ b/doc/api-reference.html
@@ -7,6 +7,7 @@
API Reference — thesis v0.3.2
+
diff --git a/doc/search.html b/doc/search.html
index 22d15ba..b685c1c 100644
--- a/doc/search.html
+++ b/doc/search.html
@@ -7,6 +7,7 @@
Search — thesis v0.3.2
+