Created
October 4, 2015 15:42
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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