增加后台管理

This commit is contained in:
yafei Lee 2012-06-23 12:07:44 +08:00
parent 51248c60ff
commit 87f1ce9b55
19 changed files with 138 additions and 0 deletions

View File

@ -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/

View File

@ -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/

View File

@ -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

View File

@ -0,0 +1,2 @@
module Admin::PostsHelper
end

View File

@ -0,0 +1,5 @@
<%= simple_form_for(@post) do %>
<%= f.input :title %>
<%= f.input :content %>
<%= f.select :type %>
<% end %>

View File

@ -0,0 +1,2 @@
<h1>Admin::Posts#create</h1>
<p>Find me in app/views/admin/posts/create.html.erb</p>

View File

@ -0,0 +1,2 @@
<h1>Admin::Posts#destroy</h1>
<p>Find me in app/views/admin/posts/destroy.html.erb</p>

View File

@ -0,0 +1,2 @@
<h1>Admin::Posts#edit</h1>
<p>Find me in app/views/admin/posts/edit.html.erb</p>

View File

@ -0,0 +1,2 @@
<h1>Admin::Posts#index</h1>
<p>Find me in app/views/admin/posts/index.html.erb</p>

View File

@ -0,0 +1,2 @@
<h3>新建博客</h3>
<%= render "form" %>

View File

@ -0,0 +1,2 @@
<h1>Admin::Posts#update</h1>
<p>Find me in app/views/admin/posts/update.html.erb</p>

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,5 @@
require 'spec_helper'
describe "posts/create.html.erb" do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

@ -0,0 +1,5 @@
require 'spec_helper'
describe "posts/destroy.html.erb" do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

@ -0,0 +1,5 @@
require 'spec_helper'
describe "posts/edit.html.erb" do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

@ -0,0 +1,5 @@
require 'spec_helper'
describe "posts/index.html.erb" do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

@ -0,0 +1,5 @@
require 'spec_helper'
describe "posts/new.html.erb" do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

@ -0,0 +1,5 @@
require 'spec_helper'
describe "posts/update.html.erb" do
pending "add some examples to (or delete) #{__FILE__}"
end