Sha256: 249ff56488c571d7f8267c6819bc12e844d73e6f16f834778bf62a4b9e956b91

Contents?: true

Size: 646 Bytes

Versions: 57

Compression:

Stored size: 646 Bytes

Contents

module AmaLayout
  class NavigationItemDecorator < Draper::Decorator
    delegate_all

    def sub_nav
      object.sub_nav.map { |sn| sn.decorate }
    end

    def sub_nav_class
      "has-dropdown" if sub_nav.any?
    end

    def top_sub_nav
      h.render partial: "ama_layout/top_sub_nav", locals: { sub_nav: sub_nav } if sub_nav.any?
    end

    def sidebar_sub_nav
      h.render partial: "ama_layout/sub_nav", locals: { sub_nav: sub_nav } if sub_nav.any?
    end

    def active_class
      "activepage" if active_link?
    end

  private
    def active_link?
      sub_nav.map(&:link).push(link).include? current_url
    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
ama_layout-3.2.2 lib/ama_layout/decorators/navigation_item_decorator.rb
ama_layout-3.2.1 lib/ama_layout/decorators/navigation_item_decorator.rb
ama_layout-3.2.0 lib/ama_layout/decorators/navigation_item_decorator.rb
ama_layout-3.1.3 lib/ama_layout/decorators/navigation_item_decorator.rb
ama_layout-3.1.1 lib/ama_layout/decorators/navigation_item_decorator.rb
ama_layout-3.1.0 lib/ama_layout/decorators/navigation_item_decorator.rb
ama_layout-3.0.0 lib/ama_layout/decorators/navigation_item_decorator.rb
ama_layout-2.9.2 lib/ama_layout/decorators/navigation_item_decorator.rb
ama_layout-2.9.1 lib/ama_layout/decorators/navigation_item_decorator.rb
ama_layout-2.9.0 lib/ama_layout/decorators/navigation_item_decorator.rb
ama_layout-2.8.0 lib/ama_layout/decorators/navigation_item_decorator.rb
ama_layout-2.7.0 lib/ama_layout/decorators/navigation_item_decorator.rb
ama_layout-2.6.0 lib/ama_layout/decorators/navigation_item_decorator.rb
ama_layout-2.5.0 lib/ama_layout/decorators/navigation_item_decorator.rb
ama_layout-2.4.5 lib/ama_layout/decorators/navigation_item_decorator.rb
ama_layout-2.4.4 lib/ama_layout/decorators/navigation_item_decorator.rb
ama_layout-2.4.3 lib/ama_layout/decorators/navigation_item_decorator.rb
ama_layout-2.4.2 lib/ama_layout/decorators/navigation_item_decorator.rb
ama_layout-2.4.1 lib/ama_layout/decorators/navigation_item_decorator.rb
ama_layout-2.4.0 lib/ama_layout/decorators/navigation_item_decorator.rb