新增新的haml模板

This commit is contained in:
tanhuazhe 2015-12-20 16:34:16 -06:00
parent 8e1dd0bab8
commit cdbc9128c9
4 changed files with 81 additions and 14 deletions

View File

@ -0,0 +1,2 @@
.row.text-center.footer
Copyright © 2015-2016 E2S, All Rights Reserved

View File

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>E2s</title>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
</head>
<body>
<%= yield %>
</body>
</html>

View File

@ -0,0 +1,62 @@
!!!
%html
%head
%meta{charset: "utf-8"}
%meta{"http-equiv"=>"X-UA-Compatible", "content"=>"IE=edge"}
%meta{"name"=>"viewport", "content"=>"width=device-width, initial-scale=1"}
%title= blog_title
= stylesheet_link_tag 'application', media: 'all'
= javascript_include_tag 'application'
= csrf_meta_tags
%body
.container.wrap_body
%nav.navbar.navbar-default.navbar-fixed-top{role:'navigation'}
.container.container-fluid
.navbar-header
= link_to blog_title, root_path, class: 'navbar-brand'
.collspse.navbar-collapse.site-header
%ul.nav.navbar-nav
%li{class: "#{'active' if params[:controller] == 'articles' && params[:action] == 'index'}"}
= link_to '文章列表', articles_path
%li
= link_to '关于博主', about_blogs_path
%ul.nav.navbar-nav.navbar-right
- if is_logined?
%li.dropdown
.navbar-header.navbar-avatar
= avatar @current_user
= link_to '#', class: 'dropdown-toggle pull-right', "data-toggle"=>"dropdown" do
= @current_user.nickname
%span.caret
%ul.dropdown-menu{role: 'menu'}
%li
= link_to '#' do
= gravatar_image_tag @current_user.email, size: 100, alt: @current_user.nickname, gravatar: {default: 'http://www.gravatar.com/avatar/0c821f675f132d790b3f25e79da739a7'}
%li
= link_to '设置', set_blogs_path
- if current_user_is_admin?
%li
= link_to '写博客', new_article_path
%li
= link_to '退出', logout_path
- else
%ul.navbar-button.navbar-right
%li
= link_to '登录', login_path, class: 'btn btn-default'
%li
= link_to '注册', register_path, class: 'btn btn-primary'
= form_tag articles_path, method: 'get', class: 'navbar-form pull-right', role: 'search', id: 'search_form' do
.form-group
= text_field_tag 'keyword', params[:keyword], class: 'form-control', placeholder: '请输入关键字'
%a#search_button
%span.icon.icon-search
.container.body_content
= yield
= render partial: 'layouts/footer'
:javascript
$(function(){
$('#search_button').click(function(){
$('#search_form').submit();
});
});

View File

@ -0,0 +1,17 @@
!!!
%html
%head
%meta{charset: "utf-8"}
%meta{"http-equiv"=>"X-UA-Compatible", "content"=>"IE=edge"}
%meta{"name"=>"viewport", "content"=>"width=device-width, initial-scale=1"}
%title= blog_title
= stylesheet_link_tag 'application', media: 'all'
= stylesheet_link_tag 'register', media: 'all'
= javascript_include_tag 'application'
= javascript_include_tag 'http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js'
= javascript_include_tag 'http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js'
= csrf_meta_tags
%body
.container.wrap_body
= yield