Sha256: a20ac6608ce3f824b8bd382c86f0d0c6de04daf1764377e5fe0f3a9e15b5c7af

Contents?: true

Size: 919 Bytes

Versions: 3

Compression:

Stored size: 919 Bytes

Contents

class Admin::ContentPartsController < Admin::BaseController
  resource_controller :belongs_to => :content_category
  
  create.before do
    @content_part.user = @current_user
  end
  
  new_action.before do
    @content_category = ContentCategory.find(params[:content_category_id])
    @content_part = @content_category.content_parts.new :user => @current_user
  end
  
  edit.before do
    @content_category = ContentCategory.find(params[:content_category_id])
    @content_part = @content_category.content_parts.find(params[:id])    
  end
  
  create.wants.html { redirect_to admin_content_category_path(@content_part.category) }
  update.wants.html { redirect_to admin_content_category_path(@content_part.category) }
  destroy.wants.html { redirect_to admin_content_category_path(@content_part.category) }
  
  protected
  
  def parent_association
    @parent_association ||= parent_object.content_parts
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spree-cms-0.2.1 app/controllers/admin/content_parts_controller.rb
spree-cms-0.2.0 app/controllers/admin/content_parts_controller.rb
spree-cms-0.1.0 app/controllers/admin/content_parts_controller.rb