Started working on a blog for the website; adjusted some styles

This commit is contained in:
2023-03-16 14:27:30 -04:00
parent 771db2dae1
commit a9c2737713
13 changed files with 108 additions and 0 deletions

View File

@ -34,6 +34,7 @@ hr
margin: 0
padding: 0
background: white
box-shadow: 0px 80px 50px -30px rgba(0, 0, 0, 0.15)
// header
@ -135,13 +136,21 @@ hr
li
padding: 15px 20px 0
border: 2px solid #bbb
border-radius: 8px
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2)
.post-title
margin-bottom: 3px
text-decoration: underline
.post-body
margin-bottom: 0
#post-header
#post-author
color: #999
font-style: italic
// footer section
#footer

View File

@ -0,0 +1,9 @@
class BlogController < ApplicationController
def index
@posts = Post.all()
end
def show
@post = Post.find(params[:id])
end
end

7
app/models/post.rb Normal file
View File

@ -0,0 +1,7 @@
class Post < ApplicationRecord
def renderBody()
Kramdown::Document.new(self.body).to_html()
end
end

View File

@ -0,0 +1,14 @@
<h1 class="u-text-center">Bit Goblin Blog</h1>
<% if @posts.length > 0 %>
<ul id="post-list">
<% @posts.each do |post| %>
<li>
<h4 class="post-title"><a href="/blog/post/<%= post.id %>"><%= post.title %></a></h4>
<p class="post-body"><%= truncate(raw(post.renderBody()), :length => 300, :escape => false) %></p>
</li>
<% end %>
</ul>
<% else %>
<p>I'm sorry, there don't appear to be any blog posts published at this time. Check back later!</p>
<% end %>

View File

@ -0,0 +1,8 @@
<header id="post-header">
<h1 id="post-title" class="u-text-center"><%= @post.title %></h1>
<h4 id="post-author" class="u-text-center">written by <%= @post.author %></h4>
</header>
<div class="post-body">
<%= raw(@post.renderBody()) %>
</div>

View File

@ -23,6 +23,7 @@
<nav id="navigation">
<ul>
<li><a href="/">Home</a></li>
<li><a href="/blog">Blog</a></li>
<li><a href="/support">Support</a></li>
<li><a href="/contact">Contact</a></li>
</ul>