add info page

This commit is contained in:
acon 2025-04-26 23:28:52 -04:00
parent 6ce4bfcd28
commit 2cf82d88be
11 changed files with 40 additions and 1 deletions

View file

@ -65,3 +65,5 @@ end
gem "tailwindcss-ruby", "~> 4.1"
gem "tailwindcss-rails", "~> 4.2"
gem "kramdown"

View file

@ -148,6 +148,8 @@ GEM
sshkit (>= 1.23.0, < 2.0)
thor (~> 1.3)
zeitwerk (>= 2.6.18, < 3.0)
kramdown (2.5.1)
rexml (>= 3.3.9)
language_server-protocol (3.17.0.4)
lint_roller (1.1.0)
logger (1.7.0)
@ -396,6 +398,7 @@ DEPENDENCIES
importmap-rails
jbuilder
kamal
kramdown
propshaft
puma (>= 5.0)
rails (~> 8.0.2)

View file

@ -1 +1,3 @@
@import "tailwindcss";
@import "@tailwindcss/typography";

View file

@ -0,0 +1,11 @@
class InfoController < ApplicationController
def show
markdown_file_path = Rails.root.join("app", "views", "info", "info.md")
if File.exist?(markdown_file_path)
markdown_content = File.read(markdown_file_path)
@content = helpers.markdown_to_html(markdown_content)
else
@content = "<p>Markdown file not found.</p>"
end
end
end

View file

@ -4,4 +4,8 @@ module ApplicationHelper
!current_page?(root_path)
end
def markdown_to_html(markdown)
Kramdown::Document.new(markdown).to_html
end
end

View file

@ -0,0 +1,2 @@
module InfoHelper
end

View file

@ -0,0 +1,3 @@
um add parent guide here or something
fix markdown rendering because anything fancier than bold and italize isn't working

View file

@ -0,0 +1,3 @@
<div class="prose mx-auto p-5">
<%= @content.html_safe %>
</div>

View file

@ -5,6 +5,6 @@
<%= link_to "Main", posts_path, class: "hover:bg-[#564CAD] border-2 border-[#564CAD] p-2 rounded-lg transition duration-100 block" %>
<%= link_to "User", root_path, class: "hover:bg-[#564CAD] border-2 border-[#564CAD] p-2 rounded-lg transition duration-100 block" %>
<%= link_to "Leaderboards", root_path, class: "hover:bg-[#564CAD] border-2 border-[#564CAD] p-2 rounded-lg transition duration-100 block" %>
<%= link_to "Info", root_path, class: "hover:bg-[#564CAD] border-2 border-[#564CAD] p-2 rounded-lg transition duration-100 block" %>
<%= link_to "Info", info_path, class: "hover:bg-[#564CAD] border-2 border-[#564CAD] p-2 rounded-lg transition duration-100 block" %>
</div>
</div>

View file

@ -13,4 +13,6 @@ Rails.application.routes.draw do
root "landing#index"
resources :posts
get "/info", to: "info#show"
end

View file

@ -0,0 +1,7 @@
require "test_helper"
class InfoControllerTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# end
end