diff --git a/app/models/reading_list.rb b/app/models/reading_list.rb index a584acd..206fce3 100644 --- a/app/models/reading_list.rb +++ b/app/models/reading_list.rb @@ -5,6 +5,14 @@ def initialize(year = Time.now.year) @year = year end + def prev_year + @year - 1 + end + + def next_year + @year + 1 + end + def books @books ||= select_books end diff --git a/app/views/reading_list/index.html.haml b/app/views/reading_list/index.html.haml index efae87e..05f83df 100644 --- a/app/views/reading_list/index.html.haml +++ b/app/views/reading_list/index.html.haml @@ -1,4 +1,8 @@ -%h1= reading_list.year +- content_for :header do + %nav.flex.justify-between.items-center.py-6.border-b-8.border-dark-gray + %p.m-0= link_to "prev", reading_list_path(reading_list.prev_year) + %h1.m-0= reading_list.year + %p.m-0= link_to "next", reading_list_path(reading_list.next_year) %p #{reading_list.books.count} books for #{number_with_delimiter reading_list.total_pages} pages at a pace of #{reading_list.pace} pages/day.