Merge branch 'master' of gitlab.com:mythic-insight/legendary
This commit is contained in:
commit
a8b4dd2dca
5 changed files with 6 additions and 6 deletions
|
@ -36,7 +36,7 @@ defmodule Legendary.Content.Sitemaps do
|
||||||
if page_count > 1 do
|
if page_count > 1 do
|
||||||
(2..page_count)
|
(2..page_count)
|
||||||
|> Enum.each(fn page ->
|
|> Enum.each(fn page ->
|
||||||
add Helpers.paged_post_path(Endpoint, :show, post, page), priority: 0.5, changefreq: "hourly", expires: nil
|
add Helpers.posts_path(Endpoint, :show, post, page: page), priority: 0.5, changefreq: "hourly", expires: nil
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -68,7 +68,7 @@ defmodule Legendary.Content.PostsController do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
def show(conn, %{"id" => id, "page" => page_string}) when is_list(id) do
|
def show(conn, %{"id" => id, "page" => page_string}) when is_list(id) do
|
||||||
show(conn, %{"id" => Enum.join(id, "/"), "page" => "1"})
|
show(conn, %{"id" => Enum.join(id, "/"), "page" => page_string})
|
||||||
end
|
end
|
||||||
def show(conn, %{"id" => id}), do: show(conn, %{"id" => id, "page" => "1"})
|
def show(conn, %{"id" => id}), do: show(conn, %{"id" => id, "page" => "1"})
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,8 @@ defmodule Legendary.Content.Routes do
|
||||||
post "/wp-login.php", PostPasswordController, :create
|
post "/wp-login.php", PostPasswordController, :create
|
||||||
get "/", PostsController, :index
|
get "/", PostsController, :index
|
||||||
resources "/sitemap", SitemapController, only: [:index]
|
resources "/sitemap", SitemapController, only: [:index]
|
||||||
get "/*id", PostsController, :show
|
get "/:id", PostsController, :show
|
||||||
get "/:id/:page", PostsController, :show, as: :paged_post
|
get "/*id", PostsController, :show, as: :nested_posts
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
1..Legendary.Content.Post.content_page_count(@post),
|
1..Legendary.Content.Post.content_page_count(@post),
|
||||||
fn page ->
|
fn page ->
|
||||||
if assigns[:current_page] == nil || assigns[:current_page] != page do
|
if assigns[:current_page] == nil || assigns[:current_page] != page do
|
||||||
link page, to: Routes.paged_post_path(@conn, :show, @post, page)
|
link page, to: Routes.posts_path(@conn, :show, @post, page: page)
|
||||||
else
|
else
|
||||||
content_tag :span, page, class: "paginator-page"
|
content_tag :span, page, class: "paginator-page"
|
||||||
end
|
end
|
||||||
|
|
|
@ -154,7 +154,7 @@ defmodule Legendary.Content.PostsControllerTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
test "shows the post with pagination", %{conn: conn, posts: posts} do
|
test "shows the post with pagination", %{conn: conn, posts: posts} do
|
||||||
conn = get conn, Routes.paged_post_path(conn, :show, posts, "2")
|
conn = get conn, Routes.posts_path(conn, :show, posts, page: "2")
|
||||||
|
|
||||||
assert html_response(conn, 200) =~ posts.title
|
assert html_response(conn, 200) =~ posts.title
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue