Skip to content

Instantly share code, notes, and snippets.

@BillBarnhill
Created October 4, 2015 15:42
Show Gist options
  • Save BillBarnhill/dc3677a4141084eacdd8 to your computer and use it in GitHub Desktop.
Save BillBarnhill/dc3677a4141084eacdd8 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