<commit_before>class TagPanelDecorator < ApplicationDecorator
  attr_accessor :context, :form_url, :cancel_url

  def initialize(context, options = {})
    self.context = context
    self.form_url = options[:form_url] || h.url_for([context, :tags])
    self.cancel_url = options[:cancel_url] || h.url_for
  end

  def render
    locals = {context: context, form_url: form_url, cancel_url: cancel_url}
    h.content_tag(:div, class: "tags-panel") do
      panel = h.render partial: "shared/tags/panel", locals: locals
      form = h.render partial: "shared/tags/edit", locals: locals<commit_msg>Add an auth_context to the tag panel decorator, but figure it out by default where possible.<commit_after>class TagPanelDecorator < ApplicationDecorator
  attr_accessor :context, :form_url, :cancel_url, :auth_context

  def initialize(context, options = {})
    self.context = context
    self.form_url = options[:form_url] || h.url_for([context, :tags])
    self.cancel_url = options[:cancel_url] || h.url_for
    self.auth_context = options[:auth_context] || ((context.respond_to?(:model) ? context.model : context).class.model_name.underscore + "_tags").to_sym
  end

  def render
    locals = {context: context, form_url: form_url, cancel_url: cancel_url, auth_context: auth_context}
    h.content_tag(:div, class: "tags-panel") do
      panel = h.render partial: "shared/tags/panel", locals: locals
      form = h.render partial: "shared/tags/edit", locals: locals
{'fraction_non_alphanumeric': 0.12303485987696514, 'fraction_numerical': 0.0, 'mean_word_length': 4.587786259541985, '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': '6703134', 'n_tokens_mistral': 461, 'n_tokens_neox': 459, 'n_words': 113}