<commit_before>module CMS
  class PagesController < RailsAdminCMS::Config.parent_controller
    before_action :find_page_view
    after_action :allow_iframe

    def find_page_view
      @cms_view = Viewable::Page.find(params[:page_id]) if params[:page_id].present? && params[:parent_id].blank?
    end

    def find_page_parent_view
      @cms_view = Viewable::Page.find(params[:parent_id]) if params[:parent_id].present?
    end

    def show
      if @cms_view
        render @cms_view.view_path
      else
        render "cms/pages/#{params[:cms_view_type]}"
      end
    end

    private

    def allow_iframe
      if RailsAdminCMS::Config.allow_iframe_from.present?
        response.headers['X-FRAME-OPTIONS'] = RailsAdminCMS::Config.allow_iframe_from
      end
    end
  end
end<commit_msg>added add show page meta method<commit_after>module CMS
  class PagesController < RailsAdminCMS::Config.parent_controller
    before_action :find_page_view
    after_action :allow_iframe

    def find_page_view
      @cms_view = Viewable::Page.find(params[:page_id]) if params[:page_id].present? && params[:parent_id].blank?
    end

    def find_page_parent_view(show_page = nil)
      @cms_view = Viewable::Page.find(params[:parent_id]) if params[:parent_id].present?
      add_show_page_meta show_page unless show_page.nil?
    end

    def show
      if @cms_view
        render @cms_view.view_path
      else
        render "cms/pages/#{params[:cms_view_type]}"
      end
    end

    private

    def allow_iframe
      if RailsAdminCMS::Config.allow_iframe_from.present?
        response.headers['X-FRAME-OPTIONS'] = RailsAdminCMS::Config.allow_iframe_from
      end
    end

    def add_show_page_meta(show_page)
      %i(
        meta_title
        meta_description
        meta_keywords
        meta_general_image
        twitter_card
        twitter_title
        twitter_description
        twitter_image
        og_title
        og_image
        og_description
      ).each do |meta|
        @cms_view.send("#{meta}=", show_page.send(meta)) if show_page.send(meta).present?
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.08613345953620445, 'fraction_numerical': 0.0, 'mean_word_length': 2.929368029739777, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1199360', 'n_tokens_mistral': 702, 'n_tokens_neox': 649, 'n_words': 124}