Class: Refinery::Admin::PagePartsController

Inherits:
Refinery::AdminController show all
Defined in:
pages/app/controllers/refinery/admin/page_parts_controller.rb

Instance Method Summary collapse

Methods included from BaseController

#admin?, included, #refinery_admin_root_path, #searching?

Methods included from Refinery::ApplicationController

#admin?, #current_refinery_user, #error_404, #from_dialog?, #home_page?, included, #local_request?

Instance Method Details

#destroyObject



13
14
15
16
17
18
19
20
21
22
# File 'pages/app/controllers/refinery/admin/page_parts_controller.rb', line 13

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

#newObject



5
6
7
8
9
10
11
# File 'pages/app/controllers/refinery/admin/page_parts_controller.rb', line 5

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