<commit_before>class PagesController < AdminController#:nodoc:

  uses_tiny_mce :options => TinyMCEconfig.load, :only => [:new,:edit,:create,:update]

  before_filter :find_page, :only => [:edit, :update, :destroy]
  before_filter :calculate_page_types, :only => [:new, :create]

  def index
    @pages = []
    Page.each_with_level( Page.find(:all, :order => 'lft ASC') ) { |page,level| @pages << { :page => page, :level => level } }
    @menus = Page.menus
  end

  def new
    @page = Page.new(:parent_id => params[:page_id])
    @page.user = current_user
  end

  def edit
  end

  def create
    @page = Page.new(params[:page])

    if @page.save
      notice Page, :created
      redirect_to pages_path
    else
      render :action => "new"
    end
  end

  def update
    if @page.update_attributes(params[:page])
      notice Page, :updated
      redirect_to edit_page_path(@page)
    else
      notice_error Page, :updated
      render :action => "edit"
    end
  end

  def destroy
    @page.destroy

    redirect_to pages_path
  end
<commit_msg>menu checkboxes fix<commit_after>class PagesController < AdminController#:nodoc:

  uses_tiny_mce :options => TinyMCEconfig.load, :only => [:new,:edit,:create,:update]

  before_filter :find_page, :only => [:edit, :update, :destroy]
  before_filter :calculate_page_types, :only => [:new, :create]

  def index
    @pages = []
    Page.each_with_level( Page.find(:all, :order => 'lft ASC') ) { |page,level| @pages << { :page => page, :level => level } }
    @menus = Page.menus
  end

  def new
    @page = Page.new(:parent_id => params[:page_id])
    @page.user = current_user
  end

  def edit
  end

  def create
    @page = Page.new(params[:page])

    if @page.save
      notice Page, :created
      redirect_to pages_path
    else
      render :action => "new"
    end
  end

  def update
    if @page.update_attributes(params[:page])
      if request.xhr?
	render :update do |page|
	  page.reload
	end
      else
	notice Page, :updated
	redirect_to edit_page_path(@page)
      end
    else
      notice_error Page, :updated
      render :action => "edit"
    end
  end

  def destroy
    @page.destroy

    redirect_to pages_path
  end

{'fraction_non_alphanumeric': 0.12551159618008187, 'fraction_numerical': 0.0, 'mean_word_length': 3.029304029304029, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 23, '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': '7462178', 'n_tokens_mistral': 772, 'n_tokens_neox': 742, 'n_words': 188}