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/views/archives/index.html.slim b/app/views/archives/index.html.slim new file mode 100644 index 0000000..9970060 --- /dev/null +++ b/app/views/archives/index.html.slim @@ -0,0 +1,23 @@ +ul + li + a href="#" 科学是什么 + p + | 分类: + span 技术 + | 标签: + span 生活, 感悟 + | 浏览数: + span 1010 + | 喜欢: + span 10 + li + a href="#" 科学是什么 + p + | 分类: + span 技术 + | 标签: + span 生活, 感悟 + | 浏览数: + span 1010 + | 喜欢: + span 10 diff --git a/app/views/layouts/application.html.slim b/app/views/layouts/application.html.slim index d387d35..d9b58bd 100644 --- a/app/views/layouts/application.html.slim +++ b/app/views/layouts/application.html.slim @@ -32,7 +32,7 @@ html li label Archive li - a href="#" 时间线 + = link_to '时间线', archives_path li label AboutMe a href="#" 关于我 diff --git a/config/routes.rb b/config/routes.rb index 39ff251..179e9ee 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] 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