2011-10-30 23:02:41 +00:00
|
|
|
module Locomotive
|
2010-05-24 00:18:23 +00:00
|
|
|
class ContentTypesController < BaseController
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-05-24 00:18:23 +00:00
|
|
|
sections 'contents'
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2011-12-19 13:15:11 +00:00
|
|
|
respond_to :json, :only => [:create, :update, :destroy]
|
|
|
|
|
2011-12-22 00:31:33 +00:00
|
|
|
helper 'Locomotive::Accounts', 'Locomotive::CustomFields'
|
2011-12-19 13:15:11 +00:00
|
|
|
|
|
|
|
def new
|
|
|
|
@content_type = current_site.content_types.new
|
|
|
|
respond_with @content_type
|
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
|
|
|
@content_type = current_site.content_types.create(params[:content_type])
|
|
|
|
logger.debug @content_type.contents_custom_fields.inspect
|
|
|
|
respond_with @content_type, :location => edit_content_type_url(@content_type._id)
|
|
|
|
end
|
|
|
|
|
|
|
|
def edit
|
|
|
|
@content_type = current_site.content_types.find(params[:id])
|
|
|
|
respond_with @content_type
|
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
|
|
|
@content_type = current_site.content_types.find(params[:id])
|
|
|
|
@content_type.update_attributes(params[:content_type])
|
|
|
|
respond_with @content_type, :location => edit_content_type_url(@content_type._id)
|
|
|
|
end
|
|
|
|
|
2010-10-07 00:45:41 +00:00
|
|
|
def destroy
|
2011-12-19 13:15:11 +00:00
|
|
|
@content_type = current_site.content_types.find(params[:id])
|
|
|
|
@content_type.destroy
|
|
|
|
respond_with @content_type, :location => pages_url
|
2010-10-07 00:45:41 +00:00
|
|
|
end
|
|
|
|
|
2010-05-24 00:18:23 +00:00
|
|
|
end
|
2010-07-23 20:09:54 +00:00
|
|
|
end
|