Add remarks field to translations
This commit is contained in:
@ -15,6 +15,7 @@ defmodule Outlook.Translations.Translation do
|
|||||||
field :public_content, :string
|
field :public_content, :string
|
||||||
field :title, :string
|
field :title, :string
|
||||||
field :unauthorized, :boolean, default: false
|
field :unauthorized, :boolean, default: false
|
||||||
|
field :remarks, :string
|
||||||
belongs_to :user, User
|
belongs_to :user, User
|
||||||
belongs_to :article, Article
|
belongs_to :article, Article
|
||||||
|
|
||||||
@ -24,7 +25,7 @@ defmodule Outlook.Translations.Translation do
|
|||||||
@doc false
|
@doc false
|
||||||
def changeset(translation, attrs) do
|
def changeset(translation, attrs) do
|
||||||
translation
|
translation
|
||||||
|> cast(attrs, [:language, :title, :teaser, :date, :public, :unauthorized, :article_id, :public_content])
|
|> cast(attrs, [:language, :title, :teaser, :date, :public, :unauthorized, :article_id, :public_content, :remarks])
|
||||||
|> cast(attrs, [:content])
|
|> cast(attrs, [:content])
|
||||||
|> validate_required([:language, :title, :content, :date, :public, :unauthorized, :article_id])
|
|> validate_required([:language, :title, :content, :date, :public, :unauthorized, :article_id])
|
||||||
|> unique_constraint([:language, :article_id],
|
|> unique_constraint([:language, :article_id],
|
||||||
|
|||||||
@ -32,6 +32,7 @@ defmodule OutlookWeb.TranslationLive.FormComponent do
|
|||||||
<.input field={{f, :public}} type="checkbox" label="public" />
|
<.input field={{f, :public}} type="checkbox" label="public" />
|
||||||
<.input field={{f, :unauthorized}} type="checkbox" label="unauthorized" />
|
<.input field={{f, :unauthorized}} type="checkbox" label="unauthorized" />
|
||||||
</div>
|
</div>
|
||||||
|
<.input field={{f, :remarks}} type="textarea" label="remarks" class="h-28" />
|
||||||
<input type="hidden" id="continue_edit" name="continue_edit" value="false" />
|
<input type="hidden" id="continue_edit" name="continue_edit" value="false" />
|
||||||
<input type="hidden" id="publish" name="publish" value="false" />
|
<input type="hidden" id="publish" name="publish" value="false" />
|
||||||
<:actions>
|
<:actions>
|
||||||
|
|||||||
@ -11,11 +11,12 @@
|
|||||||
<.list>
|
<.list>
|
||||||
<:item title="Language"><%= @translation.language %></:item>
|
<:item title="Language"><%= @translation.language %></:item>
|
||||||
<:item title="Title"><%= @translation.title %></:item>
|
<:item title="Title"><%= @translation.title %></:item>
|
||||||
<:item title="Teaser"><%= @translation.teaser %></:item>
|
<:item title="Teaser"><%= @translation.teaser |> tidy_raw %></:item>
|
||||||
<%!-- <:item title="Content"><%= @translation.content %></:item> --%>
|
<%!-- <:item title="Content"><%= @translation.content %></:item> --%>
|
||||||
<:item title="Date"><%= @translation.date %></:item>
|
<:item title="Date"><%= @translation.date %></:item>
|
||||||
<:item title="Public"><%= @translation.public %></:item>
|
<:item title="Public"><%= @translation.public %></:item>
|
||||||
<:item title="Unauthorized"><%= @translation.unauthorized %></:item>
|
<:item title="Unauthorized"><%= @translation.unauthorized %></:item>
|
||||||
|
<:item title="Remarks"><%= @translation.remarks |> tidy_raw %></:item>
|
||||||
</.list>
|
</.list>
|
||||||
|
|
||||||
<div class="article show_status">
|
<div class="article show_status">
|
||||||
|
|||||||
@ -0,0 +1,9 @@
|
|||||||
|
defmodule Outlook.Repo.Migrations.AddRemarksToTranslations do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
def change do
|
||||||
|
alter table(:translations) do
|
||||||
|
add :remarks, :text
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user