From 20441526e70bf5537035db9c0ccf2c2321658215 Mon Sep 17 00:00:00 2001 From: yafeilee Date: Sun, 30 Mar 2014 08:16:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=B6=E9=97=B4=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/archives_controller.rb | 9 ++++++++ app/views/archives/index.html.slim | 23 ++++++++++++++++++++ app/views/layouts/application.html.slim | 2 +- config/routes.rb | 1 + spec/controllers/archives_controller_spec.rb | 12 ++++++++++ 5 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 app/controllers/archives_controller.rb create mode 100644 app/views/archives/index.html.slim create mode 100644 spec/controllers/archives_controller_spec.rb 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