mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
misc fixes
This commit is contained in:
parent
b56485f13a
commit
da16bd48d8
2 changed files with 6 additions and 4 deletions
|
@ -6,12 +6,12 @@ defmodule PhilomenaWeb.Page.HistoryController do
|
|||
alias Philomena.Repo
|
||||
import Ecto.Query
|
||||
|
||||
plug :load_resource, model: StaticPage, id_field: "slug", persisted: true
|
||||
plug :load_resource, model: StaticPage, id_name: "page_id", nid_field: "slug", persisted: true
|
||||
|
||||
def index(conn, _params) do
|
||||
page = conn.assigns.static_page
|
||||
|
||||
versions =
|
||||
{versions, _last_body} =
|
||||
Version
|
||||
|> where(static_page_id: ^page.id)
|
||||
|> preload(:user)
|
||||
|
@ -26,7 +26,7 @@ defmodule PhilomenaWeb.Page.HistoryController do
|
|||
Enum.map_reduce(pages, current_body, fn page, previous_body ->
|
||||
difference = List.myers_difference(split(previous_body), split(page.body))
|
||||
|
||||
%{page | difference: difference}
|
||||
{%{page | difference: difference}, page.body}
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
|
@ -214,7 +214,9 @@ defmodule PhilomenaWeb.Router do
|
|||
resources "/reports", Gallery.ReportController, only: [:new, :create]
|
||||
end
|
||||
resources "/adverts", AdvertController, only: [:show]
|
||||
resources "/pages", PageController, only: [:show]
|
||||
resources "/pages", PageController, only: [:show] do
|
||||
resources "/history", Page.HistoryController, only: [:index]
|
||||
end
|
||||
resources "/dnp", DnpEntryController, only: [:index, :show]
|
||||
resources "/staff", StaffController, only: [:index]
|
||||
resources "/stats", StatController, only: [:index]
|
||||
|
|
Loading…
Reference in a new issue