<commit_before>module ApplicationHelper
  def show_link(object, content = nil, options={})
    content ||= "View"
    options[:class] = 'btn btn-primary' if options[:class].nil?
    link_to(content, object, options) if can?(:read, object)
  end

  def edit_link(object, content = nil, options={})
    content ||= "Edit"
    options[:class] = 'btn btn-warning' if options[:class].nil?
    link_to(content, [:edit, object], options) if can?(:update, object)
  end

  def destroy_link(object, content = nil, options={})
    content ||= "Delete"
    options[:class] = 'btn btn-danger' if options[:class].nil?
    options[:method] = :delete if options[:method].nil?
    options[:data] = { confirm: 'Are you sure?' }if options[:confirm].nil?
    link_to(content, object, options) if can?(:destroy, object)
  end

  def create_link(object, content = nil, options={})
    content ||= "Create"
    options[:class] = 'btn btn-info' if options[:class].nil?
    if can?(:create, object)
      object_class = (object.kind_of?(Class) ? object : object.class)
      link_to(content, [:new, object_class.name.underscore.to_sym], options)
    end
  end

  def header_title
    # TODO put base_title into an ENV
    base_title = "APTrust"
    if !current_user
      base_title
    else<commit_msg>Amend link helpers to display icons in addition to words.  Also clean up button based UI.<commit_after>module ApplicationHelper
  def show_link(object, content = nil, options={})
    content ||= '<i class="icon-eye-open"></i> <strong>View</strong>'
    options[:class] = 'btn' if options[:class].nil?
    link_to(content.html_safe, object, options) if can?(:read, object)
  end

  def edit_link(object, content = nil, options={})
    content ||= '<i class="icon-edit"></i> <strong>Edit</strong>'
    options[:class] = 'btn' if options[:class].nil?
    link_to(content.html_safe, [:edit, object], options) if can?(:update, object)
  end

  def destroy_link(object, content = nil, options={})
    content ||= '<i class="icon-trash"></i> <strong>Delete</strong>'
    options[:class] = 'btn btn-danger' if options[:class].nil?
    options[:method] = :delete if options[:method].nil?
    options[:data] = { confirm: 'Are you sure?' }if options[:confirm].nil?
    link_to(content.html_safe, object, options) if can?(:destroy, object)
  end

  def create_link(object, content = nil, options={})
    content ||= '<i class="icon-plus"></i> <strong>Create</strong>'
    options[:class] = 'btn' if options[:class].nil?
    if can?(:create, object)
      object_class = (object.kind_of?(Class) ? object : object.class)
      link_to(content.html_safe, [:new, object_class.name.underscore.to_sym], options)
    end
  end

  def header_title
    # TODO put base_title into an ENV
    base_title = "APTrust"
    if !current_user
      base_title
    else
{'fraction_non_alphanumeric': 0.15613910574875797, 'fraction_numerical': 0.0, 'mean_word_length': 4.051971326164875, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '1665154', 'n_tokens_mistral': 916, 'n_tokens_neox': 901, 'n_words': 239}