2012-01-24 20:16:53 +00:00
|
|
|
module Locomotive
|
|
|
|
module Api
|
|
|
|
class ContentAssetsController < BaseController
|
|
|
|
|
2012-04-26 19:14:23 +00:00
|
|
|
load_and_authorize_resource :class => Locomotive::ContentAsset
|
|
|
|
|
2012-01-24 20:16:53 +00:00
|
|
|
def index
|
|
|
|
@content_assets = current_site.content_assets
|
|
|
|
respond_with(@content_assets)
|
|
|
|
end
|
|
|
|
|
2012-04-26 19:14:23 +00:00
|
|
|
def show
|
|
|
|
@content_asset = current_site.content_assets.find(params[:id])
|
|
|
|
respond_with(@content_asset)
|
|
|
|
end
|
|
|
|
|
2012-01-24 20:16:53 +00:00
|
|
|
def create
|
|
|
|
@content_asset = current_site.content_assets.create(params[:content_asset])
|
2012-01-26 15:51:32 +00:00
|
|
|
respond_with @content_asset, :location => main_app.locomotive_api_content_assets_url
|
2012-01-24 20:16:53 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
|
|
|
@content_asset = current_site.content_assets.find(params[:id])
|
|
|
|
@content_asset.update_attributes(params[:content_asset])
|
2012-01-26 15:51:32 +00:00
|
|
|
respond_with @content_asset, :location => main_app.locomotive_api_content_assets_url
|
2012-01-24 20:16:53 +00:00
|
|
|
end
|
|
|
|
|
2012-04-26 19:14:23 +00:00
|
|
|
def destroy
|
|
|
|
@content_asset = current_site.content_assets.find(params[:id])
|
|
|
|
@content_asset.destroy
|
|
|
|
respond_with @content_asset
|
|
|
|
end
|
|
|
|
|
2012-01-24 20:16:53 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|