2015-12-03 10:32:24 +08:00
|
|
|
module ApplicationHelper
|
2015-12-20 06:29:29 +08:00
|
|
|
def avatar(user)
|
|
|
|
user.avatar.present? ? image_tag(user.avatar) : (gravatar_image_tag user.email, alt: user.username)
|
|
|
|
end
|
|
|
|
|
|
|
|
def avatar_url(user)
|
|
|
|
user.avatar.present? ? user.avatar : (gravatar_image_url user.email, alt: user.username)
|
|
|
|
end
|
|
|
|
|
|
|
|
def get_categories
|
|
|
|
Category.order('articles_count desc')
|
|
|
|
end
|
|
|
|
|
|
|
|
def get_tags(article)
|
|
|
|
tags = article.tags || ''
|
|
|
|
tags.split(',')
|
|
|
|
end
|
|
|
|
|
|
|
|
def get_articles_count
|
|
|
|
Article.count
|
|
|
|
end
|
|
|
|
|
|
|
|
def blog_title
|
|
|
|
blog = BlogInfo.first
|
2016-01-06 19:39:35 +08:00
|
|
|
blog.present? ? blog.blog_title : 'E2S'
|
2015-12-20 06:29:29 +08:00
|
|
|
end
|
2015-12-03 10:32:24 +08:00
|
|
|
end
|