Sha256: 1805e1288c56dcc319dc29aef3431759f20df2f353915ac8252db3b928fbdf50
Contents?: true
Size: 551 Bytes
Versions: 11
Compression:
Stored size: 551 Bytes
Contents
class PageDecorator < ApplicationDecorator 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 "/#{locale}/#{slugs.reverse.join('/')}" end end
Version data entries
11 entries across 11 versions & 1 rubygems