Refactor app in to its own slice

This commit is contained in:
2024-02-17 10:40:36 +11:00
parent b809b132d3
commit a6078f882e
161 changed files with 16176 additions and 193 deletions

View File

@@ -0,0 +1,53 @@
# frozen_string_literal: false
# auto_register: false
module Main
module Decorators
module Books
class Decorator < SimpleDelegator
def display_published_at
published_at.strftime("%e %B, %Y")
end
def machine_published_at
published_at.rfc2822
end
def syndicated?
!syndication_sources.empty?
end
def template_type
:book
end
def authors
book_author.split(";").join(" ")
end
def status_colour
case book_status
when "read" || "finished"
"text-green-100 bg-green-500"
when "to-read"
"text-blue-100 bg-blue-500"
when "reading"
"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
end