diff options
-rw-r--r-- | app/assets/stylesheets/main/entries.scss | 31 | ||||
-rw-r--r-- | app/controllers/admin/blogs_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/blogs_controller.rb | 6 | ||||
-rw-r--r-- | app/views/admin/blogs/_form.html.haml | 2 | ||||
-rw-r--r-- | app/views/admin/blogs/index.html.haml | 2 | ||||
-rw-r--r-- | app/views/blogs/index.atom.builder | 2 | ||||
-rw-r--r-- | app/views/blogs/index.html.haml | 12 | ||||
-rw-r--r-- | app/views/blogs/summary.html.haml | 3 | ||||
-rw-r--r-- | config/routes.rb | 5 |
9 files changed, 54 insertions, 11 deletions
diff --git a/app/assets/stylesheets/main/entries.scss b/app/assets/stylesheets/main/entries.scss index b511333..b83082c 100644 --- a/app/assets/stylesheets/main/entries.scss +++ b/app/assets/stylesheets/main/entries.scss | |||
@@ -16,6 +16,7 @@ | |||
16 | color: #59770e; | 16 | color: #59770e; |
17 | border-bottom: 1px dotted #CCCCCC; | 17 | border-bottom: 1px dotted #CCCCCC; |
18 | padding-bottom: 3px; | 18 | padding-bottom: 3px; |
19 | font-family: "Trebuchet MS", sans-serif; | ||
19 | 20 | ||
20 | a { | 21 | a { |
21 | text-decoration: none; | 22 | text-decoration: none; |
@@ -186,3 +187,33 @@ | |||
186 | } | 187 | } |
187 | } | 188 | } |
188 | } | 189 | } |
190 | |||
191 | #blog-archive { | ||
192 | margin-left: 1em; | ||
193 | |||
194 | h2, h3 { | ||
195 | font-family: "Trebuchet MS", sans-serif; | ||
196 | } | ||
197 | } | ||
198 | |||
199 | .archive-link { | ||
200 | margin-left: 1em; | ||
201 | |||
202 | a { | ||
203 | text-decoration: none; | ||
204 | font-weight: bold; | ||
205 | |||
206 | &, &:visited { | ||
207 | color: #ee2c2c; | ||
208 | } | ||
209 | |||
210 | &:hover { | ||
211 | text-decoration: underline; | ||
212 | color: #9ea1ad; | ||
213 | } | ||
214 | } | ||
215 | |||
216 | small { | ||
217 | margin-left: 1.5em; | ||
218 | } | ||
219 | } | ||
diff --git a/app/controllers/admin/blogs_controller.rb b/app/controllers/admin/blogs_controller.rb index ea2c46c..c6d0168 100644 --- a/app/controllers/admin/blogs_controller.rb +++ b/app/controllers/admin/blogs_controller.rb | |||
@@ -13,7 +13,7 @@ class Admin::BlogsController < Admin::AdminController | |||
13 | @blog = Blog.find(params[:id]) | 13 | @blog = Blog.find(params[:id]) |
14 | 14 | ||
15 | if @blog.published | 15 | if @blog.published |
16 | redirect_to blog_url(@blog.slug) | 16 | redirect_to blog_post_url(@blog.slug) |
17 | else | 17 | else |
18 | render layout: "application" | 18 | render layout: "application" |
19 | end | 19 | end |
diff --git a/app/controllers/blogs_controller.rb b/app/controllers/blogs_controller.rb index eda1bbb..c35a05d 100644 --- a/app/controllers/blogs_controller.rb +++ b/app/controllers/blogs_controller.rb | |||
@@ -1,7 +1,11 @@ | |||
1 | class BlogsController < ApplicationController | 1 | class BlogsController < ApplicationController |
2 | 2 | ||
3 | def index | 3 | def summary |
4 | @blogs = Blog.where(published: true).order(published_at: :desc).paginate(page: params[:page], per_page: 10) | 4 | @blogs = Blog.where(published: true).order(published_at: :desc).paginate(page: params[:page], per_page: 10) |
5 | end | ||
6 | |||
7 | def index | ||
8 | @blogs = Blog.where(published: true).order(published_at: :desc) | ||
5 | 9 | ||
6 | respond_to do |format| | 10 | respond_to do |format| |
7 | format.html | 11 | format.html |
diff --git a/app/views/admin/blogs/_form.html.haml b/app/views/admin/blogs/_form.html.haml index 625c85e..01177c1 100644 --- a/app/views/admin/blogs/_form.html.haml +++ b/app/views/admin/blogs/_form.html.haml | |||
@@ -18,7 +18,7 @@ | |||
18 | - unless f.object.new_record? | 18 | - unless f.object.new_record? |
19 | #entry-preview-link.details-module | 19 | #entry-preview-link.details-module |
20 | - if f.object.published | 20 | - if f.object.published |
21 | = link_to "View post", blog_url(f.object.slug_was), target: "entry-preview" | 21 | = link_to "View post", blog_post_url(f.object.slug_was), target: "entry-preview" |
22 | - else | 22 | - else |
23 | = link_to "Preview post", admin_blog_url(f.object.id), target: "entry-preview" | 23 | = link_to "Preview post", admin_blog_url(f.object.id), target: "entry-preview" |
24 | .details-module | 24 | .details-module |
diff --git a/app/views/admin/blogs/index.html.haml b/app/views/admin/blogs/index.html.haml index 9899176..c74fef5 100644 --- a/app/views/admin/blogs/index.html.haml +++ b/app/views/admin/blogs/index.html.haml | |||
@@ -10,5 +10,5 @@ | |||
10 | %td= blog.published_at.strftime("%B %d, %Y, %l:%M%P") | 10 | %td= blog.published_at.strftime("%B %d, %Y, %l:%M%P") |
11 | %td | 11 | %td |
12 | %ul.admin-actions | 12 | %ul.admin-actions |
13 | %li= link_to "View", blog_url(blog.slug) | 13 | %li= link_to "View", blog_post_url(blog.slug) |
14 | %li= link_to "Edit", edit_admin_blog_url(blog.id) | 14 | %li= link_to "Edit", edit_admin_blog_url(blog.id) |
diff --git a/app/views/blogs/index.atom.builder b/app/views/blogs/index.atom.builder index 72deba2..a05f29d 100644 --- a/app/views/blogs/index.atom.builder +++ b/app/views/blogs/index.atom.builder | |||
@@ -2,7 +2,7 @@ atom_feed do |feed| | |||
2 | feed.title("Four Island") | 2 | feed.title("Four Island") |
3 | feed.updated(@blogs[0].published_at) if @blogs.length > 0 | 3 | feed.updated(@blogs[0].published_at) if @blogs.length > 0 |
4 | 4 | ||
5 | @blogs.each do |blog| | 5 | @blogs.limit(10).each do |blog| |
6 | feed.entry(blog, published: blog.published_at) do |entry| | 6 | feed.entry(blog, published: blog.published_at) do |entry| |
7 | entry.title(blog.title) | 7 | entry.title(blog.title) |
8 | entry.content(markdown(blog.body), type: 'html') | 8 | entry.content(markdown(blog.body), type: 'html') |
diff --git a/app/views/blogs/index.html.haml b/app/views/blogs/index.html.haml index e9639ca..75bf92f 100644 --- a/app/views/blogs/index.html.haml +++ b/app/views/blogs/index.html.haml | |||
@@ -1,3 +1,9 @@ | |||
1 | - @blogs.each do |blog| | 1 | #blog-archive |
2 | = render blog, short: true | 2 | %h2 Blog Archive |
3 | = will_paginate @blogs | 3 | .bubble.rounded |
4 | - @blogs.chunk {|blog| blog.published_at.strftime("%B %Y") }.each do |chunk| | ||
5 | %h3= chunk[0] | ||
6 | - chunk[1].each do |blog| | ||
7 | %p.archive-link | ||
8 | = link_to blog.title, blog | ||
9 | %small= blog.published_at.strftime("%-d %b %Y") | ||
diff --git a/app/views/blogs/summary.html.haml b/app/views/blogs/summary.html.haml new file mode 100644 index 0000000..e9639ca --- /dev/null +++ b/app/views/blogs/summary.html.haml | |||
@@ -0,0 +1,3 @@ | |||
1 | - @blogs.each do |blog| | ||
2 | = render blog, short: true | ||
3 | = will_paginate @blogs | ||
diff --git a/config/routes.rb b/config/routes.rb index 514eb67..580cce4 100644 --- a/config/routes.rb +++ b/config/routes.rb | |||
@@ -22,10 +22,9 @@ Rails.application.routes.draw do | |||
22 | passwords: 'users/passwords' | 22 | passwords: 'users/passwords' |
23 | } | 23 | } |
24 | 24 | ||
25 | root "blogs#index" | 25 | root "blogs#summary" |
26 | 26 | ||
27 | get 'says', to: 'blogs#index' | 27 | resources :blogs, only: [:index, :show], param: :slug, path: "blog" |
28 | get 'says/:slug', to: 'blogs#show', as: :blog | ||
29 | 28 | ||
30 | get 'thinks/:slug', to: 'streams#show', as: :stream | 29 | get 'thinks/:slug', to: 'streams#show', as: :stream |
31 | 30 | ||