mirror of
https://github.com/System-End/highway.git
synced 2026-04-19 23:22:53 +00:00
add info page
This commit is contained in:
parent
6ce4bfcd28
commit
2cf82d88be
11 changed files with 40 additions and 1 deletions
|
|
@ -65,3 +65,5 @@ end
|
|||
gem "tailwindcss-ruby", "~> 4.1"
|
||||
|
||||
gem "tailwindcss-rails", "~> 4.2"
|
||||
|
||||
gem "kramdown"
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
@import "tailwindcss";
|
||||
|
||||
@import "@tailwindcss/typography";
|
||||
|
|
|
|||
11
site/app/controllers/info_controller.rb
Normal file
11
site/app/controllers/info_controller.rb
Normal 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
|
||||
|
|
@ -4,4 +4,8 @@ module ApplicationHelper
|
|||
!current_page?(root_path)
|
||||
end
|
||||
|
||||
def markdown_to_html(markdown)
|
||||
Kramdown::Document.new(markdown).to_html
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
2
site/app/helpers/info_helper.rb
Normal file
2
site/app/helpers/info_helper.rb
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
module InfoHelper
|
||||
end
|
||||
3
site/app/views/info/info.md
Normal file
3
site/app/views/info/info.md
Normal 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
|
||||
3
site/app/views/info/show.html.erb
Normal file
3
site/app/views/info/show.html.erb
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<div class="prose mx-auto p-5">
|
||||
<%= @content.html_safe %>
|
||||
</div>
|
||||
|
|
@ -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>
|
||||
|
|
@ -13,4 +13,6 @@ Rails.application.routes.draw do
|
|||
root "landing#index"
|
||||
resources :posts
|
||||
|
||||
get "/info", to: "info#show"
|
||||
|
||||
end
|
||||
|
|
|
|||
7
site/test/controllers/info_controller_test.rb
Normal file
7
site/test/controllers/info_controller_test.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
require "test_helper"
|
||||
|
||||
class InfoControllerTest < ActionDispatch::IntegrationTest
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
||||
Loading…
Add table
Reference in a new issue