<commit_before>class Shared::Collection::TablePresenter < Presenter
  def initialize(subject, options = {})
    super(subject, options)
    
    set_default_options(
      {  
        current_parent: parent, show_title: true, append_new_link: true, show_actions: true
      }
    )
  end
  
  def set_options(options)
    @options.merge!(options)
  end
  
  def actions
    return '' unless show_actions
    
    content_tag :td, render('shared/resource/actions', type: type, resource: resource)
  end
  
  def new_link
    return '' unless append_new_link
    
    path = if current_parent
      eval("new_#{root_model_class_name(current_parent).tableize.singularize}_#{type.singularize}_path(current_parent)")
    else
      eval("new_#{type.singularize}_path")
    end
    
    link_to t("#{type}.new.title"), path
  end
end<commit_msg>Improves TablePresenter#new_link<commit_after>class Shared::Collection::TablePresenter < Presenter
  def initialize(subject, options = {})
    super(subject, options)
    
    set_default_options(
      {  
        current_parent: parent, show_title: true, append_new_link: true, show_actions: true
      }
    )
  end
  
  def set_options(options)
    @options.merge!(options)
  end
  
  def actions
    return '' unless show_actions
    
    content_tag :td, render('shared/resource/actions', type: type, resource: resource)
  end
  
  def new_link
    return '' unless append_new_link
    
    path = if current_parent
      eval("new_#{root_model_class_name(current_parent).tableize.singularize}_#{type.gsub('.', '_').singularize}_path(current_parent)")
    else
      eval("new_#{type.gsub('.', '_').singularize}_path")
    end
    
    link_to t("#{type}.new.title"), path
  end
end
{'fraction_non_alphanumeric': 0.1117544875506659, 'fraction_numerical': 0.0, 'mean_word_length': 3.4081632653061225, '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': '6535153', 'n_tokens_mistral': 552, 'n_tokens_neox': 551, 'n_words': 106}