diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-10-11 10:31:33 -0400 | 
|---|---|---|
| committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-10-11 10:31:33 -0400 | 
| commit | ffcc44d1a73ae1191e835fa625f2f8a7e3e25bda (patch) | |
| tree | 55e9825d4e7d59cdad345d85ac4adf60607568b9 /app | |
| parent | 1622895cd467f59f25fe375f081aa59693ae4c8f (diff) | |
| download | thoughts-ffcc44d1a73ae1191e835fa625f2f8a7e3e25bda.tar.gz thoughts-ffcc44d1a73ae1191e835fa625f2f8a7e3e25bda.tar.bz2 thoughts-ffcc44d1a73ae1191e835fa625f2f8a7e3e25bda.zip | |
Blogs list is now main page (with pagination)
Diffstat (limited to 'app')
| -rw-r--r-- | app/assets/stylesheets/main/entries.scss | 3 | ||||
| -rw-r--r-- | app/assets/stylesheets/main/layout.scss | 1 | ||||
| -rw-r--r-- | app/controllers/blogs_controller.rb | 9 | ||||
| -rw-r--r-- | app/views/blogs/index.atom.builder | 15 | ||||
| -rw-r--r-- | app/views/blogs/index.html.haml | 3 | 
5 files changed, 28 insertions, 3 deletions
| diff --git a/app/assets/stylesheets/main/entries.scss b/app/assets/stylesheets/main/entries.scss index b2832e4..1b2d1c6 100644 --- a/app/assets/stylesheets/main/entries.scss +++ b/app/assets/stylesheets/main/entries.scss | |||
| @@ -2,9 +2,6 @@ | |||
| 2 | // They will automatically be included in application.css. | 2 | // They will automatically be included in application.css. | 
| 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ | 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ | 
| 4 | 4 | ||
| 5 | @import url('https://fonts.googleapis.com/css?family=Slabo+27px'); | ||
| 6 | @import url('https://fonts.googleapis.com/css?family=Roboto:400,700'); | ||
| 7 | |||
| 8 | #blog-post { | 5 | #blog-post { | 
| 9 | font-size: 16px; | 6 | font-size: 16px; | 
| 10 | line-height: 24px; | 7 | line-height: 24px; | 
| diff --git a/app/assets/stylesheets/main/layout.scss b/app/assets/stylesheets/main/layout.scss index 180d1c7..5aa5095 100644 --- a/app/assets/stylesheets/main/layout.scss +++ b/app/assets/stylesheets/main/layout.scss | |||
| @@ -186,6 +186,7 @@ blockquote.bubble.bottom::after { | |||
| 186 | 186 | ||
| 187 | .breadcrumb { | 187 | .breadcrumb { | 
| 188 | margin-left: 1em; | 188 | margin-left: 1em; | 
| 189 | margin-bottom: 1em; | ||
| 189 | 190 | ||
| 190 | a, a:visited { | 191 | a, a:visited { | 
| 191 | color: #555d66; | 192 | color: #555d66; | 
| diff --git a/app/controllers/blogs_controller.rb b/app/controllers/blogs_controller.rb index 8ee472e..eda1bbb 100644 --- a/app/controllers/blogs_controller.rb +++ b/app/controllers/blogs_controller.rb | |||
| @@ -1,5 +1,14 @@ | |||
| 1 | class BlogsController < ApplicationController | 1 | class BlogsController < ApplicationController | 
| 2 | 2 | ||
| 3 | def index | ||
| 4 | @blogs = Blog.where(published: true).order(published_at: :desc).paginate(page: params[:page], per_page: 10) | ||
| 5 | |||
| 6 | respond_to do |format| | ||
| 7 | format.html | ||
| 8 | format.atom | ||
| 9 | end | ||
| 10 | end | ||
| 11 | |||
| 3 | def show | 12 | def show | 
| 4 | @blog = Blog.find_by_slug(params[:slug]) | 13 | @blog = Blog.find_by_slug(params[:slug]) | 
| 5 | 14 | ||
| diff --git a/app/views/blogs/index.atom.builder b/app/views/blogs/index.atom.builder new file mode 100644 index 0000000..dd498c8 --- /dev/null +++ b/app/views/blogs/index.atom.builder | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | atom_feed do |feed| | ||
| 2 | feed.title("Four Island") | ||
| 3 | feed.updated(@blogs[0].published_at) if @blogs.length > 0 | ||
| 4 | |||
| 5 | @blogs.each do |blog| | ||
| 6 | feed.entry(blog) do |entry| | ||
| 7 | entry.title(blog.title) | ||
| 8 | entry.content(blog.body, type: 'html') | ||
| 9 | |||
| 10 | entry.author do |author| | ||
| 11 | author.name("hatkirby") | ||
| 12 | end | ||
| 13 | end | ||
| 14 | end | ||
| 15 | end | ||
| diff --git a/app/views/blogs/index.html.haml b/app/views/blogs/index.html.haml new file mode 100644 index 0000000..a1ad64c --- /dev/null +++ b/app/views/blogs/index.html.haml | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | - @blogs.each do |blog| | ||
| 2 | = render blog | ||
| 3 | = will_paginate @blogs | ||
