Mephisto previous/next articles


/ Published in: Rails
Save to your folder(s)



Copy this code and paste it in your HTML
  1. #article_drop.rb
  2.  
  3. ## this goes in app/drops/article_drop.rb
  4. def next?
  5. !@source.next.blank?
  6. end
  7.  
  8. def previous?
  9. !@source.previous.blank?
  10. end
  11.  
  12. #previous link
  13. {% if article.previous? %}
  14. {{ article | previous_article | link_to_article }}
  15. {% else %}
  16. <a href="/">home</a>
  17. {% endif %}
  18.  
  19. #next link
  20. {% if article.next? %}
  21. {{ article | next_article | link_to_article }}
  22. {% else %}
  23. <a href="/">home</a>
  24. {% endif %}

URL: http://tesoriere.com/2009/4/mephisto-next-article-link-and-previous-article-link

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.