<commit_before>module Cms
  module Helpers
    module NavigationHelper
      def self.included(base)
        methods = self.instance_methods
        methods.delete(:included)
        if base.respond_to?(:helper_method)
          base.helper_method methods
        end
      end

      def menu(menu_keys = nil, i18n_root = "menu")
        menu_keys ||= %w(about_us services process benefits teams industries blog contacts)

        compute_navigation_keys(menu_keys, i18n_root)
      end

      def sitemap_entries(keys = nil, i18n_root = "sitemap")
        keys ||= [{key: "home", url: root_path}, "about_us", "services", "process", {key: "teams", children_class: Team}, {key: "industries", children_class: Industry}, "blog", "contacts", "career", "privacy_policy", "terms_of_use" ]

        compute_navigation_keys(keys, i18n_root, false)
      end

      def read_also_entries
        compute_navigation_keys(@read_also_entries, "read_also")
      end

      def compute_navigation_keys(keys, i18n_root = "navigation", check_for_active = true)

        h = {}
        keys.keep_if{|e|  ( (e.is_a?(String) || e.is_a?(Symbol)) && e.present? ) ||  (e.is_a?(Hash) || e[:key].present?)   }.each do |key|
          entry = {}
          if key.is_a?(String) || key.is_a?(Symbol)
            entry[:key] = key.to_sym
          elsif key.is_a?(Hash)
            entry = key
          end



          entry[:name] ||= (Cms.t("#{i18n_root}.#{entry[:key]}", raise: true) rescue entry[:key].to_s.humanize)
          entry[:url] ||= send("#{entry[:key]}_path")

          if (children_class = entry[:children_class])
            scopes = %w(published sort_by_position sort_by_sorting_position).select{|s| children_class.respond_to?(s) }

            children = children_class.all
            if scopes.any?
              scopes.each do |s|
                children = children.send(s)
              end
            end

            entry[:children] = children
          end


          #active = params[:route_name].to_s == key

          h[entry[:key]] = entry



<commit_msg>title and html title keys to compute_navigation_keys<commit_after>module Cms
  module Helpers
    module NavigationHelper
      def self.included(base)
        methods = self.instance_methods
        methods.delete(:included)
        if base.respond_to?(:helper_method)
          base.helper_method methods
        end
      end

      def menu(menu_keys = nil, i18n_root = "menu", options = {})
        menu_keys ||= %w(about_us services process benefits teams industries blog contacts)

        compute_navigation_keys(menu_keys, i18n_root, true, options)
      end

      def sitemap_entries(keys = nil, i18n_root = "sitemap")
        keys ||= [{key: "home", url: root_path}, "about_us", "services", "process", {key: "teams", children_class: Team}, {key: "industries", children_class: Industry}, "blog", "contacts", "career", "privacy_policy", "terms_of_use" ]

        compute_navigation_keys(keys, i18n_root, false)
      end

      def read_also_entries
        compute_navigation_keys(@read_also_entries, "read_also")
      end

      def compute_navigation_keys(keys, i18n_root = "navigation", check_for_active = true, options = {})
        defaults = {
            i18n_title_key: false,
            i18n_html_title_key: false
        }
        settings = defaults.merge(options)
        h = {}
        keys.keep_if{|e|  ( (e.is_a?(String) || e.is_a?(Symbol)) && e.present? ) ||  (e.is_a?(Hash) || e[:key].present?)   }.each do |key|
          entry = {}
          if key.is_a?(String) || key.is_a?(Symbol)
            entry[:key] = key.to_sym
          elsif key.is_a?(Hash)
            entry = key
          end


          if settings[:i18n_title_key] == true
            settings[:i18n_title_key] = "title"
          end

          if settings[:i18n_html_title_key] == true
            settings[:i18n_html_title_key] = "html-title"
          end

          if settings[:i18n_title_key]
            entry[:name] ||= (Cms.t("#{i18n_root}.#{settings[:i18n_title_key]}.#{entry[:key]}", raise: true) rescue nil)
          end

          if settings[:i18n_html_title_key]
            entry[:title] ||= (Cms.t("#{i18n_root}.#{settings[:i18n_html_title_key]}.#{entry[:key]}", raise: true) rescue nil)
          end

          entry[:name] ||= (Cms.t("#{i18n_root}.#{entry[:key]}", raise: true) rescue entry[:key].to_s.humanize)

          entry[:url] ||= send("#{entry[:key]}_path")

          if (children_class = entry[:children_class])
            scopes = %w(published sort_by_position sort_by_sorting_position).select{|s| children_class.respond_to?(s) }

            children = children_class.all
            if scopes.any?
              scopes.each do |s|
                children = children.send(s)
              end
            end

            entry[:children] = children
          end


          #active = params[:route_name].to_s == key

          h[entry[:key]] = entry




{'fraction_non_alphanumeric': 0.13253984264676216, 'fraction_numerical': 0.00968327617510591, 'mean_word_length': 2.4169538249483113, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2870981', 'n_tokens_mistral': 1619, 'n_tokens_neox': 1560, 'n_words': 309}