Update the code format.
This commit is contained in:
@@ -12,14 +12,16 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents do
|
||||
import MyComponents.JustSearchResources, only: [just_search_resources: 1]
|
||||
|
||||
import MyComponents.Pagination, only: [pagination: 1]
|
||||
import MyComponents.Buttons, only: [
|
||||
success_button: 1,
|
||||
primary_button: 1,
|
||||
add_button: 1,
|
||||
save_button: 1,
|
||||
edit_button: 1,
|
||||
cancel_button: 1,
|
||||
]
|
||||
|
||||
import MyComponents.Buttons,
|
||||
only: [
|
||||
success_button: 1,
|
||||
primary_button: 1,
|
||||
add_button: 1,
|
||||
save_button: 1,
|
||||
edit_button: 1,
|
||||
cancel_button: 1
|
||||
]
|
||||
|
||||
alias MyComponents.SelectPublisher
|
||||
import MyComponents.SelectedPublisher, only: [selected_publisher: 1]
|
||||
|
||||
@@ -84,7 +84,7 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.Pagination do
|
||||
%{count: count, limit: limit} = pages
|
||||
|
||||
max_number =
|
||||
count/limit
|
||||
(count / limit)
|
||||
|> :math.ceil()
|
||||
|> Kernel.trunc()
|
||||
|
||||
@@ -94,7 +94,7 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.Pagination do
|
||||
defp get_current_page(pages) do
|
||||
%{offset: offset, limit: limit} = pages
|
||||
|
||||
Kernel.trunc(offset/limit) +1
|
||||
Kernel.trunc(offset / limit) + 1
|
||||
end
|
||||
|
||||
def page_params_which(page, params, which) do
|
||||
@@ -111,7 +111,7 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.Pagination do
|
||||
|
||||
def page_params_number(page_params, params, number) do
|
||||
limit = Keyword.get(page_params, :limit)
|
||||
offset = limit*(number-1)
|
||||
offset = limit * (number - 1)
|
||||
|
||||
params
|
||||
|> Map.put("limit", limit)
|
||||
|
||||
@@ -42,9 +42,9 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.SelectAuthor do
|
||||
|
||||
def handle_event("search", %{"query" => query}, socket) do
|
||||
{:noreply,
|
||||
socket
|
||||
|> assign(:author_query, query)
|
||||
|> search()}
|
||||
socket
|
||||
|> assign(:author_query, query)
|
||||
|> search()}
|
||||
end
|
||||
|
||||
defp search(socket) do
|
||||
|
||||
@@ -42,9 +42,9 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.SelectPublisher do
|
||||
|
||||
def handle_event("search", %{"query" => query}, socket) do
|
||||
{:noreply,
|
||||
socket
|
||||
|> assign(:publisher_query, query)
|
||||
|> search()}
|
||||
socket
|
||||
|> assign(:publisher_query, query)
|
||||
|> search()}
|
||||
end
|
||||
|
||||
defp search(socket) do
|
||||
|
||||
Reference in New Issue
Block a user