<commit_before>class Ecm::News::Backend::ItemsController < Itsf::Backend::Resource::BaseController
  def self.resource_class
    Ecm::News::Item
  end

  def toggle_published
    @resource = resource_class.find(params[:id])
    @resource.toggle_published!
    action = @resource.published? ? :published : :unpublished
    respond_with(
      @resource,
      location: collection_path,
      notice: I18n.t("flash.actions.#{action_name}.#{action}.notice", inflections)
    )
  end

  private

  def permitted_params
    params
      .require(:item)
      .permit(:title, :locale, :body, :link_to_more, :published, pictures_attributes: [ :image, :_destroy, :id ])
  end

  def load_resource
    load_scope.friendly.find(params[:id])
  end
end<commit_msg>Use concern instead of own implementation.<commit_after>class Ecm::News::Backend::ItemsController < Itsf::Backend::Resource::BaseController
  include Controller::FriendlyIdConcern
  include Controller::ActsAsPublishedConcern

  def self.resource_class
    Ecm::News::Item
  end

  private

  def permitted_params
    params
      .require(:item)
      .permit(:title, :locale, :body, :link_to_more, :published, pictures_attributes: [ :image, :_destroy, :id ])
  end
end
{'fraction_non_alphanumeric': 0.11947626841243862, 'fraction_numerical': 0.0016366612111292963, 'mean_word_length': 4.459821428571429, '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': '2008250', 'n_tokens_mistral': 381, 'n_tokens_neox': 375, 'n_words': 75}