class Inkblot::Layout
Public Class Methods
Source
# File lib/inkblot/layout.rb, line 7 def initialize(title, id) @title = title @id = id end
Public Instance Methods
Source
# File lib/inkblot/layout.rb, line 18 def pages = Inkblot.navigation || {} def nav_end = Inkblot.config["nav-end"] || {} def view_template(&block) doctype html do head do meta charset: "utf-8" meta name: "viewport", content: "width=device-width, initial-scale=1.0" title { "#{@title} | #{Inkblot.config["title"]}" } link rel: "stylesheet", href: "/tailwind.css" link rel: "stylesheet", href: "/inkblot.min.css" link rel: "stylesheet", href: "/syntax.css" end body(class: "flex flex-row w-screen h-screen p-0 m-0 dark:bg-[#1f2021] dark:text-gray-50") do aside(class: "p-5 min-w-[15%] border-r border-gray-200 bg-gray-100 dark:bg-[#131314] dark:border-stone-700 fixed top-0 left-0 h-screen") do nav(style: "display: flex; flex-direction: column; justify-content: space-between; height: 100%;") do ul do pages.each do |section| li(class: "font-bold text-gray-500 dark:text-gray-400 py-2 text-sm") { section.keys[0] } section.values[0].each do |page| title = Pages.pages[page][:fm]["title"] cur_page = (@id ? @id == page : @title == title) nav_link(Pages.pages[page][:out], cur_page ? "text-gray-900" : "") do Pages.pages[page][:fm]["title"] end end end end ul do nav_end.each do |title, url| nav_link(url) { title } end end end end div(class: "w-full my-10", &block) end end end end end
Source
# File lib/inkblot/layout.rb, line 21 def view_template(&block) doctype html do head do meta charset: "utf-8" meta name: "viewport", content: "width=device-width, initial-scale=1.0" title { "#{@title} | #{Inkblot.config["title"]}" } link rel: "stylesheet", href: "/tailwind.css" link rel: "stylesheet", href: "/inkblot.min.css" link rel: "stylesheet", href: "/syntax.css" end body(class: "flex flex-row w-screen h-screen p-0 m-0 dark:bg-[#1f2021] dark:text-gray-50") do aside(class: "p-5 min-w-[15%] border-r border-gray-200 bg-gray-100 dark:bg-[#131314] dark:border-stone-700 fixed top-0 left-0 h-screen") do nav(style: "display: flex; flex-direction: column; justify-content: space-between; height: 100%;") do ul do pages.each do |section| li(class: "font-bold text-gray-500 dark:text-gray-400 py-2 text-sm") { section.keys[0] } section.values[0].each do |page| title = Pages.pages[page][:fm]["title"] cur_page = (@id ? @id == page : @title == title) nav_link(Pages.pages[page][:out], cur_page ? "text-gray-900" : "") do Pages.pages[page][:fm]["title"] end end end end ul do nav_end.each do |title, url| nav_link(url) { title } end end end end div(class: "w-full my-10", &block) end end end