Sha256: 5837e21fc336e6217ff747fb649a79501681e09aa6876c3c8a521b0943ea5452

Contents?: true

Size: 803 Bytes

Versions: 2

Compression:

Stored size: 803 Bytes

Contents

module Refinery
  module Admin
    class PagePartsController < ::Refinery::AdminController

      def new
        render :partial => '/refinery/admin/pages/page_part_field', :locals => {
                 :part => ::Refinery::PagePart.new(new_page_part_params),
                 :new_part => true,
                 :part_index => params[:part_index]
               }
      end

      def destroy
        part = ::Refinery::PagePart.find(params[:id])
        page = part.page
        if part.destroy
          page.reposition_parts!
          render :text => "'#{part.title}' deleted."
        else
          render :text => "'#{part.title}' not deleted."
        end
      end

      protected
        def new_page_part_params
          params.permit(:title, :slug, :body)
        end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
refinerycms-pages-3.0.1 app/controllers/refinery/admin/page_parts_controller.rb
refinerycms-pages-3.0.0 app/controllers/refinery/admin/page_parts_controller.rb