Merge branch 'tags_feature'
This commit is contained in:
commit
16a656934f
|
@ -8,6 +8,6 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
def format_date(time)
|
||||
time.strftime("%Y-%m-%d")
|
||||
time.strftime("%Y.%m.%d")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,2 @@
|
|||
module ApplicationHelper
|
||||
def format_date(time)
|
||||
time.strftime("%Y-%m-%d")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,9 +2,8 @@ class Label
|
|||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
field :type, :type => String
|
||||
field :name, :type => String
|
||||
|
||||
has_and_belongs_to_many :post
|
||||
|
||||
validates :type, presence: true
|
||||
validates :name, presence: true
|
||||
end
|
||||
|
|
|
@ -39,7 +39,9 @@ class Post
|
|||
end
|
||||
|
||||
def labels_content
|
||||
self.labels.collect { |label| label.name }.join(", ")
|
||||
content = self.labels.collect { |label| label.name }.join(", ")
|
||||
content = '无' if content.blank?
|
||||
content
|
||||
end
|
||||
|
||||
def liked_count
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
h2.blog-title #{post.title}
|
||||
p.ptag
|
||||
i.fi-list
|
||||
span 技术
|
||||
span #{post.type}
|
||||
p.ptag
|
||||
i.fi-pricetag-multiple
|
||||
span 生活, 感悟
|
||||
span #{post.labels_content}
|
||||
|
||||
.content.markdown
|
||||
== post.content_html
|
||||
|
|
|
@ -2,16 +2,16 @@
|
|||
.small-12.large-8.columns
|
||||
h2.blog-title #{@newest.title}
|
||||
p.ptag
|
||||
| 分类:
|
||||
i.fi-list
|
||||
span #{@newest.type}
|
||||
p.ptag
|
||||
| 标签:
|
||||
span #{@newest.labels.collect{ |label| label.name}.join(', ')}
|
||||
i.fi-pricetag-multiple
|
||||
span #{@newest.labels_content}
|
||||
.content.markdown
|
||||
== @newest.sub_content
|
||||
|
||||
= link_to "阅读全文 >>", blog_path(@newest)
|
||||
p.published-at 发表于 2014-2-12
|
||||
p.published-at 发表于 #{format_date(@newest.created_at)}
|
||||
|
||||
h4.recent-title RECENT
|
||||
ul.recent-content
|
||||
|
|
Loading…
Reference in New Issue