upgrade to phoenix 1.7
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-04-13 23:29:29 -04:00
parent a1c846be33
commit 63d854ffbe
116 changed files with 1156 additions and 1111 deletions

View File

@ -60,11 +60,11 @@ defmodule MemexWeb.ContextLive.Index do
end
def handle_event("search", %{"search" => %{"search_term" => ""}}, socket) do
{:noreply, socket |> push_patch(to: Routes.context_index_path(Endpoint, :index))}
{:noreply, socket |> push_patch(to: ~p"/contexts")}
end
def handle_event("search", %{"search" => %{"search_term" => search_term}}, socket) do
redirect_to = Routes.context_index_path(Endpoint, :search, search_term)
redirect_to = ~p"/contexts/#{search_term}"
{:noreply, socket |> push_patch(to: redirect_to)}
end

View File

@ -34,7 +34,7 @@
<:actions :let={context}>
<.link
:if={Contexts.is_owner?(context, @current_user)}
patch={Routes.context_index_path(@socket, :edit, context.slug)}
patch={~p"/contexts/#{context}/edit"}
aria-label={dgettext("actions", "edit %{context_slug}", context_slug: context.slug)}
>
<%= dgettext("actions", "edit") %>
@ -53,16 +53,12 @@
</.live_component>
<% end %>
<.link
:if={@current_user}
patch={Routes.context_index_path(@socket, :new)}
class="self-end btn btn-primary"
>
<.link :if={@current_user} patch={~p"/contexts/new"} class="self-end btn btn-primary">
<%= dgettext("actions", "new context") %>
</.link>
</div>
<.modal :if={@live_action in [:new, :edit]} return_to={Routes.context_index_path(@socket, :index)}>
<.modal :if={@live_action in [:new, :edit]} return_to={~p"/contexts"}>
<.live_component
module={MemexWeb.ContextLive.FormComponent}
id={@context.id || :new}
@ -70,6 +66,6 @@
title={@page_title}
action={@live_action}
context={@context}
return_to={Routes.context_index_path(@socket, :index)}
return_to={~p"/contexts"}
/>
</.modal>

View File

@ -38,7 +38,7 @@ defmodule MemexWeb.ContextLive.Show do
socket =
socket
|> put_flash(:info, gettext("%{slug} deleted", slug: slug))
|> push_navigate(to: Routes.context_index_path(Endpoint, :index))
|> push_navigate(to: ~p"/contexts")
{:noreply, socket}
end

View File

@ -4,11 +4,7 @@
</h1>
<div class="flex flex-wrap space-x-1">
<.link
:for={tag <- @context.tags}
navigate={Routes.context_index_path(Endpoint, :search, tag)}
class="link"
>
<.link :for={tag <- @context.tags} navigate={~p"/contexts/#{tag}"} class="link">
<%= tag %>
</.link>
</div>
@ -23,7 +19,7 @@
<.link
:if={Contexts.is_owner?(@context, @current_user)}
class="btn btn-primary"
patch={Routes.context_show_path(@socket, :edit, @context.slug)}
patch={~p"/context/#{@context}/edit"}
>
<%= dgettext("actions", "edit") %>
</.link>
@ -40,10 +36,7 @@
</div>
</div>
<.modal
:if={@live_action == :edit}
return_to={Routes.context_show_path(@socket, :show, @context.slug)}
>
<.modal :if={@live_action == :edit} return_to={~p"/context/#{@context}"}>
<.live_component
module={MemexWeb.ContextLive.FormComponent}
id={@context.id}
@ -51,6 +44,6 @@
title={@page_title}
action={@live_action}
context={@context}
return_to={Routes.context_show_path(@socket, :show, @context.slug)}
return_to={~p"/context/#{@context}"}
/>
</.modal>

View File

@ -5,7 +5,6 @@ defmodule MemexWeb.HomeLive do
use MemexWeb, :live_view
alias Memex.Accounts
alias MemexWeb.FaqLive
@version Mix.Project.config()[:version]

View File

@ -32,7 +32,7 @@
</li>
<li class="flex flex-col justify-center items-center text-right space-y-2">
<.link navigate={Routes.live_path(Endpoint, FaqLive)} class="btn btn-primary">
<.link navigate={~p"/faq"} class="btn btn-primary">
<%= gettext("read more on how to use memEx") %>
</.link>
</li>
@ -86,7 +86,7 @@
</b>
<p class="flex flex-col justify-center items-center space-y-2">
<%= if @admins |> Enum.empty?() do %>
<.link href={Routes.user_registration_path(Endpoint, :new)} class="link">
<.link href={~p"/users/register"} class="link">
<%= dgettext("prompts", "register to setup memEx") %>
</.link>
<% else %>

View File

@ -8,7 +8,7 @@
<%= gettext("no invites 😔") %>
</h1>
<.link patch={Routes.invite_index_path(Endpoint, :new)} class="btn btn-primary">
<.link patch={~p"/invites"} class="btn btn-primary">
<%= dgettext("actions", "invite someone new!") %>
</.link>
<% end %>
@ -35,7 +35,7 @@
</form>
</:code_actions>
<.link
patch={Routes.invite_index_path(Endpoint, :edit, invite)}
patch={~p"/invites/#{invite}/edit"}
class="text-primary-400 link"
aria-label={
dgettext("actions", "edit invite for %{invite_name}", invite_name: invite.name)
@ -86,11 +86,7 @@
</.link>
</.invite_card>
<.link
:if={@invites != []}
patch={Routes.invite_index_path(Endpoint, :new)}
class="btn btn-primary ml-auto"
>
<.link :if={@invites != []} patch={~p"/invites/new"} class="btn btn-primary ml-auto">
<%= dgettext("actions", "create invite") %>
</.link>
</div>
@ -152,14 +148,14 @@
<% end %>
</div>
<.modal :if={@live_action in [:new, :edit]} return_to={Routes.invite_index_path(Endpoint, :index)}>
<.modal :if={@live_action in [:new, :edit]} return_to={~p"/invites"}>
<.live_component
module={MemexWeb.InviteLive.FormComponent}
id={@invite.id || :new}
title={@page_title}
action={@live_action}
invite={@invite}
return_to={Routes.invite_index_path(Endpoint, :index)}
return_to={~p"/invites"}
current_user={@current_user}
/>
</.modal>

View File

@ -60,11 +60,11 @@ defmodule MemexWeb.NoteLive.Index do
end
def handle_event("search", %{"search" => %{"search_term" => ""}}, socket) do
{:noreply, socket |> push_patch(to: Routes.note_index_path(Endpoint, :index))}
{:noreply, socket |> push_patch(to: ~p"/notes")}
end
def handle_event("search", %{"search" => %{"search_term" => search_term}}, socket) do
{:noreply, socket |> push_patch(to: Routes.note_index_path(Endpoint, :search, search_term))}
{:noreply, socket |> push_patch(to: ~p"/notes/#{search_term}")}
end
defp display_notes(%{assigns: %{current_user: current_user, search: search}} = socket)

View File

@ -34,7 +34,7 @@
<:actions :let={note}>
<.link
:if={Notes.is_owner?(note, @current_user)}
patch={Routes.note_index_path(@socket, :edit, note.slug)}
patch={~p"/notes/#{note}/edit"}
aria-label={dgettext("actions", "edit %{note_slug}", note_slug: note.slug)}
>
<%= dgettext("actions", "edit") %>
@ -53,16 +53,12 @@
</.live_component>
<% end %>
<.link
:if={@current_user}
patch={Routes.note_index_path(@socket, :new)}
class="self-end btn btn-primary"
>
<.link :if={@current_user} patch={~p"/notes/new"} class="self-end btn btn-primary">
<%= dgettext("actions", "new note") %>
</.link>
</div>
<.modal :if={@live_action in [:new, :edit]} return_to={Routes.note_index_path(@socket, :index)}>
<.modal :if={@live_action in [:new, :edit]} return_to={~p"/notes"}>
<.live_component
module={MemexWeb.NoteLive.FormComponent}
id={@note.id || :new}
@ -70,6 +66,6 @@
title={@page_title}
action={@live_action}
note={@note}
return_to={Routes.note_index_path(@socket, :index)}
return_to={~p"/notes"}
/>
</.modal>

View File

@ -38,7 +38,7 @@ defmodule MemexWeb.NoteLive.Show do
socket =
socket
|> put_flash(:info, gettext("%{slug} deleted", slug: slug))
|> push_navigate(to: Routes.note_index_path(Endpoint, :index))
|> push_navigate(to: ~p"/notes")
{:noreply, socket}
end

View File

@ -4,11 +4,7 @@
</h1>
<div class="flex flex-wrap space-x-1">
<.link
:for={tag <- @note.tags}
navigate={Routes.note_index_path(Endpoint, :search, tag)}
class="link"
>
<.link :for={tag <- @note.tags} navigate={~p"/notes/#{tag}"} class="link">
<%= tag %>
</.link>
</div>
@ -23,7 +19,7 @@
<.link
:if={Notes.is_owner?(@note, @current_user)}
class="btn btn-primary"
patch={Routes.note_show_path(@socket, :edit, @note.slug)}
patch={~p"/note/#{@note}/edit"}
>
<%= dgettext("actions", "edit") %>
</.link>
@ -40,7 +36,7 @@
</div>
</div>
<.modal :if={@live_action == :edit} return_to={Routes.note_show_path(@socket, :show, @note.slug)}>
<.modal :if={@live_action == :edit} return_to={~p"/note/#{@note}"}>
<.live_component
module={MemexWeb.NoteLive.FormComponent}
id={@note.id}
@ -48,6 +44,6 @@
title={@page_title}
action={@live_action}
note={@note}
return_to={Routes.note_show_path(@socket, :show, @note.slug)}
return_to={~p"/note/#{@note}"}
/>
</.modal>

View File

@ -60,12 +60,11 @@ defmodule MemexWeb.PipelineLive.Index do
end
def handle_event("search", %{"search" => %{"search_term" => ""}}, socket) do
{:noreply, socket |> push_patch(to: Routes.pipeline_index_path(Endpoint, :index))}
{:noreply, socket |> push_patch(to: ~p"/pipelines")}
end
def handle_event("search", %{"search" => %{"search_term" => search_term}}, socket) do
redirect_to = Routes.pipeline_index_path(Endpoint, :search, search_term)
{:noreply, socket |> push_patch(to: redirect_to)}
{:noreply, socket |> push_patch(to: ~p"/pipelines/#{search_term}")}
end
defp display_pipelines(%{assigns: %{current_user: current_user, search: search}} = socket)

View File

@ -34,7 +34,7 @@
<:actions :let={pipeline}>
<.link
:if={Pipelines.is_owner?(pipeline, @current_user)}
patch={Routes.pipeline_index_path(@socket, :edit, pipeline.slug)}
patch={~p"/pipelines/#{pipeline}/edit"}
aria-label={dgettext("actions", "edit %{pipeline_slug}", pipeline_slug: pipeline.slug)}
>
<%= dgettext("actions", "edit") %>
@ -55,19 +55,12 @@
</.live_component>
<% end %>
<.link
:if={@current_user}
patch={Routes.pipeline_index_path(@socket, :new)}
class="self-end btn btn-primary"
>
<.link :if={@current_user} patch={~p"/pipelines/new"} class="self-end btn btn-primary">
<%= dgettext("actions", "new pipeline") %>
</.link>
</div>
<.modal
:if={@live_action in [:new, :edit]}
return_to={Routes.pipeline_index_path(@socket, :index)}
>
<.modal :if={@live_action in [:new, :edit]} return_to={~p"/pipelines"}>
<.live_component
module={MemexWeb.PipelineLive.FormComponent}
id={@pipeline.id || :new}
@ -75,6 +68,6 @@
title={@page_title}
action={@live_action}
pipeline={@pipeline}
return_to={Routes.pipeline_index_path(@socket, :index)}
return_to={~p"/pipelines"}
/>
</.modal>

View File

@ -73,7 +73,7 @@ defmodule MemexWeb.PipelineLive.Show do
socket =
socket
|> put_flash(:info, gettext("%{slug} deleted", slug: slug))
|> push_navigate(to: Routes.pipeline_index_path(Endpoint, :index))
|> push_navigate(to: ~p"/pipelines")
{:noreply, socket}
end
@ -91,7 +91,7 @@ defmodule MemexWeb.PipelineLive.Show do
socket =
socket
|> put_flash(:info, gettext("%{title} deleted", title: title))
|> push_patch(to: Routes.pipeline_show_path(Endpoint, :show, pipeline_slug))
|> push_patch(to: ~p"/pipeline/#{pipeline_slug}")
{:noreply, socket}
end
@ -110,7 +110,7 @@ defmodule MemexWeb.PipelineLive.Show do
socket =
socket
|> push_patch(to: Routes.pipeline_show_path(Endpoint, :show, pipeline_slug))
|> push_patch(to: ~p"/pipeline/#{pipeline_slug}")
{:noreply, socket}
end

View File

@ -4,11 +4,7 @@
</h1>
<div class="flex flex-wrap space-x-1">
<.link
:for={tag <- @pipeline.tags}
navigate={Routes.pipeline_index_path(Endpoint, :search, tag)}
class="link"
>
<.link :for={tag <- @pipeline.tags} navigate={~p"/pipelines/#{tag}"} class="link">
<%= tag %>
</.link>
</div>
@ -31,7 +27,7 @@
<.link
:if={Pipelines.is_owner?(@pipeline, @current_user)}
class="btn btn-primary"
patch={Routes.pipeline_show_path(@socket, :edit, @pipeline.slug)}
patch={~p"/pipeline/#{@pipeline}/edit"}
>
<%= dgettext("actions", "edit") %>
</.link>
@ -100,7 +96,7 @@
<.link
class="self-end btn btn-primary"
patch={Routes.pipeline_show_path(@socket, :edit_step, @pipeline.slug, step_id)}
patch={~p"/pipeline/#{@pipeline}/#{step_id}"}
aria-label={dgettext("actions", "edit %{step_title}", step_title: step.title)}
>
<%= dgettext("actions", "edit") %>
@ -127,7 +123,7 @@
<.link
:if={Pipelines.is_owner?(@pipeline, @current_user)}
class="self-end btn btn-primary"
patch={Routes.pipeline_show_path(@socket, :add_step, @pipeline.slug)}
patch={~p"/pipeline/#{@pipeline}/add_step"}
>
<%= dgettext("actions", "add step") %>
</.link>
@ -135,7 +131,7 @@
<%= case @live_action do %>
<% :edit -> %>
<.modal return_to={Routes.pipeline_show_path(@socket, :show, @pipeline.slug)}>
<.modal return_to={~p"/pipeline/#{@pipeline}"}>
<.live_component
module={MemexWeb.PipelineLive.FormComponent}
id={@pipeline.id}
@ -143,11 +139,11 @@
title={@page_title}
action={@live_action}
pipeline={@pipeline}
return_to={Routes.pipeline_show_path(@socket, :show, @pipeline.slug)}
return_to={~p"/pipeline/#{@pipeline}"}
/>
</.modal>
<% action when action in [:add_step, :edit_step] -> %>
<.modal return_to={Routes.pipeline_show_path(@socket, :show, @pipeline.slug)}>
<.modal return_to={~p"/pipeline/#{@pipeline}"}>
<.live_component
module={MemexWeb.StepLive.FormComponent}
id={@pipeline.id || :new}
@ -156,7 +152,7 @@
action={@live_action}
pipeline={@pipeline}
step={@step}
return_to={Routes.pipeline_show_path(@socket, :show, @pipeline.slug)}
return_to={~p"/pipeline/#{@pipeline}"}
/>
</.modal>
<% _ -> %>