Posted By

Boulder on 07/18/10


Tagged

liquid mephisto


Versions (?)

Mephisto previous/next articles


 / Published in: Rails
 

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

  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 %}

Report this snippet  

You need to login to post a comment.