View Source ExCell.View (ExCell v0.1.1)

Cell helpers used to render the cells in both Views and Cells

Summary

Functions

Renders a cell in the view.

Renders the cell directly as a string, used for testing purposes.

Returns the relative path of a module to the namespace. This method is used to determine the template path of the cell.

Functions

Renders a cell in the view.

Examples

iex(0)> safe_to_string(AppWeb.AvatarView.cell(AvatarCell))
"<div class="AvatarCell" ...>"

iex(1)> safe_to_string(AppWeb.AvatarView.cell(AvatarCell, do: "Foo"))
"<div class="AvatarCell" ...>Foo</div>"

iex(2)> safe_to_string(AppWeb.AvatarView.cell(AvatarCell, user: %User{name: "Bar"}))
"<div class="AvatarCell" ...>Bar</div>"

iex(3)> safe_to_string(AppWeb.AvatarView.cell(AvatarCell, %Plug.Conn{} |> assign(:user, %User{name: "Bar"})))
"<div class="AvatarCell" ...>Bar</div>"

iex(4)> safe_to_string(AppWeb.AvatarView.cell(AvatarCell, "Hello"))
"<div class="AvatarCell" ...>Hello</div>"

Renders the cell directly as a string, used for testing purposes.

Examples

iex(0)> AppWeb.AvatarView.cell_to_string(AvatarCell)
"<div class="AvatarCell" ...>"

iex(1)> AppWeb.AvatarView.cell_to_string(AvatarCell, do: "Foo")
"<div class="AvatarCell" ...>Foo</div>"

iex(2)> AppWeb.AvatarView.cell_to_string(AvatarCell, user: %User{name: "Bar"})
"<div class="AvatarCell" ...>Bar</div>"
Link to this function

cell_to_string(cell, assigns)

View Source
Link to this function

cell_to_string(cell, assigns, list)

View Source
Link to this function

relative_path(module, namespace)

View Source

Returns the relative path of a module to the namespace. This method is used to determine the template path of the cell.

Examples

iex(0)> ExCell.View.relative_path(AppWeb.AvatarCell, AppWeb)
"avatar"

iex(1)> ExCell.View.relative_path(AppWeb.Namespace.AvatarCell, AppWeb)
"namespace/avatar"