完成一些基本页面

This commit is contained in:
meganchen15 2015-12-24 12:15:21 +08:00
parent 42e6f42a7a
commit 49366069e4
3 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,19 @@
- if defined?(obj) && obj.present? && obj.errors.any?
.alert.alert-danger
%a.close{"data-dismiss"=>"alert"} ×
%span
= obj.errors.full_messages.first
- if flash[:error].present?
.alert.alert-danger
%a.close{"data-dismiss"=>"alert"} ×
%span
= flash[:error]
.col-md-2
%ul.nav.nav-pills.nav-stacked{role: 'tablist'}
%li{role: 'presentation', class: "#{'active' if params[:action] == 'set'}"}
= link_to '个人信息设置', set_blogs_path
- if current_user_is_admin?
%li{role: 'presentation', class: "#{'active' if params[:action] == 'set_blog'}"}
= link_to '博客设置', set_blog_blogs_path
%li{role: 'presentation'}
= link_to '修改密码', change_password_blogs_path

10
app/views/blogs/about.html.haml Executable file
View File

@ -0,0 +1,10 @@
.text-left
%p
%h2 博主
= @blog ? @blog.name : '未设置'
%p
%h2 email
= @blog ? (link_to @blog.email, "mailto:#{@blog.email}") : '未设置'
%p
%h2 简介
= @blog ? @blog.description : '未设置'

11
app/views/blogs/index.html.haml Executable file
View File

@ -0,0 +1,11 @@
.row.inner.edge
.col-md-9.layout-main
.article-list#article-list
= render partial: 'articles/articles'
.col-md-3
%h3 最新评论
- if @new_comments.present?
%ul.list-group.new_comments
- @new_comments.each do |comment|
%li.text-left
= link_to "#{comment.user.nickname}: #{comment.content[0..18]}...", article_path(comment.article_id) + "#comment_#{comment.id}", target: '_blank', class: 'list-group-item'