wiki base sceleton
This commit is contained in:
parent
df27ec29f3
commit
eacea15a21
20 changed files with 432 additions and 0 deletions
61
app/controllers/wikis_controller.rb
Normal file
61
app/controllers/wikis_controller.rb
Normal file
|
@ -0,0 +1,61 @@
|
|||
class WikisController < ApplicationController
|
||||
before_filter :project
|
||||
layout "project"
|
||||
respond_to :html
|
||||
|
||||
def show
|
||||
@wiki = @project.wikis.find_by_slug(params[:id])
|
||||
respond_with(@wiki)
|
||||
end
|
||||
|
||||
def new
|
||||
@wiki = Wiki.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @wiki }
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@wiki = Wiki.find(params[:id])
|
||||
end
|
||||
|
||||
def create
|
||||
@wiki = Wiki.new(params[:wiki])
|
||||
|
||||
respond_to do |format|
|
||||
if @wiki.save
|
||||
format.html { redirect_to @wiki, notice: 'Wiki was successfully created.' }
|
||||
format.json { render json: @wiki, status: :created, location: @wiki }
|
||||
else
|
||||
format.html { render action: "new" }
|
||||
format.json { render json: @wiki.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
@wiki = Wiki.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @wiki.update_attributes(params[:wiki])
|
||||
format.html { redirect_to @wiki, notice: 'Wiki was successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
format.html { render action: "edit" }
|
||||
format.json { render json: @wiki.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@wiki = Wiki.find(params[:id])
|
||||
@wiki.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to wikis_url }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue