Sha256: 3949e8087d3e05d365392ec8f873d8bf0f93ef430bf8c5640b90275871d4390d

Contents?: true

Size: 687 Bytes

Versions: 9

Compression:

Stored size: 687 Bytes

Contents

# frozen_string_literal: true

module Navigator
  # Navigation helper methods for the view layer.
  module NavigationHelper
    # rubocop:disable Metrics/ParameterLists
    # rubocop:disable Metrics/LineLength
    def navigation tag = "ul", attributes: {}, activator: navigation_activator, &block
      raw Navigator::Menu.new(self, tag: tag, attributes: attributes, activator: activator, &block).render
    end
    # rubocop:enable Metrics/ParameterLists
    # rubocop:enable Metrics/LineLength

    module_function

    def current_path
      request.env["PATH_INFO"]
    end

    def navigation_activator
      Navigator::TagActivator.new search_value: current_path
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
navigator-4.1.4 app/helpers/navigator/navigation_helper.rb
navigator-4.1.3 app/helpers/navigator/navigation_helper.rb
navigator-4.1.2 app/helpers/navigator/navigation_helper.rb
navigator-4.1.1 app/helpers/navigator/navigation_helper.rb
navigator-4.1.0 app/helpers/navigator/navigation_helper.rb
navigator-4.0.0 app/helpers/navigator/navigation_helper.rb
navigator-3.2.0 app/helpers/navigator/navigation_helper.rb
navigator-3.1.0 app/helpers/navigator/navigation_helper.rb
navigator-3.0.0 app/helpers/navigator/navigation_helper.rb