From 49366069e4d6919e3dfb36c6eb33f7219743a9b3 Mon Sep 17 00:00:00 2001 From: meganchen15 Date: Thu, 24 Dec 2015 12:15:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=B8=80=E4=BA=9B=E5=9F=BA?= =?UTF-8?q?=E6=9C=AC=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/blogs/_set_sidebar.html.haml | 19 +++++++++++++++++++ app/views/blogs/about.html.haml | 10 ++++++++++ app/views/blogs/index.html.haml | 11 +++++++++++ 3 files changed, 40 insertions(+) create mode 100755 app/views/blogs/_set_sidebar.html.haml create mode 100755 app/views/blogs/about.html.haml create mode 100755 app/views/blogs/index.html.haml diff --git a/app/views/blogs/_set_sidebar.html.haml b/app/views/blogs/_set_sidebar.html.haml new file mode 100755 index 0000000..d675bc3 --- /dev/null +++ b/app/views/blogs/_set_sidebar.html.haml @@ -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 diff --git a/app/views/blogs/about.html.haml b/app/views/blogs/about.html.haml new file mode 100755 index 0000000..f0cb224 --- /dev/null +++ b/app/views/blogs/about.html.haml @@ -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 : '未设置' \ No newline at end of file diff --git a/app/views/blogs/index.html.haml b/app/views/blogs/index.html.haml new file mode 100755 index 0000000..368b9e1 --- /dev/null +++ b/app/views/blogs/index.html.haml @@ -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'