Sha256: 8e7e8370ed7a79d42a570fa61b214ae102fdd0d33cfc4ff93bfb9f51d0e83eef

Contents?: true

Size: 868 Bytes

Versions: 1

Compression:

Stored size: 868 Bytes

Contents

# frozen_string_literal: true

class Occams::Admin::Cms::Revisions::PageController < Occams::Admin::Cms::Revisions::BaseController
  def show
    @current_content = @record.fragments.each_with_object({}) do |b, c|
      c[b.identifier] = b.content
    end
    @versioned_content = @record.fragments.each_with_object({}) do |b, c|
      d = @revision.data["fragments_attributes"].detect { |r| r[:identifier] == b.identifier }
      c[b.identifier] = d.try(:[], :content)
    end

    render "occams/admin/cms/revisions/show"
  end

private

  def load_record
    @record = @site.pages.find(params[:page_id])
  rescue ActiveRecord::RecordNotFound
    flash[:danger] = I18n.t("occams.admin.cms.revisions.record_not_found")
    redirect_to occams_admin_cms_site_pages_path(@site)
  end

  def record_path
    edit_occams_admin_cms_site_page_path(@site, @record)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
occams-1.0.1 app/controllers/occams/admin/cms/revisions/page_controller.rb