Compare commits
No commits in common. "master" and "rails" have entirely different histories.
9
Gemfile
9
Gemfile
@ -2,16 +2,16 @@ source "https://rubygems.org"
|
|||||||
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
||||||
|
|
||||||
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
|
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
|
||||||
gem "rails", "~> 7.0"
|
gem "rails", "~> 7.0.3"
|
||||||
|
|
||||||
# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
|
# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
|
||||||
gem "sprockets-rails"
|
gem "sprockets-rails"
|
||||||
|
|
||||||
# Use sqlite3 as the database for Active Record
|
# Use sqlite3 as the database for Active Record
|
||||||
gem "sqlite3", "~> 1.6"
|
gem "sqlite3", "~> 1.4"
|
||||||
|
|
||||||
# Use the Puma web server [https://github.com/puma/puma]
|
# Use the Puma web server [https://github.com/puma/puma]
|
||||||
gem "puma", "~> 6.1"
|
gem "puma", "~> 5.0"
|
||||||
|
|
||||||
# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
|
# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
|
||||||
gem "importmap-rails"
|
gem "importmap-rails"
|
||||||
@ -46,9 +46,6 @@ gem "sassc-rails"
|
|||||||
# Use CoffeeScript to process JS
|
# Use CoffeeScript to process JS
|
||||||
gem "coffee-rails"
|
gem "coffee-rails"
|
||||||
|
|
||||||
# Kramdown gem to convert Markdown to HTML
|
|
||||||
gem "kramdown", "~> 2.4"
|
|
||||||
|
|
||||||
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
|
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
|
||||||
# gem "image_processing", "~> 1.2"
|
# gem "image_processing", "~> 1.2"
|
||||||
|
|
||||||
|
13
Gemfile.lock
13
Gemfile.lock
@ -111,8 +111,6 @@ GEM
|
|||||||
jbuilder (2.11.5)
|
jbuilder (2.11.5)
|
||||||
actionview (>= 5.0.0)
|
actionview (>= 5.0.0)
|
||||||
activesupport (>= 5.0.0)
|
activesupport (>= 5.0.0)
|
||||||
kramdown (2.4.0)
|
|
||||||
rexml
|
|
||||||
loofah (2.18.0)
|
loofah (2.18.0)
|
||||||
crass (~> 1.0.2)
|
crass (~> 1.0.2)
|
||||||
nokogiri (>= 1.5.9)
|
nokogiri (>= 1.5.9)
|
||||||
@ -142,7 +140,7 @@ GEM
|
|||||||
nokogiri (1.13.6-x86_64-linux)
|
nokogiri (1.13.6-x86_64-linux)
|
||||||
racc (~> 1.4)
|
racc (~> 1.4)
|
||||||
public_suffix (4.0.7)
|
public_suffix (4.0.7)
|
||||||
puma (6.1.1)
|
puma (5.6.4)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
racc (1.6.0)
|
racc (1.6.0)
|
||||||
rack (2.2.4)
|
rack (2.2.4)
|
||||||
@ -200,7 +198,7 @@ GEM
|
|||||||
actionpack (>= 5.2)
|
actionpack (>= 5.2)
|
||||||
activesupport (>= 5.2)
|
activesupport (>= 5.2)
|
||||||
sprockets (>= 3.0.0)
|
sprockets (>= 3.0.0)
|
||||||
sqlite3 (1.6.1-x86_64-linux)
|
sqlite3 (1.4.4)
|
||||||
stimulus-rails (1.0.4)
|
stimulus-rails (1.0.4)
|
||||||
railties (>= 6.0.0)
|
railties (>= 6.0.0)
|
||||||
strscan (3.0.3)
|
strscan (3.0.3)
|
||||||
@ -240,13 +238,12 @@ DEPENDENCIES
|
|||||||
debug
|
debug
|
||||||
importmap-rails
|
importmap-rails
|
||||||
jbuilder
|
jbuilder
|
||||||
kramdown (~> 2.4)
|
puma (~> 5.0)
|
||||||
puma (~> 6.1)
|
rails (~> 7.0.3)
|
||||||
rails (~> 7.0)
|
|
||||||
sassc-rails
|
sassc-rails
|
||||||
selenium-webdriver
|
selenium-webdriver
|
||||||
sprockets-rails
|
sprockets-rails
|
||||||
sqlite3 (~> 1.6)
|
sqlite3 (~> 1.4)
|
||||||
stimulus-rails
|
stimulus-rails
|
||||||
turbo-rails
|
turbo-rails
|
||||||
tzinfo-data
|
tzinfo-data
|
||||||
|
@ -34,7 +34,6 @@ hr
|
|||||||
margin: 0
|
margin: 0
|
||||||
padding: 0
|
padding: 0
|
||||||
background: white
|
background: white
|
||||||
box-shadow: 0px 80px 50px -30px rgba(0, 0, 0, 0.15)
|
|
||||||
|
|
||||||
// header
|
// header
|
||||||
|
|
||||||
@ -68,7 +67,6 @@ hr
|
|||||||
font:
|
font:
|
||||||
weight: bold
|
weight: bold
|
||||||
text-align: center
|
text-align: center
|
||||||
text-shadow: 0px 3px 5px rgba(0, 0, 0, 0.45)
|
|
||||||
|
|
||||||
#navigation
|
#navigation
|
||||||
width: 100%
|
width: 100%
|
||||||
@ -137,21 +135,13 @@ hr
|
|||||||
li
|
li
|
||||||
padding: 15px 20px 0
|
padding: 15px 20px 0
|
||||||
border: 2px solid #bbb
|
border: 2px solid #bbb
|
||||||
border-radius: 8px
|
|
||||||
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2)
|
|
||||||
|
|
||||||
.post-title
|
.post-title
|
||||||
margin-bottom: 3px
|
margin-bottom: 3px
|
||||||
text-decoration: underline
|
|
||||||
|
|
||||||
.post-body
|
.post-body
|
||||||
margin-bottom: 0
|
margin-bottom: 0
|
||||||
|
|
||||||
#post-header
|
|
||||||
#post-author
|
|
||||||
color: #999
|
|
||||||
font-style: italic
|
|
||||||
|
|
||||||
// footer section
|
// footer section
|
||||||
|
|
||||||
#footer
|
#footer
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
class BlogController < ApplicationController
|
|
||||||
def index
|
|
||||||
@posts = Post.all()
|
|
||||||
end
|
|
||||||
|
|
||||||
def show
|
|
||||||
@post = Post.find(params[:id])
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,7 +0,0 @@
|
|||||||
class Post < ApplicationRecord
|
|
||||||
|
|
||||||
def renderBody()
|
|
||||||
Kramdown::Document.new(self.body).to_html()
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
@ -1,14 +0,0 @@
|
|||||||
<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 %>
|
|
@ -1,8 +0,0 @@
|
|||||||
<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>
|
|
@ -23,7 +23,6 @@
|
|||||||
<nav id="navigation">
|
<nav id="navigation">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="/">Home</a></li>
|
<li><a href="/">Home</a></li>
|
||||||
<li><a href="/blog">Blog</a></li>
|
|
||||||
<li><a href="/support">Support</a></li>
|
<li><a href="/support">Support</a></li>
|
||||||
<li><a href="/contact">Contact</a></li>
|
<li><a href="/contact">Contact</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -3,7 +3,4 @@ Rails.application.routes.draw do
|
|||||||
|
|
||||||
get "/contact", to: "welcome#contact"
|
get "/contact", to: "welcome#contact"
|
||||||
get "/support", to: "welcome#support"
|
get "/support", to: "welcome#support"
|
||||||
|
|
||||||
get "/blog", to: "blog#index"
|
|
||||||
get "/blog/post/:id", to: "blog#show"
|
|
||||||
end
|
end
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
class CreatePosts < ActiveRecord::Migration[7.0]
|
|
||||||
def change
|
|
||||||
create_table :posts do |t|
|
|
||||||
t.string :title
|
|
||||||
t.string :author
|
|
||||||
t.text :body
|
|
||||||
|
|
||||||
t.timestamps
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
22
db/schema.rb
generated
22
db/schema.rb
generated
@ -1,22 +0,0 @@
|
|||||||
# This file is auto-generated from the current state of the database. Instead
|
|
||||||
# of editing this file, please use the migrations feature of Active Record to
|
|
||||||
# incrementally modify your database, and then regenerate this schema definition.
|
|
||||||
#
|
|
||||||
# This file is the source Rails uses to define your schema when running `bin/rails
|
|
||||||
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
|
|
||||||
# be faster and is potentially less error prone than running all of your
|
|
||||||
# migrations from scratch. Old migrations may fail to apply correctly if those
|
|
||||||
# migrations use external dependencies or application code.
|
|
||||||
#
|
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
|
||||||
|
|
||||||
ActiveRecord::Schema[7.0].define(version: 2023_03_16_173633) do
|
|
||||||
create_table "posts", force: :cascade do |t|
|
|
||||||
t.string "title"
|
|
||||||
t.string "author"
|
|
||||||
t.text "body"
|
|
||||||
t.datetime "created_at", null: false
|
|
||||||
t.datetime "updated_at", null: false
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
11
test/fixtures/posts.yml
vendored
11
test/fixtures/posts.yml
vendored
@ -1,11 +0,0 @@
|
|||||||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
|
||||||
|
|
||||||
one:
|
|
||||||
title: MyString
|
|
||||||
author: MyString
|
|
||||||
body: MyText
|
|
||||||
|
|
||||||
two:
|
|
||||||
title: MyString
|
|
||||||
author: MyString
|
|
||||||
body: MyText
|
|
@ -1,7 +0,0 @@
|
|||||||
require "test_helper"
|
|
||||||
|
|
||||||
class PostTest < ActiveSupport::TestCase
|
|
||||||
# test "the truth" do
|
|
||||||
# assert true
|
|
||||||
# end
|
|
||||||
end
|
|
Loading…
Reference in New Issue
Block a user