Update the code format for components and LiveViews.
continuous-integration/drone/push Build is failing
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -30,19 +30,11 @@ defmodule DecentralisedBookIndexWeb.AuthorLive.Index do
|
||||
<% else %>
|
||||
<div class="flex flex-wrap flex-[3_1_auto]">
|
||||
<%= for author <- @page.results do %>
|
||||
<.author_card
|
||||
author={author}
|
||||
current_user={@current_user}
|
||||
/>
|
||||
<.author_card author={author} current_user={@current_user} />
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<.pagination
|
||||
endpoint={~p"/authors"}
|
||||
page={@page}
|
||||
page_params={@page_params}
|
||||
params={@params}
|
||||
/>
|
||||
<.pagination endpoint={~p"/authors"} page={@page} page_params={@page_params} params={@params} />
|
||||
<% end %>
|
||||
"""
|
||||
end
|
||||
|
||||
@@ -108,7 +108,10 @@ defmodule DecentralisedBookIndexWeb.AuthorLive.Show do
|
||||
@impl true
|
||||
def handle_params(%{"id" => id}, _, socket) do
|
||||
author =
|
||||
Ash.get!(DecentralisedBookIndex.Metadata.Author, id, load: [:dbi_server], actor: socket.assigns.current_user)
|
||||
Ash.get!(DecentralisedBookIndex.Metadata.Author, id,
|
||||
load: [:dbi_server],
|
||||
actor: socket.assigns.current_user
|
||||
)
|
||||
|
||||
alternative_names = DecentralisedBookIndex.Metadata.get_author_alternative_names!(author)
|
||||
|
||||
|
||||
@@ -21,19 +21,11 @@ defmodule DecentralisedBookIndexWeb.BookLive.FormComponent do
|
||||
<%= if @form.source.type == :create do %>
|
||||
<.input field={@form[:title]} type="text" label="Title" />
|
||||
<.input field={@form[:cover_image_url]} type="text" label="Cover image url" />
|
||||
<.input
|
||||
field={@form[:description]}
|
||||
type="textarea"
|
||||
label="Description"
|
||||
/>
|
||||
<.input field={@form[:description]} type="textarea" label="Description" />
|
||||
<.bids_inputs form={@form} myself={@myself} />
|
||||
<.author_roles_inputs form={@form} myself={@myself} notify_component={@myself} />
|
||||
<.input field={@form[:format]} type="text" label="Format" />
|
||||
<.input
|
||||
field={@form[:language]}
|
||||
type="text"
|
||||
label="Language"
|
||||
/>
|
||||
<.input field={@form[:language]} type="text" label="Language" />
|
||||
<.input field={@form[:page_count]} type="number" label="Page count" />
|
||||
<div>
|
||||
<.input field={@form[:publisher_id]} type="text" label="Publisher" type="hidden" show_errors?={false} />
|
||||
@@ -48,19 +40,11 @@ defmodule DecentralisedBookIndexWeb.BookLive.FormComponent do
|
||||
<%= if @form.source.type == :update do %>
|
||||
<.input field={@form[:title]} type="text" label="Title" />
|
||||
<.input field={@form[:cover_image_url]} type="text" label="Cover image url" />
|
||||
<.input
|
||||
field={@form[:description]}
|
||||
type="textarea"
|
||||
label="Description"
|
||||
/>
|
||||
<.input field={@form[:description]} type="textarea" label="Description" />
|
||||
<.bids_inputs form={@form} myself={@myself} />
|
||||
<.author_roles_inputs form={@form} myself={@myself} notify_component={@myself} />
|
||||
<.input field={@form[:format]} type="text" label="Format" />
|
||||
<.input
|
||||
field={@form[:language]}
|
||||
type="text"
|
||||
label="Language"
|
||||
/>
|
||||
<.input field={@form[:language]} type="text" label="Language" />
|
||||
<.input field={@form[:page_count]} type="number" label="Page count" />
|
||||
<div>
|
||||
<.input field={@form[:publisher_id]} type="text" label="Publisher" type="hidden" show_errors?={false} />
|
||||
@@ -181,8 +165,20 @@ defmodule DecentralisedBookIndexWeb.BookLive.FormComponent do
|
||||
size="xs"
|
||||
inverse
|
||||
>
|
||||
<svg class="w-6 h-6 text-gray-800 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24">
|
||||
<path fill-rule="evenodd" d="M8.586 2.586A2 2 0 0 1 10 2h4a2 2 0 0 1 2 2v2h3a1 1 0 1 1 0 2v12a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V8a1 1 0 0 1 0-2h3V4a2 2 0 0 1 .586-1.414ZM10 6h4V4h-4v2Zm1 4a1 1 0 1 0-2 0v8a1 1 0 1 0 2 0v-8Zm4 0a1 1 0 1 0-2 0v8a1 1 0 1 0 2 0v-8Z" clip-rule="evenodd"/>
|
||||
<svg
|
||||
class="w-6 h-6 text-gray-800 dark:text-white"
|
||||
aria-hidden="true"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
fill="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
d="M8.586 2.586A2 2 0 0 1 10 2h4a2 2 0 0 1 2 2v2h3a1 1 0 1 1 0 2v12a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V8a1 1 0 0 1 0-2h3V4a2 2 0 0 1 .586-1.414ZM10 6h4V4h-4v2Zm1 4a1 1 0 1 0-2 0v8a1 1 0 1 0 2 0v-8Zm4 0a1 1 0 1 0-2 0v8a1 1 0 1 0 2 0v-8Z"
|
||||
clip-rule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
</.button_link>
|
||||
</td>
|
||||
@@ -285,8 +281,20 @@ defmodule DecentralisedBookIndexWeb.BookLive.FormComponent do
|
||||
size="xs"
|
||||
inverse
|
||||
>
|
||||
<svg class="w-6 h-6 text-gray-800 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24">
|
||||
<path fill-rule="evenodd" d="M8.586 2.586A2 2 0 0 1 10 2h4a2 2 0 0 1 2 2v2h3a1 1 0 1 1 0 2v12a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V8a1 1 0 0 1 0-2h3V4a2 2 0 0 1 .586-1.414ZM10 6h4V4h-4v2Zm1 4a1 1 0 1 0-2 0v8a1 1 0 1 0 2 0v-8Zm4 0a1 1 0 1 0-2 0v8a1 1 0 1 0 2 0v-8Z" clip-rule="evenodd"/>
|
||||
<svg
|
||||
class="w-6 h-6 text-gray-800 dark:text-white"
|
||||
aria-hidden="true"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
fill="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
d="M8.586 2.586A2 2 0 0 1 10 2h4a2 2 0 0 1 2 2v2h3a1 1 0 1 1 0 2v12a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V8a1 1 0 0 1 0-2h3V4a2 2 0 0 1 .586-1.414ZM10 6h4V4h-4v2Zm1 4a1 1 0 1 0-2 0v8a1 1 0 1 0 2 0v-8Zm4 0a1 1 0 1 0-2 0v8a1 1 0 1 0 2 0v-8Z"
|
||||
clip-rule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
</.button_link>
|
||||
</td>
|
||||
|
||||
@@ -30,19 +30,11 @@ defmodule DecentralisedBookIndexWeb.BookLive.Index do
|
||||
<% else %>
|
||||
<div class="flex flex-wrap flex-[3_1_auto]">
|
||||
<%= for book <- @page.results do %>
|
||||
<.book_card
|
||||
book={book}
|
||||
current_user={@current_user}
|
||||
/>
|
||||
<.book_card book={book} current_user={@current_user} />
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<.pagination
|
||||
endpoint={~p"/books"}
|
||||
page={@page}
|
||||
page_params={@page_params}
|
||||
params={@params}
|
||||
/>
|
||||
<.pagination endpoint={~p"/books"} page={@page} page_params={@page_params} params={@params} />
|
||||
<% end %>
|
||||
|
||||
<.modal :if={@live_action in [:new, :edit]} id="book-modal" show on_cancel={JS.patch(~p"/books")}>
|
||||
|
||||
@@ -33,11 +33,27 @@ defmodule DecentralisedBookIndexWeb.BookLive.Show do
|
||||
|
||||
<div class="mb-4">
|
||||
<%= if @book.cover_image_url != nil do %>
|
||||
<img class="w-36 shadow-lg mt-14 mx-auto object-cover" src={@book.cover_image_url} alt={"#{@book.title} image"}/>
|
||||
<img
|
||||
class="w-36 shadow-lg mt-14 mx-auto object-cover"
|
||||
src={@book.cover_image_url}
|
||||
alt={"#{@book.title} image"}
|
||||
/>
|
||||
<% else %>
|
||||
<div class="relative w-36 h-36 overflow-hidden mt-14 mx-auto">
|
||||
<svg class="w-36 h-36 text-gray-800 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24">
|
||||
<path fill-rule="evenodd" d="M6 2a2 2 0 0 0-2 2v15a3 3 0 0 0 3 3h12a1 1 0 1 0 0-2h-2v-2h2a1 1 0 0 0 1-1V4a2 2 0 0 0-2-2h-8v16h5v2H7a1 1 0 1 1 0-2h1V2H6Z" clip-rule="evenodd"/>
|
||||
<svg
|
||||
class="w-36 h-36 text-gray-800 dark:text-white"
|
||||
aria-hidden="true"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
fill="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
d="M6 2a2 2 0 0 0-2 2v15a3 3 0 0 0 3 3h12a1 1 0 1 0 0-2h-2v-2h2a1 1 0 0 0 1-1V4a2 2 0 0 0-2-2h-8v16h5v2H7a1 1 0 1 1 0-2h1V2H6Z"
|
||||
clip-rule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -50,7 +66,9 @@ defmodule DecentralisedBookIndexWeb.BookLive.Show do
|
||||
</dl>
|
||||
<dl>
|
||||
<dt class="mb-2 font-semibold leading-none text-gray-900 dark:text-white">Publisher</dt>
|
||||
<dd class="mb-4 font-light text-gray-500 sm:mb-5 dark:text-gray-400">{@book.publisher.name}</dd>
|
||||
<dd class="mb-4 font-light text-gray-500 sm:mb-5 dark:text-gray-400">
|
||||
{@book.publisher.name}
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt class="mb-2 font-semibold leading-none text-gray-900 dark:text-white">Published</dt>
|
||||
@@ -71,7 +89,9 @@ defmodule DecentralisedBookIndexWeb.BookLive.Show do
|
||||
<dl>
|
||||
<dt class="mb-2 font-semibold leading-none text-gray-900 dark:text-white">Identifiers</dt>
|
||||
<%= for bid <- @book.bids do %>
|
||||
<dd class="mb-4 font-light text-gray-500 sm:mb-5 dark:text-gray-400">{bid.type}: {bid.bid}</dd>
|
||||
<dd class="mb-4 font-light text-gray-500 sm:mb-5 dark:text-gray-400">
|
||||
{bid.type}: {bid.bid}
|
||||
</dd>
|
||||
<% end %>
|
||||
</dl>
|
||||
<%= if not is_nil(@book.dbi_server) do %>
|
||||
@@ -96,10 +116,7 @@ defmodule DecentralisedBookIndexWeb.BookLive.Show do
|
||||
<h1 class="text-lg font-semibold leading-8 text-zinc-800 dark:text-white">Editions</h1>
|
||||
<div class="flex flex-wrap flex-[3_1_auto]">
|
||||
<%= for book <- @alternative_editions do %>
|
||||
<.book_card
|
||||
book={book}
|
||||
current_user={@current_user}
|
||||
/>
|
||||
<.book_card book={book} current_user={@current_user} />
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -73,12 +73,7 @@ defmodule DecentralisedBookIndexWeb.DbiServerLive.Index do
|
||||
</:action>
|
||||
</.table>
|
||||
|
||||
<.pagination
|
||||
endpoint={~p"/servers"}
|
||||
page={@page}
|
||||
page_params={@page_params}
|
||||
params={@params}
|
||||
/>
|
||||
<.pagination endpoint={~p"/servers"} page={@page} page_params={@page_params} params={@params} />
|
||||
</div>
|
||||
<% end %>
|
||||
"""
|
||||
@@ -87,7 +82,10 @@ defmodule DecentralisedBookIndexWeb.DbiServerLive.Index do
|
||||
@impl true
|
||||
def mount(_params, _session, socket) do
|
||||
if connected?(socket) do
|
||||
Phoenix.PubSub.subscribe(DecentralisedBookIndex.PubSub, DecentralisedBookIndex.SyncWorkerManual.topic())
|
||||
Phoenix.PubSub.subscribe(
|
||||
DecentralisedBookIndex.PubSub,
|
||||
DecentralisedBookIndex.SyncWorkerManual.topic()
|
||||
)
|
||||
end
|
||||
|
||||
{:ok,
|
||||
|
||||
@@ -27,7 +27,9 @@ defmodule DecentralisedBookIndexWeb.DbiServerLive.Show do
|
||||
</dl>
|
||||
<dl>
|
||||
<dt class="mb-2 font-semibold leading-none text-gray-900 dark:text-white">Sync on?</dt>
|
||||
<dd class="mb-4 font-light text-gray-500 sm:mb-5 dark:text-gray-400">{@dbi_server.sync_on?}</dd>
|
||||
<dd class="mb-4 font-light text-gray-500 sm:mb-5 dark:text-gray-400">
|
||||
{@dbi_server.sync_on?}
|
||||
</dd>
|
||||
</dl>
|
||||
<%= if not is_nil(@dbi_server.dbi_server) do %>
|
||||
<dl>
|
||||
@@ -57,7 +59,10 @@ defmodule DecentralisedBookIndexWeb.DbiServerLive.Show do
|
||||
|> assign(:page_title, page_title(socket.assigns.live_action))
|
||||
|> assign(
|
||||
:dbi_server,
|
||||
Ash.get!(DecentralisedBookIndex.Metadata.DBIServer, id, load: [:dbi_server], actor: socket.assigns.current_user)
|
||||
Ash.get!(DecentralisedBookIndex.Metadata.DBIServer, id,
|
||||
load: [:dbi_server],
|
||||
actor: socket.assigns.current_user
|
||||
)
|
||||
)}
|
||||
end
|
||||
|
||||
|
||||
@@ -57,7 +57,10 @@ defmodule DecentralisedBookIndexWeb.PublisherLive.Show do
|
||||
|> assign(:page_title, page_title(socket.assigns.live_action))
|
||||
|> assign(
|
||||
:publisher,
|
||||
Ash.get!(DecentralisedBookIndex.Metadata.Publisher, id, load: [:dbi_server], actor: socket.assigns.current_user)
|
||||
Ash.get!(DecentralisedBookIndex.Metadata.Publisher, id,
|
||||
load: [:dbi_server],
|
||||
actor: socket.assigns.current_user
|
||||
)
|
||||
)}
|
||||
end
|
||||
|
||||
|
||||
@@ -30,11 +30,7 @@ defmodule DecentralisedBookIndexWeb.UserLive.Index do
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="pt-2 flex flex-col gap-2">
|
||||
<.table
|
||||
id="users"
|
||||
rows={@users}
|
||||
row_click={fn user -> JS.navigate(~p"/users/#{user}") end}
|
||||
>
|
||||
<.table id="users" rows={@users} row_click={fn user -> JS.navigate(~p"/users/#{user}") end}>
|
||||
<:col :let={user} label="Email">{user.email}</:col>
|
||||
|
||||
<:col :let={user} label="Role">{user.role}</:col>
|
||||
@@ -48,12 +44,7 @@ defmodule DecentralisedBookIndexWeb.UserLive.Index do
|
||||
</:action>
|
||||
</.table>
|
||||
|
||||
<.pagination
|
||||
endpoint={~p"/servers"}
|
||||
page={@page}
|
||||
page_params={@page_params}
|
||||
params={@params}
|
||||
/>
|
||||
<.pagination endpoint={~p"/servers"} page={@page} page_params={@page_params} params={@params} />
|
||||
</div>
|
||||
<% end %>
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user