Replace uuids with "nanoid"s
This commit is contained in:
@ -19,7 +19,7 @@ defmodule OutlookWeb.HtmlDocComponent do
|
||||
|
||||
def dnode(%{node: %{status: status}} = assigns) do
|
||||
~H"""
|
||||
<.dynamic_tag name="span" class="tunit" uuid={@node.uuid} {Map.get(@node.eph, :attributes, %{})}>
|
||||
<.dynamic_tag name="span" class="tunit" nid={@node.nid} {Map.get(@node.eph, :attributes, %{})}>
|
||||
<%= @node.content |> raw %>
|
||||
</.dynamic_tag>
|
||||
"""
|
||||
@ -27,7 +27,7 @@ defmodule OutlookWeb.HtmlDocComponent do
|
||||
|
||||
def dnode(assigns) when assigns.node.type == :element do
|
||||
~H"""
|
||||
<.dynamic_tag name={@node.name} uuid={@node.uuid} {Map.get(@node.eph, :attributes, %{})}>
|
||||
<.dynamic_tag name={@node.name} nid={@node.nid} {Map.get(@node.eph, :attributes, %{})}>
|
||||
<%= for child_node <- @node.content do %>
|
||||
<.dnode node={child_node} />
|
||||
<% end %>
|
||||
|
||||
@ -33,7 +33,7 @@ defmodule OutlookWeb.HtmlTreeComponent do
|
||||
|
||||
def tree_element(assigns) do
|
||||
~H"""
|
||||
<div uuid={@node.uuid} phx-click={JS.push("select", value: %{uuid: @node.uuid})}>
|
||||
<div nid={@node.nid} phx-click={JS.push("select", value: %{nid: @node.nid})}>
|
||||
<%= "#{String.duplicate(" ", @level)}<#{@node.name}>" %>
|
||||
</div>
|
||||
"""
|
||||
@ -41,7 +41,7 @@ defmodule OutlookWeb.HtmlTreeComponent do
|
||||
|
||||
def tree_text(assigns) do
|
||||
~H"""
|
||||
<div uuid={@node.uuid} phx-click={JS.push("select", value: %{uuid: @node.uuid})}>
|
||||
<div nid={@node.nid} phx-click={JS.push("select", value: %{nid: @node.nid})}>
|
||||
<%= "#{String.duplicate(" ", @level)}\"#{String.slice(@node.content, 0, 15)}...\"\n" %>
|
||||
</div>
|
||||
"""
|
||||
@ -49,7 +49,7 @@ defmodule OutlookWeb.HtmlTreeComponent do
|
||||
|
||||
def tree_comment(assigns) do
|
||||
~H"""
|
||||
<div uuid={@node.uuid} phx-click={JS.push("select", value: %{uuid: @node.uuid})} title={@node.content}>
|
||||
<div nid={@node.nid} phx-click={JS.push("select", value: %{nid: @node.nid})} title={@node.content}>
|
||||
<%= "#{String.duplicate(" ", @level)}<!-- #{String.slice(@node.content, 0, 15)}...-->\n" %>
|
||||
</div>
|
||||
"""
|
||||
|
||||
@ -105,11 +105,11 @@ defmodule OutlookWeb.TranslationLive.FormComponent do
|
||||
{:noreply, socket |> assign(:current_tunit, tunit)}
|
||||
end
|
||||
|
||||
def handle_event("select_current_tunit", %{"uuid" => uuid}, socket) do
|
||||
def handle_event("select_current_tunit", %{"nid" => nid}, socket) do
|
||||
{:noreply,
|
||||
socket
|
||||
|> update_translation_with_current_tunit(socket.assigns.current_tunit.status)
|
||||
|> assign(:current_tunit, socket.assigns.translation_content[uuid])}
|
||||
|> assign(:current_tunit, socket.assigns.translation_content[nid])}
|
||||
end
|
||||
|
||||
@doc "updating on browser events"
|
||||
@ -124,7 +124,7 @@ defmodule OutlookWeb.TranslationLive.FormComponent do
|
||||
defp update_current_tunit(socket, _) do
|
||||
assign(socket,
|
||||
:current_tunit,
|
||||
socket.assigns.translation_content[socket.assigns.current_tunit.uuid])
|
||||
socket.assigns.translation_content[socket.assigns.current_tunit.nid])
|
||||
end
|
||||
|
||||
defp assign_article_tree(socket, translation) do
|
||||
@ -140,7 +140,7 @@ defmodule OutlookWeb.TranslationLive.FormComponent do
|
||||
socket
|
||||
|> assign(:translation_content,
|
||||
socket.assigns.translation_content
|
||||
|> Map.put(socket.assigns.current_tunit.uuid, socket.assigns.current_tunit))
|
||||
|> Map.put(socket.assigns.current_tunit.nid, socket.assigns.current_tunit))
|
||||
end
|
||||
|
||||
defp save_translation(socket, :edit, translation_params) do
|
||||
|
||||
Reference in New Issue
Block a user