Bookshelf fixes

This commit is contained in:
2023-06-27 21:27:47 +10:00
parent 5f550f7c92
commit b72fd28899
3 changed files with 47 additions and 36 deletions

View File

@@ -28,7 +28,7 @@ module Adamantium
def status_colour
case book_status
when "read"
when "read" || "finished"
"text-green-100 bg-green-500"
when "to-read"
"text-blue-100 bg-blue-500"
@@ -36,6 +36,17 @@ module Adamantium
"text-orange-100 bg-orange-500"
end
end
def status_label
case book_status
when "read" || "finished"
"Read"
when "to-read"
"To read"
when "reading"
"Reading"
end
end
end
end
end

View File

@@ -3,8 +3,8 @@
div class="mb-12 prose dark:prose-invert max-w-prose mx-auto text-gray-800 dark:text-gray-200"
h1 📚 Bookshelf
div class="mb-12 max-w-prose mx-auto"
table class="prose dark:prose-invert table-auto"
div class="mb-12 prose dark:prose-invert max-w-prose mx-auto"
table class="text-gray-800 dark:text-white table-auto"
thead
tr
td
@@ -13,8 +13,8 @@ div class="mb-12 prose dark:prose-invert max-w-prose mx-auto text-gray-800 dark:
- reading.each do |book|
tr
td
div class="rounded-md text-xs #{book.status_colour} px-2 w-full text-center"
= book.book_status
div class="rounded-md uppercase text-xs #{book.status_colour} px-2 w-full text-center"
= book.status_label
td
= book.name
td
@@ -22,8 +22,8 @@ div class="mb-12 prose dark:prose-invert max-w-prose mx-auto text-gray-800 dark:
- to_read.each do |book|
tr
td
div class="rounded-md text-xs #{book.status_colour} px-2 w-full text-center"
= book.book_status
div class="rounded-md uppercase text-xs #{book.status_colour} px-2 w-full text-center"
= book.status_label
td
= book.name
td
@@ -31,8 +31,8 @@ div class="mb-12 prose dark:prose-invert max-w-prose mx-auto text-gray-800 dark:
- read.each do |book|
tr
td
div class="rounded-md text-xs #{book.status_colour} px-2 w-full text-center"
= book.book_status
div class="rounded-md uppercase text-xs #{book.status_colour} px-2 w-full text-center"
= book.status_label
td
= book.name
td

View File

@@ -10,7 +10,7 @@ module Adamantium
required(:slug).filled(:string)
required(:post_type).value(included_in?: %w[book])
required(:book_author).maybe(:string)
required(:book_status).value(included_in?: %w[to-read reading read])
required(:book_status).value(included_in?: %w[to-read reading read finished])
end
end
end