Sha256: 3a456d1e6055b9f028598fca9c1cdd214a06060a17649b18fb71d950926f58e9

Contents?: true

Size: 857 Bytes

Versions: 2

Compression:

Stored size: 857 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module DecidimAwesome
    module MenuItemPresenterOverride
      extend ActiveSupport::Concern

      included do
        def link_to(name = nil, options = nil, html_options = nil, &)
          html_options ||= {}
          html_options[:target] = @menu_item.try(:target)

          options ||= html_options
          @view.link_to(name, options, html_options, &)
        end

        def active
          return @menu_item.active.call(url, @view) if @menu_item.try(:active).respond_to?(:call)

          @menu_item&.active
        end

        def active_for_breadcrumb?
          is_active_link?(url, @menu_item.try(:original_active) || active)
        end

        def hacked_not_overriding?
          !(@menu_item.is_a?(Decidim::MenuItem) || @menu_item.overrided?)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
decidim-decidim_awesome-0.11.2 app/presenters/concerns/decidim/decidim_awesome/menu_item_presenter_override.rb
decidim-decidim_awesome-0.11.1 app/presenters/concerns/decidim/decidim_awesome/menu_item_presenter_override.rb