item_extensions.rb 287 B

123456789101112131415
  1. # frozen_string_literal: true
  2. module SimpleNavigation
  3. module ItemExtensions
  4. def url
  5. if @url.nil? && @sub_navigation
  6. @sub_navigation.items.first.url
  7. else
  8. @url
  9. end
  10. end
  11. end
  12. end
  13. SimpleNavigation::Item.prepend(SimpleNavigation::ItemExtensions)