diff --git a/priv/repo/seeds.exs b/priv/repo/seeds.exs index 25584b8b..13ebd626 100644 --- a/priv/repo/seeds.exs +++ b/priv/repo/seeds.exs @@ -21,7 +21,8 @@ alias Philomena.{ Reports.Report, Roles.Role, Tags.Tag, - Users.User + Users.User, + StaticPages.StaticPage } alias Philomena.Elasticsearch @@ -88,6 +89,14 @@ for role_def <- resources["roles"] do |> Repo.insert(on_conflict: :nothing) end +IO.puts("---- Generating static pages") + +for page_def <- resources["pages"] do + %StaticPage{title: page_def["title"], slug: page_def["slug"], body: page_def["body"]} + |> StaticPage.changeset(%{}) + |> Repo.insert(on_conflict: :nothing) +end + IO.puts("---- Indexing content") Elasticsearch.reindex(Tag |> preload(^Tags.indexing_preloads()), Tag) diff --git a/priv/repo/seeds.json b/priv/repo/seeds.json index a0bcdfd6..ac40820d 100644 --- a/priv/repo/seeds.json +++ b/priv/repo/seeds.json @@ -91,5 +91,6 @@ {"name": "moderator", "resource_type": "Topic"}, {"name": "admin", "resource_type": "Advert"}, {"name": "admin", "resource_type": "StaticPage"} - ] + ], + "pages": [] }