improve table information
This commit is contained in:
parent
c0df3440f5
commit
dcfd1b87df
@ -1,5 +1,6 @@
|
|||||||
# v0.1.1
|
# v0.1.1
|
||||||
- improve search a whole lot
|
- improve search a whole lot
|
||||||
|
- improve table information for notes and contexts
|
||||||
|
|
||||||
# v0.1.0
|
# v0.1.0
|
||||||
initial release >:3c
|
initial release >:3c
|
||||||
|
@ -4,7 +4,7 @@ defmodule MemexWeb.Components.ContextsTableComponent do
|
|||||||
"""
|
"""
|
||||||
use MemexWeb, :live_component
|
use MemexWeb, :live_component
|
||||||
alias Ecto.UUID
|
alias Ecto.UUID
|
||||||
alias Memex.{Accounts.User, Contexts, Contexts.Context}
|
alias Memex.{Accounts.User, Contexts.Context}
|
||||||
alias Phoenix.LiveView.{Rendered, Socket}
|
alias Phoenix.LiveView.{Rendered, Socket}
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
@ -45,7 +45,6 @@ defmodule MemexWeb.Components.ContextsTableComponent do
|
|||||||
|
|
||||||
columns = [
|
columns = [
|
||||||
%{label: gettext("slug"), key: :slug},
|
%{label: gettext("slug"), key: :slug},
|
||||||
%{label: gettext("content"), key: :content},
|
|
||||||
%{label: gettext("tags"), key: :tags},
|
%{label: gettext("tags"), key: :tags},
|
||||||
%{label: gettext("visibility"), key: :visibility}
|
%{label: gettext("visibility"), key: :visibility}
|
||||||
| columns
|
| columns
|
||||||
@ -105,20 +104,8 @@ defmodule MemexWeb.Components.ContextsTableComponent do
|
|||||||
{slug, slug_block}
|
{slug, slug_block}
|
||||||
end
|
end
|
||||||
|
|
||||||
defp get_value_for_key(:content, %{content: content}, _additional_data) do
|
|
||||||
assigns = %{content: content}
|
|
||||||
|
|
||||||
content_block = ~H"""
|
|
||||||
<div class="truncate max-w-sm">
|
|
||||||
<%= @content %>
|
|
||||||
</div>
|
|
||||||
"""
|
|
||||||
|
|
||||||
{content, content_block}
|
|
||||||
end
|
|
||||||
|
|
||||||
defp get_value_for_key(:tags, %{tags: tags}, _additional_data) do
|
defp get_value_for_key(:tags, %{tags: tags}, _additional_data) do
|
||||||
tags |> Contexts.get_tags_string()
|
tags |> Enum.join(", ")
|
||||||
end
|
end
|
||||||
|
|
||||||
defp get_value_for_key(:actions, context, %{actions: actions}) do
|
defp get_value_for_key(:actions, context, %{actions: actions}) do
|
||||||
|
@ -4,7 +4,7 @@ defmodule MemexWeb.Components.NotesTableComponent do
|
|||||||
"""
|
"""
|
||||||
use MemexWeb, :live_component
|
use MemexWeb, :live_component
|
||||||
alias Ecto.UUID
|
alias Ecto.UUID
|
||||||
alias Memex.{Accounts.User, Notes, Notes.Note}
|
alias Memex.{Accounts.User, Notes.Note}
|
||||||
alias Phoenix.LiveView.{Rendered, Socket}
|
alias Phoenix.LiveView.{Rendered, Socket}
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
@ -45,7 +45,6 @@ defmodule MemexWeb.Components.NotesTableComponent do
|
|||||||
|
|
||||||
columns = [
|
columns = [
|
||||||
%{label: gettext("slug"), key: :slug},
|
%{label: gettext("slug"), key: :slug},
|
||||||
%{label: gettext("content"), key: :content},
|
|
||||||
%{label: gettext("tags"), key: :tags},
|
%{label: gettext("tags"), key: :tags},
|
||||||
%{label: gettext("visibility"), key: :visibility}
|
%{label: gettext("visibility"), key: :visibility}
|
||||||
| columns
|
| columns
|
||||||
@ -105,20 +104,8 @@ defmodule MemexWeb.Components.NotesTableComponent do
|
|||||||
{slug, slug_block}
|
{slug, slug_block}
|
||||||
end
|
end
|
||||||
|
|
||||||
defp get_value_for_key(:content, %{content: content}, _additional_data) do
|
|
||||||
assigns = %{content: content}
|
|
||||||
|
|
||||||
content_block = ~H"""
|
|
||||||
<div class="truncate max-w-sm">
|
|
||||||
<%= @content %>
|
|
||||||
</div>
|
|
||||||
"""
|
|
||||||
|
|
||||||
{content, content_block}
|
|
||||||
end
|
|
||||||
|
|
||||||
defp get_value_for_key(:tags, %{tags: tags}, _additional_data) do
|
defp get_value_for_key(:tags, %{tags: tags}, _additional_data) do
|
||||||
tags |> Notes.get_tags_string()
|
tags |> Enum.join(", ")
|
||||||
end
|
end
|
||||||
|
|
||||||
defp get_value_for_key(:actions, note, %{actions: actions}) do
|
defp get_value_for_key(:actions, note, %{actions: actions}) do
|
||||||
|
@ -4,7 +4,7 @@ defmodule MemexWeb.Components.PipelinesTableComponent do
|
|||||||
"""
|
"""
|
||||||
use MemexWeb, :live_component
|
use MemexWeb, :live_component
|
||||||
alias Ecto.UUID
|
alias Ecto.UUID
|
||||||
alias Memex.{Accounts.User, Pipelines, Pipelines.Pipeline}
|
alias Memex.{Accounts.User, Pipelines.Pipeline}
|
||||||
alias Phoenix.LiveView.{Rendered, Socket}
|
alias Phoenix.LiveView.{Rendered, Socket}
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
@ -118,7 +118,7 @@ defmodule MemexWeb.Components.PipelinesTableComponent do
|
|||||||
end
|
end
|
||||||
|
|
||||||
defp get_value_for_key(:tags, %{tags: tags}, _additional_data) do
|
defp get_value_for_key(:tags, %{tags: tags}, _additional_data) do
|
||||||
tags |> Pipelines.get_tags_string()
|
tags |> Enum.join(", ")
|
||||||
end
|
end
|
||||||
|
|
||||||
defp get_value_for_key(:actions, pipeline, %{actions: actions}) do
|
defp get_value_for_key(:actions, pipeline, %{actions: actions}) do
|
||||||
|
@ -118,8 +118,6 @@ msgstr ""
|
|||||||
msgid "confirm new password"
|
msgid "confirm new password"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/components/contexts_table_component.ex:48
|
|
||||||
#: lib/memex_web/components/notes_table_component.ex:48
|
|
||||||
#: lib/memex_web/live/note_live/form_component.html.heex:23
|
#: lib/memex_web/live/note_live/form_component.html.heex:23
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "content"
|
msgid "content"
|
||||||
@ -349,8 +347,8 @@ msgstr ""
|
|||||||
msgid "tag1,tag2"
|
msgid "tag1,tag2"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/components/contexts_table_component.ex:49
|
#: lib/memex_web/components/contexts_table_component.ex:48
|
||||||
#: lib/memex_web/components/notes_table_component.ex:49
|
#: lib/memex_web/components/notes_table_component.ex:48
|
||||||
#: lib/memex_web/components/pipelines_table_component.ex:49
|
#: lib/memex_web/components/pipelines_table_component.ex:49
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "tags"
|
msgid "tags"
|
||||||
@ -381,8 +379,8 @@ msgstr ""
|
|||||||
msgid "view the source code"
|
msgid "view the source code"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/components/contexts_table_component.ex:50
|
#: lib/memex_web/components/contexts_table_component.ex:49
|
||||||
#: lib/memex_web/components/notes_table_component.ex:50
|
#: lib/memex_web/components/notes_table_component.ex:49
|
||||||
#: lib/memex_web/components/pipelines_table_component.ex:50
|
#: lib/memex_web/components/pipelines_table_component.ex:50
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "visibility"
|
msgid "visibility"
|
||||||
|
@ -107,8 +107,6 @@ msgstr ""
|
|||||||
msgid "confirm new password"
|
msgid "confirm new password"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/components/contexts_table_component.ex:48
|
|
||||||
#: lib/memex_web/components/notes_table_component.ex:48
|
|
||||||
#: lib/memex_web/live/note_live/form_component.html.heex:23
|
#: lib/memex_web/live/note_live/form_component.html.heex:23
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "content"
|
msgid "content"
|
||||||
@ -338,8 +336,8 @@ msgstr ""
|
|||||||
msgid "tag1,tag2"
|
msgid "tag1,tag2"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/components/contexts_table_component.ex:49
|
#: lib/memex_web/components/contexts_table_component.ex:48
|
||||||
#: lib/memex_web/components/notes_table_component.ex:49
|
#: lib/memex_web/components/notes_table_component.ex:48
|
||||||
#: lib/memex_web/components/pipelines_table_component.ex:49
|
#: lib/memex_web/components/pipelines_table_component.ex:49
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "tags"
|
msgid "tags"
|
||||||
@ -370,8 +368,8 @@ msgstr ""
|
|||||||
msgid "view the source code"
|
msgid "view the source code"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/components/contexts_table_component.ex:50
|
#: lib/memex_web/components/contexts_table_component.ex:49
|
||||||
#: lib/memex_web/components/notes_table_component.ex:50
|
#: lib/memex_web/components/notes_table_component.ex:49
|
||||||
#: lib/memex_web/components/pipelines_table_component.ex:50
|
#: lib/memex_web/components/pipelines_table_component.ex:50
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "visibility"
|
msgid "visibility"
|
||||||
|
@ -34,7 +34,7 @@ defmodule MemexWeb.ContextLiveTest do
|
|||||||
{:ok, _index_live, html} = live(conn, Routes.context_index_path(conn, :index))
|
{:ok, _index_live, html} = live(conn, Routes.context_index_path(conn, :index))
|
||||||
|
|
||||||
assert html =~ "contexts"
|
assert html =~ "contexts"
|
||||||
assert html =~ context.content
|
assert html =~ context.slug
|
||||||
end
|
end
|
||||||
|
|
||||||
test "saves new context", %{conn: conn} do
|
test "saves new context", %{conn: conn} do
|
||||||
@ -56,7 +56,7 @@ defmodule MemexWeb.ContextLiveTest do
|
|||||||
|> follow_redirect(conn, Routes.context_index_path(conn, :index))
|
|> follow_redirect(conn, Routes.context_index_path(conn, :index))
|
||||||
|
|
||||||
assert html =~ "#{@create_attrs |> Map.get("slug")} created"
|
assert html =~ "#{@create_attrs |> Map.get("slug")} created"
|
||||||
assert html =~ "some content"
|
assert html =~ "some-slug"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "updates context in listing", %{conn: conn, context: context} do
|
test "updates context in listing", %{conn: conn, context: context} do
|
||||||
@ -78,7 +78,7 @@ defmodule MemexWeb.ContextLiveTest do
|
|||||||
|> follow_redirect(conn, Routes.context_index_path(conn, :index))
|
|> follow_redirect(conn, Routes.context_index_path(conn, :index))
|
||||||
|
|
||||||
assert html =~ "#{@update_attrs |> Map.get("slug")} saved"
|
assert html =~ "#{@update_attrs |> Map.get("slug")} saved"
|
||||||
assert html =~ "some updated content"
|
assert html =~ "some-updated-slug"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "deletes context in listing", %{conn: conn, context: context} do
|
test "deletes context in listing", %{conn: conn, context: context} do
|
||||||
@ -96,7 +96,7 @@ defmodule MemexWeb.ContextLiveTest do
|
|||||||
{:ok, _show_live, html} = live(conn, Routes.context_show_path(conn, :show, context.slug))
|
{:ok, _show_live, html} = live(conn, Routes.context_show_path(conn, :show, context.slug))
|
||||||
|
|
||||||
assert html =~ "context"
|
assert html =~ "context"
|
||||||
assert html =~ context.content
|
assert html =~ context.slug
|
||||||
end
|
end
|
||||||
|
|
||||||
test "updates context within modal", %{conn: conn, context: context} do
|
test "updates context within modal", %{conn: conn, context: context} do
|
||||||
@ -117,7 +117,7 @@ defmodule MemexWeb.ContextLiveTest do
|
|||||||
|> follow_redirect(conn, Routes.context_show_path(conn, :show, context.slug))
|
|> follow_redirect(conn, Routes.context_show_path(conn, :show, context.slug))
|
||||||
|
|
||||||
assert html =~ "#{context.slug} saved"
|
assert html =~ "#{context.slug} saved"
|
||||||
assert html =~ "some updated content"
|
assert html =~ "tag2"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "deletes context", %{conn: conn, context: context} do
|
test "deletes context", %{conn: conn, context: context} do
|
||||||
|
@ -34,7 +34,7 @@ defmodule MemexWeb.NoteLiveTest do
|
|||||||
{:ok, _index_live, html} = live(conn, Routes.note_index_path(conn, :index))
|
{:ok, _index_live, html} = live(conn, Routes.note_index_path(conn, :index))
|
||||||
|
|
||||||
assert html =~ "notes"
|
assert html =~ "notes"
|
||||||
assert html =~ note.content
|
assert html =~ note.slug
|
||||||
end
|
end
|
||||||
|
|
||||||
test "saves new note", %{conn: conn} do
|
test "saves new note", %{conn: conn} do
|
||||||
@ -56,7 +56,7 @@ defmodule MemexWeb.NoteLiveTest do
|
|||||||
|> follow_redirect(conn, Routes.note_index_path(conn, :index))
|
|> follow_redirect(conn, Routes.note_index_path(conn, :index))
|
||||||
|
|
||||||
assert html =~ "#{@create_attrs |> Map.get("slug")} created"
|
assert html =~ "#{@create_attrs |> Map.get("slug")} created"
|
||||||
assert html =~ "some content"
|
assert html =~ "some-slug"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "updates note in listing", %{conn: conn, note: note} do
|
test "updates note in listing", %{conn: conn, note: note} do
|
||||||
@ -78,7 +78,7 @@ defmodule MemexWeb.NoteLiveTest do
|
|||||||
|> follow_redirect(conn, Routes.note_index_path(conn, :index))
|
|> follow_redirect(conn, Routes.note_index_path(conn, :index))
|
||||||
|
|
||||||
assert html =~ "#{@update_attrs |> Map.get("slug")} saved"
|
assert html =~ "#{@update_attrs |> Map.get("slug")} saved"
|
||||||
assert html =~ "some updated content"
|
assert html =~ "some-updated-slug"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "deletes note in listing", %{conn: conn, note: note} do
|
test "deletes note in listing", %{conn: conn, note: note} do
|
||||||
@ -96,7 +96,7 @@ defmodule MemexWeb.NoteLiveTest do
|
|||||||
{:ok, _show_live, html} = live(conn, Routes.note_show_path(conn, :show, note.slug))
|
{:ok, _show_live, html} = live(conn, Routes.note_show_path(conn, :show, note.slug))
|
||||||
|
|
||||||
assert html =~ "note"
|
assert html =~ "note"
|
||||||
assert html =~ note.content
|
assert html =~ note.slug
|
||||||
end
|
end
|
||||||
|
|
||||||
test "updates note within modal", %{conn: conn, note: note} do
|
test "updates note within modal", %{conn: conn, note: note} do
|
||||||
@ -117,7 +117,7 @@ defmodule MemexWeb.NoteLiveTest do
|
|||||||
|> follow_redirect(conn, Routes.note_show_path(conn, :show, note.slug))
|
|> follow_redirect(conn, Routes.note_show_path(conn, :show, note.slug))
|
||||||
|
|
||||||
assert html =~ "#{note.slug} saved"
|
assert html =~ "#{note.slug} saved"
|
||||||
assert html =~ "some updated content"
|
assert html =~ "tag2"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "deletes note", %{conn: conn, note: note} do
|
test "deletes note", %{conn: conn, note: note} do
|
||||||
|
Loading…
Reference in New Issue
Block a user