Add miscellaneous stuff
This commit is contained in:
@ -3,7 +3,6 @@ alias Outlook.HtmlPreparations.HtmlPreparation
|
|||||||
alias Outlook.InternalTree.{Html,InternalNode,TranslationUnit}
|
alias Outlook.InternalTree.{Html,InternalNode,TranslationUnit}
|
||||||
alias Outlook.InternalTree
|
alias Outlook.InternalTree
|
||||||
alias Outlook.Articles
|
alias Outlook.Articles
|
||||||
alias Outlook.Artikel
|
|
||||||
alias Outlook.Accounts
|
alias Outlook.Accounts
|
||||||
alias Outlook.Articles.Article
|
alias Outlook.Articles.Article
|
||||||
alias Outlook.Authors
|
alias Outlook.Authors
|
||||||
|
|||||||
@ -39,7 +39,7 @@ defmodule Outlook.Authors do
|
|||||||
|
|
||||||
def get_author_with_articles!(id) do
|
def get_author_with_articles!(id) do
|
||||||
Repo.get!(Author, id)
|
Repo.get!(Author, id)
|
||||||
|> Repo.preload([:articles])
|
|> Repo.preload([articles: :translations])
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
|
|||||||
@ -9,7 +9,7 @@ defmodule Outlook.Authors.Author do
|
|||||||
field :homepage_name, :string
|
field :homepage_name, :string
|
||||||
field :homepage_url, :string
|
field :homepage_url, :string
|
||||||
field :name, :string
|
field :name, :string
|
||||||
has_many :articles, Article
|
has_many :articles, Article, on_delete: :delete_all
|
||||||
|
|
||||||
timestamps()
|
timestamps()
|
||||||
end
|
end
|
||||||
|
|||||||
@ -54,10 +54,12 @@ defmodule Outlook.Translators.Deepl do
|
|||||||
)
|
)
|
||||||
response = Jason.decode!(response_raw.body, keys: :atoms)
|
response = Jason.decode!(response_raw.body, keys: :atoms)
|
||||||
|
|
||||||
|
require Logger
|
||||||
case response do
|
case response do
|
||||||
%{status: "done"} ->
|
%{status: "done"} ->
|
||||||
response
|
response
|
||||||
%{status: status} ->
|
%{status: status} ->
|
||||||
|
Logger.debug "Deepl response: #{response |> inspect}"
|
||||||
steps = Map.get(response, :seconds_remaining, 1) * 5
|
steps = Map.get(response, :seconds_remaining, 1) * 5
|
||||||
for n <- 0..steps do
|
for n <- 0..steps do
|
||||||
send(pid, {:progress, %{progress: 100 * n / steps, status: status}})
|
send(pid, {:progress, %{progress: 100 * n / steps, status: status}})
|
||||||
|
|||||||
@ -12,4 +12,10 @@ defmodule OutlookWeb.ViewHelpers do
|
|||||||
def tidy_raw(whatever) do
|
def tidy_raw(whatever) do
|
||||||
whatever
|
whatever
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# TODO: implement (and use) the following function
|
||||||
|
@doc "Strip <a> tags to prevent broken html (or 'breaking') from user input."
|
||||||
|
def strip_links(html) do
|
||||||
|
raise "Yet to be implemented!"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user