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
|
||||
alias Outlook.Articles
|
||||
alias Outlook.Artikel
|
||||
alias Outlook.Accounts
|
||||
alias Outlook.Articles.Article
|
||||
alias Outlook.Authors
|
||||
|
||||
@ -39,7 +39,7 @@ defmodule Outlook.Authors do
|
||||
|
||||
def get_author_with_articles!(id) do
|
||||
Repo.get!(Author, id)
|
||||
|> Repo.preload([:articles])
|
||||
|> Repo.preload([articles: :translations])
|
||||
end
|
||||
|
||||
@doc """
|
||||
|
||||
@ -9,7 +9,7 @@ defmodule Outlook.Authors.Author do
|
||||
field :homepage_name, :string
|
||||
field :homepage_url, :string
|
||||
field :name, :string
|
||||
has_many :articles, Article
|
||||
has_many :articles, Article, on_delete: :delete_all
|
||||
|
||||
timestamps()
|
||||
end
|
||||
|
||||
@ -54,10 +54,12 @@ defmodule Outlook.Translators.Deepl do
|
||||
)
|
||||
response = Jason.decode!(response_raw.body, keys: :atoms)
|
||||
|
||||
require Logger
|
||||
case response do
|
||||
%{status: "done"} ->
|
||||
response
|
||||
%{status: status} ->
|
||||
Logger.debug "Deepl response: #{response |> inspect}"
|
||||
steps = Map.get(response, :seconds_remaining, 1) * 5
|
||||
for n <- 0..steps do
|
||||
send(pid, {:progress, %{progress: 100 * n / steps, status: status}})
|
||||
|
||||
@ -12,4 +12,10 @@ defmodule OutlookWeb.ViewHelpers do
|
||||
def tidy_raw(whatever) do
|
||||
whatever
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user