Sha256: 7cd723f26d372661edd8438f0ea892beab3b13cb20508003473287f1226779e0
Contents?: true
Size: 636 Bytes
Versions: 5
Compression:
Stored size: 636 Bytes
Contents
class PageDecorator < Draper::Decorator delegate_all def options_for_parents ::Page.flat_tree.map do |p| ["#{'-' * p.depth} #{p.description}".strip, p.id] end end def path(locale: I18n.locale, options: {}) return h.send(route, options) if route.present? slugs = [] parents.each do |p| if p.route.present? slugs << h.send(p.route, options) return slugs.reverse.join('/') else slugs << p.seo(locale).slug end end str = '' str << "/#{locale}" if Udongo.config.prefix_routes_with_locale? str << "/#{slugs.reverse.join('/')}" str end end
Version data entries
5 entries across 5 versions & 1 rubygems