save and show identity icons as raw svg
This commit is contained in:
parent
0780a4c048
commit
ca2400c8f0
8 changed files with 20 additions and 7 deletions
|
@ -3,4 +3,7 @@
|
||||||
@import "tailwindcss/utilities";
|
@import "tailwindcss/utilities";
|
||||||
|
|
||||||
@import "./lolight.css";
|
@import "./lolight.css";
|
||||||
@import "./lightbox.css";
|
@import "./lightbox.css";
|
||||||
|
|
||||||
|
/* Set appropriate width for identity icons */
|
||||||
|
a[rel] svg { width: 1em; }
|
|
@ -6,7 +6,7 @@ defmodule Chiya.Identities.Identity do
|
||||||
field :name, :string
|
field :name, :string
|
||||||
field :url, :string
|
field :url, :string
|
||||||
field :rel, :string, default: "me"
|
field :rel, :string, default: "me"
|
||||||
field :icon, :string, default: "cube"
|
field :icon, :string, default: ""
|
||||||
|
|
||||||
field :public, :boolean, default: false
|
field :public, :boolean, default: false
|
||||||
field :active, :boolean, default: false
|
field :active, :boolean, default: false
|
||||||
|
|
|
@ -12,7 +12,7 @@ defmodule ChiyaWeb.CoreComponents do
|
||||||
|
|
||||||
alias Phoenix.LiveView.JS
|
alias Phoenix.LiveView.JS
|
||||||
import ChiyaWeb.Gettext
|
import ChiyaWeb.Gettext
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Renders a horizontal line
|
Renders a horizontal line
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<.input field={f[:url]} type="text" label="Url" />
|
<.input field={f[:url]} type="text" label="Url" />
|
||||||
<.input field={f[:public]} type="checkbox" label="Public" />
|
<.input field={f[:public]} type="checkbox" label="Public" />
|
||||||
<.input field={f[:active]} type="checkbox" label="Active" />
|
<.input field={f[:active]} type="checkbox" label="Active" />
|
||||||
<.input field={f[:icon]} type="text" label="Icon" />
|
<.input field={f[:icon]} type="textarea" label="Icon" />
|
||||||
<:actions>
|
<:actions>
|
||||||
<.button>Save Identity</.button>
|
<.button>Save Identity</.button>
|
||||||
</:actions>
|
</:actions>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
</.header>
|
</.header>
|
||||||
|
|
||||||
<.table id="identities" rows={@identities} row_click={&JS.navigate(~p"/admin/identities/#{&1}")}>
|
<.table id="identities" rows={@identities} row_click={&JS.navigate(~p"/admin/identities/#{&1}")}>
|
||||||
<:col :let={identity} label="Icon"><%= identity.icon %></:col>
|
<:col :let={identity} label="Icon"><%= raw identity.icon %></:col>
|
||||||
<:col :let={identity} label="Name"><%= identity.name %></:col>
|
<:col :let={identity} label="Name"><%= identity.name %></:col>
|
||||||
<:col :let={identity} label="Rel"><%= identity.rel %></:col>
|
<:col :let={identity} label="Rel"><%= identity.rel %></:col>
|
||||||
<:col :let={identity} label="Url"><%= identity.url %></:col>
|
<:col :let={identity} label="Url"><%= identity.url %></:col>
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<p class="mt-4 text-base leading-7 text-gray-600">
|
<p class="mt-4 text-base leading-7 text-gray-600">
|
||||||
<%= @settings.subtitle %>
|
<%= @settings.subtitle %>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="w-full mt-6 sm:w-auto">
|
<div class="w-full mt-6 sm:w-auto">
|
||||||
<div class="flex gap-4 text-sm leading-6 text-gray-700">
|
<div class="flex gap-4 text-sm leading-6 text-gray-700">
|
||||||
<%= for identity <- @identities do %>
|
<%= for identity <- @identities do %>
|
||||||
|
@ -16,7 +17,7 @@
|
||||||
target="_blank"
|
target="_blank"
|
||||||
class="group -mx-2 -my-0.5 inline-flex items-center gap-3 rounded-lg px-2 py-0.5 hover:bg-gray-50 hover:text-gray-900"
|
class="group -mx-2 -my-0.5 inline-flex items-center gap-3 rounded-lg px-2 py-0.5 hover:bg-gray-50 hover:text-gray-900"
|
||||||
>
|
>
|
||||||
<.icon name="hero-cube" />
|
<%= raw identity.icon %>
|
||||||
<%= identity.name %>
|
<%= identity.name %>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -12,4 +12,4 @@ defmodule Chiya.Repo.Migrations.CreateNoteImages do
|
||||||
|
|
||||||
create index(:note_images, [:note_id])
|
create index(:note_images, [:note_id])
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -0,0 +1,9 @@
|
||||||
|
defmodule Chiya.Repo.Migrations.ChangeIdentityIconToText do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
def change do
|
||||||
|
alter table(:identities) do
|
||||||
|
modify :icon, :text, from: :string
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue