Bookshelf
This commit is contained in:
33
Rakefile
33
Rakefile
@@ -30,27 +30,24 @@ namespace :blog do
|
||||
end
|
||||
end
|
||||
|
||||
task load_from_overcast: ["blog:load_environment"] do
|
||||
require "nokogiri"
|
||||
task load_from_bookshelf: ["blog:load_environment"] do
|
||||
require "hanami/prepare"
|
||||
require "down"
|
||||
require "csv"
|
||||
require "sequel"
|
||||
|
||||
podcast_repo = Adamantium::Container["repos.podcast_repo"]
|
||||
settings = Adamantium::Container["settings"]
|
||||
post_repo = Adamantium::Container["repos.post_repo"]
|
||||
|
||||
podcast_repo.delete_all
|
||||
|
||||
doc = File.open("tmp/overcast.opml") { |f| Nokogiri::XML(f) }
|
||||
doc.xpath("//outline[@type='rss']").each do |outline|
|
||||
overcast_id = outline.get_attribute("overcastId")
|
||||
url = "https://public.overcast-cdn.com/art/#{overcast_id}_thumb"
|
||||
destination = File.join("public", "media", "podcast_art", "#{overcast_id}.jpg")
|
||||
Down.download(url, destination: destination)
|
||||
|
||||
podcast_repo.create(
|
||||
name: outline.get_attribute("title"),
|
||||
url: outline.get_attribute("htmlUrl"),
|
||||
overcast_id: outline.get_attribute("overcastId")
|
||||
CSV.open("tmp/books.csv", headers: true).each do |book|
|
||||
next if book["isbn13"].nil?
|
||||
post_repo.create(
|
||||
name: book["title"],
|
||||
post_type: "book",
|
||||
book_status: book["readingStatus"],
|
||||
slug: "isbn:#{book["isbn13"]}",
|
||||
book_author: book["authors"],
|
||||
content: book["description"],
|
||||
category: [],
|
||||
published_at: Time.now
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@@ -46,3 +46,11 @@ h1, h2, h3, h4, h5, h6, h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
|
||||
font-family: "JetBrainsMono", Monaco, monospace;
|
||||
}
|
||||
|
||||
.map-marker {
|
||||
border: 3px solid blue;
|
||||
border-radius: 8px;
|
||||
background: RGBa(0, 0, 255, 0.1);
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
|
@@ -1,9 +1,7 @@
|
||||
# Colophon
|
||||
# 🧱 Colophon
|
||||
|
||||
Hello! Welcome to dnitza.com 👋
|
||||
|
||||
|
||||
|
||||
This site is made from:
|
||||
|
||||
- Adamantium — A custom-built, [Hanami](https://github.com/hanami/hanami)-based, blogging engine [based on the Micropub spec](https://www.w3.org/TR/micropub/) (open sourced soon).
|
||||
|
@@ -21,6 +21,21 @@ module Adamantium
|
||||
def template_type
|
||||
:book
|
||||
end
|
||||
|
||||
def authors
|
||||
self.book_author.split(";").join(" ")
|
||||
end
|
||||
|
||||
def status_colour
|
||||
case book_status
|
||||
when "read"
|
||||
"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
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@@ -131,7 +131,7 @@ module Adamantium
|
||||
posts
|
||||
.where(post_type: "book")
|
||||
.published
|
||||
.order(Sequel.desc(:published_at))
|
||||
.order(Sequel.asc(:name))
|
||||
.limit(limit)
|
||||
.to_a
|
||||
end
|
||||
|
@@ -1,23 +1,41 @@
|
||||
- context.content_for(:title, "Books | ")
|
||||
|
||||
div class="mb-12 prose dark:prose-invert max-w-prose mx-auto text-gray-800 dark:text-gray-200"
|
||||
h1 Books
|
||||
h1 📚 Bookshelf
|
||||
|
||||
div class="mb-12 max-w-prose mx-auto"
|
||||
table class="prose dark:prose-invert table-auto"
|
||||
thead
|
||||
tr
|
||||
td Title
|
||||
td Author
|
||||
td Status
|
||||
- books.each do |book|
|
||||
td
|
||||
td class="p-2" Title
|
||||
td class="p-2" Author(s)
|
||||
- reading.each do |book|
|
||||
tr
|
||||
td
|
||||
/ a href="/books/#{book.slug}"
|
||||
span class="rounded-md text-xs #{book.status_colour} p-1"
|
||||
= book.book_status
|
||||
td
|
||||
= book.name
|
||||
td
|
||||
= book.book_author
|
||||
= book.authors
|
||||
- to_read.each do |book|
|
||||
tr
|
||||
td
|
||||
= book.book_status
|
||||
span class="rounded-md text-xs #{book.status_colour} p-1"
|
||||
= book.book_status
|
||||
td
|
||||
= book.name
|
||||
td
|
||||
= book.authors
|
||||
- read.each do |book|
|
||||
tr
|
||||
td
|
||||
span class="rounded-md text-xs #{book.status_colour} p-1"
|
||||
= book.book_status
|
||||
td
|
||||
= book.name
|
||||
td
|
||||
= book.authors
|
||||
|
||||
div class="max-w-screen-md mx-auto border-t-4 border-solid border-gray-400 dark:border-gray-600"
|
||||
|
@@ -17,5 +17,6 @@ div class="mb-12 max-w-prose mx-auto text-gray-800 dark:text-gray-200"
|
||||
a class="block p-1 border border-blue-200 bg-blue-200 text-blue-900 hover:bg-blue-300 text-center rounded-lg" href="/movies" 🍿 Movies
|
||||
a class="block p-1 border border-blue-200 bg-blue-200 text-blue-900 hover:bg-blue-300 text-center rounded-lg" href="/trips" 🛫 Trips
|
||||
a class="block p-1 border border-blue-200 bg-blue-200 text-blue-900 hover:bg-blue-300 text-center rounded-lg" href="/podcasts" 🎙️ Podcasts
|
||||
a class="block p-1 border border-blue-200 bg-blue-200 text-blue-900 hover:bg-blue-300 text-center rounded-lg" href="/bookshelf" 📚️ Bookshelf
|
||||
/ a class="block p-1 border border-blue-200 bg-blue-300 text-blue-900 hover:bg-blue-200 text-center rounded-lg" href="/art" 🎨 Art things
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
- context.content_for(:title, "Movies | ")
|
||||
|
||||
div class="mb-12 prose dark:prose-invert max-w-prose mx-auto text-gray-800 dark:text-gray-200"
|
||||
h1 Movies
|
||||
h1 🍿 Movies
|
||||
|
||||
div class="mb-12 max-w-prose mx-auto"
|
||||
table class="prose dark:prose-invert table-auto"
|
||||
|
@@ -1,7 +1,7 @@
|
||||
- context.content_for(:title, "Podcasts | ")
|
||||
|
||||
div class="mb-12 prose dark:prose-invert max-w-prose mx-auto text-gray-800 dark:text-gray-200"
|
||||
h1 Podcasts
|
||||
h1 🎙️ Podcasts
|
||||
|
||||
div class="mb-12 max-w-prose mx-auto"
|
||||
table class="prose dark:prose-invert table-auto"
|
||||
|
@@ -1,7 +1,7 @@
|
||||
- context.content_for(:title, "Trips | ")
|
||||
|
||||
div class="mb-4 prose dark:prose-invert max-w-prose mx-auto text-gray-800 dark:text-gray-200"
|
||||
h1 Trips
|
||||
h1 🛫 Trips
|
||||
|
||||
div class="mb-12 max-w-prose mx-auto"
|
||||
table class="prose dark:prose-invert table-auto"
|
||||
|
@@ -1,7 +1,7 @@
|
||||
- context.content_for(:title, "Hikes | ")
|
||||
|
||||
div class="mb-12 prose dark:prose-invert max-w-prose mx-auto text-gray-800 dark:text-gray-200"
|
||||
h1 Hikes
|
||||
h1 🥾 Hikes
|
||||
|
||||
div class="prose dark:prose-invert max-w-prose mx-auto"
|
||||
- workouts_by_year.each do |year, workouts|
|
||||
|
@@ -4,8 +4,24 @@ module Adamantium
|
||||
class Index < Adamantium::View
|
||||
include Deps["repos.post_repo"]
|
||||
|
||||
expose :books do
|
||||
post_repo.books_listing.map do |book|
|
||||
private_expose :books do
|
||||
post_repo.books_listing.group_by { |book| book.book_status }
|
||||
end
|
||||
|
||||
expose :read do |books|
|
||||
books["read"].map do |book|
|
||||
Decorators::Books::Decorator.new book
|
||||
end
|
||||
end
|
||||
|
||||
expose :to_read do |books|
|
||||
books["to-read"].map do |book|
|
||||
Decorators::Books::Decorator.new book
|
||||
end
|
||||
end
|
||||
|
||||
expose :reading do |books|
|
||||
books["reading"].map do |book|
|
||||
Decorators::Books::Decorator.new book
|
||||
end
|
||||
end
|
||||
|
@@ -59,7 +59,7 @@ module Adamantium
|
||||
|
||||
get "/podcasts", to: "podcasts.index"
|
||||
|
||||
get "/books", to: "books.index"
|
||||
get "/bookshelf", to: "books.index"
|
||||
|
||||
redirect "deploying-a-hanami-app-to-fly-io", to: "/post/deploying-a-hanami-20-app-to-flyio"
|
||||
redirect "deploying-a-hanami-app-to-fly-io/", to: "/post/deploying-a-hanami-20-app-to-flyio"
|
||||
|
@@ -3,7 +3,7 @@
|
||||
const colors = require("tailwindcss/colors");
|
||||
|
||||
module.exports = {
|
||||
content: ["./app/templates/**/*.slim", "./public/assets/index.js"],
|
||||
content: ["./app/templates/**/*.slim", "./public/assets/index.js", "app/decorators/*/decorator.rb"],
|
||||
theme: {
|
||||
fontSize: {
|
||||
xsm: '0.75rem',
|
||||
|
Reference in New Issue
Block a user