Class: Admin::PagePartsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/admin/page_parts_controller.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject



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

def destroy
  part = 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



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

def new
  render :partial => "/admin/pages/page_part_field", :locals => {
    :part => PagePart.new(:title => params[:title], :body => params[:body]),
    :new_part => true,
    :part_index => params[:part_index]
  }
end