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