增加浏览记录与返回首页
This commit is contained in:
parent
e5ba083bc9
commit
6267b9d465
|
@ -13,6 +13,7 @@ class BlogsController < ApplicationController
|
|||
|
||||
def show
|
||||
@post = Post.find(params[:id])
|
||||
@post.visited
|
||||
@prev = Post.where(:created_at.lt => @post.created_at).desc(:created_at).where(:id.ne => @post.id).first
|
||||
@next = Post.where(:created_at.gt => @post.created_at).asc(:created_at).where(:id.ne => @post.id).first
|
||||
@comments = @post.comments
|
||||
|
|
|
@ -21,6 +21,9 @@ html
|
|||
= link_to '创建新博客', new_admin_post_path
|
||||
li
|
||||
= link_to '管理博客', admin_posts_path
|
||||
ul.right
|
||||
li
|
||||
= link_to '返回首页', root_path
|
||||
- flash.each do |name, msg|
|
||||
- if msg.is_a?(String)
|
||||
div class=("alert-box #{name == :notice ? "success" : "alert"}") data-alert=""
|
||||
|
|
Loading…
Reference in New Issue