<commit_before>require 'filesize'

module StashEngine
  module ApplicationHelper
    def geolocation_image(resource)
      if resource && resource.geolocation == true
        image_tag('stash_datacite/geolocation.png', size: '20x20', alt: 'Box')
      else
        ' '
      end
    end

    # displays log in/out based on session state, temporary for now
    # :nocov:
    def log_in_out
      if session[:user_id].blank?
        link_to 'log in', stash_url_helpers.tenants_path
      else
        link_to 'log out', stash_url_helpers.sessions_destroy_path
      end
    end
    # :nocov:

    def filesize(bytes)
      return '' if bytes.nil?
      return "#{bytes} B" if bytes < 1000
      ::Filesize.new(bytes, Filesize::SI).pretty
    end
  end
end<commit_msg>add geolocation icon next to title on dashboard to show resources with geolocation<commit_after>require 'filesize'

module StashEngine
  module ApplicationHelper
    # displays log in/out based on session state, temporary for now
    # :nocov:
    def log_in_out
      if session[:user_id].blank?
        link_to 'log in', stash_url_helpers.tenants_path
      else
        link_to 'log out', stash_url_helpers.sessions_destroy_path
      end
    end
    # :nocov:

    def filesize(bytes)
      return '' if bytes.nil?
      return "#{bytes} B" if bytes < 1000
      ::Filesize.new(bytes, Filesize::SI).pretty
    end
  end
end
{'fraction_non_alphanumeric': 0.08548850574712644, 'fraction_numerical': 0.008620689655172414, 'mean_word_length': 2.7750677506775068, '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': '3861923', 'n_tokens_mistral': 456, 'n_tokens_neox': 447, 'n_words': 123}