Skip to content
Snippets Groups Projects
Commit 54fc7100 authored by Arnaud Levy's avatar Arnaud Levy
Browse files

wip

parent 6e16b25c
No related branches found
No related tags found
No related merge requests found
......@@ -83,12 +83,20 @@ class Communication::Website::Permalink < ApplicationRecord
}
end
def published_path
p = pattern
substitutions.each do |key, value|
p.gsub! ":#{key}", value
end
p
end
def published?
# Can be overwritten
true
end
def published_path
def substitutions
raise NotImplementedError
end
......
......@@ -19,9 +19,12 @@ class Communication::Website::Permalink::Post < Communication::Website::Permalin
website.id == about.communication_website_id && about.published && about.published_at
end
def published_path
pattern
.gsub(":year/:month/:day", about.published_at.strftime("%Y/%m/%d"))
.gsub(":slug", about.slug)
def substitutions
{
year: about.published_at.year,
month: about.published_at.month,
day: about.published_at.day,
slug: about.slug
}
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment