about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-10-11 10:31:33 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-10-11 10:31:33 -0400
commitffcc44d1a73ae1191e835fa625f2f8a7e3e25bda (patch)
tree55e9825d4e7d59cdad345d85ac4adf60607568b9
parent1622895cd467f59f25fe375f081aa59693ae4c8f (diff)
downloadthoughts-ffcc44d1a73ae1191e835fa625f2f8a7e3e25bda.tar.gz
thoughts-ffcc44d1a73ae1191e835fa625f2f8a7e3e25bda.tar.bz2
thoughts-ffcc44d1a73ae1191e835fa625f2f8a7e3e25bda.zip
Blogs list is now main page (with pagination)
-rw-r--r--Gemfile1
-rw-r--r--Gemfile.lock2
-rw-r--r--app/assets/stylesheets/main/entries.scss3
-rw-r--r--app/assets/stylesheets/main/layout.scss1
-rw-r--r--app/controllers/blogs_controller.rb9
-rw-r--r--app/views/blogs/index.atom.builder15
-rw-r--r--app/views/blogs/index.html.haml3
-rw-r--r--config/routes.rb3
8 files changed, 33 insertions, 4 deletions
diff --git a/Gemfile b/Gemfile index 46a6dfb..19e4c66 100644 --- a/Gemfile +++ b/Gemfile
@@ -77,3 +77,4 @@ gem 'audited', '~> 5.0'
77gem 'enumerize' 77gem 'enumerize'
78gem 'sprockets', '3.7.2' 78gem 'sprockets', '3.7.2'
79gem 'lingo', git: "https://git.fourisland.com/lingo", glob: "rails/*.gemspec", branch: "main" 79gem 'lingo', git: "https://git.fourisland.com/lingo", glob: "rails/*.gemspec", branch: "main"
80gem 'will_paginate', '~> 4.0'
diff --git a/Gemfile.lock b/Gemfile.lock index 0a75380..0dbdb61 100644 --- a/Gemfile.lock +++ b/Gemfile.lock
@@ -332,6 +332,7 @@ GEM
332 websocket-driver (0.7.6) 332 websocket-driver (0.7.6)
333 websocket-extensions (>= 0.1.0) 333 websocket-extensions (>= 0.1.0)
334 websocket-extensions (0.1.5) 334 websocket-extensions (0.1.5)
335 will_paginate (4.0.0)
335 xpath (3.2.0) 336 xpath (3.2.0)
336 nokogiri (~> 1.8) 337 nokogiri (~> 1.8)
337 zeitwerk (2.6.12) 338 zeitwerk (2.6.12)
@@ -378,6 +379,7 @@ DEPENDENCIES
378 uglifier (>= 1.3.0) 379 uglifier (>= 1.3.0)
379 web-console (>= 3.3.0) 380 web-console (>= 3.3.0)
380 webrick (~> 1.7) 381 webrick (~> 1.7)
382 will_paginate (~> 4.0)
381 383
382BUNDLED WITH 384BUNDLED WITH
383 2.2.3 385 2.2.3
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 @@
1class BlogsController < ApplicationController 1class 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 @@
1atom_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
15end
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
diff --git a/config/routes.rb b/config/routes.rb index f524cf1..d1d1d35 100644 --- a/config/routes.rb +++ b/config/routes.rb
@@ -24,8 +24,9 @@ Rails.application.routes.draw do
24 passwords: 'users/passwords' 24 passwords: 'users/passwords'
25 } 25 }
26 26
27 root "records#index" 27 root "blogs#index"
28 28
29 get 'says', to: 'blogs#index'
29 get 'says/:slug', to: 'blogs#show', as: :blog 30 get 'says/:slug', to: 'blogs#show', as: :blog
30 31
31 get 'thinks/:slug', to: 'streams#show', as: :stream 32 get 'thinks/:slug', to: 'streams#show', as: :stream