Sha256: 85fc5e2be60a0aa9cc85ef2b4a8a88ff736699b9112333fa168416d84ef7a491

Contents?: true

Size: 913 Bytes

Versions: 3

Compression:

Stored size: 913 Bytes

Contents

class Manage::PagesController < Manage::BaseController
  before_filter :find_structure
  
  cache_sweeper :page_sweeper, :only => [:create, :update, :destroy]
  
  # GET /manage/structures/1/page/edit
  def edit
    @page = @structure.page || @structure.build_page(:title=>@structure.title)
    
    respond_with(@page) do |format|
      format.html { render :action => (@page.new_record? ? 'new' : 'edit') }
    end
  end
  
  # POST /manage/structures/1/page
  def create
    @page = @structure.build_page(params[:page])
    @page.save
    
    respond_with(@page, :location => manage_structures_path)
  end
  
  # PUT /manage/structures/1/page
  def update
    @page = @structure.page
    @page.update_attributes(params[:page])
    
    respond_with(@page, :location => manage_structures_path)
  end
  
  protected
  
    def find_structure
      @structure = Structure.find(params[:structure_id])
    end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
freeberry-0.2.7 app/controllers/manage/pages_controller.rb
freeberry-0.2.6 app/controllers/manage/pages_controller.rb
freeberry-0.2.5 app/controllers/manage/pages_controller.rb