Sha256: e95e21b7e8775db3e587be6c105dcbc21aeb7a5fdb337d5d9c307641d02e179f

Contents?: true

Size: 997 Bytes

Versions: 4

Compression:

Stored size: 997 Bytes

Contents

module Admin
  class PagesController < BaseController

    sections 'contents'

    respond_to :json, :only => [:update, :sort, :get_path]

    def index
      @pages = current_site.all_pages_in_once
    end

    def new
      @page = current_site.pages.build
    end

    def update
      update! do |success, failure|
        success.json do
          render :json => {
            :notice => t('flash.admin.pages.update.notice'),
            :editable_elements => @page.template_changed ?
              render_to_string(:partial => 'admin/pages/editable_elements.html.haml') : ''
          }
        end
      end
    end

    def sort
      @page = current_site.pages.find(params[:id])
      @page.sort_children!(params[:children])

      respond_with @page
    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

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
locomotive_cms-1.0.0.beta.2 app/controllers/admin/pages_controller.rb
locomotive_cms-1.0.0.beta app/controllers/admin/pages_controller.rb
locomotive_cms-0.0.4.beta12 app/controllers/admin/pages_controller.rb
locomotive_cms-0.0.4.beta11 app/controllers/admin/pages_controller.rb