Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

97 lines (78 sloc) 2.29 kb
class PagesController < ApplicationController
layout "proteomap", :only => [:new]
# GET /pages
# GET /pages.xml
def index
@pages = Page.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @pages }
format.json { render :json => @page }
end
end
# GET /pages/1
# GET /pages/1.xml
def show
@page = Page.find(params[:id])
respond_to do |format|
format.js # index.html.erb
format.html # show.html.erb
format.xml { render :xml => @page }
end
end
# GET /pages/new
# GET /pages/new.xml
def new
@page = Page.new
respond_to do |format|
format.html # new.html.erb
format.json # new.html.erb
format.xml { render :xml => @page }
end
end
# GET /pages/1/edit
def edit
@page = Page.find(params[:id])
end
# POST /pages
# POST /pages.xml
def create
@page = Page.new(:title => params[:page][:title]\
, :url => params[:page][:url]) if params[:page]
respond_to do |format|
if @page and @page.save
format.html { redirect_to(@page, :notice => 'Page was successfully created.') }
format.xml { render :xml => @page, :status => :created, :location => @page }
format.json { render :json => @page }
else
format.html { render :action => "new" }
format.xml { render :xml => @page.errors, :status => :unprocessable_entity }
format.json { render :json => @page.errors, :status => :unprocessable_entity }
end
end
end
# PUT /pages/1
# PUT /pages/1.xml
def update
@page = Page.find(params[:id])
respond_to do |format|
if @page.update_attributes(params[:page])
format.html { redirect_to(@page, :notice => 'Page was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @page.errors, :status => :unprocessable_entity }
end
end
end
# DELETE /pages/1
# DELETE /pages/1.xml
def destroy
@page = Page.find(params[:id])
@page.destroy
respond_to do |format|
format.html { redirect_to(pages_url) }
format.xml { head :ok }
end
end
end
Jump to Line
Something went wrong with that request. Please try again.