diff --git a/Gemfile b/Gemfile index caed57c..04d5e93 100644 --- a/Gemfile +++ b/Gemfile @@ -11,6 +11,7 @@ gem 'coffee-rails', '~> 4.0.1' gem 'uglifier', '>= 1.3.0' gem 'jquery-rails' gem 'foundation-rails', '~> 5.2.1' +gem 'foundation-icons-sass-rails' gem "mongoid" gem "mongoid-pagination" diff --git a/app/assets/images/weixin.jpg b/app/assets/images/weixin.jpg new file mode 100644 index 0000000..383ee21 Binary files /dev/null and b/app/assets/images/weixin.jpg differ diff --git a/app/assets/stylesheets/admin/posts.css.scss b/app/assets/stylesheets/admin/posts.css.scss index 246a86a..51192ad 100644 --- a/app/assets/stylesheets/admin/posts.css.scss +++ b/app/assets/stylesheets/admin/posts.css.scss @@ -2,13 +2,6 @@ // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ -h3 { - font-size: 40px; - margin-bottom: 10px; - padding-bottom: 5px; - border-bottom: 1px solid #CCC; -} - #post_content { width: 800px; height: 390px; diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 06d1f1a..09f1af9 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -4,5 +4,5 @@ //= require_tree . .inner-wrap { - height: 100%; + min-height: 100%; } diff --git a/app/assets/stylesheets/archives.css.scss b/app/assets/stylesheets/archives.css.scss new file mode 100644 index 0000000..39af0e8 --- /dev/null +++ b/app/assets/stylesheets/archives.css.scss @@ -0,0 +1,40 @@ +.archives-field { + padding-top: 0.5rem; + margin-top: 1rem; + padding-bottom: 0.5rem; + + i { + margin-right: 0.5rem; + } + + span { + margin-right: 1rem; + } + + .blog-title { + color: #111111; + font-size: 1.2rem; + font-weight: 500; + border: none; + } + + li { + list-style: none; + color: #666666; + border-bottom: 1px dashed #CCCCCC; + margin-bottom: 1rem; + } + + .load-more { + width: 100%; + text-align: center; + button { + background-color: transparent; + color: #333333; + border: 1px solid #DDDDDD; + &:focus { + outline-style: none; + } + } + } +} diff --git a/app/assets/stylesheets/comments.css.scss b/app/assets/stylesheets/comments.css.scss new file mode 100644 index 0000000..09b70ac --- /dev/null +++ b/app/assets/stylesheets/comments.css.scss @@ -0,0 +1,43 @@ +.comment-field { + background-color: #333333; + padding-top: 3rem; + padding-bottom: 1rem; + + textarea { + min-height: 7rem; + } + + input[type='text'], textarea { + border: 1px solid #333333; + background-color: #F7F7F7; + box-shadow: none; + &:focus { + box-shadow: none; + background-color: white; + } + } + + .has-tip { + color: #008cba; + } + + .next { + float: right; + } +} + +.comment-diag { + color: #EBEBEB; + border-top: 1px solid #5E5E5E; + padding-top: 1rem; + .name { + + } + .created-at { + color: #b3b3b3; + } + .comment-content { + padding-bottom: 1rem; + border-bottom: 1px dashed #8a8a8a; + } +} diff --git a/app/assets/stylesheets/foundation_and_overrides.scss b/app/assets/stylesheets/foundation_and_overrides.scss index 332f1e6..415338b 100644 --- a/app/assets/stylesheets/foundation_and_overrides.scss +++ b/app/assets/stylesheets/foundation_and_overrides.scss @@ -1189,3 +1189,17 @@ // $include-html-visibility-classes: $include-html-classes; @import 'foundation'; +@import 'foundation-icons'; + +#like-button { + color: #eaa296; + background-color: transparent; + border: 1px solid #e79385; + border-radius: 10rem; + &:hover { + background-color: #FCFF9E; + } + &:focus { + outline-style: none; + } +} diff --git a/app/assets/stylesheets/head.css.scss b/app/assets/stylesheets/head.css.scss index 7923ef7..26c8b4a 100644 --- a/app/assets/stylesheets/head.css.scss +++ b/app/assets/stylesheets/head.css.scss @@ -1,3 +1,14 @@ .middle-text { text-align: center; + a { + color: #F7F7F7; + } +} + +.off-canvas-list { + i { + margin-right: 0.5rem; + display: inline-block; + width: 1rem; + } } diff --git a/app/assets/stylesheets/like_and_weixin.css.scss b/app/assets/stylesheets/like_and_weixin.css.scss new file mode 100644 index 0000000..e69de29 diff --git a/app/controllers/archives_controller.rb b/app/controllers/archives_controller.rb new file mode 100644 index 0000000..88380c4 --- /dev/null +++ b/app/controllers/archives_controller.rb @@ -0,0 +1,9 @@ +class ArchivesController < ApplicationController + def index + @posts = Post.all + end + + def archive_params + params.permit(:type) + end +end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index afd6a2d..95f2992 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,5 +1,4 @@ class HomeController < ApplicationController def index - redirect_to "http://who.yafeilee.me" end end diff --git a/app/views/archives/index.html.slim b/app/views/archives/index.html.slim new file mode 100644 index 0000000..5402cb6 --- /dev/null +++ b/app/views/archives/index.html.slim @@ -0,0 +1,19 @@ +.row + .small-12.large-8.columns + ul.archives-field + - 3.times do + li + a.blog-title href="#" 科学是什么 + p.tags-field + i.fi-calendar + span 2014-2-12 + i.fi-list + span 技术 + i.fi-pricetag-multiple + span 生活, 感悟 + i.fi-torsos + span 1010 + i.fi-heart + span 10 + .load-more + button.small Load More diff --git a/app/views/blogs/_comment.html.slim b/app/views/blogs/_comment.html.slim new file mode 100644 index 0000000..3a155bc --- /dev/null +++ b/app/views/blogs/_comment.html.slim @@ -0,0 +1,18 @@ +.row + .small-12.large-12.columns + = text_area_tag(:content, nil, placeholder: '发表你的看法') +.row + .small-12.large-6.columns + = text_field_tag(:name, nil, placeholder: '你的名字') + = text_field_tag(:email, nil, placeholder: '你的邮箱') +button 发表 +.comment-diag + p.name + | WinDy • + span.created-at 2014-2-12 13:00 + p.comment-content 写的好!! + + p.name + | WinDy • + span.created-at 2014-2-12 13:00 + p.comment-content 写的好!! diff --git a/app/views/blogs/_post.html.slim b/app/views/blogs/_post.html.slim index 5fdd4d0..99a3851 100644 --- a/app/views/blogs/_post.html.slim +++ b/app/views/blogs/_post.html.slim @@ -1,11 +1,28 @@ -.blog - h2 - = link_to post.title, blog_path(post) - .content.wikistyle - = post.content_html.html_safe - .cc - = t(:announce_at) - = format_time(post.created_at) - | | - = t(:visited_count) + post.visited.to_s -.bottom +h2.blog-title hello +p.ptag + | 分类: + span 技术 +p.ptag + | 标签: + span 生活, 感悟 + +.content + p 没错, 科学只是哲学的一个部分, 所以此书给我最大的收获是, 科学只是一种实用主义. 只是这种实用主义更纯粹些: + p + | 1. 任何公理都值得怀疑 + | 2. 能够验证与重复 + + p 瞧, 第 2 点的感觉就是说, 太阳一直东方升起, 这就是科学, 因为我们一直在重复这个结论. 但是, 我们知道, 1000万年后, 我们可能就再也看不到太阳了, 所以这个结论还需要修正. 这就是科学的本质. + + p 再举个历史的例子: + + p + | 1. 地球是平的 + | 2. 地球是圆的 + | 3. 地球是椭圆的 + +p.ptag + | 发表于: + span 2014-2-14 +p + button#like-button Like diff --git a/app/views/blogs/show.html.slim b/app/views/blogs/show.html.slim index 3ca4b9d..dc21a66 100644 --- a/app/views/blogs/show.html.slim +++ b/app/views/blogs/show.html.slim @@ -1,2 +1,13 @@ -.blogs - = render :partial=> "post", :locals=> { :post=> @post } +.row + .small-12.large-8.columns + = render partial: "post", :locals=> { :post=> @post } +.comment-field + .row + .small-12.large-8.columns + = render partial: 'comment', locals: { comments: @comments } + .row + .small-12.large-8.columns + a.prev href="#" + span.has-tip data-tooltip="" title="hello" Prev + a.next href="#" + span.has-tip data-tooltip="" title="hello" Next diff --git a/app/views/home/index.html.slim b/app/views/home/index.html.slim new file mode 100644 index 0000000..e814942 --- /dev/null +++ b/app/views/home/index.html.slim @@ -0,0 +1,27 @@ +.row + .small-12.large-8.columns + h2.blog-title ABOUT ME + p 我的名字是李亚飞( YaFei Lee ), 网名为 WinDy, 由于是我第一个网名, 所以一直使用至今. + p 我是 85 后成员, 目前生活在深圳, 计划长期在这里发展. + p 当年毕业于吉林大学计算机专业, 并在深信服工作约 5 年时间, 如今正在独立创业路中. + p 曾经对软件测试开发领域有浓厚兴趣, 如今对产品开发与公司运营兴趣较多. 平时多研究 Ruby on Rails, Web 开发等技术. 闲暇之余爱好中国象棋, 乒乓球, 读书. + p 最近正在读的书在这里: 豆瓣书单 + + h4 近期动态 + hr + p 目前在独立创业路中, 正在互联网金融大浪中淘金. + p WinDy's Blog 开博也有 2 年以上了, 由于个人原因, 博客完全自主采用 Ruby on Rails 完成, 在 2014 年 3 月进行了重构, 以移动设备优先进行了设计. + p 闲暇之余, 开通了微信公众账号, 与 WinDy's Blog 不同, 这里不讲技术性内容, 主要面向生活感悟, 个人思考等, 欢迎关注. + = image_tag 'weixin.jpg' + p 也可以搜索 技术达人李亚飞 来找到我. + p 我对微信是重度使用者, 几乎不使用微博, 微信账号可以在我个别博客里发现, Enjoying! + + h4 更多链接 + hr + ul + li + a href="https://github.com/windy" target="_blank" Github + li + a href="http://www.douban.com/people/41759170/" target="_blank" Douban + li + a href="http://www.linkedin.com/pub/yafei-lee/77/3b/505" target="_blank" LinkedIn diff --git a/app/views/layouts/application.html.slim b/app/views/layouts/application.html.slim index 22aaea9..c4b2178 100644 --- a/app/views/layouts/application.html.slim +++ b/app/views/layouts/application.html.slim @@ -17,28 +17,44 @@ html a.left-off-canvas-toggle.menu-icon href="#" span section.middle.tab-bar-section - h1.title.middle-text WinDy + .row.small-12.large-10.columns + h1.title.middle-text + = link_to 'WinDy', root_path aslide.left-off-canvas-menu ul.off-canvas-list li label Menu li - a href="#" 技 术 + = link_to root_path do + i.fi-home + | 首页 li - a href="#" 生 活 + = link_to '/tech' do + i.fi-social-evernote + | 技术 li - a href="#" 创 业 + = link_to '/life' do + i.fi-torsos-male-female + | 生活 + li + = link_to '/creator' do + i.fi-lightbulb + | 创业 li label Archive li - a href="#" 时间线 + = link_to archives_path do + i.fi-align-justify + | 时间线 li - label AboutMe - a href="#" 关于我 + label About + = link_to about_path do + i.fi-torso + | 关于我 section.main-section = yield = render "layouts/footer" - a.exit-off-canvas + a.exit-off-canvas diff --git a/config/routes.rb b/config/routes.rb index 39ff251..bc26009 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,6 +6,7 @@ WBlog::Application.routes.draw do end end + resources :archives # photos resources :photos, :only=>[:create] @@ -18,5 +19,5 @@ WBlog::Application.routes.draw do end get '/about' => 'home#index' get '/admin' => 'admin/posts#new' - get '/:type' => 'blogs#index' + get '/:type' => 'archives#index' end diff --git a/spec/controllers/archives_controller_spec.rb b/spec/controllers/archives_controller_spec.rb new file mode 100644 index 0000000..92853ce --- /dev/null +++ b/spec/controllers/archives_controller_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +describe ArchivesController do + + describe "GET 'index'" do + it "returns http success" do + get 'index' + response.should be_success + end + end + +end diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb index a9a1182..36f5442 100644 --- a/spec/controllers/home_controller_spec.rb +++ b/spec/controllers/home_controller_spec.rb @@ -5,7 +5,7 @@ describe HomeController do describe "GET 'index'" do it "returns http success" do get 'index' - expect(response).to redirect_to("http://who.yafeilee.me") + expect(response).to be_success end end