2012-01-24 20:16:53 +00:00
|
|
|
module Locomotive
|
|
|
|
module Api
|
|
|
|
class PagesController < BaseController
|
|
|
|
|
2012-04-17 13:12:42 +00:00
|
|
|
load_and_authorize_resource :class => Locomotive::Page
|
|
|
|
|
2012-01-24 20:16:53 +00:00
|
|
|
def index
|
|
|
|
@pages = current_site.pages.all
|
|
|
|
respond_with(@pages)
|
|
|
|
end
|
|
|
|
|
2012-04-16 18:36:39 +00:00
|
|
|
def show
|
|
|
|
@page = current_site.pages.find(params[:id])
|
|
|
|
respond_with(@page)
|
|
|
|
end
|
|
|
|
|
2012-01-24 20:16:53 +00:00
|
|
|
def create
|
|
|
|
@page = current_site.pages.create(params[:page])
|
2012-01-26 15:51:32 +00:00
|
|
|
respond_with @page, :location => main_app.locomotive_api_pages_url
|
2012-01-24 20:16:53 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
|
|
|
@page = current_site.pages.find(params[:id])
|
|
|
|
@page.update_attributes(params[:page])
|
2012-01-26 15:51:32 +00:00
|
|
|
respond_with @page, :location => main_app.locomotive_api_pages_url
|
2012-01-24 20:16:53 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|