forked from shibao/cannery
		
	use Endpoint for links
This commit is contained in:
		| @@ -10,7 +10,7 @@ | |||||||
|     </h2> |     </h2> | ||||||
|  |  | ||||||
|     <%= live_patch(dgettext("actions", "Add another container!"), |     <%= live_patch(dgettext("actions", "Add another container!"), | ||||||
|       to: Routes.container_index_path(@socket, :new), |       to: Routes.container_index_path(Endpoint, :new), | ||||||
|       class: "btn btn-primary" |       class: "btn btn-primary" | ||||||
|     ) %> |     ) %> | ||||||
|   <% else %> |   <% else %> | ||||||
|   | |||||||
| @@ -10,12 +10,12 @@ | |||||||
|     </h2> |     </h2> | ||||||
|  |  | ||||||
|     <%= live_patch(dgettext("actions", "Add your first box!"), |     <%= live_patch(dgettext("actions", "Add your first box!"), | ||||||
|       to: Routes.ammo_group_index_path(@socket, :new), |       to: Routes.ammo_group_index_path(Endpoint, :new), | ||||||
|       class: "btn btn-primary" |       class: "btn btn-primary" | ||||||
|     ) %> |     ) %> | ||||||
|   <% else %> |   <% else %> | ||||||
|     <%= live_patch(dgettext("actions", "New Ammo group"), |     <%= live_patch(dgettext("actions", "New Ammo group"), | ||||||
|       to: Routes.ammo_group_index_path(@socket, :new), |       to: Routes.ammo_group_index_path(Endpoint, :new), | ||||||
|       class: "btn btn-primary" |       class: "btn btn-primary" | ||||||
|     ) %> |     ) %> | ||||||
|  |  | ||||||
| @@ -92,7 +92,7 @@ | |||||||
|               <td class="p-2"> |               <td class="p-2"> | ||||||
|                 <%= if ammo_group.container do %> |                 <%= if ammo_group.container do %> | ||||||
|                   <%= live_patch(ammo_group.container.name, |                   <%= live_patch(ammo_group.container.name, | ||||||
|                     to: Routes.ammo_group_index_path(@socket, :move, ammo_group), |                     to: Routes.ammo_group_index_path(Endpoint, :move, ammo_group), | ||||||
|                     class: "btn btn-primary" |                     class: "btn btn-primary" | ||||||
|                   ) %> |                   ) %> | ||||||
|                 <% end %> |                 <% end %> | ||||||
| @@ -100,13 +100,13 @@ | |||||||
|  |  | ||||||
|               <td class="p-2"> |               <td class="p-2"> | ||||||
|                 <div class="px-4 py-2 space-x-4 flex justify-center items-center"> |                 <div class="px-4 py-2 space-x-4 flex justify-center items-center"> | ||||||
|                   <%= live_redirect to: Routes.ammo_group_show_path(@socket, :show, ammo_group), |                   <%= live_redirect to: Routes.ammo_group_show_path(Endpoint, :show, ammo_group), | ||||||
|                                 class: "text-primary-600 link", |                                 class: "text-primary-600 link", | ||||||
|                                 data: [qa: "view-#{ammo_group.id}"] do %> |                                 data: [qa: "view-#{ammo_group.id}"] do %> | ||||||
|                     <i class="fa-fw fa-lg fas fa-eye"></i> |                     <i class="fa-fw fa-lg fas fa-eye"></i> | ||||||
|                   <% end %> |                   <% end %> | ||||||
|  |  | ||||||
|                   <%= live_patch to: Routes.ammo_group_index_path(@socket, :edit, ammo_group), |                   <%= live_patch to: Routes.ammo_group_index_path(Endpoint, :edit, ammo_group), | ||||||
|                              class: "text-primary-600 link", |                              class: "text-primary-600 link", | ||||||
|                              data: [qa: "edit-#{ammo_group.id}"] do %> |                              data: [qa: "edit-#{ammo_group.id}"] do %> | ||||||
|                     <i class="fa-fw fa-lg fas fa-edit"></i> |                     <i class="fa-fw fa-lg fas fa-edit"></i> | ||||||
|   | |||||||
| @@ -10,12 +10,12 @@ | |||||||
|     </h2> |     </h2> | ||||||
|  |  | ||||||
|     <%= live_patch(dgettext("actions", "Add your first type!"), |     <%= live_patch(dgettext("actions", "Add your first type!"), | ||||||
|       to: Routes.ammo_type_index_path(@socket, :new), |       to: Routes.ammo_type_index_path(Endpoint, :new), | ||||||
|       class: "btn btn-primary" |       class: "btn btn-primary" | ||||||
|     ) %> |     ) %> | ||||||
|   <% else %> |   <% else %> | ||||||
|     <%= live_patch(dgettext("actions", "New Ammo type"), |     <%= live_patch(dgettext("actions", "New Ammo type"), | ||||||
|       to: Routes.ammo_type_index_path(@socket, :new), |       to: Routes.ammo_type_index_path(Endpoint, :new), | ||||||
|       class: "btn btn-primary" |       class: "btn btn-primary" | ||||||
|     ) %> |     ) %> | ||||||
|  |  | ||||||
| @@ -48,13 +48,13 @@ | |||||||
|  |  | ||||||
|               <td class="p-2"> |               <td class="p-2"> | ||||||
|                 <div class="px-4 py-2 space-x-4 flex justify-center items-center"> |                 <div class="px-4 py-2 space-x-4 flex justify-center items-center"> | ||||||
|                   <%= live_redirect to: Routes.ammo_type_show_path(@socket, :show, ammo_type), |                   <%= live_redirect to: Routes.ammo_type_show_path(Endpoint, :show, ammo_type), | ||||||
|                                 class: "text-primary-600 link", |                                 class: "text-primary-600 link", | ||||||
|                                 data: [qa: "view-#{ammo_type.id}"] do %> |                                 data: [qa: "view-#{ammo_type.id}"] do %> | ||||||
|                     <i class="fa-fw fa-lg fas fa-eye"></i> |                     <i class="fa-fw fa-lg fas fa-eye"></i> | ||||||
|                   <% end %> |                   <% end %> | ||||||
|  |  | ||||||
|                   <%= live_patch to: Routes.ammo_type_index_path(@socket, :edit, ammo_type), |                   <%= live_patch to: Routes.ammo_type_index_path(Endpoint, :edit, ammo_type), | ||||||
|                              class: "text-primary-600 link", |                              class: "text-primary-600 link", | ||||||
|                              data: [qa: "edit-#{ammo_type.id}"] do %> |                              data: [qa: "edit-#{ammo_type.id}"] do %> | ||||||
|                     <i class="fa-fw fa-lg fas fa-edit"></i> |                     <i class="fa-fw fa-lg fas fa-edit"></i> | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ | |||||||
|   <% end %> |   <% end %> | ||||||
|  |  | ||||||
|   <div class="flex space-x-4 justify-center items-center text-primary-600"> |   <div class="flex space-x-4 justify-center items-center text-primary-600"> | ||||||
|     <%= live_patch to: Routes.ammo_type_show_path(@socket, :edit, @ammo_type), |     <%= live_patch to: Routes.ammo_type_show_path(Endpoint, :edit, @ammo_type), | ||||||
|                class: "text-primary-600 link", |                class: "text-primary-600 link", | ||||||
|                data: [qa: "edit"] do %> |                data: [qa: "edit"] do %> | ||||||
|       <i class="fa-fw fa-lg fas fa-edit"></i> |       <i class="fa-fw fa-lg fas fa-edit"></i> | ||||||
|   | |||||||
| @@ -6,6 +6,7 @@ defmodule CanneryWeb.ContainerLive.Index do | |||||||
|   use CanneryWeb, :live_view |   use CanneryWeb, :live_view | ||||||
|   import CanneryWeb.Components.ContainerCard |   import CanneryWeb.Components.ContainerCard | ||||||
|   alias Cannery.{Containers, Containers.Container} |   alias Cannery.{Containers, Containers.Container} | ||||||
|  |   alias CanneryWeb.Endpoint | ||||||
|   alias Ecto.Changeset |   alias Ecto.Changeset | ||||||
|  |  | ||||||
|   @impl true |   @impl true | ||||||
|   | |||||||
| @@ -10,12 +10,12 @@ | |||||||
|     </h2> |     </h2> | ||||||
|  |  | ||||||
|     <%= live_patch(dgettext("actions", "Add your first container!"), |     <%= live_patch(dgettext("actions", "Add your first container!"), | ||||||
|       to: Routes.container_index_path(@socket, :new), |       to: Routes.container_index_path(Endpoint, :new), | ||||||
|       class: "btn btn-primary" |       class: "btn btn-primary" | ||||||
|     ) %> |     ) %> | ||||||
|   <% else %> |   <% else %> | ||||||
|     <%= live_patch(dgettext("actions", "New Container"), |     <%= live_patch(dgettext("actions", "New Container"), | ||||||
|       to: Routes.container_index_path(@socket, :new), |       to: Routes.container_index_path(Endpoint, :new), | ||||||
|       class: "btn btn-primary" |       class: "btn btn-primary" | ||||||
|     ) %> |     ) %> | ||||||
|   <% end %> |   <% end %> | ||||||
| @@ -23,7 +23,7 @@ | |||||||
|   <div class="flex flex-row flex-wrap justify-center items-center"> |   <div class="flex flex-row flex-wrap justify-center items-center"> | ||||||
|     <%= for container <- @containers do %> |     <%= for container <- @containers do %> | ||||||
|       <.container_card container={container}> |       <.container_card container={container}> | ||||||
|         <%= live_patch to: Routes.container_index_path(@socket, :edit, container), |         <%= live_patch to: Routes.container_index_path(Endpoint, :edit, container), | ||||||
|                    class: "text-primary-600 link", |                    class: "text-primary-600 link", | ||||||
|                    data: [qa: "edit-#{container.id}"] do %> |                    data: [qa: "edit-#{container.id}"] do %> | ||||||
|           <i class="fa-fw fa-lg fas fa-edit"></i> |           <i class="fa-fw fa-lg fas fa-edit"></i> | ||||||
| @@ -46,14 +46,14 @@ | |||||||
| </div> | </div> | ||||||
|  |  | ||||||
| <%= if @live_action in [:new, :edit] do %> | <%= if @live_action in [:new, :edit] do %> | ||||||
|   <.modal return_to={Routes.container_index_path(@socket, :index)}> |   <.modal return_to={Routes.container_index_path(Endpoint, :index)}> | ||||||
|     <.live_component |     <.live_component | ||||||
|       module={CanneryWeb.ContainerLive.FormComponent} |       module={CanneryWeb.ContainerLive.FormComponent} | ||||||
|       id={@container.id || :new} |       id={@container.id || :new} | ||||||
|       title={@page_title} |       title={@page_title} | ||||||
|       action={@live_action} |       action={@live_action} | ||||||
|       container={@container} |       container={@container} | ||||||
|       return_to={Routes.container_index_path(@socket, :index)} |       return_to={Routes.container_index_path(Endpoint, :index)} | ||||||
|       current_user={@current_user} |       current_user={@current_user} | ||||||
|     /> |     /> | ||||||
|   </.modal> |   </.modal> | ||||||
|   | |||||||
| @@ -23,7 +23,7 @@ | |||||||
|   <% end %> |   <% end %> | ||||||
|  |  | ||||||
|   <div class="flex space-x-4 justify-center items-center text-primary-600"> |   <div class="flex space-x-4 justify-center items-center text-primary-600"> | ||||||
|     <%= live_patch to: Routes.container_show_path(@socket, :edit, @container), |     <%= live_patch to: Routes.container_show_path(Endpoint, :edit, @container), | ||||||
|                class: "text-primary-600 link", |                class: "text-primary-600 link", | ||||||
|                data: [qa: "edit"] do %> |                data: [qa: "edit"] do %> | ||||||
|       <i class="fa-fw fa-lg fas fa-edit"></i> |       <i class="fa-fw fa-lg fas fa-edit"></i> | ||||||
|   | |||||||
| @@ -10,12 +10,12 @@ | |||||||
|     </h1> |     </h1> | ||||||
|  |  | ||||||
|     <%= live_patch(dgettext("actions", "Invite someone new!"), |     <%= live_patch(dgettext("actions", "Invite someone new!"), | ||||||
|       to: Routes.invite_index_path(@socket, :new), |       to: Routes.invite_index_path(Endpoint, :new), | ||||||
|       class: "btn btn-primary" |       class: "btn btn-primary" | ||||||
|     ) %> |     ) %> | ||||||
|   <% else %> |   <% else %> | ||||||
|     <%= live_patch(dgettext("actions", "Create Invite"), |     <%= live_patch(dgettext("actions", "Create Invite"), | ||||||
|       to: Routes.invite_index_path(@socket, :new), |       to: Routes.invite_index_path(Endpoint, :new), | ||||||
|       class: "btn btn-primary" |       class: "btn btn-primary" | ||||||
|     ) %> |     ) %> | ||||||
|   <% end %> |   <% end %> | ||||||
| @@ -144,14 +144,14 @@ | |||||||
| </div> | </div> | ||||||
|  |  | ||||||
| <%= if @live_action in [:new, :edit] do %> | <%= if @live_action in [:new, :edit] do %> | ||||||
|   <.modal return_to={Routes.invite_index_path(@socket, :index)}> |   <.modal return_to={Routes.invite_index_path(Endpoint, :index)}> | ||||||
|     <.live_component |     <.live_component | ||||||
|       module={CanneryWeb.InviteLive.FormComponent} |       module={CanneryWeb.InviteLive.FormComponent} | ||||||
|       id={@invite.id || :new} |       id={@invite.id || :new} | ||||||
|       title={@page_title} |       title={@page_title} | ||||||
|       action={@live_action} |       action={@live_action} | ||||||
|       invite={@invite} |       invite={@invite} | ||||||
|       return_to={Routes.invite_index_path(@socket, :index)} |       return_to={Routes.invite_index_path(Endpoint, :index)} | ||||||
|       current_user={@current_user} |       current_user={@current_user} | ||||||
|     /> |     /> | ||||||
|   </.modal> |   </.modal> | ||||||
|   | |||||||
| @@ -25,13 +25,13 @@ defmodule CanneryWeb.LiveHelpers do | |||||||
|  |  | ||||||
|   ## Examples |   ## Examples | ||||||
|  |  | ||||||
|       <.modal return_to={Routes.<%= schema.singular %>_index_path(@socket, :index)}> |       <.modal return_to={Routes.<%= schema.singular %>_index_path(Endpoint, :index)}> | ||||||
|         <.live_component |         <.live_component | ||||||
|           module={<%= inspect context.web_module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>Live.FormComponent} |           module={<%= inspect context.web_module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>Live.FormComponent} | ||||||
|           id={@<%= schema.singular %>.id || :new} |           id={@<%= schema.singular %>.id || :new} | ||||||
|           title={@page_title} |           title={@page_title} | ||||||
|           action={@live_action} |           action={@live_action} | ||||||
|           return_to={Routes.<%= schema.singular %>_index_path(@socket, :index)} |           return_to={Routes.<%= schema.singular %>_index_path(Endpoint, :index)} | ||||||
|           <%= schema.singular %>: @<%= schema.singular %> |           <%= schema.singular %>: @<%= schema.singular %> | ||||||
|         /> |         /> | ||||||
|       </.modal> |       </.modal> | ||||||
|   | |||||||
| @@ -12,12 +12,12 @@ | |||||||
|     </h2> |     </h2> | ||||||
|  |  | ||||||
|     <%= live_patch(dgettext("actions", "Make your first tag!"), |     <%= live_patch(dgettext("actions", "Make your first tag!"), | ||||||
|       to: Routes.tag_index_path(@socket, :new), |       to: Routes.tag_index_path(Endpoint, :new), | ||||||
|       class: "btn btn-primary" |       class: "btn btn-primary" | ||||||
|     ) %> |     ) %> | ||||||
|   <% else %> |   <% else %> | ||||||
|     <%= live_patch(dgettext("actions", "New Tag"), |     <%= live_patch(dgettext("actions", "New Tag"), | ||||||
|       to: Routes.tag_index_path(@socket, :new), |       to: Routes.tag_index_path(Endpoint, :new), | ||||||
|       class: "btn btn-primary" |       class: "btn btn-primary" | ||||||
|     ) %> |     ) %> | ||||||
|   <% end %> |   <% end %> | ||||||
| @@ -46,14 +46,14 @@ | |||||||
| </div> | </div> | ||||||
|  |  | ||||||
| <%= if @live_action in [:new, :edit] do %> | <%= if @live_action in [:new, :edit] do %> | ||||||
|   <.modal return_to={Routes.tag_index_path(@socket, :index)}> |   <.modal return_to={Routes.tag_index_path(Endpoint, :index)}> | ||||||
|     <.live_component |     <.live_component | ||||||
|       module={CanneryWeb.TagLive.FormComponent} |       module={CanneryWeb.TagLive.FormComponent} | ||||||
|       id={@tag.id || :new} |       id={@tag.id || :new} | ||||||
|       title={@page_title} |       title={@page_title} | ||||||
|       action={@live_action} |       action={@live_action} | ||||||
|       tag={@tag} |       tag={@tag} | ||||||
|       return_to={Routes.tag_index_path(@socket, :index)} |       return_to={Routes.tag_index_path(Endpoint, :index)} | ||||||
|       current_user={@current_user} |       current_user={@current_user} | ||||||
|     /> |     /> | ||||||
|   </.modal> |   </.modal> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user