Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save churcho/4072508e9b7f3d43b1b08f18c5926694 to your computer and use it in GitHub Desktop.
Save churcho/4072508e9b7f3d43b1b08f18c5926694 to your computer and use it in GitHub Desktop.
Example of a Phoenix view helper (put in your view or in App views) that inserts a read more link
@doc """
Inserts a link to the show path of a resource item. The
item must implement .id.
##Example
<%= read_more_link @conn, @post %>
"""
def read_more_link(conn, item) do
link to: Router.Helpers.post_path(conn, :show, item.id) do
"Read More"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment