Forked from BillBarnhill/phoenix_read_more_helper_snippet.ex
Created
March 16, 2018 17:58
-
-
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
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