<commit_before>module Office::NavigationHelper

  def build_public_signup_breadcrumbs(public_signup)
    BreadCrumbBuilder.new(public_signup) do |b|
      b.add :index, 'Pending Public Signups', office_public_signups_path
      b.add :approved, 'Approved Public Signups', approved_office_public_signups_path
      b.add :show, public_signup, [:office, public_signup]
      b.filter :name, do |name|
        name = :approved if name == :index &&
          public_signup &&
          public_signup.approved?
        name
      end
    end
  end

  def public_signup_breadcrumbs
    build_breadcrumbs(build_public_signup_breadcrumbs(public_signup))
  end
      
  def build_angel_breadcrumbs(angel)
    BreadCrumbBuilder.new(angel) do |b|
      b.add :index, 'Angels', office_angels_path
      b.add :show, angel, [:office, angel]
    end
  end

  def angel_breadcrumbs
    build_breadcrumbs(build_angel_breadcrumbs(angel))
  end
      
  def build_event_breadcrumbs(event)
    BreadCrumbBuilder.new(event) do |b|
      b.add :index, 'Future Events', office_events_path
      b.add :past, 'Past Events', past_office_events_path
      b.add :show, event, [:office, event]
      b.filter :name, do |name|
        name = :past if name == :index &&
          event &&
          event.start_date &&
          event.start_date < Date.current
        name
      end
    end
  end

  def event_breadcrumbs
    build_breadcrumbs(build_event_breadcrumbs(event))
  end
      
  def build_registration_breadcrumbs(registration)
    BreadCrumbBuilder.new(registration) do |b|
      b.add :index, lambda { ['Registrations', [:office, parent, :registrations]] }
      b.add :show, lambda { [registration, [:office, parent, registration]] }
    end
  end

  def registration_breadcrumbs
    crumbs =  build_breadcrumbs(build_event_breadcrumbs(event), :show)
    crumbs << build_breadcrumbs(build_registration_breadcrumbs(registration))
    crumbs
  end
      
  def registration_navigation
    tabs = [["#{parent.display_name} Registrations", :index]]
    if parent.kind_of?(Event)
      tabs << ['Checklist', :checklist]
      tabs << ['Roster', :roster]
    end
    tabs
  end

  def display_name_or_id(something)
    if something.respond_to?(:display_name)
      result = something.display_name 
      result = "##{something.id}" if result.blank?
    else
      result = something.to_s
    end
    result
  end

  def status_menu
  end<commit_msg>fix breadcrumbs for angel parents<commit_after>module Office::NavigationHelper

  def build_public_signup_breadcrumbs(public_signup)
    BreadCrumbBuilder.new(public_signup) do |b|
      b.add :index, 'Pending Public Signups', office_public_signups_path
      b.add :approved, 'Approved Public Signups', approved_office_public_signups_path
      b.add :show, public_signup, [:office, public_signup]
      b.filter :name, do |name|
        name = :approved if name == :index &&
          public_signup &&
          public_signup.approved?
        name
      end
    end
  end

  def public_signup_breadcrumbs
    build_breadcrumbs(build_public_signup_breadcrumbs(public_signup))
  end
      
  def build_angel_breadcrumbs(angel)
    BreadCrumbBuilder.new(angel) do |b|
      b.add :index, 'Angels', office_angels_path
      b.add :show, angel, [:office, angel]
    end
  end

  def angel_breadcrumbs
    build_breadcrumbs(build_angel_breadcrumbs(angel))
  end
      
  def build_event_breadcrumbs(event)
    BreadCrumbBuilder.new(event) do |b|
      b.add :index, 'Future Events', office_events_path
      b.add :past, 'Past Events', past_office_events_path
      b.add :show, event, [:office, event]
      b.filter :name, do |name|
        name = :past if name == :index &&
          event &&
          event.start_date &&
          event.start_date < Date.current
        name
      end
    end
  end

  def event_breadcrumbs
    build_breadcrumbs(build_event_breadcrumbs(event))
  end
      
  def build_registration_breadcrumbs(registration)
    BreadCrumbBuilder.new(registration) do |b|
      b.add :index, lambda { ['Registrations', [:office, parent, :registrations]] }
      b.add :show, lambda { [registration, [:office, parent, registration]] }
    end
  end

  def registration_breadcrumbs
    if parent.is_a?(Event)
      crumbs =  build_breadcrumbs(build_event_breadcrumbs(parent), :show)
    else
      crumbs =  build_breadcrumbs(build_angel_breadcrumbs(parent), :show)
    end
    crumbs << build_breadcrumbs(build_registration_breadcrumbs(registration))
    crumbs
  end
      
  def registration_navigation
    tabs = [["#{parent.display_name} Registrations", :index]]
    if parent.kind_of?(Event)
      tabs << ['Checklist', :checklist]
      tabs << ['Roster', :roster]
    end
    tabs
  end

  def display_name_or_id(something)
    if something.respond_to?(:display_name)
      result = something.display_name 
      result = "##{something.id}" if result.blank?
    else
      result = something.to_s
    end
    result
  end

  def status_menu
  end
{'fraction_non_alphanumeric': 0.09454327403557865, 'fraction_numerical': 0.0, 'mean_word_length': 3.166527893422148, 'pattern_counts': {'":': 0, '<': 17, '<?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': '658135', 'n_tokens_mistral': 1675, 'n_tokens_neox': 1665, 'n_words': 350}