<commit_before>class Pulitzer::ContentElementsController < Pulitzer::ApplicationController
  before_filter :set_content_element, only: [:show, :edit, :update]

  def index
    @post                       = Pulitzer::Post.find(params[:post_id])
    @content_elements           = @post.preview_version.template_content_elements
    @free_form_content_elements = @post.preview_version.free_form_content_elements
    route                       = "pulitzer_preview_#{@post.title.parameterize('_')}_path"
    @preview_path               = main_app.public_send(route) if main_app.respond_to?(route)
  end

  def new
    @version          = Pulitzer::Version.find params[:version_id]
    @content_element  = @version.content_elements.build
    render partial: 'new', locals: { content_element: @content_element, version: @version }
  end

  def create
    @version         = Pulitzer::Version.find content_element_params[:version_id]
    @content_element = @version.content_elements.create content_element_params
    render partial: 'show_wrapper', locals: { content_element: @content_element }
  end

  def show
    render partial: 'show', locals: { content_element: @content_element }
  end
<commit_msg>Add preview for different multiple post pages<commit_after>class Pulitzer::ContentElementsController < Pulitzer::ApplicationController
  before_filter :set_content_element, only: [:show, :edit, :update]

  def index
    @post                       = Pulitzer::Post.find(params[:post_id])
    @content_elements           = @post.preview_version.template_content_elements
    @free_form_content_elements = @post.preview_version.free_form_content_elements
    route                       = "pulitzer_preview_#{@post.post_type.name.parameterize('_')}_path"
    @preview_path               = main_app.public_send(route, @post.slug) if main_app.respond_to?(route)
  end

  def new
    @version          = Pulitzer::Version.find params[:version_id]
    @content_element  = @version.content_elements.build
    render partial: 'new', locals: { content_element: @content_element, version: @version }
  end

  def create
    @version         = Pulitzer::Version.find content_element_params[:version_id]
    @content_element = @version.content_elements.create content_element_params
    render partial: 'show_wrapper', locals: { content_element: @content_element }
  end

  def show
    render partial: 'show', locals: { content_element: @content_element }
  end

{'fraction_non_alphanumeric': 0.09636586361780318, 'fraction_numerical': 0.0, 'mean_word_length': 3.78515625, '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': '3135416', 'n_tokens_mistral': 698, 'n_tokens_neox': 692, 'n_words': 135}