From 87f1ce9b55351d8aa35ba3a9f3c2ae005de8600c Mon Sep 17 00:00:00 2001 From: yafei Lee Date: Sat, 23 Jun 2012 12:07:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=90=8E=E5=8F=B0=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/javascripts/admin/posts.js.coffee | 3 ++ app/assets/stylesheets/admin/posts.css.scss | 3 ++ app/controllers/admin/posts_controller.rb | 21 +++++++++ app/helpers/admin/posts_helper.rb | 2 + app/views/admin/posts/_form.html.erb | 5 ++ app/views/admin/posts/create.html.erb | 2 + app/views/admin/posts/destroy.html.erb | 2 + app/views/admin/posts/edit.html.erb | 2 + app/views/admin/posts/index.html.erb | 2 + app/views/admin/posts/new.html.erb | 2 + app/views/admin/posts/update.html.erb | 2 + .../admin/posts_controller_spec.rb | 47 +++++++++++++++++++ spec/helpers/admin/posts_helper_spec.rb | 15 ++++++ .../views/admin/posts/create.html.erb_spec.rb | 5 ++ .../admin/posts/destroy.html.erb_spec.rb | 5 ++ spec/views/admin/posts/edit.html.erb_spec.rb | 5 ++ spec/views/admin/posts/index.html.erb_spec.rb | 5 ++ spec/views/admin/posts/new.html.erb_spec.rb | 5 ++ .../views/admin/posts/update.html.erb_spec.rb | 5 ++ 19 files changed, 138 insertions(+) create mode 100644 app/assets/javascripts/admin/posts.js.coffee create mode 100644 app/assets/stylesheets/admin/posts.css.scss create mode 100644 app/controllers/admin/posts_controller.rb create mode 100644 app/helpers/admin/posts_helper.rb create mode 100644 app/views/admin/posts/_form.html.erb create mode 100644 app/views/admin/posts/create.html.erb create mode 100644 app/views/admin/posts/destroy.html.erb create mode 100644 app/views/admin/posts/edit.html.erb create mode 100644 app/views/admin/posts/index.html.erb create mode 100644 app/views/admin/posts/new.html.erb create mode 100644 app/views/admin/posts/update.html.erb create mode 100644 spec/controllers/admin/posts_controller_spec.rb create mode 100644 spec/helpers/admin/posts_helper_spec.rb create mode 100644 spec/views/admin/posts/create.html.erb_spec.rb create mode 100644 spec/views/admin/posts/destroy.html.erb_spec.rb create mode 100644 spec/views/admin/posts/edit.html.erb_spec.rb create mode 100644 spec/views/admin/posts/index.html.erb_spec.rb create mode 100644 spec/views/admin/posts/new.html.erb_spec.rb create mode 100644 spec/views/admin/posts/update.html.erb_spec.rb diff --git a/app/assets/javascripts/admin/posts.js.coffee b/app/assets/javascripts/admin/posts.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/admin/posts.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/stylesheets/admin/posts.css.scss b/app/assets/stylesheets/admin/posts.css.scss new file mode 100644 index 0000000..45f43f5 --- /dev/null +++ b/app/assets/stylesheets/admin/posts.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the admin/posts controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/admin/posts_controller.rb b/app/controllers/admin/posts_controller.rb new file mode 100644 index 0000000..def9502 --- /dev/null +++ b/app/controllers/admin/posts_controller.rb @@ -0,0 +1,21 @@ +class Admin::PostsController < ApplicationController + layout false + def new + @post = Post.new + end + + def edit + end + + def destroy + end + + def index + end + + def create + end + + def update + end +end diff --git a/app/helpers/admin/posts_helper.rb b/app/helpers/admin/posts_helper.rb new file mode 100644 index 0000000..e9158b2 --- /dev/null +++ b/app/helpers/admin/posts_helper.rb @@ -0,0 +1,2 @@ +module Admin::PostsHelper +end diff --git a/app/views/admin/posts/_form.html.erb b/app/views/admin/posts/_form.html.erb new file mode 100644 index 0000000..a40f073 --- /dev/null +++ b/app/views/admin/posts/_form.html.erb @@ -0,0 +1,5 @@ +<%= simple_form_for(@post) do %> + <%= f.input :title %> + <%= f.input :content %> + <%= f.select :type %> +<% end %> diff --git a/app/views/admin/posts/create.html.erb b/app/views/admin/posts/create.html.erb new file mode 100644 index 0000000..90a97c7 --- /dev/null +++ b/app/views/admin/posts/create.html.erb @@ -0,0 +1,2 @@ +

Admin::Posts#create

+

Find me in app/views/admin/posts/create.html.erb

diff --git a/app/views/admin/posts/destroy.html.erb b/app/views/admin/posts/destroy.html.erb new file mode 100644 index 0000000..8b3697f --- /dev/null +++ b/app/views/admin/posts/destroy.html.erb @@ -0,0 +1,2 @@ +

Admin::Posts#destroy

+

Find me in app/views/admin/posts/destroy.html.erb

diff --git a/app/views/admin/posts/edit.html.erb b/app/views/admin/posts/edit.html.erb new file mode 100644 index 0000000..6542d2b --- /dev/null +++ b/app/views/admin/posts/edit.html.erb @@ -0,0 +1,2 @@ +

Admin::Posts#edit

+

Find me in app/views/admin/posts/edit.html.erb

diff --git a/app/views/admin/posts/index.html.erb b/app/views/admin/posts/index.html.erb new file mode 100644 index 0000000..cc91617 --- /dev/null +++ b/app/views/admin/posts/index.html.erb @@ -0,0 +1,2 @@ +

Admin::Posts#index

+

Find me in app/views/admin/posts/index.html.erb

diff --git a/app/views/admin/posts/new.html.erb b/app/views/admin/posts/new.html.erb new file mode 100644 index 0000000..4513013 --- /dev/null +++ b/app/views/admin/posts/new.html.erb @@ -0,0 +1,2 @@ +

新建博客

+<%= render "form" %> diff --git a/app/views/admin/posts/update.html.erb b/app/views/admin/posts/update.html.erb new file mode 100644 index 0000000..5f637fc --- /dev/null +++ b/app/views/admin/posts/update.html.erb @@ -0,0 +1,2 @@ +

Admin::Posts#update

+

Find me in app/views/admin/posts/update.html.erb

diff --git a/spec/controllers/admin/posts_controller_spec.rb b/spec/controllers/admin/posts_controller_spec.rb new file mode 100644 index 0000000..79603c9 --- /dev/null +++ b/spec/controllers/admin/posts_controller_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' + +describe Admin::PostsController do + + describe "GET 'new'" do + it "returns http success" do + get 'new' + response.should be_success + end + end + + describe "GET 'edit'" do + it "returns http success" do + get 'edit' + response.should be_success + end + end + + describe "GET 'destroy'" do + it "returns http success" do + get 'destroy' + response.should be_success + end + end + + describe "GET 'index'" do + it "returns http success" do + get 'index' + response.should be_success + end + end + + describe "GET 'create'" do + it "returns http success" do + get 'create' + response.should be_success + end + end + + describe "GET 'update'" do + it "returns http success" do + get 'update' + response.should be_success + end + end + +end diff --git a/spec/helpers/admin/posts_helper_spec.rb b/spec/helpers/admin/posts_helper_spec.rb new file mode 100644 index 0000000..9781390 --- /dev/null +++ b/spec/helpers/admin/posts_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the Admin::PostsHelper. For example: +# +# describe Admin::PostsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe Admin::PostsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/views/admin/posts/create.html.erb_spec.rb b/spec/views/admin/posts/create.html.erb_spec.rb new file mode 100644 index 0000000..144636b --- /dev/null +++ b/spec/views/admin/posts/create.html.erb_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe "posts/create.html.erb" do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/views/admin/posts/destroy.html.erb_spec.rb b/spec/views/admin/posts/destroy.html.erb_spec.rb new file mode 100644 index 0000000..f401600 --- /dev/null +++ b/spec/views/admin/posts/destroy.html.erb_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe "posts/destroy.html.erb" do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/views/admin/posts/edit.html.erb_spec.rb b/spec/views/admin/posts/edit.html.erb_spec.rb new file mode 100644 index 0000000..572cda9 --- /dev/null +++ b/spec/views/admin/posts/edit.html.erb_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe "posts/edit.html.erb" do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/views/admin/posts/index.html.erb_spec.rb b/spec/views/admin/posts/index.html.erb_spec.rb new file mode 100644 index 0000000..774f67f --- /dev/null +++ b/spec/views/admin/posts/index.html.erb_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe "posts/index.html.erb" do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/views/admin/posts/new.html.erb_spec.rb b/spec/views/admin/posts/new.html.erb_spec.rb new file mode 100644 index 0000000..2249b1f --- /dev/null +++ b/spec/views/admin/posts/new.html.erb_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe "posts/new.html.erb" do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/views/admin/posts/update.html.erb_spec.rb b/spec/views/admin/posts/update.html.erb_spec.rb new file mode 100644 index 0000000..17cbe42 --- /dev/null +++ b/spec/views/admin/posts/update.html.erb_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe "posts/update.html.erb" do + pending "add some examples to (or delete) #{__FILE__}" +end