<commit_before># -*- encoding : utf-8 -*-
class CheckListsController < BackController

  before_action :load_check_list, :except => [:index, :new, :create]
  before_action :reset_back_path # for expirings items back link
  skip_before_action :require_html_request, :only => [:show]

  def index
    @check_lists = @station.check_lists
                           .page(params[:page])
                           .order('title')
  end

  def show
    respond_to do |format|
      format.html
      format.pdf do
        prawnto :prawn => { :page_size => "A4" },
                :inline => false, :filename => "check_liste_#{@check_list.title.filenamize}.pdf"
      end
    end
  end

  def new
    @check_list = @station.check_lists.new
  end

  def create
    @check_list = @station.check_lists.new(check_list_params)
    if(@check_list.save)
      flash[:success] = "La liste a été créée."
      redirect_to(@check_list)
    else
      render(:action => :new)
    end
  end

  def edit
  end

  def update
    if @check_list.update_attributes(check_list_params)
      flash[:success] = "La liste a été mise à jour."
      redirect_to(@check_list)
    else
      render(:action => :edit)
    end
  end

  def copy
    @check_list = @check_list.copy
    flash[:success] = "La liste a été copiée."
    redirect_to(check_lists_path)
  end

  def destroy
    @check_list.destroy
    flash[:success] = "La liste a été supprimée."<commit_msg>Add authorizations on check lists.<commit_after># -*- encoding : utf-8 -*-
class CheckListsController < BackController

  authorize_resource
  skip_authorize_resource :only => :copy

  before_action :load_check_list, :except => [:index, :new, :create]
  before_action :reset_back_path # for expirings items back link
  skip_before_action :require_html_request, :only => [:show]

  def index
    @check_lists = @station.check_lists
                           .page(params[:page])
                           .order('title')
  end

  def show
    respond_to do |format|
      format.html
      format.pdf do
        prawnto :prawn => { :page_size => "A4" },
                :inline => false, :filename => "check_liste_#{@check_list.title.filenamize}.pdf"
      end
    end
  end

  def new
    @check_list = @station.check_lists.new
  end

  def create
    @check_list = @station.check_lists.new(check_list_params)
    if(@check_list.save)
      flash[:success] = "La liste a été créée."
      redirect_to(@check_list)
    else
      render(:action => :new)
    end
  end

  def edit
  end

  def update
    if @check_list.update_attributes(check_list_params)
      flash[:success] = "La liste a été mise à jour."
      redirect_to(@check_list)
    else
      render(:action => :edit)
    end
  end

  def copy
    authorize! :create, CheckList
    @check_list = @check_list.copy
    flash[:success] = "La liste a été copiée."
    redirect_to(check_lists_path)
  end

  def destroy
    @check_list.destroy
    flash[:success] = "La liste a été supprimée."
{'fraction_non_alphanumeric': 0.10649698593436034, 'fraction_numerical': 0.0013395847287340924, 'mean_word_length': 2.6206060606060606, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 20, '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': '6875729', 'n_tokens_mistral': 990, 'n_tokens_neox': 974, 'n_words': 236}