Sha256: eccfeaff6472601a8480c9d9ee40e74887caa3e1d09344816b5cb34a9948e186

Contents?: true

Size: 1.49 KB

Versions: 15

Compression:

Stored size: 1.49 KB

Contents

module Admin
  class PagesController < BaseController
  
    sections 'contents'
  
    def index
      @pages = current_site.pages.roots
    end
  
    def new
      @page = current_site.pages.build
      @page.parts << PagePart.build_body_part
    end
  
    def edit
      @page = current_site.pages.find(params[:id])  
    end
  
    def create
      @page = current_site.pages.build(params[:page])

      if @page.save
        flash_success!
        redirect_to edit_admin_page_url(@page)
      else
        flash_error!
        render :action => 'new'
      end
    end
  
    def update
      @page = current_site.pages.find(params[:id])
      
      if @page.update_attributes(params[:page])
        flash_success!
        redirect_to edit_admin_page_url(@page)
      else
        flash_error!
        render :action => "edit"
      end
    end
  
    def sort
      @page = current_site.pages.find(params[:id])
      @page.sort_children!(params[:children])
    
      render :json => { :message => translate_flash_msg(:successful) }
    end
  
    def get_path
      page = current_site.pages.build(:parent => current_site.pages.find(params[:parent_id]), :slug => params[:slug].slugify)
    
      render :json => { :url => page.url, :slug => page.slug }
    end
  
    def destroy
      @page = current_site.pages.find(params[:id])

      begin
        @page.destroy
        flash_success!
      rescue Exception => e
        flash[:error] = e.to_s
      end

      redirect_to admin_pages_url
    end
  
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
locomotive_cms-0.0.2.9 app/controllers/admin/pages_controller.rb
locomotive_cms-0.0.2.8 app/controllers/admin/pages_controller.rb
locomotive_cms-0.0.2.7 app/controllers/admin/pages_controller.rb
locomotive_cms-0.0.2.6 app/controllers/admin/pages_controller.rb
locomotive_cms-0.0.2.5 app/controllers/admin/pages_controller.rb
locomotive_cms-0.0.2.4 app/controllers/admin/pages_controller.rb
locomotive_cms-0.0.2.3 app/controllers/admin/pages_controller.rb
locomotive_cms-0.0.2.2 app/controllers/admin/pages_controller.rb
locomotive_cms-0.0.2.1 app/controllers/admin/pages_controller.rb
locomotive_cms-0.0.2 app/controllers/admin/pages_controller.rb
locomotive_cms-0.0.1.4 app/controllers/admin/pages_controller.rb
locomotive_cms-0.0.1.3 app/controllers/admin/pages_controller.rb
locomotive_cms-0.0.1.2 app/controllers/admin/pages_controller.rb
locomotive_cms-0.0.1.1 app/controllers/admin/pages_controller.rb
locomotive_cms-0.0.1 app/controllers/admin/pages_controller.rb