diff --git a/lib/philomena_web/controllers/admin/advert/image_controller.ex b/lib/philomena_web/controllers/admin/advert/image_controller.ex
index 8fe46022..c3bae8c0 100644
--- a/lib/philomena_web/controllers/admin/advert/image_controller.ex
+++ b/lib/philomena_web/controllers/admin/advert/image_controller.ex
@@ -22,7 +22,7 @@ defmodule PhilomenaWeb.Admin.Advert.ImageController do
{:ok, _advert} ->
conn
|> put_flash(:info, "Advert was successfully updated.")
- |> redirect(to: Routes.admin_advert_path(conn, :index))
+ |> redirect(to: ~p"/admin/adverts")
{:error, changeset} ->
render(conn, "edit.html", changeset: changeset)
diff --git a/lib/philomena_web/controllers/admin/advert_controller.ex b/lib/philomena_web/controllers/admin/advert_controller.ex
index bb119f42..e058ce26 100644
--- a/lib/philomena_web/controllers/admin/advert_controller.ex
+++ b/lib/philomena_web/controllers/admin/advert_controller.ex
@@ -32,7 +32,7 @@ defmodule PhilomenaWeb.Admin.AdvertController do
{:ok, _advert} ->
conn
|> put_flash(:info, "Advert was successfully created.")
- |> redirect(to: Routes.admin_advert_path(conn, :index))
+ |> redirect(to: ~p"/admin/adverts")
{:error, :advert, changeset, _changes} ->
render(conn, "new.html", changeset: changeset)
@@ -49,7 +49,7 @@ defmodule PhilomenaWeb.Admin.AdvertController do
{:ok, _advert} ->
conn
|> put_flash(:info, "Advert was successfully updated.")
- |> redirect(to: Routes.admin_advert_path(conn, :index))
+ |> redirect(to: ~p"/admin/adverts")
{:error, changeset} ->
render(conn, "edit.html", changeset: changeset)
@@ -61,7 +61,7 @@ defmodule PhilomenaWeb.Admin.AdvertController do
conn
|> put_flash(:info, "Advert was successfully deleted.")
- |> redirect(to: Routes.admin_advert_path(conn, :index))
+ |> redirect(to: ~p"/admin/adverts")
end
defp verify_authorized(conn, _opts) do
diff --git a/lib/philomena_web/controllers/admin/artist_link/contact_controller.ex b/lib/philomena_web/controllers/admin/artist_link/contact_controller.ex
index 98efb1f4..0e0ffc30 100644
--- a/lib/philomena_web/controllers/admin/artist_link/contact_controller.ex
+++ b/lib/philomena_web/controllers/admin/artist_link/contact_controller.ex
@@ -19,13 +19,13 @@ defmodule PhilomenaWeb.Admin.ArtistLink.ContactController do
conn
|> put_flash(:info, "Artist successfully marked as contacted.")
|> moderation_log(details: &log_details/3, data: artist_link)
- |> redirect(to: Routes.admin_artist_link_path(conn, :index))
+ |> redirect(to: ~p"/admin/artist_links")
end
defp log_details(conn, _action, artist_link) do
%{
body: "Contacted artist #{artist_link.user.name} at #{artist_link.uri}",
- subject_path: Routes.profile_artist_link_path(conn, :show, artist_link.user, artist_link)
+ subject_path: ~p"/profiles/#{artist_link.user}/artist_links/#{artist_link}"
}
end
end
diff --git a/lib/philomena_web/controllers/admin/artist_link/reject_controller.ex b/lib/philomena_web/controllers/admin/artist_link/reject_controller.ex
index 9bf92139..168251fd 100644
--- a/lib/philomena_web/controllers/admin/artist_link/reject_controller.ex
+++ b/lib/philomena_web/controllers/admin/artist_link/reject_controller.ex
@@ -18,13 +18,13 @@ defmodule PhilomenaWeb.Admin.ArtistLink.RejectController do
conn
|> put_flash(:info, "Artist link successfully marked as rejected.")
|> moderation_log(details: &log_details/3, data: artist_link)
- |> redirect(to: Routes.admin_artist_link_path(conn, :index))
+ |> redirect(to: ~p"/admin/artist_links")
end
defp log_details(conn, _action, artist_link) do
%{
body: "Rejected artist link #{artist_link.uri} created by #{artist_link.user.name}",
- subject_path: Routes.profile_artist_link_path(conn, :show, artist_link.user, artist_link)
+ subject_path: ~p"/profiles/#{artist_link.user}/artist_links/#{artist_link}"
}
end
end
diff --git a/lib/philomena_web/controllers/admin/artist_link/verification_controller.ex b/lib/philomena_web/controllers/admin/artist_link/verification_controller.ex
index a4cc1fce..02a45ab4 100644
--- a/lib/philomena_web/controllers/admin/artist_link/verification_controller.ex
+++ b/lib/philomena_web/controllers/admin/artist_link/verification_controller.ex
@@ -19,13 +19,13 @@ defmodule PhilomenaWeb.Admin.ArtistLink.VerificationController do
conn
|> put_flash(:info, "Artist link successfully verified.")
|> moderation_log(details: &log_details/3, data: result.artist_link)
- |> redirect(to: Routes.admin_artist_link_path(conn, :index))
+ |> redirect(to: ~p"/admin/artist_links")
end
defp log_details(conn, _action, artist_link) do
%{
body: "Verified artist link #{artist_link.uri} created by #{artist_link.user.name}",
- subject_path: Routes.profile_artist_link_path(conn, :show, artist_link.user, artist_link)
+ subject_path: ~p"/profiles/#{artist_link.user}/artist_links/#{artist_link}"
}
end
end
diff --git a/lib/philomena_web/controllers/admin/badge/image_controller.ex b/lib/philomena_web/controllers/admin/badge/image_controller.ex
index abdac0a2..069b8f0b 100644
--- a/lib/philomena_web/controllers/admin/badge/image_controller.ex
+++ b/lib/philomena_web/controllers/admin/badge/image_controller.ex
@@ -17,7 +17,7 @@ defmodule PhilomenaWeb.Admin.Badge.ImageController do
{:ok, _badge} ->
conn
|> put_flash(:info, "Badge updated successfully.")
- |> redirect(to: Routes.admin_badge_path(conn, :index))
+ |> redirect(to: ~p"/admin/badges")
{:error, :badge, changeset, _changes} ->
render(conn, "edit.html", changeset: changeset)
diff --git a/lib/philomena_web/controllers/admin/badge_controller.ex b/lib/philomena_web/controllers/admin/badge_controller.ex
index 2aa79e31..f253f647 100644
--- a/lib/philomena_web/controllers/admin/badge_controller.ex
+++ b/lib/philomena_web/controllers/admin/badge_controller.ex
@@ -28,7 +28,7 @@ defmodule PhilomenaWeb.Admin.BadgeController do
{:ok, _badge} ->
conn
|> put_flash(:info, "Badge created successfully.")
- |> redirect(to: Routes.admin_badge_path(conn, :index))
+ |> redirect(to: ~p"/admin/badges")
{:error, :badge, changeset, _changes} ->
render(conn, "new.html", changeset: changeset)
@@ -45,7 +45,7 @@ defmodule PhilomenaWeb.Admin.BadgeController do
{:ok, _badge} ->
conn
|> put_flash(:info, "Badge updated successfully.")
- |> redirect(to: Routes.admin_badge_path(conn, :index))
+ |> redirect(to: ~p"/admin/badges")
{:error, :badge, changeset, _changes} ->
render(conn, "edit.html", changeset: changeset)
diff --git a/lib/philomena_web/controllers/admin/batch/tag_controller.ex b/lib/philomena_web/controllers/admin/batch/tag_controller.ex
index 4ae3c714..59371b6a 100644
--- a/lib/philomena_web/controllers/admin/batch/tag_controller.ex
+++ b/lib/philomena_web/controllers/admin/batch/tag_controller.ex
@@ -71,7 +71,7 @@ defmodule PhilomenaWeb.Admin.Batch.TagController do
defp log_details(conn, _action, data) do
%{
body: "Batch tagged '#{data.tag_list}' on #{data.image_count} images",
- subject_path: Routes.profile_path(conn, :show, conn.assigns.current_user)
+ subject_path: ~p"/profiles/#{conn.assigns.current_user}"
}
end
end
diff --git a/lib/philomena_web/controllers/admin/dnp_entry/transition_controller.ex b/lib/philomena_web/controllers/admin/dnp_entry/transition_controller.ex
index a774ece0..8f0fc52e 100644
--- a/lib/philomena_web/controllers/admin/dnp_entry/transition_controller.ex
+++ b/lib/philomena_web/controllers/admin/dnp_entry/transition_controller.ex
@@ -16,12 +16,12 @@ defmodule PhilomenaWeb.Admin.DnpEntry.TransitionController do
{:ok, dnp_entry} ->
conn
|> put_flash(:info, "Successfully updated DNP entry.")
- |> redirect(to: Routes.dnp_entry_path(conn, :show, dnp_entry))
+ |> redirect(to: ~p"/dnp/#{dnp_entry}")
{:error, _changeset} ->
conn
|> put_flash(:error, "Failed to update DNP entry!")
- |> redirect(to: Routes.dnp_entry_path(conn, :show, conn.assigns.dnp_entry))
+ |> redirect(to: ~p"/dnp/#{conn.assigns.dnp_entry}")
end
end
diff --git a/lib/philomena_web/controllers/admin/donation_controller.ex b/lib/philomena_web/controllers/admin/donation_controller.ex
index 91de59cf..2274daff 100644
--- a/lib/philomena_web/controllers/admin/donation_controller.ex
+++ b/lib/philomena_web/controllers/admin/donation_controller.ex
@@ -23,12 +23,12 @@ defmodule PhilomenaWeb.Admin.DonationController do
{:ok, _donation} ->
conn
|> put_flash(:info, "Donation successfully created.")
- |> redirect(to: Routes.admin_donation_path(conn, :index))
+ |> redirect(to: ~p"/admin/donations")
_error ->
conn
|> put_flash(:error, "Error creating donation!")
- |> redirect(to: Routes.admin_donation_path(conn, :index))
+ |> redirect(to: ~p"/admin/donations")
end
end
diff --git a/lib/philomena_web/controllers/admin/fingerprint_ban_controller.ex b/lib/philomena_web/controllers/admin/fingerprint_ban_controller.ex
index 5cb4ccd0..2e1c20f9 100644
--- a/lib/philomena_web/controllers/admin/fingerprint_ban_controller.ex
+++ b/lib/philomena_web/controllers/admin/fingerprint_ban_controller.ex
@@ -48,7 +48,7 @@ defmodule PhilomenaWeb.Admin.FingerprintBanController do
conn
|> put_flash(:info, "Fingerprint was successfully banned.")
|> moderation_log(details: &log_details/3, data: fingerprint_ban)
- |> redirect(to: Routes.admin_fingerprint_ban_path(conn, :index))
+ |> redirect(to: ~p"/admin/fingerprint_bans")
{:error, changeset} ->
render(conn, "new.html", changeset: changeset)
@@ -66,7 +66,7 @@ defmodule PhilomenaWeb.Admin.FingerprintBanController do
conn
|> put_flash(:info, "Fingerprint ban successfully updated.")
|> moderation_log(details: &log_details/3, data: fingerprint_ban)
- |> redirect(to: Routes.admin_fingerprint_ban_path(conn, :index))
+ |> redirect(to: ~p"/admin/fingerprint_bans")
{:error, changeset} ->
render(conn, "edit.html", changeset: changeset)
@@ -79,7 +79,7 @@ defmodule PhilomenaWeb.Admin.FingerprintBanController do
conn
|> put_flash(:info, "Fingerprint ban successfully deleted.")
|> moderation_log(details: &log_details/3, data: fingerprint_ban)
- |> redirect(to: Routes.admin_fingerprint_ban_path(conn, :index))
+ |> redirect(to: ~p"/admin/fingerprint_bans")
end
defp load_bans(queryable, conn) do
@@ -118,6 +118,6 @@ defmodule PhilomenaWeb.Admin.FingerprintBanController do
:delete -> "Deleted a fingerprint ban #{ban.generated_ban_id}"
end
- %{body: body, subject_path: Routes.admin_fingerprint_ban_path(conn, :index)}
+ %{body: body, subject_path: ~p"/admin/fingerprint_bans"}
end
end
diff --git a/lib/philomena_web/controllers/admin/forum_controller.ex b/lib/philomena_web/controllers/admin/forum_controller.ex
index 7d9e0190..5c40e4c4 100644
--- a/lib/philomena_web/controllers/admin/forum_controller.ex
+++ b/lib/philomena_web/controllers/admin/forum_controller.ex
@@ -21,7 +21,7 @@ defmodule PhilomenaWeb.Admin.ForumController do
{:ok, _forum} ->
conn
|> put_flash(:info, "Forum created successfully.")
- |> redirect(to: Routes.admin_forum_path(conn, :index))
+ |> redirect(to: ~p"/admin/forums")
{:error, changeset} ->
render(conn, "new.html", changeset: changeset)
@@ -38,7 +38,7 @@ defmodule PhilomenaWeb.Admin.ForumController do
{:ok, _forum} ->
conn
|> put_flash(:info, "Forum updated successfully.")
- |> redirect(to: Routes.admin_forum_path(conn, :index))
+ |> redirect(to: ~p"/admin/forums")
{:error, changeset} ->
render(conn, "edit.html", changeset: changeset)
diff --git a/lib/philomena_web/controllers/admin/mod_note_controller.ex b/lib/philomena_web/controllers/admin/mod_note_controller.ex
index 23f71815..f5b3999f 100644
--- a/lib/philomena_web/controllers/admin/mod_note_controller.ex
+++ b/lib/philomena_web/controllers/admin/mod_note_controller.ex
@@ -46,7 +46,7 @@ defmodule PhilomenaWeb.Admin.ModNoteController do
{:ok, _mod_note} ->
conn
|> put_flash(:info, "Successfully created mod note.")
- |> redirect(to: Routes.admin_mod_note_path(conn, :index))
+ |> redirect(to: ~p"/admin/mod_notes")
{:error, changeset} ->
render(conn, "new.html", changeset: changeset)
@@ -63,7 +63,7 @@ defmodule PhilomenaWeb.Admin.ModNoteController do
{:ok, _mod_note} ->
conn
|> put_flash(:info, "Successfully updated mod note.")
- |> redirect(to: Routes.admin_mod_note_path(conn, :index))
+ |> redirect(to: ~p"/admin/mod_notes")
{:error, changeset} ->
render(conn, "edit.html", changeset: changeset)
@@ -75,7 +75,7 @@ defmodule PhilomenaWeb.Admin.ModNoteController do
conn
|> put_flash(:info, "Successfully deleted mod note.")
- |> redirect(to: Routes.admin_mod_note_path(conn, :index))
+ |> redirect(to: ~p"/admin/mod_notes")
end
defp verify_authorized(conn, _opts) do
diff --git a/lib/philomena_web/controllers/admin/report/claim_controller.ex b/lib/philomena_web/controllers/admin/report/claim_controller.ex
index 93880a22..76702b2e 100644
--- a/lib/philomena_web/controllers/admin/report/claim_controller.ex
+++ b/lib/philomena_web/controllers/admin/report/claim_controller.ex
@@ -12,12 +12,12 @@ defmodule PhilomenaWeb.Admin.Report.ClaimController do
{:ok, _report} ->
conn
|> put_flash(:info, "Successfully marked report as in progress")
- |> redirect(to: Routes.admin_report_path(conn, :index))
+ |> redirect(to: ~p"/admin/reports")
{:error, _changeset} ->
conn
|> put_flash(:error, "Couldn't claim that report!")
- |> redirect(to: Routes.admin_report_path(conn, :show, conn.assigns.report))
+ |> redirect(to: ~p"/admin/reports/#{conn.assigns.report}")
end
end
@@ -26,6 +26,6 @@ defmodule PhilomenaWeb.Admin.Report.ClaimController do
conn
|> put_flash(:info, "Successfully released report.")
- |> redirect(to: Routes.admin_report_path(conn, :show, report))
+ |> redirect(to: ~p"/admin/reports/#{report}")
end
end
diff --git a/lib/philomena_web/controllers/admin/report/close_controller.ex b/lib/philomena_web/controllers/admin/report/close_controller.ex
index dedb4d2d..75f1e7ff 100644
--- a/lib/philomena_web/controllers/admin/report/close_controller.ex
+++ b/lib/philomena_web/controllers/admin/report/close_controller.ex
@@ -12,6 +12,6 @@ defmodule PhilomenaWeb.Admin.Report.CloseController do
conn
|> put_flash(:info, "Successfully closed report")
- |> redirect(to: Routes.admin_report_path(conn, :index))
+ |> redirect(to: ~p"/admin/reports")
end
end
diff --git a/lib/philomena_web/controllers/admin/site_notice_controller.ex b/lib/philomena_web/controllers/admin/site_notice_controller.ex
index 11462540..7612422e 100644
--- a/lib/philomena_web/controllers/admin/site_notice_controller.ex
+++ b/lib/philomena_web/controllers/admin/site_notice_controller.ex
@@ -28,7 +28,7 @@ defmodule PhilomenaWeb.Admin.SiteNoticeController do
{:ok, _site_notice} ->
conn
|> put_flash(:info, "Successfully created site notice.")
- |> redirect(to: Routes.admin_site_notice_path(conn, :index))
+ |> redirect(to: ~p"/admin/site_notices")
{:error, changeset} ->
render(conn, "new.html", changeset: changeset)
@@ -45,7 +45,7 @@ defmodule PhilomenaWeb.Admin.SiteNoticeController do
{:ok, _site_notice} ->
conn
|> put_flash(:info, "Succesfully updated site notice.")
- |> redirect(to: Routes.admin_site_notice_path(conn, :index))
+ |> redirect(to: ~p"/admin/site_notices")
{:error, changeset} ->
render(conn, "edit.html", changeset: changeset)
@@ -57,7 +57,7 @@ defmodule PhilomenaWeb.Admin.SiteNoticeController do
conn
|> put_flash(:info, "Sucessfully deleted site notice.")
- |> redirect(to: Routes.admin_site_notice_path(conn, :index))
+ |> redirect(to: ~p"/admin/site_notices")
end
defp verify_authorized(conn, _opts) do
diff --git a/lib/philomena_web/controllers/admin/subnet_ban_controller.ex b/lib/philomena_web/controllers/admin/subnet_ban_controller.ex
index 93c42807..f2d0dbaa 100644
--- a/lib/philomena_web/controllers/admin/subnet_ban_controller.ex
+++ b/lib/philomena_web/controllers/admin/subnet_ban_controller.ex
@@ -50,7 +50,7 @@ defmodule PhilomenaWeb.Admin.SubnetBanController do
conn
|> put_flash(:info, "Subnet was successfully banned.")
|> moderation_log(details: &log_details/3, data: subnet_ban)
- |> redirect(to: Routes.admin_subnet_ban_path(conn, :index))
+ |> redirect(to: ~p"/admin/subnet_bans")
{:error, changeset} ->
render(conn, "new.html", changeset: changeset)
@@ -68,7 +68,7 @@ defmodule PhilomenaWeb.Admin.SubnetBanController do
conn
|> put_flash(:info, "Subnet ban successfully updated.")
|> moderation_log(details: &log_details/3, data: subnet_ban)
- |> redirect(to: Routes.admin_subnet_ban_path(conn, :index))
+ |> redirect(to: ~p"/admin/subnet_bans")
{:error, changeset} ->
render(conn, "edit.html", changeset: changeset)
@@ -81,7 +81,7 @@ defmodule PhilomenaWeb.Admin.SubnetBanController do
conn
|> put_flash(:info, "Subnet ban successfully deleted.")
|> moderation_log(details: &log_details/3, data: subnet_ban)
- |> redirect(to: Routes.admin_subnet_ban_path(conn, :index))
+ |> redirect(to: ~p"/admin/subnet_bans")
end
defp load_bans(queryable, conn) do
@@ -120,6 +120,6 @@ defmodule PhilomenaWeb.Admin.SubnetBanController do
:delete -> "Deleted a subnet ban #{ban.generated_ban_id}"
end
- %{body: body, subject_path: Routes.admin_subnet_ban_path(conn, :index)}
+ %{body: body, subject_path: ~p"/admin/subnet_bans"}
end
end
diff --git a/lib/philomena_web/controllers/admin/user/activation_controller.ex b/lib/philomena_web/controllers/admin/user/activation_controller.ex
index e5f78aad..f261ab1b 100644
--- a/lib/philomena_web/controllers/admin/user/activation_controller.ex
+++ b/lib/philomena_web/controllers/admin/user/activation_controller.ex
@@ -12,7 +12,7 @@ defmodule PhilomenaWeb.Admin.User.ActivationController do
conn
|> put_flash(:info, "User was reactivated.")
- |> redirect(to: Routes.profile_path(conn, :show, user))
+ |> redirect(to: ~p"/profiles/#{user}")
end
def delete(conn, _params) do
@@ -20,7 +20,7 @@ defmodule PhilomenaWeb.Admin.User.ActivationController do
conn
|> put_flash(:info, "User was deactivated.")
- |> redirect(to: Routes.profile_path(conn, :show, user))
+ |> redirect(to: ~p"/profiles/#{user}")
end
defp verify_authorized(conn, _opts) do
diff --git a/lib/philomena_web/controllers/admin/user/api_key_controller.ex b/lib/philomena_web/controllers/admin/user/api_key_controller.ex
index e2987ff9..19b1eb64 100644
--- a/lib/philomena_web/controllers/admin/user/api_key_controller.ex
+++ b/lib/philomena_web/controllers/admin/user/api_key_controller.ex
@@ -12,7 +12,7 @@ defmodule PhilomenaWeb.Admin.User.ApiKeyController do
conn
|> put_flash(:info, "API token successfully reset.")
- |> redirect(to: Routes.profile_path(conn, :show, user))
+ |> redirect(to: ~p"/profiles/#{user}")
end
defp verify_authorized(conn, _opts) do
diff --git a/lib/philomena_web/controllers/admin/user/avatar_controller.ex b/lib/philomena_web/controllers/admin/user/avatar_controller.ex
index c04fdbcd..80c1e262 100644
--- a/lib/philomena_web/controllers/admin/user/avatar_controller.ex
+++ b/lib/philomena_web/controllers/admin/user/avatar_controller.ex
@@ -12,7 +12,7 @@ defmodule PhilomenaWeb.Admin.User.AvatarController do
conn
|> put_flash(:info, "Successfully removed avatar.")
- |> redirect(to: Routes.admin_user_path(conn, :edit, conn.assigns.user))
+ |> redirect(to: ~p"/admin/users/#{conn.assigns.user}/edit")
end
defp verify_authorized(conn, _opts) do
diff --git a/lib/philomena_web/controllers/admin/user/downvote_controller.ex b/lib/philomena_web/controllers/admin/user/downvote_controller.ex
index 1dfdaff8..df5cb145 100644
--- a/lib/philomena_web/controllers/admin/user/downvote_controller.ex
+++ b/lib/philomena_web/controllers/admin/user/downvote_controller.ex
@@ -12,7 +12,7 @@ defmodule PhilomenaWeb.Admin.User.DownvoteController do
conn
|> put_flash(:info, "Downvote wipe started.")
- |> redirect(to: Routes.profile_path(conn, :show, conn.assigns.user))
+ |> redirect(to: ~p"/profiles/#{conn.assigns.user}")
end
defp verify_authorized(conn, _opts) do
diff --git a/lib/philomena_web/controllers/admin/user/force_filter_controller.ex b/lib/philomena_web/controllers/admin/user/force_filter_controller.ex
index 049d68fb..74266ef5 100644
--- a/lib/philomena_web/controllers/admin/user/force_filter_controller.ex
+++ b/lib/philomena_web/controllers/admin/user/force_filter_controller.ex
@@ -18,7 +18,7 @@ defmodule PhilomenaWeb.Admin.User.ForceFilterController do
conn
|> put_flash(:info, "Filter was forced.")
- |> redirect(to: Routes.profile_path(conn, :show, user))
+ |> redirect(to: ~p"/profiles/#{user}")
end
def delete(conn, _params) do
@@ -26,7 +26,7 @@ defmodule PhilomenaWeb.Admin.User.ForceFilterController do
conn
|> put_flash(:info, "Forced filter was removed.")
- |> redirect(to: Routes.profile_path(conn, :show, user))
+ |> redirect(to: ~p"/profiles/#{user}")
end
defp verify_authorized(conn, _opts) do
diff --git a/lib/philomena_web/controllers/admin/user/unlock_controller.ex b/lib/philomena_web/controllers/admin/user/unlock_controller.ex
index 0c36122e..54610fda 100644
--- a/lib/philomena_web/controllers/admin/user/unlock_controller.ex
+++ b/lib/philomena_web/controllers/admin/user/unlock_controller.ex
@@ -12,7 +12,7 @@ defmodule PhilomenaWeb.Admin.User.UnlockController do
conn
|> put_flash(:info, "User was unlocked.")
- |> redirect(to: Routes.profile_path(conn, :show, user))
+ |> redirect(to: ~p"/profiles/#{user}")
end
defp verify_authorized(conn, _opts) do
diff --git a/lib/philomena_web/controllers/admin/user/verification_controller.ex b/lib/philomena_web/controllers/admin/user/verification_controller.ex
index 982a520c..9478bc42 100644
--- a/lib/philomena_web/controllers/admin/user/verification_controller.ex
+++ b/lib/philomena_web/controllers/admin/user/verification_controller.ex
@@ -13,7 +13,7 @@ defmodule PhilomenaWeb.Admin.User.VerificationController do
conn
|> put_flash(:info, "User verification granted.")
|> moderation_log(details: &log_details/3, data: user)
- |> redirect(to: Routes.profile_path(conn, :show, user))
+ |> redirect(to: ~p"/profiles/#{user}")
end
def delete(conn, _params) do
@@ -22,7 +22,7 @@ defmodule PhilomenaWeb.Admin.User.VerificationController do
conn
|> put_flash(:info, "User verification revoked.")
|> moderation_log(details: &log_details/3, data: user)
- |> redirect(to: Routes.profile_path(conn, :show, user))
+ |> redirect(to: ~p"/profiles/#{user}")
end
defp verify_authorized(conn, _opts) do
@@ -39,6 +39,6 @@ defmodule PhilomenaWeb.Admin.User.VerificationController do
:delete -> "Revoked verification from #{user.name}"
end
- %{body: body, subject_path: Routes.profile_path(conn, :show, user)}
+ %{body: body, subject_path: ~p"/profiles/#{user}"}
end
end
diff --git a/lib/philomena_web/controllers/admin/user/vote_controller.ex b/lib/philomena_web/controllers/admin/user/vote_controller.ex
index bcb9318a..310f3575 100644
--- a/lib/philomena_web/controllers/admin/user/vote_controller.ex
+++ b/lib/philomena_web/controllers/admin/user/vote_controller.ex
@@ -12,7 +12,7 @@ defmodule PhilomenaWeb.Admin.User.VoteController do
conn
|> put_flash(:info, "Vote and fave wipe started.")
- |> redirect(to: Routes.profile_path(conn, :show, conn.assigns.user))
+ |> redirect(to: ~p"/profiles/#{conn.assigns.user}")
end
defp verify_authorized(conn, _opts) do
diff --git a/lib/philomena_web/controllers/admin/user/wipe_controller.ex b/lib/philomena_web/controllers/admin/user/wipe_controller.ex
index 86301f4d..3bc64a82 100644
--- a/lib/philomena_web/controllers/admin/user/wipe_controller.ex
+++ b/lib/philomena_web/controllers/admin/user/wipe_controller.ex
@@ -15,7 +15,7 @@ defmodule PhilomenaWeb.Admin.User.WipeController do
:info,
"PII wipe queued, please verify and then deactivate the account as necessary."
)
- |> redirect(to: Routes.profile_path(conn, :show, conn.assigns.user))
+ |> redirect(to: ~p"/profiles/#{conn.assigns.user}")
end
defp verify_authorized(conn, _opts) do
diff --git a/lib/philomena_web/controllers/admin/user_ban_controller.ex b/lib/philomena_web/controllers/admin/user_ban_controller.ex
index f98c3337..bbaf6b62 100644
--- a/lib/philomena_web/controllers/admin/user_ban_controller.ex
+++ b/lib/philomena_web/controllers/admin/user_ban_controller.ex
@@ -51,7 +51,7 @@ defmodule PhilomenaWeb.Admin.UserBanController do
conn
|> put_flash(:info, "User was successfully banned.")
|> moderation_log(details: &log_details/3, data: user_ban)
- |> redirect(to: Routes.admin_user_ban_path(conn, :index))
+ |> redirect(to: ~p"/admin/user_bans")
{:error, :user_ban, changeset, _changes} ->
render(conn, "new.html", changeset: changeset)
@@ -72,7 +72,7 @@ defmodule PhilomenaWeb.Admin.UserBanController do
conn
|> put_flash(:info, "User ban successfully updated.")
|> moderation_log(details: &log_details/3, data: user_ban)
- |> redirect(to: Routes.admin_user_ban_path(conn, :index))
+ |> redirect(to: ~p"/admin/user_bans")
{:error, changeset} ->
render(conn, "edit.html", changeset: changeset)
@@ -85,7 +85,7 @@ defmodule PhilomenaWeb.Admin.UserBanController do
conn
|> put_flash(:info, "User ban successfully deleted.")
|> moderation_log(details: &log_details/3, data: user_ban)
- |> redirect(to: Routes.admin_user_ban_path(conn, :index))
+ |> redirect(to: ~p"/admin/user_bans")
end
defp load_bans(queryable, conn) do
@@ -124,6 +124,6 @@ defmodule PhilomenaWeb.Admin.UserBanController do
:delete -> "Deleted a user ban #{ban.generated_ban_id}"
end
- %{body: body, subject_path: Routes.admin_user_ban_path(conn, :index)}
+ %{body: body, subject_path: ~p"/admin/user_bans"}
end
end
diff --git a/lib/philomena_web/controllers/admin/user_controller.ex b/lib/philomena_web/controllers/admin/user_controller.ex
index fe31d2f4..672147f8 100644
--- a/lib/philomena_web/controllers/admin/user_controller.ex
+++ b/lib/philomena_web/controllers/admin/user_controller.ex
@@ -63,7 +63,7 @@ defmodule PhilomenaWeb.Admin.UserController do
conn
|> put_flash(:info, "User successfully updated.")
|> moderation_log(details: &log_details/3, data: user)
- |> redirect(to: Routes.profile_path(conn, :show, user))
+ |> redirect(to: ~p"/profiles/#{user}")
{:error, changeset} ->
render(conn, "edit.html", changeset: changeset)
@@ -84,7 +84,7 @@ defmodule PhilomenaWeb.Admin.UserController do
defp log_details(conn, _action, user) do
%{
body: "Updated user details for #{user.name}",
- subject_path: Routes.profile_path(conn, :show, user)
+ subject_path: ~p"/profiles/#{user}"
}
end
end
diff --git a/lib/philomena_web/controllers/avatar_controller.ex b/lib/philomena_web/controllers/avatar_controller.ex
index 50a30cf2..9b6e4544 100644
--- a/lib/philomena_web/controllers/avatar_controller.ex
+++ b/lib/philomena_web/controllers/avatar_controller.ex
@@ -18,7 +18,7 @@ defmodule PhilomenaWeb.AvatarController do
{:ok, _user} ->
conn
|> put_flash(:info, "Successfully updated avatar.")
- |> redirect(to: Routes.avatar_path(conn, :edit))
+ |> redirect(to: ~p"/avatar/edit")
{:error, changeset} ->
render(conn, "edit.html", changeset: changeset)
@@ -30,6 +30,6 @@ defmodule PhilomenaWeb.AvatarController do
conn
|> put_flash(:info, "Successfully removed avatar.")
- |> redirect(to: Routes.avatar_path(conn, :edit))
+ |> redirect(to: ~p"/avatar/edit")
end
end
diff --git a/lib/philomena_web/controllers/channel/nsfw_controller.ex b/lib/philomena_web/controllers/channel/nsfw_controller.ex
index f695fb4d..31125122 100644
--- a/lib/philomena_web/controllers/channel/nsfw_controller.ex
+++ b/lib/philomena_web/controllers/channel/nsfw_controller.ex
@@ -7,14 +7,14 @@ defmodule PhilomenaWeb.Channel.NsfwController do
conn
|> set_cookie("chan_nsfw", "true")
|> put_flash(:info, "Successfully updated channel visibility.")
- |> redirect(to: Routes.channel_path(conn, :index))
+ |> redirect(to: ~p"/channels")
end
def delete(conn, _params) do
conn
|> set_cookie("chan_nsfw", "false")
|> put_flash(:info, "Successfully updated channel visibility.")
- |> redirect(to: Routes.channel_path(conn, :index))
+ |> redirect(to: ~p"/channels")
end
# Duplicated from setting controller
diff --git a/lib/philomena_web/controllers/channel_controller.ex b/lib/philomena_web/controllers/channel_controller.ex
index 973017d3..6d88d257 100644
--- a/lib/philomena_web/controllers/channel_controller.ex
+++ b/lib/philomena_web/controllers/channel_controller.ex
@@ -52,7 +52,7 @@ defmodule PhilomenaWeb.ChannelController do
{:ok, _channel} ->
conn
|> put_flash(:info, "Channel created successfully.")
- |> redirect(to: Routes.channel_path(conn, :index))
+ |> redirect(to: ~p"/channels")
{:error, changeset} ->
render(conn, "new.html", changeset: changeset)
@@ -69,7 +69,7 @@ defmodule PhilomenaWeb.ChannelController do
{:ok, _channel} ->
conn
|> put_flash(:info, "Channel updated successfully.")
- |> redirect(to: Routes.channel_path(conn, :index))
+ |> redirect(to: ~p"/channels")
{:error, changeset} ->
render(conn, "edit.html", changeset: changeset)
@@ -81,7 +81,7 @@ defmodule PhilomenaWeb.ChannelController do
conn
|> put_flash(:info, "Channel destroyed successfully.")
- |> redirect(to: Routes.channel_path(conn, :index))
+ |> redirect(to: ~p"/channels")
end
defp maybe_search(query, %{"cq" => cq}) when is_binary(cq) and cq != "" do
diff --git a/lib/philomena_web/controllers/confirmation_controller.ex b/lib/philomena_web/controllers/confirmation_controller.ex
index 2186bb8e..c22aa9ed 100644
--- a/lib/philomena_web/controllers/confirmation_controller.ex
+++ b/lib/philomena_web/controllers/confirmation_controller.ex
@@ -14,7 +14,7 @@ defmodule PhilomenaWeb.ConfirmationController do
if user = Users.get_user_by_email(email) do
Users.deliver_user_confirmation_instructions(
user,
- &Routes.confirmation_url(conn, :show, &1)
+ &url(~p"/confirmations/#{&1}")
)
end
diff --git a/lib/philomena_web/controllers/conversation/hide_controller.ex b/lib/philomena_web/controllers/conversation/hide_controller.ex
index 44bd8bad..71480de6 100644
--- a/lib/philomena_web/controllers/conversation/hide_controller.ex
+++ b/lib/philomena_web/controllers/conversation/hide_controller.ex
@@ -20,7 +20,7 @@ defmodule PhilomenaWeb.Conversation.HideController do
conn
|> put_flash(:info, "Conversation hidden.")
- |> redirect(to: Routes.conversation_path(conn, :index))
+ |> redirect(to: ~p"/conversations")
end
def delete(conn, _params) do
@@ -31,6 +31,6 @@ defmodule PhilomenaWeb.Conversation.HideController do
conn
|> put_flash(:info, "Conversation restored.")
- |> redirect(to: Routes.conversation_path(conn, :show, conversation))
+ |> redirect(to: ~p"/conversations/#{conversation}")
end
end
diff --git a/lib/philomena_web/controllers/conversation/message_controller.ex b/lib/philomena_web/controllers/conversation/message_controller.ex
index 7e238902..8bd44940 100644
--- a/lib/philomena_web/controllers/conversation/message_controller.ex
+++ b/lib/philomena_web/controllers/conversation/message_controller.ex
@@ -36,12 +36,12 @@ defmodule PhilomenaWeb.Conversation.MessageController do
conn
|> put_flash(:info, "Message successfully sent.")
- |> redirect(to: Routes.conversation_path(conn, :show, conversation, page: page))
+ |> redirect(to: ~p"/conversations/#{conversation}?#{[page: page]}")
_error ->
conn
|> put_flash(:error, "There was an error posting your message")
- |> redirect(to: Routes.conversation_path(conn, :show, conversation))
+ |> redirect(to: ~p"/conversations/#{conversation}")
end
end
end
diff --git a/lib/philomena_web/controllers/conversation/read_controller.ex b/lib/philomena_web/controllers/conversation/read_controller.ex
index 93a5601e..aa777274 100644
--- a/lib/philomena_web/controllers/conversation/read_controller.ex
+++ b/lib/philomena_web/controllers/conversation/read_controller.ex
@@ -20,7 +20,7 @@ defmodule PhilomenaWeb.Conversation.ReadController do
conn
|> put_flash(:info, "Conversation marked as read.")
- |> redirect(to: Routes.conversation_path(conn, :show, conversation))
+ |> redirect(to: ~p"/conversations/#{conversation}")
end
def delete(conn, _params) do
@@ -31,6 +31,6 @@ defmodule PhilomenaWeb.Conversation.ReadController do
conn
|> put_flash(:info, "Conversation marked as unread.")
- |> redirect(to: Routes.conversation_path(conn, :index))
+ |> redirect(to: ~p"/conversations")
end
end
diff --git a/lib/philomena_web/controllers/conversation/report_controller.ex b/lib/philomena_web/controllers/conversation/report_controller.ex
index 634bed1a..dab81482 100644
--- a/lib/philomena_web/controllers/conversation/report_controller.ex
+++ b/lib/philomena_web/controllers/conversation/report_controller.ex
@@ -22,7 +22,7 @@ defmodule PhilomenaWeb.Conversation.ReportController do
def new(conn, _params) do
conversation = conn.assigns.conversation
- action = Routes.conversation_report_path(conn, :create, conversation)
+ action = ~p"/conversations/#{conversation}/reports"
changeset =
%Report{reportable_type: "Conversation", reportable_id: conversation.id}
@@ -40,7 +40,7 @@ defmodule PhilomenaWeb.Conversation.ReportController do
def create(conn, params) do
conversation = conn.assigns.conversation
- action = Routes.conversation_report_path(conn, :create, conversation)
+ action = ~p"/conversations/#{conversation}/reports"
ReportController.create(conn, action, conversation, "Conversation", params)
end
diff --git a/lib/philomena_web/controllers/conversation_controller.ex b/lib/philomena_web/controllers/conversation_controller.ex
index 8b936f8e..12784b42 100644
--- a/lib/philomena_web/controllers/conversation_controller.ex
+++ b/lib/philomena_web/controllers/conversation_controller.ex
@@ -115,7 +115,7 @@ defmodule PhilomenaWeb.ConversationController do
conn
|> put_flash(:info, "Conversation successfully created.")
- |> redirect(to: Routes.conversation_path(conn, :show, conversation))
+ |> redirect(to: ~p"/conversations/#{conversation}")
{:error, changeset} ->
conn
diff --git a/lib/philomena_web/controllers/dnp_entry_controller.ex b/lib/philomena_web/controllers/dnp_entry_controller.ex
index ff3f1a07..d2e675b2 100644
--- a/lib/philomena_web/controllers/dnp_entry_controller.ex
+++ b/lib/philomena_web/controllers/dnp_entry_controller.ex
@@ -97,7 +97,7 @@ defmodule PhilomenaWeb.DnpEntryController do
{:ok, dnp_entry} ->
conn
|> put_flash(:info, "Successfully submitted DNP request.")
- |> redirect(to: Routes.dnp_entry_path(conn, :show, dnp_entry))
+ |> redirect(to: ~p"/dnp/#{dnp_entry}")
{:error, changeset} ->
render(conn, "new.html", changeset: changeset)
@@ -122,7 +122,7 @@ defmodule PhilomenaWeb.DnpEntryController do
{:ok, dnp_entry} ->
conn
|> put_flash(:info, "Successfully updated DNP request.")
- |> redirect(to: Routes.dnp_entry_path(conn, :show, dnp_entry))
+ |> redirect(to: ~p"/dnp/#{dnp_entry}")
{:error, changeset} ->
render(conn, "edit.html", changeset: changeset)
diff --git a/lib/philomena_web/controllers/duplicate_report/accept_controller.ex b/lib/philomena_web/controllers/duplicate_report/accept_controller.ex
index 2b21e306..a67760dc 100644
--- a/lib/philomena_web/controllers/duplicate_report/accept_controller.ex
+++ b/lib/philomena_web/controllers/duplicate_report/accept_controller.ex
@@ -21,12 +21,12 @@ defmodule PhilomenaWeb.DuplicateReport.AcceptController do
conn
|> put_flash(:info, "Successfully accepted report.")
|> moderation_log(details: &log_details/3, data: report.duplicate_report)
- |> redirect(to: Routes.duplicate_report_path(conn, :index))
+ |> redirect(to: ~p"/duplicate_reports")
_error ->
conn
|> put_flash(:error, "Failed to accept report! Maybe someone else already accepted it.")
- |> redirect(to: Routes.duplicate_report_path(conn, :index))
+ |> redirect(to: ~p"/duplicate_reports")
end
end
@@ -34,7 +34,7 @@ defmodule PhilomenaWeb.DuplicateReport.AcceptController do
%{
body:
"Accepted duplicate report, merged #{report.image.id} into #{report.duplicate_of_image.id}",
- subject_path: Routes.image_path(conn, :show, report.image)
+ subject_path: ~p"/images/#{report.image}"
}
end
end
diff --git a/lib/philomena_web/controllers/duplicate_report/accept_reverse_controller.ex b/lib/philomena_web/controllers/duplicate_report/accept_reverse_controller.ex
index d112ce27..7c04cc49 100644
--- a/lib/philomena_web/controllers/duplicate_report/accept_reverse_controller.ex
+++ b/lib/philomena_web/controllers/duplicate_report/accept_reverse_controller.ex
@@ -21,12 +21,12 @@ defmodule PhilomenaWeb.DuplicateReport.AcceptReverseController do
conn
|> put_flash(:info, "Successfully accepted report in reverse.")
|> moderation_log(details: &log_details/3, data: report.duplicate_report)
- |> redirect(to: Routes.duplicate_report_path(conn, :index))
+ |> redirect(to: ~p"/duplicate_reports")
_error ->
conn
|> put_flash(:error, "Failed to accept report! Maybe someone else already accepted it.")
- |> redirect(to: Routes.duplicate_report_path(conn, :index))
+ |> redirect(to: ~p"/duplicate_reports")
end
end
@@ -34,7 +34,7 @@ defmodule PhilomenaWeb.DuplicateReport.AcceptReverseController do
%{
body:
"Reverse-accepted duplicate report, merged #{report.image.id} into #{report.duplicate_of_image.id}",
- subject_path: Routes.image_path(conn, :show, report.image)
+ subject_path: ~p"/images/#{report.image}"
}
end
end
diff --git a/lib/philomena_web/controllers/duplicate_report/claim_controller.ex b/lib/philomena_web/controllers/duplicate_report/claim_controller.ex
index 31646f56..966eddae 100644
--- a/lib/philomena_web/controllers/duplicate_report/claim_controller.ex
+++ b/lib/philomena_web/controllers/duplicate_report/claim_controller.ex
@@ -21,7 +21,7 @@ defmodule PhilomenaWeb.DuplicateReport.ClaimController do
conn
|> put_flash(:info, "Successfully claimed report.")
|> moderation_log(details: &log_details/3, data: report)
- |> redirect(to: Routes.duplicate_report_path(conn, :index))
+ |> redirect(to: ~p"/duplicate_reports")
end
def delete(conn, _params) do
@@ -30,7 +30,7 @@ defmodule PhilomenaWeb.DuplicateReport.ClaimController do
conn
|> put_flash(:info, "Successfully released report.")
|> moderation_log(details: &log_details/3)
- |> redirect(to: Routes.duplicate_report_path(conn, :index))
+ |> redirect(to: ~p"/duplicate_reports")
end
defp log_details(conn, action, _) do
@@ -42,7 +42,7 @@ defmodule PhilomenaWeb.DuplicateReport.ClaimController do
%{
body: body,
- subject_path: Routes.duplicate_report_path(conn, :index)
+ subject_path: ~p"/duplicate_reports"
}
end
end
diff --git a/lib/philomena_web/controllers/duplicate_report/reject_controller.ex b/lib/philomena_web/controllers/duplicate_report/reject_controller.ex
index e019fb2a..83626c36 100644
--- a/lib/philomena_web/controllers/duplicate_report/reject_controller.ex
+++ b/lib/philomena_web/controllers/duplicate_report/reject_controller.ex
@@ -22,13 +22,13 @@ defmodule PhilomenaWeb.DuplicateReport.RejectController do
conn
|> put_flash(:info, "Successfully rejected report.")
|> moderation_log(details: &log_details/3, data: report)
- |> redirect(to: Routes.duplicate_report_path(conn, :index))
+ |> redirect(to: ~p"/duplicate_reports")
end
defp log_details(conn, _action, report) do
%{
body: "Rejected duplicate report (#{report.image.id} -> #{report.duplicate_of_image.id})",
- subject_path: Routes.duplicate_report_path(conn, :index)
+ subject_path: ~p"/duplicate_reports"
}
end
end
diff --git a/lib/philomena_web/controllers/duplicate_report_controller.ex b/lib/philomena_web/controllers/duplicate_report_controller.ex
index f30539a0..5fd80e38 100644
--- a/lib/philomena_web/controllers/duplicate_report_controller.ex
+++ b/lib/philomena_web/controllers/duplicate_report_controller.ex
@@ -56,12 +56,12 @@ defmodule PhilomenaWeb.DuplicateReportController do
{:ok, duplicate_report} ->
conn
|> put_flash(:info, "Duplicate report created successfully.")
- |> redirect(to: Routes.image_path(conn, :show, duplicate_report.image_id))
+ |> redirect(to: ~p"/images/#{duplicate_report.image_id}")
{:error, _changeset} ->
conn
|> put_flash(:error, "Failed to submit duplicate report")
- |> redirect(to: Routes.image_path(conn, :show, source))
+ |> redirect(to: ~p"/images/#{source}")
end
end
diff --git a/lib/philomena_web/controllers/filter/clear_recent.ex b/lib/philomena_web/controllers/filter/clear_recent.ex
index f3aed68d..24f321d3 100644
--- a/lib/philomena_web/controllers/filter/clear_recent.ex
+++ b/lib/philomena_web/controllers/filter/clear_recent.ex
@@ -10,6 +10,6 @@ defmodule PhilomenaWeb.Filter.ClearRecentController do
conn
|> put_flash(:info, "Cleared recent filters.")
- |> redirect(to: Routes.filter_path(conn, :index))
+ |> redirect(to: ~p"/filters")
end
end
diff --git a/lib/philomena_web/controllers/filter/public_controller.ex b/lib/philomena_web/controllers/filter/public_controller.ex
index 80e23308..e31a8219 100644
--- a/lib/philomena_web/controllers/filter/public_controller.ex
+++ b/lib/philomena_web/controllers/filter/public_controller.ex
@@ -12,12 +12,12 @@ defmodule PhilomenaWeb.Filter.PublicController do
{:ok, filter} ->
conn
|> put_flash(:info, "Successfully made filter public.")
- |> redirect(to: Routes.filter_path(conn, :show, filter))
+ |> redirect(to: ~p"/filters/#{filter}")
_error ->
conn
|> put_flash(:error, "Couldn't make filter public!")
- |> redirect(to: Routes.filter_path(conn, :show, conn.assigns.filter))
+ |> redirect(to: ~p"/filters/#{conn.assigns.filter}")
end
end
end
diff --git a/lib/philomena_web/controllers/filter_controller.ex b/lib/philomena_web/controllers/filter_controller.ex
index 86c218f8..9f19415f 100644
--- a/lib/philomena_web/controllers/filter_controller.ex
+++ b/lib/philomena_web/controllers/filter_controller.ex
@@ -146,7 +146,7 @@ defmodule PhilomenaWeb.FilterController do
{:ok, filter} ->
conn
|> put_flash(:info, "Filter created successfully.")
- |> redirect(to: Routes.filter_path(conn, :show, filter))
+ |> redirect(to: ~p"/filters/#{filter}")
{:error, %Ecto.Changeset{} = changeset} ->
render(conn, "new.html", changeset: changeset)
@@ -171,7 +171,7 @@ defmodule PhilomenaWeb.FilterController do
{:ok, filter} ->
conn
|> put_flash(:info, "Filter updated successfully.")
- |> redirect(to: Routes.filter_path(conn, :show, filter))
+ |> redirect(to: ~p"/filters/#{filter}")
{:error, %Ecto.Changeset{} = changeset} ->
render(conn, "edit.html", filter: filter, changeset: changeset)
@@ -185,12 +185,12 @@ defmodule PhilomenaWeb.FilterController do
{:ok, _filter} ->
conn
|> put_flash(:info, "Filter deleted successfully.")
- |> redirect(to: Routes.filter_path(conn, :index))
+ |> redirect(to: ~p"/filters")
_error ->
conn
|> put_flash(:error, "Filter is still in use, not deleted.")
- |> redirect(to: Routes.filter_path(conn, :show, filter))
+ |> redirect(to: ~p"/filters/#{filter}")
end
end
end
diff --git a/lib/philomena_web/controllers/gallery/report_controller.ex b/lib/philomena_web/controllers/gallery/report_controller.ex
index 879fd8fd..3d4b5fd5 100644
--- a/lib/philomena_web/controllers/gallery/report_controller.ex
+++ b/lib/philomena_web/controllers/gallery/report_controller.ex
@@ -21,7 +21,7 @@ defmodule PhilomenaWeb.Gallery.ReportController do
def new(conn, _params) do
gallery = conn.assigns.gallery
- action = Routes.gallery_report_path(conn, :create, gallery)
+ action = ~p"/galleries/#{gallery}/reports"
changeset =
%Report{reportable_type: "Gallery", reportable_id: gallery.id}
@@ -39,7 +39,7 @@ defmodule PhilomenaWeb.Gallery.ReportController do
def create(conn, params) do
gallery = conn.assigns.gallery
- action = Routes.gallery_report_path(conn, :create, gallery)
+ action = ~p"/galleries/#{gallery}/reports"
ReportController.create(conn, action, gallery, "Gallery", params)
end
diff --git a/lib/philomena_web/controllers/gallery_controller.ex b/lib/philomena_web/controllers/gallery_controller.ex
index ee19d230..2b298d2c 100644
--- a/lib/philomena_web/controllers/gallery_controller.ex
+++ b/lib/philomena_web/controllers/gallery_controller.ex
@@ -110,7 +110,7 @@ defmodule PhilomenaWeb.GalleryController do
{:ok, gallery} ->
conn
|> put_flash(:info, "Gallery successfully created.")
- |> redirect(to: Routes.gallery_path(conn, :show, gallery))
+ |> redirect(to: ~p"/galleries/#{gallery}")
{:error, changeset} ->
conn
@@ -132,7 +132,7 @@ defmodule PhilomenaWeb.GalleryController do
{:ok, gallery} ->
conn
|> put_flash(:info, "Gallery successfully updated.")
- |> redirect(to: Routes.gallery_path(conn, :show, gallery))
+ |> redirect(to: ~p"/galleries/#{gallery}")
{:error, changeset} ->
conn
@@ -147,7 +147,7 @@ defmodule PhilomenaWeb.GalleryController do
conn
|> put_flash(:info, "Gallery successfully destroyed.")
- |> redirect(to: Routes.gallery_path(conn, :index))
+ |> redirect(to: ~p"/galleries")
end
defp prev_next_page_images(conn, query) do
diff --git a/lib/philomena_web/controllers/image/anonymous_controller.ex b/lib/philomena_web/controllers/image/anonymous_controller.ex
index d74b1682..1855efc9 100644
--- a/lib/philomena_web/controllers/image/anonymous_controller.ex
+++ b/lib/philomena_web/controllers/image/anonymous_controller.ex
@@ -23,7 +23,7 @@ defmodule PhilomenaWeb.Image.AnonymousController do
conn
|> put_flash(:info, "Successfully updated anonymity.")
|> moderation_log(details: &log_details/3, data: image)
- |> redirect(to: Routes.image_path(conn, :show, image))
+ |> redirect(to: ~p"/images/#{image}")
end
defp verify_authorized(conn, _opts) do
@@ -36,7 +36,7 @@ defmodule PhilomenaWeb.Image.AnonymousController do
defp log_details(conn, _action, image) do
%{
body: "Updated anonymity of image >>#{image.id}",
- subject_path: Routes.image_path(conn, :show, image)
+ subject_path: ~p"/images/#{image}"
}
end
end
diff --git a/lib/philomena_web/controllers/image/approve_controller.ex b/lib/philomena_web/controllers/image/approve_controller.ex
index 689339f8..1a44cb76 100644
--- a/lib/philomena_web/controllers/image/approve_controller.ex
+++ b/lib/philomena_web/controllers/image/approve_controller.ex
@@ -15,10 +15,10 @@ defmodule PhilomenaWeb.Image.ApproveController do
conn
|> put_flash(:info, "Image has been approved.")
|> moderation_log(details: &log_details/3, data: image)
- |> redirect(to: Routes.admin_approval_path(conn, :index))
+ |> redirect(to: ~p"/admin/approvals")
end
defp log_details(conn, _action, image) do
- %{body: "Approved image #{image.id}", subject_path: Routes.image_path(conn, :show, image)}
+ %{body: "Approved image #{image.id}", subject_path: ~p"/images/#{image}"}
end
end
diff --git a/lib/philomena_web/controllers/image/comment/approve_controller.ex b/lib/philomena_web/controllers/image/comment/approve_controller.ex
index 699d0cc2..f6b05ca1 100644
--- a/lib/philomena_web/controllers/image/comment/approve_controller.ex
+++ b/lib/philomena_web/controllers/image/comment/approve_controller.ex
@@ -23,13 +23,13 @@ defmodule PhilomenaWeb.Image.Comment.ApproveController do
conn
|> put_flash(:info, "Comment has been approved.")
|> moderation_log(details: &log_details/3, data: comment)
- |> redirect(to: Routes.image_path(conn, :show, comment.image_id) <> "#comment_#{comment.id}")
+ |> redirect(to: ~p"/images/#{comment.image_id}" <> "#comment_#{comment.id}")
end
defp log_details(conn, _action, comment) do
%{
body: "Approved comment on image >>#{comment.image_id}",
- subject_path: Routes.image_path(conn, :show, comment.image_id) <> "#comment_#{comment.id}"
+ subject_path: ~p"/images/#{comment.image_id}" <> "#comment_#{comment.id}"
}
end
end
diff --git a/lib/philomena_web/controllers/image/comment/delete_controller.ex b/lib/philomena_web/controllers/image/comment/delete_controller.ex
index 4527e759..21fc2c1f 100644
--- a/lib/philomena_web/controllers/image/comment/delete_controller.ex
+++ b/lib/philomena_web/controllers/image/comment/delete_controller.ex
@@ -17,23 +17,19 @@ defmodule PhilomenaWeb.Image.Comment.DeleteController do
conn
|> put_flash(:info, "Comment successfully destroyed!")
|> moderation_log(details: &log_details/3, data: comment)
- |> redirect(
- to: Routes.image_path(conn, :show, comment.image_id) <> "#comment_#{comment.id}"
- )
+ |> redirect(to: ~p"/images/#{comment.image_id}" <> "#comment_#{comment.id}")
{:error, _changeset} ->
conn
|> put_flash(:error, "Unable to destroy comment!")
- |> redirect(
- to: Routes.image_path(conn, :show, comment.image_id) <> "#comment_#{comment.id}"
- )
+ |> redirect(to: ~p"/images/#{comment.image_id}" <> "#comment_#{comment.id}")
end
end
defp log_details(conn, _action, comment) do
%{
body: "Destroyed comment on image >>#{comment.image_id}",
- subject_path: Routes.image_path(conn, :show, comment.image_id) <> "#comment_#{comment.id}"
+ subject_path: ~p"/images/#{comment.image_id}" <> "#comment_#{comment.id}"
}
end
end
diff --git a/lib/philomena_web/controllers/image/comment/hide_controller.ex b/lib/philomena_web/controllers/image/comment/hide_controller.ex
index 1e55f86d..94241104 100644
--- a/lib/philomena_web/controllers/image/comment/hide_controller.ex
+++ b/lib/philomena_web/controllers/image/comment/hide_controller.ex
@@ -16,16 +16,12 @@ defmodule PhilomenaWeb.Image.Comment.HideController do
conn
|> put_flash(:info, "Comment successfully hidden!")
|> moderation_log(details: &log_details/3, data: comment)
- |> redirect(
- to: Routes.image_path(conn, :show, comment.image_id) <> "#comment_#{comment.id}"
- )
+ |> redirect(to: ~p"/images/#{comment.image_id}" <> "#comment_#{comment.id}")
_error ->
conn
|> put_flash(:error, "Unable to hide comment!")
- |> redirect(
- to: Routes.image_path(conn, :show, comment.image_id) <> "#comment_#{comment.id}"
- )
+ |> redirect(to: ~p"/images/#{comment.image_id}" <> "#comment_#{comment.id}")
end
end
@@ -37,16 +33,12 @@ defmodule PhilomenaWeb.Image.Comment.HideController do
conn
|> put_flash(:info, "Comment successfully unhidden!")
|> moderation_log(details: &log_details/3, data: comment)
- |> redirect(
- to: Routes.image_path(conn, :show, comment.image_id) <> "#comment_#{comment.id}"
- )
+ |> redirect(to: ~p"/images/#{comment.image_id}" <> "#comment_#{comment.id}")
{:error, _changeset} ->
conn
|> put_flash(:error, "Unable to unhide comment!")
- |> redirect(
- to: Routes.image_path(conn, :show, comment.image_id) <> "#comment_#{comment.id}"
- )
+ |> redirect(to: ~p"/images/#{comment.image_id}" <> "#comment_#{comment.id}")
end
end
@@ -59,7 +51,7 @@ defmodule PhilomenaWeb.Image.Comment.HideController do
%{
body: body,
- subject_path: Routes.image_path(conn, :show, comment.image_id) <> "#comment_#{comment.id}"
+ subject_path: ~p"/images/#{comment.image_id}" <> "#comment_#{comment.id}"
}
end
end
diff --git a/lib/philomena_web/controllers/image/comment/report_controller.ex b/lib/philomena_web/controllers/image/comment/report_controller.ex
index 27725a4b..d957abbd 100644
--- a/lib/philomena_web/controllers/image/comment/report_controller.ex
+++ b/lib/philomena_web/controllers/image/comment/report_controller.ex
@@ -24,7 +24,7 @@ defmodule PhilomenaWeb.Image.Comment.ReportController do
def new(conn, _params) do
comment = conn.assigns.comment
- action = Routes.image_comment_report_path(conn, :create, comment.image, comment)
+ action = ~p"/images/#{comment.image}/comments/#{comment}/reports"
changeset =
%Report{reportable_type: "Comment", reportable_id: comment.id}
@@ -42,7 +42,7 @@ defmodule PhilomenaWeb.Image.Comment.ReportController do
def create(conn, params) do
comment = conn.assigns.comment
- action = Routes.image_comment_report_path(conn, :create, comment.image, comment)
+ action = ~p"/images/#{comment.image}/comments/#{comment}/reports"
ReportController.create(conn, action, comment, "Comment", params)
end
diff --git a/lib/philomena_web/controllers/image/comment_controller.ex b/lib/philomena_web/controllers/image/comment_controller.ex
index cfcda777..ca0ff9ad 100644
--- a/lib/philomena_web/controllers/image/comment_controller.ex
+++ b/lib/philomena_web/controllers/image/comment_controller.ex
@@ -42,7 +42,7 @@ defmodule PhilomenaWeb.Image.CommentController do
def index(conn, %{"comment_id" => comment_id}) do
page = CommentLoader.find_page(conn, conn.assigns.image, comment_id)
- redirect(conn, to: Routes.image_comment_path(conn, :index, conn.assigns.image, page: page))
+ redirect(conn, to: ~p"/images/#{conn.assigns.image}/comments?#{[page: page]}")
end
def index(conn, _params) do
@@ -93,7 +93,7 @@ defmodule PhilomenaWeb.Image.CommentController do
_error ->
conn
|> put_flash(:error, "There was an error posting your comment")
- |> redirect(to: Routes.image_path(conn, :show, image))
+ |> redirect(to: ~p"/images/#{image}")
end
end
@@ -126,9 +126,7 @@ defmodule PhilomenaWeb.Image.CommentController do
conn
|> put_flash(:info, "Comment updated successfully.")
- |> redirect(
- to: Routes.image_path(conn, :show, conn.assigns.image) <> "#comment_#{comment.id}"
- )
+ |> redirect(to: ~p"/images/#{conn.assigns.image}" <> "#comment_#{comment.id}")
{:error, :comment, changeset, _changes} ->
render(conn, "edit.html", comment: conn.assigns.comment, changeset: changeset)
diff --git a/lib/philomena_web/controllers/image/comment_lock_controller.ex b/lib/philomena_web/controllers/image/comment_lock_controller.ex
index e913bdb6..c6c5b2b9 100644
--- a/lib/philomena_web/controllers/image/comment_lock_controller.ex
+++ b/lib/philomena_web/controllers/image/comment_lock_controller.ex
@@ -13,7 +13,7 @@ defmodule PhilomenaWeb.Image.CommentLockController do
conn
|> put_flash(:info, "Successfully locked comments.")
|> moderation_log(details: &log_details/3, data: image)
- |> redirect(to: Routes.image_path(conn, :show, image))
+ |> redirect(to: ~p"/images/#{image}")
end
def delete(conn, _params) do
@@ -22,7 +22,7 @@ defmodule PhilomenaWeb.Image.CommentLockController do
conn
|> put_flash(:info, "Successfully unlocked comments.")
|> moderation_log(details: &log_details/3, data: image)
- |> redirect(to: Routes.image_path(conn, :show, image))
+ |> redirect(to: ~p"/images/#{image}")
end
defp log_details(conn, action, image) do
@@ -34,7 +34,7 @@ defmodule PhilomenaWeb.Image.CommentLockController do
%{
body: body,
- subject_path: Routes.image_path(conn, :show, image)
+ subject_path: ~p"/images/#{image}"
}
end
end
diff --git a/lib/philomena_web/controllers/image/delete_controller.ex b/lib/philomena_web/controllers/image/delete_controller.ex
index adae818c..3d86cfa6 100644
--- a/lib/philomena_web/controllers/image/delete_controller.ex
+++ b/lib/philomena_web/controllers/image/delete_controller.ex
@@ -20,12 +20,12 @@ defmodule PhilomenaWeb.Image.DeleteController do
conn
|> put_flash(:info, "Image successfully hidden.")
|> moderation_log(details: &log_details/3, data: result.image)
- |> redirect(to: Routes.image_path(conn, :show, image))
+ |> redirect(to: ~p"/images/#{image}")
_error ->
conn
|> put_flash(:error, "Failed to hide image.")
- |> redirect(to: Routes.image_path(conn, :show, image))
+ |> redirect(to: ~p"/images/#{image}")
end
end
@@ -37,12 +37,12 @@ defmodule PhilomenaWeb.Image.DeleteController do
conn
|> put_flash(:info, "Hide reason updated.")
|> moderation_log(details: &log_details/3, data: image)
- |> redirect(to: Routes.image_path(conn, :show, image))
+ |> redirect(to: ~p"/images/#{image}")
{:error, _changeset} ->
conn
|> put_flash(:error, "Couldn't update hide reason.")
- |> redirect(to: Routes.image_path(conn, :show, image))
+ |> redirect(to: ~p"/images/#{image}")
end
end
@@ -54,7 +54,7 @@ defmodule PhilomenaWeb.Image.DeleteController do
_false ->
conn
|> put_flash(:error, "Cannot change hide reason on a non-hidden image!")
- |> redirect(to: Routes.image_path(conn, :show, conn.assigns.image))
+ |> redirect(to: ~p"/images/#{conn.assigns.image}")
|> halt()
end
end
@@ -67,7 +67,7 @@ defmodule PhilomenaWeb.Image.DeleteController do
conn
|> put_flash(:info, "Image successfully unhidden.")
|> moderation_log(details: &log_details/3, data: image)
- |> redirect(to: Routes.image_path(conn, :show, image))
+ |> redirect(to: ~p"/images/#{image}")
end
defp log_details(conn, action, image) do
@@ -80,7 +80,7 @@ defmodule PhilomenaWeb.Image.DeleteController do
%{
body: body,
- subject_path: Routes.image_path(conn, :show, image)
+ subject_path: ~p"/images/#{image}"
}
end
end
diff --git a/lib/philomena_web/controllers/image/description_lock_controller.ex b/lib/philomena_web/controllers/image/description_lock_controller.ex
index ed8c9c87..bde327ac 100644
--- a/lib/philomena_web/controllers/image/description_lock_controller.ex
+++ b/lib/philomena_web/controllers/image/description_lock_controller.ex
@@ -13,7 +13,7 @@ defmodule PhilomenaWeb.Image.DescriptionLockController do
conn
|> put_flash(:info, "Successfully locked description.")
|> moderation_log(details: &log_details/3, data: image)
- |> redirect(to: Routes.image_path(conn, :show, image))
+ |> redirect(to: ~p"/images/#{image}")
end
def delete(conn, _params) do
@@ -22,7 +22,7 @@ defmodule PhilomenaWeb.Image.DescriptionLockController do
conn
|> put_flash(:info, "Successfully unlocked description.")
|> moderation_log(details: &log_details/3, data: image)
- |> redirect(to: Routes.image_path(conn, :show, image))
+ |> redirect(to: ~p"/images/#{image}")
end
defp log_details(conn, action, image) do
@@ -34,7 +34,7 @@ defmodule PhilomenaWeb.Image.DescriptionLockController do
%{
body: body,
- subject_path: Routes.image_path(conn, :show, image)
+ subject_path: ~p"/images/#{image}"
}
end
end
diff --git a/lib/philomena_web/controllers/image/destroy_controller.ex b/lib/philomena_web/controllers/image/destroy_controller.ex
index fe2f3e6e..8f4ed867 100644
--- a/lib/philomena_web/controllers/image/destroy_controller.ex
+++ b/lib/philomena_web/controllers/image/destroy_controller.ex
@@ -16,12 +16,12 @@ defmodule PhilomenaWeb.Image.DestroyController do
conn
|> put_flash(:info, "Image contents destroyed.")
|> moderation_log(details: &log_details/3, data: image)
- |> redirect(to: Routes.image_path(conn, :show, image))
+ |> redirect(to: ~p"/images/#{image}")
_error ->
conn
|> put_flash(:error, "Failed to destroy image.")
- |> redirect(to: Routes.image_path(conn, :show, image))
+ |> redirect(to: ~p"/images/#{image}")
end
end
@@ -33,7 +33,7 @@ defmodule PhilomenaWeb.Image.DestroyController do
_false ->
conn
|> put_flash(:error, "Cannot destroy a non-hidden image!")
- |> redirect(to: Routes.image_path(conn, :show, conn.assigns.image))
+ |> redirect(to: ~p"/images/#{conn.assigns.image}")
|> halt()
end
end
@@ -41,7 +41,7 @@ defmodule PhilomenaWeb.Image.DestroyController do
defp log_details(conn, _action, image) do
%{
body: "Hard-deleted image >>#{image.id}",
- subject_path: Routes.image_path(conn, :show, image)
+ subject_path: ~p"/images/#{image}"
}
end
end
diff --git a/lib/philomena_web/controllers/image/feature_controller.ex b/lib/philomena_web/controllers/image/feature_controller.ex
index a16ee809..74c19c05 100644
--- a/lib/philomena_web/controllers/image/feature_controller.ex
+++ b/lib/philomena_web/controllers/image/feature_controller.ex
@@ -17,7 +17,7 @@ defmodule PhilomenaWeb.Image.FeatureController do
conn
|> put_flash(:info, "Image marked as featured image.")
|> moderation_log(details: &log_details/3, data: image)
- |> redirect(to: Routes.image_path(conn, :show, image))
+ |> redirect(to: ~p"/images/#{image}")
end
defp verify_not_deleted(conn, _opts) do
@@ -25,7 +25,7 @@ defmodule PhilomenaWeb.Image.FeatureController do
true ->
conn
|> put_flash(:error, "Cannot feature a hidden image.")
- |> redirect(to: Routes.image_path(conn, :show, conn.assigns.image))
+ |> redirect(to: ~p"/images/#{conn.assigns.image}")
|> halt()
_false ->
@@ -36,7 +36,7 @@ defmodule PhilomenaWeb.Image.FeatureController do
defp log_details(conn, _action, image) do
%{
body: "Featured image >>#{image.id}",
- subject_path: Routes.image_path(conn, :show, image)
+ subject_path: ~p"/images/#{image}"
}
end
end
diff --git a/lib/philomena_web/controllers/image/file_controller.ex b/lib/philomena_web/controllers/image/file_controller.ex
index 8b3f0e3f..f169d2f4 100644
--- a/lib/philomena_web/controllers/image/file_controller.ex
+++ b/lib/philomena_web/controllers/image/file_controller.ex
@@ -16,12 +16,12 @@ defmodule PhilomenaWeb.Image.FileController do
{:ok, image} ->
conn
|> put_flash(:info, "Successfully updated file.")
- |> redirect(to: Routes.image_path(conn, :show, image))
+ |> redirect(to: ~p"/images/#{image}")
_error ->
conn
|> put_flash(:error, "Failed to update file!")
- |> redirect(to: Routes.image_path(conn, :show, conn.assigns.image))
+ |> redirect(to: ~p"/images/#{conn.assigns.image}")
end
end
@@ -30,7 +30,7 @@ defmodule PhilomenaWeb.Image.FileController do
true ->
conn
|> put_flash(:error, "Cannot replace a hidden image.")
- |> redirect(to: Routes.image_path(conn, :show, conn.assigns.image))
+ |> redirect(to: ~p"/images/#{conn.assigns.image}")
|> halt()
_false ->
diff --git a/lib/philomena_web/controllers/image/hash_controller.ex b/lib/philomena_web/controllers/image/hash_controller.ex
index ad99b133..233d5202 100644
--- a/lib/philomena_web/controllers/image/hash_controller.ex
+++ b/lib/philomena_web/controllers/image/hash_controller.ex
@@ -13,13 +13,13 @@ defmodule PhilomenaWeb.Image.HashController do
conn
|> put_flash(:info, "Successfully cleared hash.")
|> moderation_log(details: &log_details/3, data: image)
- |> redirect(to: Routes.image_path(conn, :show, image))
+ |> redirect(to: ~p"/images/#{image}")
end
defp log_details(conn, _action, image) do
%{
body: "Cleared hash of image >>#{image.id}",
- subject_path: Routes.image_path(conn, :show, image)
+ subject_path: ~p"/images/#{image}"
}
end
end
diff --git a/lib/philomena_web/controllers/image/navigate_controller.ex b/lib/philomena_web/controllers/image/navigate_controller.ex
index ab74f038..c0827caa 100644
--- a/lib/philomena_web/controllers/image/navigate_controller.ex
+++ b/lib/philomena_web/controllers/image/navigate_controller.ex
@@ -21,11 +21,11 @@ defmodule PhilomenaWeb.Image.NavigateController do
|> case do
{next_image, hit} ->
redirect(conn,
- to: Routes.image_path(conn, :show, next_image, Keyword.put(scope, :sort, hit["sort"]))
+ to: ~p"/images/#{next_image}?#{Keyword.put(scope, :sort, hit["sort"])}"
)
nil ->
- redirect(conn, to: Routes.image_path(conn, :show, image, scope))
+ redirect(conn, to: ~p"/images/#{image}?#{scope}")
end
end
@@ -41,7 +41,7 @@ defmodule PhilomenaWeb.Image.NavigateController do
page_num = page_for_offset(pagination.page_size, images.total_entries)
- redirect(conn, to: Routes.search_path(conn, :index, q: "*", page: page_num))
+ redirect(conn, to: ~p"/search?#{[q: "*", page: page_num]}")
end
defp page_for_offset(per_page, offset) do
diff --git a/lib/philomena_web/controllers/image/random_controller.ex b/lib/philomena_web/controllers/image/random_controller.ex
index f39d8c75..9bc293f7 100644
--- a/lib/philomena_web/controllers/image/random_controller.ex
+++ b/lib/philomena_web/controllers/image/random_controller.ex
@@ -20,10 +20,10 @@ defmodule PhilomenaWeb.Image.RandomController do
case unwrap_random_result(search_definition) do
nil ->
- redirect(conn, to: Routes.image_path(conn, :index))
+ redirect(conn, to: ~p"/images")
random_id ->
- redirect(conn, to: Routes.image_path(conn, :show, random_id, scope))
+ redirect(conn, to: ~p"/images/#{random_id}?#{scope}")
end
end
diff --git a/lib/philomena_web/controllers/image/repair_controller.ex b/lib/philomena_web/controllers/image/repair_controller.ex
index 7e40835a..10d86773 100644
--- a/lib/philomena_web/controllers/image/repair_controller.ex
+++ b/lib/philomena_web/controllers/image/repair_controller.ex
@@ -14,13 +14,13 @@ defmodule PhilomenaWeb.Image.RepairController do
conn
|> put_flash(:info, "Repair job enqueued.")
|> moderation_log(details: &log_details/3, data: conn.assigns.image)
- |> redirect(to: Routes.image_path(conn, :show, conn.assigns.image))
+ |> redirect(to: ~p"/images/#{conn.assigns.image}")
end
defp log_details(conn, _action, image) do
%{
body: "Repaired image >>#{image.id}",
- subject_path: Routes.image_path(conn, :show, image)
+ subject_path: ~p"/images/#{image}"
}
end
end
diff --git a/lib/philomena_web/controllers/image/report_controller.ex b/lib/philomena_web/controllers/image/report_controller.ex
index 99e2bace..6956832e 100644
--- a/lib/philomena_web/controllers/image/report_controller.ex
+++ b/lib/philomena_web/controllers/image/report_controller.ex
@@ -21,7 +21,7 @@ defmodule PhilomenaWeb.Image.ReportController do
def new(conn, _params) do
image = conn.assigns.image
- action = Routes.image_report_path(conn, :create, image)
+ action = ~p"/images/#{image}/reports"
changeset =
%Report{reportable_type: "Image", reportable_id: image.id}
@@ -39,7 +39,7 @@ defmodule PhilomenaWeb.Image.ReportController do
def create(conn, params) do
image = conn.assigns.image
- action = Routes.image_report_path(conn, :create, image)
+ action = ~p"/images/#{image}/reports"
ReportController.create(conn, action, image, "Image", params)
end
diff --git a/lib/philomena_web/controllers/image/scratchpad_controller.ex b/lib/philomena_web/controllers/image/scratchpad_controller.ex
index 863c0bc8..4fddb135 100644
--- a/lib/philomena_web/controllers/image/scratchpad_controller.ex
+++ b/lib/philomena_web/controllers/image/scratchpad_controller.ex
@@ -18,13 +18,13 @@ defmodule PhilomenaWeb.Image.ScratchpadController do
conn
|> put_flash(:info, "Successfully updated moderation notes.")
|> moderation_log(details: &log_details/3, data: image)
- |> redirect(to: Routes.image_path(conn, :show, image))
+ |> redirect(to: ~p"/images/#{image}")
end
defp log_details(conn, _action, image) do
%{
body: "Updated mod notes on image >>#{image.id} (#{image.scratchpad})",
- subject_path: Routes.image_path(conn, :show, image)
+ subject_path: ~p"/images/#{image}"
}
end
end
diff --git a/lib/philomena_web/controllers/image/source_history_controller.ex b/lib/philomena_web/controllers/image/source_history_controller.ex
index 24bab27f..85f061db 100644
--- a/lib/philomena_web/controllers/image/source_history_controller.ex
+++ b/lib/philomena_web/controllers/image/source_history_controller.ex
@@ -15,13 +15,13 @@ defmodule PhilomenaWeb.Image.SourceHistoryController do
conn
|> put_flash(:info, "Successfully deleted source history.")
|> moderation_log(details: &log_details/3, data: image)
- |> redirect(to: Routes.image_path(conn, :show, image))
+ |> redirect(to: ~p"/images/#{image}")
end
defp log_details(conn, _action, image) do
%{
body: "Deleted source history for image >>#{image.id}",
- subject_path: Routes.image_path(conn, :show, image)
+ subject_path: ~p"/images/#{image}"
}
end
end
diff --git a/lib/philomena_web/controllers/image/tag_change_controller.ex b/lib/philomena_web/controllers/image/tag_change_controller.ex
index 6868ed96..b2716558 100644
--- a/lib/philomena_web/controllers/image/tag_change_controller.ex
+++ b/lib/philomena_web/controllers/image/tag_change_controller.ex
@@ -46,7 +46,7 @@ defmodule PhilomenaWeb.Image.TagChangeController do
details: &log_details/3,
data: %{image: image, details: tag_change_details(tag_change)}
)
- |> redirect(to: Routes.image_path(conn, :show, image))
+ |> redirect(to: ~p"/images/#{image}")
end
defp added_filter(query, %{"added" => "1"}),
@@ -61,7 +61,7 @@ defmodule PhilomenaWeb.Image.TagChangeController do
defp log_details(conn, _action, %{image: image, details: details}) do
%{
body: "Deleted tag change #{details} on >>#{image.id} from history",
- subject_path: Routes.image_path(conn, :show, image)
+ subject_path: ~p"/images/#{image}"
}
end
diff --git a/lib/philomena_web/controllers/image/tag_lock_controller.ex b/lib/philomena_web/controllers/image/tag_lock_controller.ex
index 2f71b4a3..4e6a0e70 100644
--- a/lib/philomena_web/controllers/image/tag_lock_controller.ex
+++ b/lib/philomena_web/controllers/image/tag_lock_controller.ex
@@ -24,7 +24,7 @@ defmodule PhilomenaWeb.Image.TagLockController do
conn
|> put_flash(:info, "Successfully updated list of locked tags.")
|> moderation_log(details: &log_details/3, data: image)
- |> redirect(to: Routes.image_path(conn, :show, image))
+ |> redirect(to: ~p"/images/#{image}")
end
def create(conn, _params) do
@@ -33,7 +33,7 @@ defmodule PhilomenaWeb.Image.TagLockController do
conn
|> put_flash(:info, "Successfully locked tags.")
|> moderation_log(details: &log_details/3, data: image)
- |> redirect(to: Routes.image_path(conn, :show, image))
+ |> redirect(to: ~p"/images/#{image}")
end
def delete(conn, _params) do
@@ -42,7 +42,7 @@ defmodule PhilomenaWeb.Image.TagLockController do
conn
|> put_flash(:info, "Successfully unlocked tags.")
|> moderation_log(details: &log_details/3, data: image)
- |> redirect(to: Routes.image_path(conn, :show, image))
+ |> redirect(to: ~p"/images/#{image}")
end
defp log_details(conn, action, image) do
@@ -55,7 +55,7 @@ defmodule PhilomenaWeb.Image.TagLockController do
%{
body: body,
- subject_path: Routes.image_path(conn, :show, image)
+ subject_path: ~p"/images/#{image}"
}
end
end
diff --git a/lib/philomena_web/controllers/image/tamper_controller.ex b/lib/philomena_web/controllers/image/tamper_controller.ex
index 8eb66309..4ce1ac3c 100644
--- a/lib/philomena_web/controllers/image/tamper_controller.ex
+++ b/lib/philomena_web/controllers/image/tamper_controller.ex
@@ -28,7 +28,7 @@ defmodule PhilomenaWeb.Image.TamperController do
details: &log_details/3,
data: %{vote: result, image: image}
)
- |> redirect(to: Routes.image_path(conn, :show, conn.assigns.image))
+ |> redirect(to: ~p"/images/#{conn.assigns.image}")
end
defp log_details(conn, _action, data) do
@@ -43,7 +43,7 @@ defmodule PhilomenaWeb.Image.TamperController do
%{
body: "Deleted #{vote_type} by #{conn.assigns.user.name} on image >>#{data.image.id}",
- subject_path: Routes.image_path(conn, :show, image)
+ subject_path: ~p"/images/#{image}"
}
end
end
diff --git a/lib/philomena_web/controllers/image_controller.ex b/lib/philomena_web/controllers/image_controller.ex
index 47e9e088..30364cda 100644
--- a/lib/philomena_web/controllers/image_controller.ex
+++ b/lib/philomena_web/controllers/image_controller.ex
@@ -128,7 +128,7 @@ defmodule PhilomenaWeb.ImageController do
conn
|> put_flash(:info, "Image created successfully.")
- |> redirect(to: Routes.image_path(conn, :show, image))
+ |> redirect(to: ~p"/images/#{image}")
{:error, :image, changeset, _} ->
conn
@@ -208,7 +208,7 @@ defmodule PhilomenaWeb.ImageController do
:info,
"The image you were looking for has been marked a duplicate of the image below"
)
- |> redirect(to: Routes.image_path(conn, :show, image.duplicate_id))
+ |> redirect(to: ~p"/images/#{image.duplicate_id}")
|> halt()
true ->
diff --git a/lib/philomena_web/controllers/page_controller.ex b/lib/philomena_web/controllers/page_controller.ex
index 1f8490a2..d9ebae27 100644
--- a/lib/philomena_web/controllers/page_controller.ex
+++ b/lib/philomena_web/controllers/page_controller.ex
@@ -26,7 +26,7 @@ defmodule PhilomenaWeb.PageController do
{:ok, %{static_page: static_page}} ->
conn
|> put_flash(:info, "Static page successfully created.")
- |> redirect(to: Routes.page_path(conn, :show, static_page))
+ |> redirect(to: ~p"/pages/#{static_page}")
{:error, :static_page, changeset, _changes} ->
render(conn, "new.html", changeset: changeset)
@@ -47,7 +47,7 @@ defmodule PhilomenaWeb.PageController do
{:ok, %{static_page: static_page}} ->
conn
|> put_flash(:info, "Static page successfully updated.")
- |> redirect(to: Routes.page_path(conn, :show, static_page))
+ |> redirect(to: ~p"/pages/#{static_page}")
{:error, :static_page, changeset, _changes} ->
render(conn, "edit.html", changeset: changeset)
diff --git a/lib/philomena_web/controllers/password_controller.ex b/lib/philomena_web/controllers/password_controller.ex
index 4a0a7bb1..597f0af0 100644
--- a/lib/philomena_web/controllers/password_controller.ex
+++ b/lib/philomena_web/controllers/password_controller.ex
@@ -16,7 +16,7 @@ defmodule PhilomenaWeb.PasswordController do
if user = Users.get_user_by_email(email) do
Users.deliver_user_reset_password_instructions(
user,
- &Routes.password_url(conn, :edit, &1)
+ &url(~p"/passwords/#{&1}/edit")
)
end
@@ -40,7 +40,7 @@ defmodule PhilomenaWeb.PasswordController do
{:ok, _} ->
conn
|> put_flash(:info, "Password reset successfully.")
- |> redirect(to: Routes.session_path(conn, :new))
+ |> redirect(to: ~p"/sessions/new")
{:error, changeset} ->
render(conn, "edit.html", changeset: changeset)
diff --git a/lib/philomena_web/controllers/profile/artist_link_controller.ex b/lib/philomena_web/controllers/profile/artist_link_controller.ex
index 3d48c308..6362a1b7 100644
--- a/lib/philomena_web/controllers/profile/artist_link_controller.ex
+++ b/lib/philomena_web/controllers/profile/artist_link_controller.ex
@@ -52,9 +52,7 @@ defmodule PhilomenaWeb.Profile.ArtistLinkController do
:info,
"Link submitted! Please put '#{artist_link.verification_code}' on your linked webpage now."
)
- |> redirect(
- to: Routes.profile_artist_link_path(conn, :show, conn.assigns.user, artist_link)
- )
+ |> redirect(to: ~p"/profiles/#{conn.assigns.user}/artist_links/#{artist_link}")
{:error, %Ecto.Changeset{} = changeset} ->
render(conn, "new.html", changeset: changeset)
@@ -77,9 +75,7 @@ defmodule PhilomenaWeb.Profile.ArtistLinkController do
{:ok, artist_link} ->
conn
|> put_flash(:info, "Link successfully updated.")
- |> redirect(
- to: Routes.profile_artist_link_path(conn, :show, conn.assigns.user, artist_link)
- )
+ |> redirect(to: ~p"/profiles/#{conn.assigns.user}/artist_links/#{artist_link}")
{:error, changeset} ->
render(conn, "edit.html", changeset: changeset)
diff --git a/lib/philomena_web/controllers/profile/award_controller.ex b/lib/philomena_web/controllers/profile/award_controller.ex
index 07df9819..4e636236 100644
--- a/lib/philomena_web/controllers/profile/award_controller.ex
+++ b/lib/philomena_web/controllers/profile/award_controller.ex
@@ -23,7 +23,7 @@ defmodule PhilomenaWeb.Profile.AwardController do
{:ok, _award} ->
conn
|> put_flash(:info, "Award successfully created.")
- |> redirect(to: Routes.profile_path(conn, :show, conn.assigns.user))
+ |> redirect(to: ~p"/profiles/#{conn.assigns.user}")
{:error, changeset} ->
render(conn, "new.html", changeset: changeset)
@@ -40,7 +40,7 @@ defmodule PhilomenaWeb.Profile.AwardController do
{:ok, _award} ->
conn
|> put_flash(:info, "Award successfully updated.")
- |> redirect(to: Routes.profile_path(conn, :show, conn.assigns.user))
+ |> redirect(to: ~p"/profiles/#{conn.assigns.user}")
{:error, changeset} ->
render(conn, "edit.html", changeset: changeset)
@@ -52,7 +52,7 @@ defmodule PhilomenaWeb.Profile.AwardController do
conn
|> put_flash(:info, "Award successfully destroyed. By cruel and unusual means.")
- |> redirect(to: Routes.profile_path(conn, :show, conn.assigns.user))
+ |> redirect(to: ~p"/profiles/#{conn.assigns.user}")
end
defp verify_authorized(conn, _opts) do
diff --git a/lib/philomena_web/controllers/profile/commission/item_controller.ex b/lib/philomena_web/controllers/profile/commission/item_controller.ex
index 90699b08..11cc0ab6 100644
--- a/lib/philomena_web/controllers/profile/commission/item_controller.ex
+++ b/lib/philomena_web/controllers/profile/commission/item_controller.ex
@@ -47,7 +47,7 @@ defmodule PhilomenaWeb.Profile.Commission.ItemController do
{:ok, _multi} ->
conn
|> put_flash(:info, "Item successfully created.")
- |> redirect(to: Routes.profile_commission_path(conn, :show, conn.assigns.user))
+ |> redirect(to: ~p"/profiles/#{conn.assigns.user}/commission")
{:error, changeset} ->
render(conn, "new.html", user: user, commission: commission, changeset: changeset)
@@ -79,7 +79,7 @@ defmodule PhilomenaWeb.Profile.Commission.ItemController do
{:ok, _commission} ->
conn
|> put_flash(:info, "Item successfully updated.")
- |> redirect(to: Routes.profile_commission_path(conn, :show, conn.assigns.user))
+ |> redirect(to: ~p"/profiles/#{conn.assigns.user}/commission")
{:error, changeset} ->
render(conn, "edit.html",
@@ -100,7 +100,7 @@ defmodule PhilomenaWeb.Profile.Commission.ItemController do
conn
|> put_flash(:info, "Item deleted successfully.")
- |> redirect(to: Routes.profile_commission_path(conn, :show, conn.assigns.user))
+ |> redirect(to: ~p"/profiles/#{conn.assigns.user}/commission")
end
defp ensure_commission(conn, _opts) do
diff --git a/lib/philomena_web/controllers/profile/commission/report_controller.ex b/lib/philomena_web/controllers/profile/commission/report_controller.ex
index 9c9d7ac2..0ad943ef 100644
--- a/lib/philomena_web/controllers/profile/commission/report_controller.ex
+++ b/lib/philomena_web/controllers/profile/commission/report_controller.ex
@@ -32,7 +32,7 @@ defmodule PhilomenaWeb.Profile.Commission.ReportController do
def new(conn, _params) do
user = conn.assigns.user
commission = conn.assigns.user.commission
- action = Routes.profile_commission_report_path(conn, :create, user)
+ action = ~p"/profiles/#{user}/commission/reports"
changeset =
%Report{reportable_type: "Commission", reportable_id: commission.id}
@@ -51,7 +51,7 @@ defmodule PhilomenaWeb.Profile.Commission.ReportController do
def create(conn, params) do
user = conn.assigns.user
commission = conn.assigns.user.commission
- action = Routes.profile_commission_report_path(conn, :create, user)
+ action = ~p"/profiles/#{user}/commission/reports"
ReportController.create(conn, action, commission, "Commission", params)
end
diff --git a/lib/philomena_web/controllers/profile/commission_controller.ex b/lib/philomena_web/controllers/profile/commission_controller.ex
index f934fc4d..7cd2b844 100644
--- a/lib/philomena_web/controllers/profile/commission_controller.ex
+++ b/lib/philomena_web/controllers/profile/commission_controller.ex
@@ -85,7 +85,7 @@ defmodule PhilomenaWeb.Profile.CommissionController do
{:ok, _commission} ->
conn
|> put_flash(:info, "Commission successfully created.")
- |> redirect(to: Routes.profile_commission_path(conn, :show, user))
+ |> redirect(to: ~p"/profiles/#{user}/commission")
{:error, changeset} ->
render(conn, "new.html", changeset: changeset)
@@ -104,7 +104,7 @@ defmodule PhilomenaWeb.Profile.CommissionController do
{:ok, _commission} ->
conn
|> put_flash(:info, "Commission successfully updated.")
- |> redirect(to: Routes.profile_commission_path(conn, :show, conn.assigns.user))
+ |> redirect(to: ~p"/profiles/#{conn.assigns.user}/commission")
{:error, changeset} ->
render(conn, "edit.html", changeset: changeset)
@@ -118,7 +118,7 @@ defmodule PhilomenaWeb.Profile.CommissionController do
conn
|> put_flash(:info, "Commission deleted successfully.")
- |> redirect(to: Routes.commission_path(conn, :index))
+ |> redirect(to: ~p"/commissions")
end
defp ensure_commission(conn, _opts) do
@@ -156,7 +156,7 @@ defmodule PhilomenaWeb.Profile.CommissionController do
:error,
"You must have a verified artist link to create a commission listing."
)
- |> redirect(to: Routes.commission_path(conn, :index))
+ |> redirect(to: ~p"/commissions")
|> halt()
end
end
diff --git a/lib/philomena_web/controllers/profile/description_controller.ex b/lib/philomena_web/controllers/profile/description_controller.ex
index 4a7836ba..6dac8e88 100644
--- a/lib/philomena_web/controllers/profile/description_controller.ex
+++ b/lib/philomena_web/controllers/profile/description_controller.ex
@@ -30,7 +30,7 @@ defmodule PhilomenaWeb.Profile.DescriptionController do
{:ok, _user} ->
conn
|> put_flash(:info, "Description successfully updated.")
- |> redirect(to: Routes.profile_path(conn, :show, user))
+ |> redirect(to: ~p"/profiles/#{user}")
{:error, changeset} ->
render(conn, "edit.html", changeset: changeset)
diff --git a/lib/philomena_web/controllers/profile/report_controller.ex b/lib/philomena_web/controllers/profile/report_controller.ex
index 0c326b8d..80a68895 100644
--- a/lib/philomena_web/controllers/profile/report_controller.ex
+++ b/lib/philomena_web/controllers/profile/report_controller.ex
@@ -21,7 +21,7 @@ defmodule PhilomenaWeb.Profile.ReportController do
def new(conn, _params) do
user = conn.assigns.user
- action = Routes.profile_report_path(conn, :create, user)
+ action = ~p"/profiles/#{user}/reports"
changeset =
%Report{reportable_type: "User", reportable_id: user.id}
@@ -39,7 +39,7 @@ defmodule PhilomenaWeb.Profile.ReportController do
def create(conn, params) do
user = conn.assigns.user
- action = Routes.profile_report_path(conn, :create, user)
+ action = ~p"/profiles/#{user}/reports"
ReportController.create(conn, action, user, "User", params)
end
diff --git a/lib/philomena_web/controllers/profile/scratchpad_controller.ex b/lib/philomena_web/controllers/profile/scratchpad_controller.ex
index 117fb3b6..3132436e 100644
--- a/lib/philomena_web/controllers/profile/scratchpad_controller.ex
+++ b/lib/philomena_web/controllers/profile/scratchpad_controller.ex
@@ -25,7 +25,7 @@ defmodule PhilomenaWeb.Profile.ScratchpadController do
{:ok, _user} ->
conn
|> put_flash(:info, "Moderation scratchpad successfully updated.")
- |> redirect(to: Routes.profile_path(conn, :show, user))
+ |> redirect(to: ~p"/profiles/#{user}")
{:error, changeset} ->
render(conn, "edit.html", changeset: changeset)
diff --git a/lib/philomena_web/controllers/registration/email_controller.ex b/lib/philomena_web/controllers/registration/email_controller.ex
index e20a9bb0..0c696906 100644
--- a/lib/philomena_web/controllers/registration/email_controller.ex
+++ b/lib/philomena_web/controllers/registration/email_controller.ex
@@ -11,7 +11,7 @@ defmodule PhilomenaWeb.Registration.EmailController do
Users.deliver_update_email_instructions(
applied_user,
user.email,
- &Routes.registration_email_url(conn, :show, &1)
+ &url(~p"/registrations/email/#{&1}")
)
conn
@@ -19,12 +19,12 @@ defmodule PhilomenaWeb.Registration.EmailController do
:info,
"A link to confirm your email change has been sent to the new address."
)
- |> redirect(to: Routes.registration_path(conn, :edit))
+ |> redirect(to: ~p"/registrations/edit")
{:error, _changeset} ->
conn
|> put_flash(:error, "Failed to update email.")
- |> redirect(to: Routes.registration_path(conn, :edit))
+ |> redirect(to: ~p"/registrations/edit")
end
end
@@ -33,12 +33,12 @@ defmodule PhilomenaWeb.Registration.EmailController do
:ok ->
conn
|> put_flash(:info, "Email changed successfully.")
- |> redirect(to: Routes.registration_path(conn, :edit))
+ |> redirect(to: ~p"/registrations/edit")
:error ->
conn
|> put_flash(:error, "Email change link is invalid or it has expired.")
- |> redirect(to: Routes.registration_path(conn, :edit))
+ |> redirect(to: ~p"/registrations/edit")
end
end
end
diff --git a/lib/philomena_web/controllers/registration/name_controller.ex b/lib/philomena_web/controllers/registration/name_controller.ex
index 7b5cd0dd..e0023f89 100644
--- a/lib/philomena_web/controllers/registration/name_controller.ex
+++ b/lib/philomena_web/controllers/registration/name_controller.ex
@@ -17,7 +17,7 @@ defmodule PhilomenaWeb.Registration.NameController do
{:ok, user} ->
conn
|> put_flash(:info, "Name successfully updated.")
- |> redirect(to: Routes.profile_path(conn, :show, user))
+ |> redirect(to: ~p"/profiles/#{user}")
{:error, changeset} ->
render(conn, "edit.html", changeset: changeset)
diff --git a/lib/philomena_web/controllers/registration/password_controller.ex b/lib/philomena_web/controllers/registration/password_controller.ex
index 909df6eb..6e3ba04a 100644
--- a/lib/philomena_web/controllers/registration/password_controller.ex
+++ b/lib/philomena_web/controllers/registration/password_controller.ex
@@ -13,13 +13,13 @@ defmodule PhilomenaWeb.Registration.PasswordController do
{:ok, user} ->
conn
|> put_flash(:info, "Password updated successfully.")
- |> put_session(:user_return_to, Routes.registration_path(conn, :edit))
+ |> put_session(:user_return_to, ~p"/registrations/edit")
|> UserAuth.log_in_user(user)
{:error, _changeset} ->
conn
|> put_flash(:error, "Failed to update password.")
- |> redirect(to: Routes.registration_path(conn, :edit))
+ |> redirect(to: ~p"/registrations/edit")
end
end
end
diff --git a/lib/philomena_web/controllers/registration/totp_controller.ex b/lib/philomena_web/controllers/registration/totp_controller.ex
index 3cea3279..9316aeb2 100644
--- a/lib/philomena_web/controllers/registration/totp_controller.ex
+++ b/lib/philomena_web/controllers/registration/totp_controller.ex
@@ -16,7 +16,7 @@ defmodule PhilomenaWeb.Registration.TotpController do
|> Repo.update()
# Redirect to have the conn pick up the changes
- redirect(conn, to: Routes.registration_totp_path(conn, :edit))
+ redirect(conn, to: ~p"/registrations/totp/edit")
_ ->
changeset = Users.change_user(user)
@@ -48,7 +48,7 @@ defmodule PhilomenaWeb.Registration.TotpController do
{:ok, user} ->
conn
|> put_flash(:totp_backup_codes, backup_codes)
- |> put_session(:user_return_to, Routes.registration_totp_path(conn, :edit))
+ |> put_session(:user_return_to, ~p"/registrations/totp/edit")
|> UserAuth.totp_auth_user(user, %{})
end
end
diff --git a/lib/philomena_web/controllers/registration_controller.ex b/lib/philomena_web/controllers/registration_controller.ex
index 389ae579..8f3e2bbd 100644
--- a/lib/philomena_web/controllers/registration_controller.ex
+++ b/lib/philomena_web/controllers/registration_controller.ex
@@ -20,7 +20,7 @@ defmodule PhilomenaWeb.RegistrationController do
{:ok, _} =
Users.deliver_user_confirmation_instructions(
user,
- &Routes.confirmation_url(conn, :show, &1)
+ &url(~p"/confirmations/#{&1}")
)
conn
diff --git a/lib/philomena_web/controllers/report_controller.ex b/lib/philomena_web/controllers/report_controller.ex
index 3169cf02..930ecf13 100644
--- a/lib/philomena_web/controllers/report_controller.ex
+++ b/lib/philomena_web/controllers/report_controller.ex
@@ -101,7 +101,7 @@ defmodule PhilomenaWeb.ReportController do
end
defp redirect_path(_conn, nil), do: "/"
- defp redirect_path(conn, _user), do: Routes.report_path(conn, :index)
+ defp redirect_path(conn, _user), do: ~p"/reports"
defp max_reports do
5
diff --git a/lib/philomena_web/controllers/session_controller.ex b/lib/philomena_web/controllers/session_controller.ex
index ee15bc12..b5704501 100644
--- a/lib/philomena_web/controllers/session_controller.ex
+++ b/lib/philomena_web/controllers/session_controller.ex
@@ -15,7 +15,7 @@ defmodule PhilomenaWeb.SessionController do
Users.get_user_by_email_and_password(
email,
password,
- &Routes.unlock_url(conn, :show, &1)
+ &url(~p"/unlocks/#{&1}")
)
cond do
diff --git a/lib/philomena_web/controllers/setting_controller.ex b/lib/philomena_web/controllers/setting_controller.ex
index 7c3d6db9..43d4d30a 100644
--- a/lib/philomena_web/controllers/setting_controller.ex
+++ b/lib/philomena_web/controllers/setting_controller.ex
@@ -25,7 +25,7 @@ defmodule PhilomenaWeb.SettingController do
{:ok, conn} ->
conn
|> put_flash(:info, "Settings updated successfully.")
- |> redirect(to: Routes.setting_path(conn, :edit))
+ |> redirect(to: ~p"/settings/edit")
{:error, changeset} ->
conn
diff --git a/lib/philomena_web/controllers/tag/alias_controller.ex b/lib/philomena_web/controllers/tag/alias_controller.ex
index b7687b1c..b0ed3483 100644
--- a/lib/philomena_web/controllers/tag/alias_controller.ex
+++ b/lib/philomena_web/controllers/tag/alias_controller.ex
@@ -23,7 +23,7 @@ defmodule PhilomenaWeb.Tag.AliasController do
{:ok, tag} ->
conn
|> put_flash(:info, "Tag alias queued.")
- |> redirect(to: Routes.tag_alias_path(conn, :edit, tag))
+ |> redirect(to: ~p"/tags/#{tag}/alias/edit")
{:error, changeset} ->
render(conn, "edit.html", changeset: changeset)
@@ -35,6 +35,6 @@ defmodule PhilomenaWeb.Tag.AliasController do
conn
|> put_flash(:info, "Tag dealias queued.")
- |> redirect(to: Routes.tag_path(conn, :show, tag))
+ |> redirect(to: ~p"/tags/#{tag}")
end
end
diff --git a/lib/philomena_web/controllers/tag/image_controller.ex b/lib/philomena_web/controllers/tag/image_controller.ex
index 2f43ebe8..21d06983 100644
--- a/lib/philomena_web/controllers/tag/image_controller.ex
+++ b/lib/philomena_web/controllers/tag/image_controller.ex
@@ -24,7 +24,7 @@ defmodule PhilomenaWeb.Tag.ImageController do
conn
|> put_flash(:info, "Tag image successfully updated.")
|> moderation_log(details: &log_details/3, data: tag)
- |> redirect(to: Routes.tag_path(conn, :show, tag))
+ |> redirect(to: ~p"/tags/#{tag}")
{:error, :tag, changeset, _changes} ->
render(conn, "edit.html", changeset: changeset)
@@ -37,7 +37,7 @@ defmodule PhilomenaWeb.Tag.ImageController do
conn
|> put_flash(:info, "Tag image successfully removed.")
|> moderation_log(details: &log_details/3, data: tag)
- |> redirect(to: Routes.tag_path(conn, :show, conn.assigns.tag))
+ |> redirect(to: ~p"/tags/#{conn.assigns.tag}")
end
defp log_details(conn, action, tag) do
@@ -49,7 +49,7 @@ defmodule PhilomenaWeb.Tag.ImageController do
%{
body: body,
- subject_path: Routes.tag_path(conn, :show, tag)
+ subject_path: ~p"/tags/#{tag}"
}
end
end
diff --git a/lib/philomena_web/controllers/tag/reindex_controller.ex b/lib/philomena_web/controllers/tag/reindex_controller.ex
index 70b7163c..aee27c28 100644
--- a/lib/philomena_web/controllers/tag/reindex_controller.ex
+++ b/lib/philomena_web/controllers/tag/reindex_controller.ex
@@ -18,6 +18,6 @@ defmodule PhilomenaWeb.Tag.ReindexController do
conn
|> put_flash(:info, "Tag reindex started.")
- |> redirect(to: Routes.tag_path(conn, :edit, tag))
+ |> redirect(to: ~p"/tags/#{tag}/edit")
end
end
diff --git a/lib/philomena_web/controllers/tag_controller.ex b/lib/philomena_web/controllers/tag_controller.ex
index 46eb95b7..3fac85cd 100644
--- a/lib/philomena_web/controllers/tag_controller.ex
+++ b/lib/philomena_web/controllers/tag_controller.ex
@@ -98,7 +98,7 @@ defmodule PhilomenaWeb.TagController do
conn
|> put_flash(:info, "Tag successfully updated.")
|> moderation_log(details: &log_details/3, data: tag)
- |> redirect(to: Routes.tag_path(conn, :show, tag))
+ |> redirect(to: ~p"/tags/#{tag}")
{:error, changeset} ->
render(conn, "edit.html", changeset: changeset)
@@ -167,7 +167,7 @@ defmodule PhilomenaWeb.TagController do
:info,
"This tag (\"#{conn.assigns.tag.name}\") has been aliased into the tag \"#{tag.name}\"."
)
- |> redirect(to: Routes.tag_path(conn, :show, tag))
+ |> redirect(to: ~p"/tags/#{tag}")
|> halt()
end
end
@@ -181,7 +181,7 @@ defmodule PhilomenaWeb.TagController do
%{
body: body,
- subject_path: Routes.tag_path(conn, :show, tag)
+ subject_path: ~p"/tags/#{tag}"
}
end
end
diff --git a/lib/philomena_web/controllers/topic/hide_controller.ex b/lib/philomena_web/controllers/topic/hide_controller.ex
index 3149501d..247741d5 100644
--- a/lib/philomena_web/controllers/topic/hide_controller.ex
+++ b/lib/philomena_web/controllers/topic/hide_controller.ex
@@ -28,12 +28,12 @@ defmodule PhilomenaWeb.Topic.HideController do
conn
|> put_flash(:info, "Topic successfully hidden!")
|> moderation_log(details: &log_details/3, data: topic)
- |> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
+ |> redirect(to: ~p"/forums/#{topic.forum}/topics/#{topic}")
{:error, _changeset} ->
conn
|> put_flash(:error, "Unable to hide the topic!")
- |> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
+ |> redirect(to: ~p"/forums/#{topic.forum}/topics/#{topic}")
end
end
@@ -45,12 +45,12 @@ defmodule PhilomenaWeb.Topic.HideController do
conn
|> put_flash(:info, "Topic successfully restored!")
|> moderation_log(details: &log_details/3, data: topic)
- |> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
+ |> redirect(to: ~p"/forums/#{topic.forum}/topics/#{topic}")
{:error, _changeset} ->
conn
|> put_flash(:error, "Unable to restore the topic!")
- |> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
+ |> redirect(to: ~p"/forums/#{topic.forum}/topics/#{topic}")
end
end
@@ -66,7 +66,7 @@ defmodule PhilomenaWeb.Topic.HideController do
%{
body: body,
- subject_path: Routes.forum_topic_path(conn, :show, topic.forum, topic)
+ subject_path: ~p"/forums/#{topic.forum}/topics/#{topic}"
}
end
end
diff --git a/lib/philomena_web/controllers/topic/lock_controller.ex b/lib/philomena_web/controllers/topic/lock_controller.ex
index 88bf115b..aa4bf13f 100644
--- a/lib/philomena_web/controllers/topic/lock_controller.ex
+++ b/lib/philomena_web/controllers/topic/lock_controller.ex
@@ -27,12 +27,12 @@ defmodule PhilomenaWeb.Topic.LockController do
conn
|> put_flash(:info, "Topic successfully locked!")
|> moderation_log(details: &log_details/3, data: topic)
- |> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
+ |> redirect(to: ~p"/forums/#{topic.forum}/topics/#{topic}")
{:error, _changeset} ->
conn
|> put_flash(:error, "Unable to lock the topic!")
- |> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
+ |> redirect(to: ~p"/forums/#{topic.forum}/topics/#{topic}")
end
end
@@ -44,12 +44,12 @@ defmodule PhilomenaWeb.Topic.LockController do
conn
|> put_flash(:info, "Topic successfully unlocked!")
|> moderation_log(details: &log_details/3, data: topic)
- |> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
+ |> redirect(to: ~p"/forums/#{topic.forum}/topics/#{topic}")
{:error, _changeset} ->
conn
|> put_flash(:error, "Unable to unlock the topic!")
- |> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
+ |> redirect(to: ~p"/forums/#{topic.forum}/topics/#{topic}")
end
end
@@ -62,7 +62,7 @@ defmodule PhilomenaWeb.Topic.LockController do
%{
body: body,
- subject_path: Routes.forum_topic_path(conn, :show, topic.forum, topic)
+ subject_path: ~p"/forums/#{topic.forum}/topics/#{topic}"
}
end
end
diff --git a/lib/philomena_web/controllers/topic/move_controller.ex b/lib/philomena_web/controllers/topic/move_controller.ex
index f12af72e..d8c91c3f 100644
--- a/lib/philomena_web/controllers/topic/move_controller.ex
+++ b/lib/philomena_web/controllers/topic/move_controller.ex
@@ -30,19 +30,19 @@ defmodule PhilomenaWeb.Topic.MoveController do
conn
|> put_flash(:info, "Topic successfully moved!")
|> moderation_log(details: &log_details/3, data: topic)
- |> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
+ |> redirect(to: ~p"/forums/#{topic.forum}/topics/#{topic}")
{:error, _changeset} ->
conn
|> put_flash(:error, "Unable to move the topic!")
- |> redirect(to: Routes.forum_topic_path(conn, :show, conn.assigns.forum, topic))
+ |> redirect(to: ~p"/forums/#{conn.assigns.forum}/topics/#{topic}")
end
end
defp log_details(conn, _action, topic) do
%{
body: "Topic '#{topic.title}' moved to #{topic.forum.name}",
- subject_path: Routes.forum_topic_path(conn, :show, topic.forum, topic)
+ subject_path: ~p"/forums/#{topic.forum}/topics/#{topic}"
}
end
end
diff --git a/lib/philomena_web/controllers/topic/poll/vote_controller.ex b/lib/philomena_web/controllers/topic/poll/vote_controller.ex
index 3af4f011..4ffb4086 100644
--- a/lib/philomena_web/controllers/topic/poll/vote_controller.ex
+++ b/lib/philomena_web/controllers/topic/poll/vote_controller.ex
@@ -42,12 +42,12 @@ defmodule PhilomenaWeb.Topic.Poll.VoteController do
{:ok, _votes} ->
conn
|> put_flash(:info, "Your vote has been recorded.")
- |> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
+ |> redirect(to: ~p"/forums/#{topic.forum}/topics/#{topic}")
_error ->
conn
|> put_flash(:error, "Your vote was not recorded.")
- |> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
+ |> redirect(to: ~p"/forums/#{topic.forum}/topics/#{topic}")
end
end
@@ -56,7 +56,7 @@ defmodule PhilomenaWeb.Topic.Poll.VoteController do
conn
|> put_flash(:error, "Your vote was not recorded.")
- |> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
+ |> redirect(to: ~p"/forums/#{topic.forum}/topics/#{topic}")
end
def delete(conn, %{"id" => poll_vote_id}) do
@@ -67,7 +67,7 @@ defmodule PhilomenaWeb.Topic.Poll.VoteController do
conn
|> put_flash(:info, "Vote successfully removed.")
- |> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
+ |> redirect(to: ~p"/forums/#{topic.forum}/topics/#{topic}")
end
defp verify_authorized(conn, _opts) do
diff --git a/lib/philomena_web/controllers/topic/poll_controller.ex b/lib/philomena_web/controllers/topic/poll_controller.ex
index 61cec7d9..b2fdbb81 100644
--- a/lib/philomena_web/controllers/topic/poll_controller.ex
+++ b/lib/philomena_web/controllers/topic/poll_controller.ex
@@ -27,9 +27,7 @@ defmodule PhilomenaWeb.Topic.PollController do
{:ok, _poll} ->
conn
|> put_flash(:info, "Poll successfully updated.")
- |> redirect(
- to: Routes.forum_topic_path(conn, :show, conn.assigns.forum, conn.assigns.topic)
- )
+ |> redirect(to: ~p"/forums/#{conn.assigns.forum}/topics/#{conn.assigns.topic}")
{:error, changeset} ->
render(conn, "edit.html", changeset: changeset)
diff --git a/lib/philomena_web/controllers/topic/post/approve_controller.ex b/lib/philomena_web/controllers/topic/post/approve_controller.ex
index 90bf3948..01e11daf 100644
--- a/lib/philomena_web/controllers/topic/post/approve_controller.ex
+++ b/lib/philomena_web/controllers/topic/post/approve_controller.ex
@@ -23,7 +23,7 @@ defmodule PhilomenaWeb.Topic.Post.ApproveController do
|> moderation_log(details: &log_details/3, data: post)
|> redirect(
to:
- Routes.forum_topic_path(conn, :show, post.topic.forum, post.topic, post_id: post.id) <>
+ ~p"/forums/#{post.topic.forum}/topics/#{post.topic}?#{[post_id: post.id]}" <>
"#post_#{post.id}"
)
@@ -32,7 +32,7 @@ defmodule PhilomenaWeb.Topic.Post.ApproveController do
|> put_flash(:error, "Unable to approve post!")
|> redirect(
to:
- Routes.forum_topic_path(conn, :show, post.topic.forum, post.topic, post_id: post.id) <>
+ ~p"/forums/#{post.topic.forum}/topics/#{post.topic}?#{[post_id: post.id]}" <>
"#post_#{post.id}"
)
end
@@ -42,7 +42,7 @@ defmodule PhilomenaWeb.Topic.Post.ApproveController do
%{
body: "Approved forum post ##{post.id} in topic '#{post.topic.title}'",
subject_path:
- Routes.forum_topic_path(conn, :show, post.topic.forum, post.topic, post_id: post.id) <>
+ ~p"/forums/#{post.topic.forum}/topics/#{post.topic}?#{[post_id: post.id]}" <>
"#post_#{post.id}"
}
end
diff --git a/lib/philomena_web/controllers/topic/post/delete_controller.ex b/lib/philomena_web/controllers/topic/post/delete_controller.ex
index 9e6d7a45..72e39536 100644
--- a/lib/philomena_web/controllers/topic/post/delete_controller.ex
+++ b/lib/philomena_web/controllers/topic/post/delete_controller.ex
@@ -22,7 +22,7 @@ defmodule PhilomenaWeb.Topic.Post.DeleteController do
|> moderation_log(details: &log_details/3, data: post)
|> redirect(
to:
- Routes.forum_topic_path(conn, :show, post.topic.forum, post.topic, post_id: post.id) <>
+ ~p"/forums/#{post.topic.forum}/topics/#{post.topic}?#{[post_id: post.id]}" <>
"#post_#{post.id}"
)
@@ -31,7 +31,7 @@ defmodule PhilomenaWeb.Topic.Post.DeleteController do
|> put_flash(:error, "Unable to destroy post!")
|> redirect(
to:
- Routes.forum_topic_path(conn, :show, post.topic.forum, post.topic, post_id: post.id) <>
+ ~p"/forums/#{post.topic.forum}/topics/#{post.topic}?#{[post_id: post.id]}" <>
"#post_#{post.id}"
)
end
@@ -41,7 +41,7 @@ defmodule PhilomenaWeb.Topic.Post.DeleteController do
%{
body: "Destroyed forum post ##{post.id} in topic '#{post.topic.title}'",
subject_path:
- Routes.forum_topic_path(conn, :show, post.topic.forum, post.topic, post_id: post.id) <>
+ ~p"/forums/#{post.topic.forum}/topics/#{post.topic}?#{[post_id: post.id]}" <>
"#post_#{post.id}"
}
end
diff --git a/lib/philomena_web/controllers/topic/post/hide_controller.ex b/lib/philomena_web/controllers/topic/post/hide_controller.ex
index 9e449977..ed3f69d9 100644
--- a/lib/philomena_web/controllers/topic/post/hide_controller.ex
+++ b/lib/philomena_web/controllers/topic/post/hide_controller.ex
@@ -23,7 +23,7 @@ defmodule PhilomenaWeb.Topic.Post.HideController do
|> moderation_log(details: &log_details/3, data: post)
|> redirect(
to:
- Routes.forum_topic_path(conn, :show, post.topic.forum, post.topic, post_id: post.id) <>
+ ~p"/forums/#{post.topic.forum}/topics/#{post.topic}?#{[post_id: post.id]}" <>
"#post_#{post.id}"
)
@@ -32,7 +32,7 @@ defmodule PhilomenaWeb.Topic.Post.HideController do
|> put_flash(:error, "Unable to hide post!")
|> redirect(
to:
- Routes.forum_topic_path(conn, :show, post.topic.forum, post.topic, post_id: post.id) <>
+ ~p"/forums/#{post.topic.forum}/topics/#{post.topic}?#{[post_id: post.id]}" <>
"#post_#{post.id}"
)
end
@@ -48,7 +48,7 @@ defmodule PhilomenaWeb.Topic.Post.HideController do
|> moderation_log(details: &log_details/3, data: post)
|> redirect(
to:
- Routes.forum_topic_path(conn, :show, post.topic.forum, post.topic, post_id: post.id) <>
+ ~p"/forums/#{post.topic.forum}/topics/#{post.topic}?#{[post_id: post.id]}" <>
"#post_#{post.id}"
)
@@ -57,7 +57,7 @@ defmodule PhilomenaWeb.Topic.Post.HideController do
|> put_flash(:error, "Unable to unhide post!")
|> redirect(
to:
- Routes.forum_topic_path(conn, :show, post.topic.forum, post.topic, post_id: post.id) <>
+ ~p"/forums/#{post.topic.forum}/topics/#{post.topic}?#{[post_id: post.id]}" <>
"#post_#{post.id}"
)
end
@@ -76,7 +76,7 @@ defmodule PhilomenaWeb.Topic.Post.HideController do
%{
body: body,
subject_path:
- Routes.forum_topic_path(conn, :show, post.topic.forum, post.topic, post_id: post.id) <>
+ ~p"/forums/#{post.topic.forum}/topics/#{post.topic}?#{[post_id: post.id]}" <>
"#post_#{post.id}"
}
end
diff --git a/lib/philomena_web/controllers/topic/post/report_controller.ex b/lib/philomena_web/controllers/topic/post/report_controller.ex
index 2d29f7b8..f09df511 100644
--- a/lib/philomena_web/controllers/topic/post/report_controller.ex
+++ b/lib/philomena_web/controllers/topic/post/report_controller.ex
@@ -26,7 +26,7 @@ defmodule PhilomenaWeb.Topic.Post.ReportController do
def new(conn, _params) do
topic = conn.assigns.topic
post = conn.assigns.post
- action = Routes.forum_topic_post_report_path(conn, :create, topic.forum, topic, post)
+ action = ~p"/forums/#{topic.forum}/topics/#{topic}/posts/#{post}/reports"
changeset =
%Report{reportable_type: "Post", reportable_id: post.id}
@@ -40,7 +40,7 @@ defmodule PhilomenaWeb.Topic.Post.ReportController do
def create(conn, params) do
topic = conn.assigns.topic
post = conn.assigns.post
- action = Routes.forum_topic_post_report_path(conn, :create, topic.forum, topic, post)
+ action = ~p"/forums/#{topic.forum}/topics/#{topic}/posts/#{post}/reports"
ReportController.create(conn, action, post, "Post", params)
end
diff --git a/lib/philomena_web/controllers/topic/post_controller.ex b/lib/philomena_web/controllers/topic/post_controller.ex
index 9570c014..8f90abd0 100644
--- a/lib/philomena_web/controllers/topic/post_controller.ex
+++ b/lib/philomena_web/controllers/topic/post_controller.ex
@@ -58,14 +58,14 @@ defmodule PhilomenaWeb.Topic.PostController do
|> put_flash(:info, "Post created successfully.")
|> redirect(
to:
- Routes.forum_topic_path(conn, :show, forum, topic, post_id: post.id) <>
+ ~p"/forums/#{forum}/topics/#{topic}?#{[post_id: post.id]}" <>
"#post_#{post.id}"
)
_error ->
conn
|> put_flash(:error, "There was an error creating the post")
- |> redirect(to: Routes.forum_topic_path(conn, :show, forum, topic))
+ |> redirect(to: ~p"/forums/#{forum}/topics/#{topic}")
end
end
@@ -88,7 +88,7 @@ defmodule PhilomenaWeb.Topic.PostController do
|> put_flash(:info, "Post successfully edited.")
|> redirect(
to:
- Routes.forum_topic_path(conn, :show, post.topic.forum, post.topic, post_id: post.id) <>
+ ~p"/forums/#{post.topic.forum}/topics/#{post.topic}?#{[post_id: post.id]}" <>
"#post_#{post.id}"
)
diff --git a/lib/philomena_web/controllers/topic/stick_controller.ex b/lib/philomena_web/controllers/topic/stick_controller.ex
index 27f92168..d413be6d 100644
--- a/lib/philomena_web/controllers/topic/stick_controller.ex
+++ b/lib/philomena_web/controllers/topic/stick_controller.ex
@@ -26,12 +26,12 @@ defmodule PhilomenaWeb.Topic.StickController do
conn
|> put_flash(:info, "Topic successfully stickied!")
|> moderation_log(details: &log_details/3, data: topic)
- |> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
+ |> redirect(to: ~p"/forums/#{topic.forum}/topics/#{topic}")
{:error, _changeset} ->
conn
|> put_flash(:error, "Unable to stick the topic!")
- |> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
+ |> redirect(to: ~p"/forums/#{topic.forum}/topics/#{topic}")
end
end
@@ -43,12 +43,12 @@ defmodule PhilomenaWeb.Topic.StickController do
conn
|> put_flash(:info, "Topic successfully unstickied!")
|> moderation_log(details: &log_details/3, data: topic)
- |> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
+ |> redirect(to: ~p"/forums/#{topic.forum}/topics/#{topic}")
{:error, _changeset} ->
conn
|> put_flash(:error, "Unable to unstick the topic!")
- |> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
+ |> redirect(to: ~p"/forums/#{topic.forum}/topics/#{topic}")
end
end
@@ -61,7 +61,7 @@ defmodule PhilomenaWeb.Topic.StickController do
%{
body: body,
- subject_path: Routes.forum_topic_path(conn, :show, topic.forum, topic)
+ subject_path: ~p"/forums/#{topic.forum}/topics/#{topic}"
}
end
end
diff --git a/lib/philomena_web/controllers/topic_controller.ex b/lib/philomena_web/controllers/topic_controller.ex
index 4c433be2..e88670a0 100644
--- a/lib/philomena_web/controllers/topic_controller.ex
+++ b/lib/philomena_web/controllers/topic_controller.ex
@@ -128,7 +128,7 @@ defmodule PhilomenaWeb.TopicController do
conn
|> put_flash(:info, "Successfully posted topic.")
- |> redirect(to: Routes.forum_topic_path(conn, :show, forum, topic))
+ |> redirect(to: ~p"/forums/#{forum}/topics/#{topic}")
{:error, :topic, changeset, _} ->
conn
@@ -137,7 +137,7 @@ defmodule PhilomenaWeb.TopicController do
_error ->
conn
|> put_flash(:error, "There was an error with your submission. Please try again.")
- |> redirect(to: Routes.forum_topic_path(conn, :new, forum))
+ |> redirect(to: ~p"/forums/#{forum}/topics/new")
end
end
@@ -146,14 +146,12 @@ defmodule PhilomenaWeb.TopicController do
{:ok, topic} ->
conn
|> put_flash(:info, "Successfully updated topic.")
- |> redirect(to: Routes.forum_topic_path(conn, :show, conn.assigns.forum, topic))
+ |> redirect(to: ~p"/forums/#{conn.assigns.forum}/topics/#{topic}")
{:error, _changeset} ->
conn
|> put_flash(:error, "There was an error with your submission. Please try again.")
- |> redirect(
- to: Routes.forum_topic_path(conn, :show, conn.assigns.forum, conn.assigns.topic)
- )
+ |> redirect(to: ~p"/forums/#{conn.assigns.forum}/topics/#{conn.assigns.topic}")
end
end
diff --git a/lib/philomena_web/controllers/unlock_controller.ex b/lib/philomena_web/controllers/unlock_controller.ex
index 9ee7b3c5..62e8dc4f 100644
--- a/lib/philomena_web/controllers/unlock_controller.ex
+++ b/lib/philomena_web/controllers/unlock_controller.ex
@@ -14,7 +14,7 @@ defmodule PhilomenaWeb.UnlockController do
if user = Users.get_user_by_email(email) do
Users.deliver_user_unlock_instructions(
user,
- &Routes.unlock_url(conn, :show, &1)
+ &url(~p"/unlocks/#{&1}")
)
end
diff --git a/lib/philomena_web/plugs/map_parameter_plug.ex b/lib/philomena_web/plugs/map_parameter_plug.ex
index 93b7cce8..36fc7c04 100644
--- a/lib/philomena_web/plugs/map_parameter_plug.ex
+++ b/lib/philomena_web/plugs/map_parameter_plug.ex
@@ -3,7 +3,7 @@ defmodule PhilomenaWeb.MapParameterPlug do
# symphony of failure:
#
# 1.) Router helpers do not strip nil query parameters.
- # iex> Routes.gallery_path(conn, :index, gallery: nil)
+ # iex> ~p"/galleries?#{[gallery: nil]}"
# "/galleries?gallery="
#
# 2.) Pagination always sets the parameter in the route in order
diff --git a/lib/philomena_web/plugs/tor_plug.ex b/lib/philomena_web/plugs/tor_plug.ex
index 8e6cc4e3..bea6b9d2 100644
--- a/lib/philomena_web/plugs/tor_plug.ex
+++ b/lib/philomena_web/plugs/tor_plug.ex
@@ -27,7 +27,7 @@ defmodule PhilomenaWeb.TorPlug do
def maybe_redirect(conn, nil, true) do
conn
- |> Controller.redirect(to: Routes.session_path(conn, :new))
+ |> Controller.redirect(to: ~p"/sessions/new")
|> Conn.halt()
end
diff --git a/lib/philomena_web/plugs/totp_plug.ex b/lib/philomena_web/plugs/totp_plug.ex
index 30f87378..6b809123 100644
--- a/lib/philomena_web/plugs/totp_plug.ex
+++ b/lib/philomena_web/plugs/totp_plug.ex
@@ -33,7 +33,7 @@ defmodule PhilomenaWeb.TotpPlug do
_falsy ->
conn
- |> Phoenix.Controller.redirect(to: Routes.session_totp_path(conn, :new))
+ |> Phoenix.Controller.redirect(to: ~p"/sessions/totp/new")
|> Plug.Conn.halt()
end
end
diff --git a/lib/philomena_web/templates/activity/_channel_strip.html.slime b/lib/philomena_web/templates/activity/_channel_strip.html.slime
index 34acd120..278cc6e9 100644
--- a/lib/philomena_web/templates/activity/_channel_strip.html.slime
+++ b/lib/philomena_web/templates/activity/_channel_strip.html.slime
@@ -1,7 +1,7 @@
.block__content.flex.alternating-color
.flex__grow
/ TODO
- a href=Routes.channel_path(@conn, :show, @channel)
+ a href=~p"/channels/#{@channel}"
/- if channel.channel_image.present?
/ => image_tag channel.uploaded_channel_image.url, width: 32, height: 32, alt: "#{channel.title}'s logo'", class: 'channel-strip__image'
/- else
diff --git a/lib/philomena_web/templates/activity/_topic_strip.html.slime b/lib/philomena_web/templates/activity/_topic_strip.html.slime
index 68ae4913..8dc09e01 100644
--- a/lib/philomena_web/templates/activity/_topic_strip.html.slime
+++ b/lib/philomena_web/templates/activity/_topic_strip.html.slime
@@ -4,7 +4,7 @@
= if @topic.last_post do
span.hyphenate-breaks
= render PhilomenaWeb.UserAttributionView, "_anon_user.html", object: @topic.last_post, conn: @conn
- = link("replied to", to: Routes.forum_topic_path(@conn, :show, @topic.forum, @topic, post_id: @topic.last_post) <> "#post_#{@topic.last_post.id}")
- =<> link(@topic.title, to: Routes.forum_topic_path(@conn, :show, @topic.forum, @topic))
+ = link("replied to", to: ~p"/forums/#{@topic.forum}/topics/#{@topic}?#{[post_id: @topic.last_post]}" <> "#post_#{@topic.last_post.id}")
+ =<> link(@topic.title, to: ~p"/forums/#{@topic.forum}/topics/#{@topic}")
' in
- => link(@topic.forum.name, to: Routes.forum_path(@conn, :show, @topic.forum))
+ => link(@topic.forum.name, to: ~p"/forums/#{@topic.forum}")
diff --git a/lib/philomena_web/templates/activity/index.html.slime b/lib/philomena_web/templates/activity/index.html.slime
index 167296f9..f6f0a712 100644
--- a/lib/philomena_web/templates/activity/index.html.slime
+++ b/lib/philomena_web/templates/activity/index.html.slime
@@ -51,4 +51,4 @@
' Browse Watched Images
.block__content.js-resizable-media-container
= for image <- @watched do
- = render PhilomenaWeb.ImageView, "_image_box.html", image: image, link: Routes.image_path(@conn, :show, image, q: "my:watched"), size: :thumb_small, conn: @conn
+ = render PhilomenaWeb.ImageView, "_image_box.html", image: image, link: ~p"/images/#{image}?#{[q: "my:watched"]}", size: :thumb_small, conn: @conn
diff --git a/lib/philomena_web/templates/admin/advert/_form.html.slime b/lib/philomena_web/templates/admin/advert/_form.html.slime
index df77528e..9fcd46c7 100644
--- a/lib/philomena_web/templates/admin/advert/_form.html.slime
+++ b/lib/philomena_web/templates/admin/advert/_form.html.slime
@@ -14,7 +14,7 @@
= error_tag f, :image_height
- else
.field
- = link "Change image", to: Routes.admin_advert_image_path(@conn, :edit, @changeset.data), class: "button"
+ = link "Change image", to: ~p"/admin/adverts/#{@changeset.data}/image/edit", class: "button"
.field
=> label f, :link, "Link which the advert should take users to:"
diff --git a/lib/philomena_web/templates/admin/advert/edit.html.slime b/lib/philomena_web/templates/admin/advert/edit.html.slime
index fba601a0..a3764720 100644
--- a/lib/philomena_web/templates/admin/advert/edit.html.slime
+++ b/lib/philomena_web/templates/admin/advert/edit.html.slime
@@ -1,2 +1,2 @@
h1 Editing advert
-= render PhilomenaWeb.Admin.AdvertView, "_form.html", changeset: @changeset, action: Routes.admin_advert_path(@conn, :update, @advert), conn: @conn
+= render PhilomenaWeb.Admin.AdvertView, "_form.html", changeset: @changeset, action: ~p"/admin/adverts/#{@advert}", conn: @conn
diff --git a/lib/philomena_web/templates/admin/advert/image/edit.html.slime b/lib/philomena_web/templates/admin/advert/image/edit.html.slime
index 6055e6a3..6374e9c3 100644
--- a/lib/philomena_web/templates/admin/advert/image/edit.html.slime
+++ b/lib/philomena_web/templates/admin/advert/image/edit.html.slime
@@ -1,6 +1,6 @@
h2 Edit Advert
-= form_for @changeset, Routes.admin_advert_image_path(@conn, :update, @advert), [multipart: true], fn f ->
+= form_for @changeset, ~p"/admin/adverts/#{@advert}/image", [multipart: true], fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
diff --git a/lib/philomena_web/templates/admin/advert/index.html.slime b/lib/philomena_web/templates/admin/advert/index.html.slime
index 1c7e34d3..609d468e 100644
--- a/lib/philomena_web/templates/admin/advert/index.html.slime
+++ b/lib/philomena_web/templates/admin/advert/index.html.slime
@@ -1,9 +1,9 @@
-- route = fn p -> Routes.admin_advert_path(@conn, :index, p) end
+- route = fn p -> ~p"/admin/adverts?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @adverts, route: route
.block
.block__header
- a href=Routes.admin_advert_path(@conn, :new)
+ a href=~p"/admin/adverts/new"
i.fa.fa-plus>
' New advert
@@ -65,9 +65,9 @@
= advert.clicks
td
- => link "Edit", to: Routes.admin_advert_path(@conn, :edit, advert)
+ => link "Edit", to: ~p"/admin/adverts/#{advert}/edit"
' •
- = link "Destroy", to: Routes.admin_advert_path(@conn, :delete, advert), data: [confirm: "Are you really, really sure?", method: "delete"]
+ = link "Destroy", to: ~p"/admin/adverts/#{advert}", data: [confirm: "Are you really, really sure?", method: "delete"]
.block__header.block__header--light
= pagination
diff --git a/lib/philomena_web/templates/admin/advert/new.html.slime b/lib/philomena_web/templates/admin/advert/new.html.slime
index ab27e617..76472e47 100644
--- a/lib/philomena_web/templates/admin/advert/new.html.slime
+++ b/lib/philomena_web/templates/admin/advert/new.html.slime
@@ -1,2 +1,2 @@
h1 New advert
-= render PhilomenaWeb.Admin.AdvertView, "_form.html", changeset: @changeset, action: Routes.admin_advert_path(@conn, :create), conn: @conn
+= render PhilomenaWeb.Admin.AdvertView, "_form.html", changeset: @changeset, action: ~p"/admin/adverts", conn: @conn
diff --git a/lib/philomena_web/templates/admin/approval/_approvals.html.slime b/lib/philomena_web/templates/admin/approval/_approvals.html.slime
index b254f6dd..f0448000 100644
--- a/lib/philomena_web/templates/admin/approval/_approvals.html.slime
+++ b/lib/philomena_web/templates/admin/approval/_approvals.html.slime
@@ -12,13 +12,13 @@
.block__content.alternating-color
.approval-grid
.approval-items--main
- span = link ">>#{image.id}", to: Routes.image_path(@conn, :show, image)
+ span = link ">>#{image.id}", to: ~p"/images/#{image}"
.approval-items__details class=class_for_image(image)
span = image_thumb(@conn, image)
span = warning_text(image)
span
= if image.user do
- = link image.user.name, to: Routes.profile_path(@conn, :show, image.user)
+ = link image.user.name, to: ~p"/profiles/#{image.user}"
- else
em>
= truncated_ip_link(@conn, image.ip)
@@ -26,9 +26,9 @@
span = pretty_time(image.created_at)
.approval-items--footer
= if can?(@conn, :approve, image) do
- = button_to "Approve", Routes.image_approve_path(@conn, :create, image), method: "post", class: "button button--state-success"
+ = button_to "Approve", ~p"/images/#{image}/approve", method: "post", class: "button button--state-success"
= if can?(@conn, :hide, image) do
- = form_for :image, Routes.image_delete_path(@conn, :create, image), [method: "post"], fn f ->
+ = form_for :image, ~p"/images/#{image}/delete", [method: "post"], fn f ->
.field.field--inline
= text_input f, :deletion_reason, class: "input input--wide", placeholder: "Rule violation", required: true
= submit "Delete", class: "button button--state-danger button--separate-left"
diff --git a/lib/philomena_web/templates/admin/approval/index.html.slime b/lib/philomena_web/templates/admin/approval/index.html.slime
index 818f7ae1..d3f8e098 100644
--- a/lib/philomena_web/templates/admin/approval/index.html.slime
+++ b/lib/philomena_web/templates/admin/approval/index.html.slime
@@ -1,4 +1,4 @@
-- route = fn p -> Routes.admin_approval_path(@conn, :index, p) end
+- route = fn p -> ~p"/admin/approvals?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @images, route: route
h1 Approval Queue
diff --git a/lib/philomena_web/templates/admin/artist_link/index.html.slime b/lib/philomena_web/templates/admin/artist_link/index.html.slime
index b9d0e8db..633ff2c1 100644
--- a/lib/philomena_web/templates/admin/artist_link/index.html.slime
+++ b/lib/philomena_web/templates/admin/artist_link/index.html.slime
@@ -2,20 +2,20 @@ h1 Artist Links
p Link creation is done via the Users menu.
p Verifying a link will automatically award an artist badge if the link is public, no artist badge exists, and an "artist:" tag is specified.
-= form_for :artist_link, Routes.admin_artist_link_path(@conn, :index), [method: "get", class: "hform"], fn f ->
+= form_for :artist_link, ~p"/admin/artist_links", [method: "get", class: "hform"], fn f ->
.field
= text_input f, :q, name: :q, value: @conn.params["q"], class: "input hform__text", placeholder: "Search query", autocapitalize: "none"
= submit "Search", class: "hform__button button"
-- route = fn p -> Routes.admin_artist_link_path(@conn, :index, p) end
+- route = fn p -> ~p"/admin/artist_links?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @artist_links, route: route, params: link_scope(@conn), conn: @conn
.block
.block__header
= if @conn.params["all"] do
- = link "Show unverified only", to: Routes.admin_artist_link_path(@conn, :index)
+ = link "Show unverified only", to: ~p"/admin/artist_links"
- else
- = link "Show all", to: Routes.admin_artist_link_path(@conn, :index, all: "true")
+ = link "Show all", to: ~p"/admin/artist_links?#{[all: "true"]}"
= pagination
@@ -56,20 +56,20 @@ p Verifying a link will automatically award an artist badge if the link is publi
= render PhilomenaWeb.TagView, "_tag.html", tag: link.tag, conn: @conn
td
- => link "View", to: Routes.profile_artist_link_path(@conn, :show, link.user, link)
+ => link "View", to: ~p"/profiles/#{link.user}/artist_links/#{link}"
' •
- = link "Edit", to: Routes.profile_artist_link_path(@conn, :edit, link.user, link)
+ = link "Edit", to: ~p"/profiles/#{link.user}/artist_links/#{link}/edit"
td
- => link "Verify", to: Routes.admin_artist_link_verification_path(@conn, :create, link), method: :post
+ => link "Verify", to: ~p"/admin/artist_links/#{link}/verification", method: :post
' •
- => link "Reject", to: Routes.admin_artist_link_reject_path(@conn, :create, link), method: :post
+ => link "Reject", to: ~p"/admin/artist_links/#{link}/reject", method: :post
br
= if not verified?(link) do
= if contacted?(link) do
' Artist contacted
- else
- = link "Artist contacted", to: Routes.admin_artist_link_contact_path(@conn, :create, link), method: :post
+ = link "Artist contacted", to: ~p"/admin/artist_links/#{link}/contact", method: :post
td
= public_text(link)
diff --git a/lib/philomena_web/templates/admin/badge/_form.html.slime b/lib/philomena_web/templates/admin/badge/_form.html.slime
index d8af18ab..1e5dc79b 100644
--- a/lib/philomena_web/templates/admin/badge/_form.html.slime
+++ b/lib/philomena_web/templates/admin/badge/_form.html.slime
@@ -30,6 +30,6 @@
= error_tag f, :image_mime_type
- else
.field
- = link "Change image", to: Routes.admin_badge_image_path(@conn, :edit, @changeset.data), class: "button"
+ = link "Change image", to: ~p"/admin/badges/#{@changeset.data}/image/edit", class: "button"
= submit "Save Badge", class: "button", data: [disable_with: raw("Saving…")]
diff --git a/lib/philomena_web/templates/admin/badge/edit.html.slime b/lib/philomena_web/templates/admin/badge/edit.html.slime
index 01df2fba..da713050 100644
--- a/lib/philomena_web/templates/admin/badge/edit.html.slime
+++ b/lib/philomena_web/templates/admin/badge/edit.html.slime
@@ -1,5 +1,5 @@
h2 Edit Badge
-= render "_form.html", Map.put(assigns, :action, Routes.admin_badge_path(@conn, :update, @badge))
+= render "_form.html", Map.put(assigns, :action, ~p"/admin/badges/#{@badge}")
-= link "Back", to: Routes.admin_badge_path(@conn, :index)
+= link "Back", to: ~p"/admin/badges"
diff --git a/lib/philomena_web/templates/admin/badge/image/edit.html.slime b/lib/philomena_web/templates/admin/badge/image/edit.html.slime
index ca0d7b4a..90042dbb 100644
--- a/lib/philomena_web/templates/admin/badge/image/edit.html.slime
+++ b/lib/philomena_web/templates/admin/badge/image/edit.html.slime
@@ -1,6 +1,6 @@
h2 Edit Badge
-= form_for @changeset, Routes.admin_badge_image_path(@conn, :update, @badge), [multipart: true], fn f ->
+= form_for @changeset, ~p"/admin/badges/#{@badge}/image", [multipart: true], fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
diff --git a/lib/philomena_web/templates/admin/badge/index.html.slime b/lib/philomena_web/templates/admin/badge/index.html.slime
index b46f6b71..f3949858 100644
--- a/lib/philomena_web/templates/admin/badge/index.html.slime
+++ b/lib/philomena_web/templates/admin/badge/index.html.slime
@@ -1,11 +1,11 @@
h2 Badges
-- route = fn p -> Routes.admin_badge_path(@conn, :index, p) end
+- route = fn p -> ~p"/admin/badges?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @badges, route: route, conn: @conn
.block
.block__header
- a href=Routes.admin_badge_path(@conn, :new)
+ a href=~p"/admin/badges/new"
i.fa.fa-plus>
' New Badge
@@ -28,9 +28,9 @@ h2 Badges
= badge_image(badge, width: 32, height: 32)
td
- => link "Users", to: Routes.admin_badge_user_path(@conn, :index, badge)
+ => link "Users", to: ~p"/admin/badges/#{badge}/users"
' •
- = link "Edit", to: Routes.admin_badge_path(@conn, :edit, badge)
+ = link "Edit", to: ~p"/admin/badges/#{badge}/edit"
.block__header.block__header--light
= pagination
diff --git a/lib/philomena_web/templates/admin/badge/new.html.slime b/lib/philomena_web/templates/admin/badge/new.html.slime
index 72962247..57fc8273 100644
--- a/lib/philomena_web/templates/admin/badge/new.html.slime
+++ b/lib/philomena_web/templates/admin/badge/new.html.slime
@@ -1,5 +1,5 @@
h2 New Badge
-= render "_form.html", Map.put(assigns, :action, Routes.admin_badge_path(@conn, :create))
+= render "_form.html", Map.put(assigns, :action, ~p"/admin/badges")
-= link "Back", to: Routes.admin_badge_path(@conn, :index)
+= link "Back", to: ~p"/admin/badges"
diff --git a/lib/philomena_web/templates/admin/badge/user/index.html.slime b/lib/philomena_web/templates/admin/badge/user/index.html.slime
index dda58bc2..bbb1c116 100644
--- a/lib/philomena_web/templates/admin/badge/user/index.html.slime
+++ b/lib/philomena_web/templates/admin/badge/user/index.html.slime
@@ -3,7 +3,7 @@ h1
=> @badge.title
' badge
-- route = fn p -> Routes.admin_badge_user_path(@conn, :index, @badge, p) end
+- route = fn p -> ~p"/admin/badges/#{@badge}/users?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @users, route: route, conn: @conn
.block
@@ -19,7 +19,7 @@ h1
= for user <- @users do
tr
td
- = link user.name, to: Routes.profile_path(@conn, :show, user)
+ = link user.name, to: ~p"/profiles/#{user}"
.block__header.block__header--light
= pagination
diff --git a/lib/philomena_web/templates/admin/dnp_entry/index.html.slime b/lib/philomena_web/templates/admin/dnp_entry/index.html.slime
index bc646d59..bf932f69 100644
--- a/lib/philomena_web/templates/admin/dnp_entry/index.html.slime
+++ b/lib/philomena_web/templates/admin/dnp_entry/index.html.slime
@@ -1,11 +1,11 @@
h2 Do-Not-Post Requests
-= form_for :dnp_entry, Routes.admin_dnp_entry_path(@conn, :index), [method: "get", class: "hform"], fn f ->
+= form_for :dnp_entry, ~p"/admin/dnp_entries", [method: "get", class: "hform"], fn f ->
.field
= text_input f, :q, name: :q, value: @conn.params["q"], class: "input hform__text", placeholder: "Search query", autocapitalize: "none"
= submit "Search", class: "hform__button button"
-- route = fn p -> Routes.admin_dnp_entry_path(@conn, :index, p) end
+- route = fn p -> ~p"/admin/dnp_entries?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @dnp_entries, route: route, params: [states: state_param(@conn.params["states"])]
.block
@@ -13,10 +13,10 @@ h2 Do-Not-Post Requests
= pagination
span.block__header__title Display Only:
- => link "All Open", to: Routes.admin_dnp_entry_path(@conn, :index, states: ~W(requested claimed rescinded acknowledged))
- => link "Listed", to: Routes.admin_dnp_entry_path(@conn, :index, states: ~W(listed))
- => link "Rescinded", to: Routes.admin_dnp_entry_path(@conn, :index, states: ~W(rescinded acknowledged))
- => link "Closed", to: Routes.admin_dnp_entry_path(@conn, :index, states: ~W(closed))
+ => link "All Open", to: ~p"/admin/dnp_entries?#{[states: ~W(requested claimed rescinded acknowledged)]}"
+ => link "Listed", to: ~p"/admin/dnp_entries?#{[states: ~W(listed)]}"
+ => link "Rescinded", to: ~p"/admin/dnp_entries?#{[states: ~W(rescinded acknowledged)]}"
+ => link "Closed", to: ~p"/admin/dnp_entries?#{[states: ~W(closed)]}"
.block__content
table.table
@@ -38,7 +38,7 @@ h2 Do-Not-Post Requests
= render PhilomenaWeb.TagView, "_tag.html", tag: request.tag, conn: @conn
td
- = link request.requesting_user.name, to: Routes.profile_path(@conn, :show, request.requesting_user)
+ = link request.requesting_user.name, to: ~p"/profiles/#{request.requesting_user}"
td
= request.dnp_type
@@ -51,7 +51,7 @@ h2 Do-Not-Post Requests
= if request.modifying_user do
' by
- = link request.modifying_user.name, to: Routes.profile_path(@conn, :show, request.modifying_user)
+ = link request.modifying_user.name, to: ~p"/profiles/#{request.modifying_user}"
td
= pretty_time(request.created_at)
@@ -60,31 +60,31 @@ h2 Do-Not-Post Requests
= pretty_time(request.updated_at)
td
- => link "Show", to: Routes.dnp_entry_path(@conn, :show, request)
+ => link "Show", to: ~p"/dnp/#{request}"
' •
- => link "Send PM", to: Routes.conversation_path(@conn, :new, recipient: request.requesting_user.name)
+ => link "Send PM", to: ~p"/conversations/new?#{[recipient: request.requesting_user.name]}"
= case request.aasm_state do
- s when s in ["requested", "claimed"] ->
' •
- => link "Claim", to: Routes.admin_dnp_entry_transition_path(@conn, :create, request, state: "claimed"), data: [method: "post", confirm: "Are you really, really sure?"]
+ => link "Claim", to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "claimed"]}", data: [method: "post", confirm: "Are you really, really sure?"]
' •
- => link "Approve", to: Routes.admin_dnp_entry_transition_path(@conn, :create, request, state: "listed"), data: [method: "post", confirm: "Are you really, really sure?"]
+ => link "Approve", to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "listed"]}", data: [method: "post", confirm: "Are you really, really sure?"]
' •
- => link "Close", to: Routes.admin_dnp_entry_transition_path(@conn, :create, request, state: "closed"), data: [method: "post", confirm: "Are you really, really sure?"]
+ => link "Close", to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "closed"]}", data: [method: "post", confirm: "Are you really, really sure?"]
- "listed" ->
' •
- => link "Rescind", to: Routes.admin_dnp_entry_transition_path(@conn, :create, request, state: "rescinded"), data: [method: "post", confirm: "Are you really, really sure?"]
+ => link "Rescind", to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "rescinded"]}", data: [method: "post", confirm: "Are you really, really sure?"]
' •
- = link "Close", to: Routes.admin_dnp_entry_transition_path(@conn, :create, request, state: "closed"), data: [method: "post", confirm: "Are you really, really sure?"]
+ = link "Close", to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "closed"]}", data: [method: "post", confirm: "Are you really, really sure?"]
- s when s in ["rescinded", "acknowledged"] ->
' •
- => link "Claim", to: Routes.admin_dnp_entry_transition_path(@conn, :create, request, state: "acknowledged"), data: [method: "post", confirm: "Are you really, really sure?"]
+ => link "Claim", to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "acknowledged"]}", data: [method: "post", confirm: "Are you really, really sure?"]
' •
- = link "Close", to: Routes.admin_dnp_entry_transition_path(@conn, :create, request, state: "closed"), data: [method: "post", confirm: "Are you really, really sure?"]
+ = link "Close", to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "closed"]}", data: [method: "post", confirm: "Are you really, really sure?"]
- _state ->
' •
- => link "Claim", to: Routes.admin_dnp_entry_transition_path(@conn, :create, request, state: "claimed"), data: [method: "post", confirm: "Are you really, really sure?"]
+ => link "Claim", to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "claimed"]}", data: [method: "post", confirm: "Are you really, really sure?"]
diff --git a/lib/philomena_web/templates/admin/donation/_table.html.slime b/lib/philomena_web/templates/admin/donation/_table.html.slime
index 7bcd7ac6..023369b4 100644
--- a/lib/philomena_web/templates/admin/donation/_table.html.slime
+++ b/lib/philomena_web/templates/admin/donation/_table.html.slime
@@ -12,7 +12,7 @@ table.table
tr
td
= if donation.user do
- = link donation.user.name, to: Routes.profile_path(@conn, :show, donation.user)
+ = link donation.user.name, to: ~p"/profiles/#{donation.user}"
td
= donation.email
diff --git a/lib/philomena_web/templates/admin/donation/index.html.slime b/lib/philomena_web/templates/admin/donation/index.html.slime
index f27ed0bb..97ed6cac 100644
--- a/lib/philomena_web/templates/admin/donation/index.html.slime
+++ b/lib/philomena_web/templates/admin/donation/index.html.slime
@@ -1,4 +1,4 @@
-- route = fn p -> Routes.admin_donation_path(@conn, :index, p) end
+- route = fn p -> ~p"/admin/donations?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @donations, route: route, conn: @conn
h1 Donations
diff --git a/lib/philomena_web/templates/admin/donation/user/index.html.slime b/lib/philomena_web/templates/admin/donation/user/index.html.slime
index dc45ab3e..daf4f6c1 100644
--- a/lib/philomena_web/templates/admin/donation/user/index.html.slime
+++ b/lib/philomena_web/templates/admin/donation/user/index.html.slime
@@ -6,7 +6,7 @@
= render PhilomenaWeb.Admin.DonationView, "_table.html", donations: @donations, conn: @conn
h1 Add Donation
- = form_for @changeset, Routes.admin_donation_path(@conn, :create), fn f ->
+ = form_for @changeset, ~p"/admin/donations", fn f ->
.field
=> label f, :user_id, "User ID:"
= number_input f, :user_id, class: "input input--short", value: @user.id
diff --git a/lib/philomena_web/templates/admin/fingerprint_ban/edit.html.slime b/lib/philomena_web/templates/admin/fingerprint_ban/edit.html.slime
index 2e78f09b..eb424776 100644
--- a/lib/philomena_web/templates/admin/fingerprint_ban/edit.html.slime
+++ b/lib/philomena_web/templates/admin/fingerprint_ban/edit.html.slime
@@ -1,6 +1,6 @@
h1 Editing ban
-= render PhilomenaWeb.Admin.FingerprintBanView, "_form.html", changeset: @changeset, action: Routes.admin_fingerprint_ban_path(@conn, :update, @fingerprint), conn: @conn
+= render PhilomenaWeb.Admin.FingerprintBanView, "_form.html", changeset: @changeset, action: ~p"/admin/fingerprint_bans/#{@fingerprint}", conn: @conn
br
-= link "Back", to: Routes.admin_fingerprint_ban_path(@conn, :index)
+= link "Back", to: ~p"/admin/fingerprint_bans"
diff --git a/lib/philomena_web/templates/admin/fingerprint_ban/index.html.slime b/lib/philomena_web/templates/admin/fingerprint_ban/index.html.slime
index b173c39a..209ad509 100644
--- a/lib/philomena_web/templates/admin/fingerprint_ban/index.html.slime
+++ b/lib/philomena_web/templates/admin/fingerprint_ban/index.html.slime
@@ -1,16 +1,16 @@
h1 Fingerprint Bans
-- route = fn p -> Routes.admin_fingerprint_ban_path(@conn, :index, p) end
+- route = fn p -> ~p"/admin/fingerprint_bans?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @fingerprint_bans, route: route, params: page_params(@conn.params)
-= form_for :fingerprint_ban, Routes.admin_fingerprint_ban_path(@conn, :index), [method: "get", class: "hform"], fn f ->
+= form_for :fingerprint_ban, ~p"/admin/fingerprint_bans", [method: "get", class: "hform"], fn f ->
.field
= text_input f, :q, name: "q", class: "hform__text input", placeholder: "Search"
= submit "Search", class: "button hform__button"
.block
.block__header
- a href=Routes.admin_fingerprint_ban_path(@conn, :new)
+ a href=~p"/admin/fingerprint_bans/new"
i.fa.fa-plus>
' New fingerprint ban
@@ -31,7 +31,7 @@ h1 Fingerprint Bans
= for ban <- @fingerprint_bans do
tr
td
- = link ban.fingerprint, to: Routes.fingerprint_profile_path(@conn, :show, ban.fingerprint)
+ = link ban.fingerprint, to: ~p"/fingerprint_profiles/#{ban.fingerprint}"
td
=> pretty_time ban.created_at
@@ -53,10 +53,10 @@ h1 Fingerprint Bans
= ban.generated_ban_id
td
- => link "Edit", to: Routes.admin_fingerprint_ban_path(@conn, :edit, ban)
+ => link "Edit", to: ~p"/admin/fingerprint_bans/#{ban}/edit"
= if @current_user.role == "admin" do
' •
- => link "Destroy", to: Routes.admin_fingerprint_ban_path(@conn, :delete, ban), data: [confirm: "Are you really, really sure?", method: "delete"]
+ => link "Destroy", to: ~p"/admin/fingerprint_bans/#{ban}", data: [confirm: "Are you really, really sure?", method: "delete"]
.block__header.block__header--light
= pagination
diff --git a/lib/philomena_web/templates/admin/fingerprint_ban/new.html.slime b/lib/philomena_web/templates/admin/fingerprint_ban/new.html.slime
index 75db4f62..02d20b60 100644
--- a/lib/philomena_web/templates/admin/fingerprint_ban/new.html.slime
+++ b/lib/philomena_web/templates/admin/fingerprint_ban/new.html.slime
@@ -1,5 +1,5 @@
h1 New Fingerprint Ban
-= render PhilomenaWeb.Admin.FingerprintBanView, "_form.html", changeset: @changeset, action: Routes.admin_fingerprint_ban_path(@conn, :create), conn: @conn
+= render PhilomenaWeb.Admin.FingerprintBanView, "_form.html", changeset: @changeset, action: ~p"/admin/fingerprint_bans", conn: @conn
br
-= link "Back", to: Routes.admin_fingerprint_ban_path(@conn, :index)
+= link "Back", to: ~p"/admin/fingerprint_bans"
diff --git a/lib/philomena_web/templates/admin/forum/edit.html.slime b/lib/philomena_web/templates/admin/forum/edit.html.slime
index 4f513a09..8d0e959b 100644
--- a/lib/philomena_web/templates/admin/forum/edit.html.slime
+++ b/lib/philomena_web/templates/admin/forum/edit.html.slime
@@ -1,5 +1,5 @@
h2 Edit Forum
-= render "_form.html", Map.put(assigns, :action, Routes.admin_forum_path(@conn, :update, @forum))
+= render "_form.html", Map.put(assigns, :action, ~p"/admin/forums/#{@forum}")
-= link "Back", to: Routes.admin_forum_path(@conn, :index)
+= link "Back", to: ~p"/admin/forums"
diff --git a/lib/philomena_web/templates/admin/forum/index.html.slime b/lib/philomena_web/templates/admin/forum/index.html.slime
index fec3c55c..c1423ece 100644
--- a/lib/philomena_web/templates/admin/forum/index.html.slime
+++ b/lib/philomena_web/templates/admin/forum/index.html.slime
@@ -9,9 +9,9 @@ table.table
= for forum <- @forums do
tr
td
- = link forum.name, to: Routes.forum_path(@conn, :show, forum)
+ = link forum.name, to: ~p"/forums/#{forum}"
td class="text-right"
- = link "Edit", to: Routes.admin_forum_path(@conn, :edit, forum)
+ = link "Edit", to: ~p"/admin/forums/#{forum}/edit"
-= link "New Forum", to: Routes.admin_forum_path(@conn, :new)
+= link "New Forum", to: ~p"/admin/forums/new"
diff --git a/lib/philomena_web/templates/admin/forum/new.html.slime b/lib/philomena_web/templates/admin/forum/new.html.slime
index 2d6fd0cd..602d7d14 100644
--- a/lib/philomena_web/templates/admin/forum/new.html.slime
+++ b/lib/philomena_web/templates/admin/forum/new.html.slime
@@ -1,5 +1,5 @@
h2 New Forum
-= render "_form.html", Map.put(assigns, :action, Routes.admin_forum_path(@conn, :create))
+= render "_form.html", Map.put(assigns, :action, ~p"/admin/forums")
-= link "Back", to: Routes.admin_forum_path(@conn, :index)
+= link "Back", to: ~p"/admin/forums"
diff --git a/lib/philomena_web/templates/admin/mod_note/_table.html.slime b/lib/philomena_web/templates/admin/mod_note/_table.html.slime
index a47663a7..6c143079 100644
--- a/lib/philomena_web/templates/admin/mod_note/_table.html.slime
+++ b/lib/philomena_web/templates/admin/mod_note/_table.html.slime
@@ -19,9 +19,9 @@ table.table
= pretty_time note.created_at
td
- = link note.moderator.name, to: Routes.profile_path(@conn, :show, note.moderator)
+ = link note.moderator.name, to: ~p"/profiles/#{note.moderator}"
td
- => link "Edit", to: Routes.admin_mod_note_path(@conn, :edit, note)
+ => link "Edit", to: ~p"/admin/mod_notes/#{note}/edit"
' •
- => link "Delete", to: Routes.admin_mod_note_path(@conn, :delete, note), data: [confirm: "Are you really, really sure?", method: "delete"]
+ => link "Delete", to: ~p"/admin/mod_notes/#{note}", data: [confirm: "Are you really, really sure?", method: "delete"]
diff --git a/lib/philomena_web/templates/admin/mod_note/edit.html.slime b/lib/philomena_web/templates/admin/mod_note/edit.html.slime
index e9df5556..aed68f42 100644
--- a/lib/philomena_web/templates/admin/mod_note/edit.html.slime
+++ b/lib/philomena_web/templates/admin/mod_note/edit.html.slime
@@ -3,4 +3,4 @@ h2
=> @mod_note.notable_type
=> @mod_note.notable_id
-= render PhilomenaWeb.Admin.ModNoteView, "_form.html", changeset: @changeset, action: Routes.admin_mod_note_path(@conn, :update, @mod_note), conn: @conn
+= render PhilomenaWeb.Admin.ModNoteView, "_form.html", changeset: @changeset, action: ~p"/admin/mod_notes/#{@mod_note}", conn: @conn
diff --git a/lib/philomena_web/templates/admin/mod_note/index.html.slime b/lib/philomena_web/templates/admin/mod_note/index.html.slime
index 5b14f76c..580366fc 100644
--- a/lib/philomena_web/templates/admin/mod_note/index.html.slime
+++ b/lib/philomena_web/templates/admin/mod_note/index.html.slime
@@ -1,4 +1,4 @@
-- route = fn p -> Routes.admin_mod_note_path(@conn, :index, p) end
+- route = fn p -> ~p"/admin/mod_notes?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @mod_notes, route: route, conn: @conn
h2 Mod Notes
diff --git a/lib/philomena_web/templates/admin/mod_note/new.html.slime b/lib/philomena_web/templates/admin/mod_note/new.html.slime
index 1cb13aea..09d7291e 100644
--- a/lib/philomena_web/templates/admin/mod_note/new.html.slime
+++ b/lib/philomena_web/templates/admin/mod_note/new.html.slime
@@ -3,4 +3,4 @@ h2
=> @conn.params["notable_type"]
=> @conn.params["notable_id"]
-= render PhilomenaWeb.Admin.ModNoteView, "_form.html", changeset: @changeset, action: Routes.admin_mod_note_path(@conn, :create), conn: @conn
+= render PhilomenaWeb.Admin.ModNoteView, "_form.html", changeset: @changeset, action: ~p"/admin/mod_notes", conn: @conn
diff --git a/lib/philomena_web/templates/admin/report/_reports.html.slime b/lib/philomena_web/templates/admin/report/_reports.html.slime
index f43f531a..743f51cb 100644
--- a/lib/philomena_web/templates/admin/report/_reports.html.slime
+++ b/lib/philomena_web/templates/admin/report/_reports.html.slime
@@ -18,7 +18,7 @@ table.table
= truncate(report.reason)
td
= if report.user do
- = link report.user.name, to: Routes.profile_path(@conn, :show, report.user)
+ = link report.user.name, to: ~p"/profiles/#{report.user}"
- else
em>
= truncated_ip_link(@conn, report.ip)
@@ -34,20 +34,20 @@ table.table
=> pretty_state(report)
= user_abbrv @conn, report.admin
td
- => link "Show", to: Routes.admin_report_path(@conn, :show, report)
+ => link "Show", to: ~p"/admin/reports/#{report}"
= if report.open do
= if report.user do
' •
- => link "Send PM", to: Routes.conversation_path(@conn, :new, recipient: report.user.name)
+ => link "Send PM", to: ~p"/conversations/new?#{[recipient: report.user.name]}"
= if is_nil(report.admin) and not current?(report.admin, @conn.assigns.current_user) do
' •
- => link "Claim", to: Routes.admin_report_claim_path(@conn, :create, report), data: [method: "post"]
+ => link "Claim", to: ~p"/admin/reports/#{report}/claim", data: [method: "post"]
= if current?(report.admin, @conn.assigns.current_user) do
' •
- => link "Release", to: Routes.admin_report_claim_path(@conn, :delete, report), data: [method: "delete"]
+ => link "Release", to: ~p"/admin/reports/#{report}/claim", data: [method: "delete"]
' •
- => link "Close", to: Routes.admin_report_close_path(@conn, :create, report), data: [method: "post", confirm: "Are you really, really sure?"]
+ => link "Close", to: ~p"/admin/reports/#{report}/close", data: [method: "post", confirm: "Are you really, really sure?"]
diff --git a/lib/philomena_web/templates/admin/report/index.html.slime b/lib/philomena_web/templates/admin/report/index.html.slime
index 23f626f1..83c45312 100644
--- a/lib/philomena_web/templates/admin/report/index.html.slime
+++ b/lib/philomena_web/templates/admin/report/index.html.slime
@@ -1,4 +1,4 @@
-- route = fn p -> Routes.admin_report_path(@conn, :index, p) end
+- route = fn p -> ~p"/admin/reports?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", route: route, page: @reports, conn: @conn, params: [rq: @conn.params["rq"] || "*"]
h1 Reports
@@ -30,7 +30,7 @@ h1 Reports
.block__header.block__header--light
= pagination
-= form_for :report, Routes.admin_report_path(@conn, :index), [method: "get", class: "hform"], fn f ->
+= form_for :report, ~p"/admin/reports", [method: "get", class: "hform"], fn f ->
.field
= text_input f, :rq, name: :rq, value: @conn.params["rq"], class: "input hform__text", placeholder: "Search reports", autocapitalize: "none"
= submit "Search", class: "hform__button button"
diff --git a/lib/philomena_web/templates/admin/report/show.html.slime b/lib/philomena_web/templates/admin/report/show.html.slime
index f046aae3..d0d183a8 100644
--- a/lib/philomena_web/templates/admin/report/show.html.slime
+++ b/lib/philomena_web/templates/admin/report/show.html.slime
@@ -31,18 +31,18 @@ article.block.communication
= if assigns[:mod_notes] do
h4 Mod Notes
= render PhilomenaWeb.Admin.ModNoteView, "_table.html", mod_notes: @mod_notes, conn: @conn
- = link "Add New Note", to: Routes.admin_mod_note_path(@conn, :new, notable_id: @report.id, notable_type: "Report")
+ = link "Add New Note", to: ~p"/admin/mod_notes/new?#{[notable_id: @report.id, notable_type: "Report"]}"
p
= if @report.user do
- => link "Send PM", to: Routes.conversation_path(@conn, :new, recipient: @report.user.name), class: "button button--link"
+ => link "Send PM", to: ~p"/conversations/new?#{[recipient: @report.user.name]}", class: "button button--link"
= if @report.open do
- => link "Close", to: Routes.admin_report_close_path(@conn, :create, @report), class: "button", data: [method: "post"]
+ => link "Close", to: ~p"/admin/reports/#{@report}/close", class: "button", data: [method: "post"]
= if current?(@report.admin, @conn.assigns.current_user) do
- => link "Release", to: Routes.admin_report_claim_path(@conn, :delete, @report), class: "button", data: [method: "delete"]
+ => link "Release", to: ~p"/admin/reports/#{@report}/claim", class: "button", data: [method: "delete"]
- else
- => link "Claim", to: Routes.admin_report_claim_path(@conn, :create, @report), class: "button", data: [method: "post"]
+ => link "Claim", to: ~p"/admin/reports/#{@report}/claim", class: "button", data: [method: "post"]
-= link "Back", to: Routes.admin_report_path(@conn, :index), class: "button button-link"
+= link "Back", to: ~p"/admin/reports", class: "button button-link"
diff --git a/lib/philomena_web/templates/admin/site_notice/edit.html.slime b/lib/philomena_web/templates/admin/site_notice/edit.html.slime
index bd745654..de39c73e 100644
--- a/lib/philomena_web/templates/admin/site_notice/edit.html.slime
+++ b/lib/philomena_web/templates/admin/site_notice/edit.html.slime
@@ -1,2 +1,2 @@
h1 Editing site notice
-= render PhilomenaWeb.Admin.SiteNoticeView, "_form.html", changeset: @changeset, action: Routes.admin_site_notice_path(@conn, :update, @site_notice), conn: @conn
+= render PhilomenaWeb.Admin.SiteNoticeView, "_form.html", changeset: @changeset, action: ~p"/admin/site_notices/#{@site_notice}", conn: @conn
diff --git a/lib/philomena_web/templates/admin/site_notice/index.html.slime b/lib/philomena_web/templates/admin/site_notice/index.html.slime
index 1ff2ee3f..21cac767 100644
--- a/lib/philomena_web/templates/admin/site_notice/index.html.slime
+++ b/lib/philomena_web/templates/admin/site_notice/index.html.slime
@@ -1,11 +1,11 @@
h1 Site Notices
-- route = fn p -> Routes.admin_site_notice_path(@conn, :index, p) end
+- route = fn p -> ~p"/admin/site_notices?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @admin_site_notices, route: route, conn: @conn
.block
.block__header
- a href=Routes.admin_site_notice_path(@conn, :new)
+ a href=~p"/admin/site_notices/new"
i.fa.fa-plus>
' New site notice
@@ -36,9 +36,9 @@ h1 Site Notices
= live_text site_notice
td
- => link "Edit", to: Routes.admin_site_notice_path(@conn, :edit, site_notice)
+ => link "Edit", to: ~p"/admin/site_notices/#{site_notice}/edit"
' •
- => link "Destroy", to: Routes.admin_site_notice_path(@conn, :delete, site_notice), data: [confirm: "Are you really, really sure?", method: "delete"]
+ => link "Destroy", to: ~p"/admin/site_notices/#{site_notice}", data: [confirm: "Are you really, really sure?", method: "delete"]
.block__header.block__header--light
= pagination
diff --git a/lib/philomena_web/templates/admin/site_notice/new.html.slime b/lib/philomena_web/templates/admin/site_notice/new.html.slime
index b8c2f34b..cf85b793 100644
--- a/lib/philomena_web/templates/admin/site_notice/new.html.slime
+++ b/lib/philomena_web/templates/admin/site_notice/new.html.slime
@@ -1,2 +1,2 @@
h1 New site notice
-= render PhilomenaWeb.Admin.SiteNoticeView, "_form.html", changeset: @changeset, action: Routes.admin_site_notice_path(@conn, :create), conn: @conn
+= render PhilomenaWeb.Admin.SiteNoticeView, "_form.html", changeset: @changeset, action: ~p"/admin/site_notices", conn: @conn
diff --git a/lib/philomena_web/templates/admin/subnet_ban/edit.html.slime b/lib/philomena_web/templates/admin/subnet_ban/edit.html.slime
index 98f35634..dc451983 100644
--- a/lib/philomena_web/templates/admin/subnet_ban/edit.html.slime
+++ b/lib/philomena_web/templates/admin/subnet_ban/edit.html.slime
@@ -1,6 +1,6 @@
h1 Editing ban
-= render PhilomenaWeb.Admin.SubnetBanView, "_form.html", changeset: @changeset, action: Routes.admin_subnet_ban_path(@conn, :update, @subnet), conn: @conn
+= render PhilomenaWeb.Admin.SubnetBanView, "_form.html", changeset: @changeset, action: ~p"/admin/subnet_bans/#{@subnet}", conn: @conn
br
-= link "Back", to: Routes.admin_subnet_ban_path(@conn, :index)
+= link "Back", to: ~p"/admin/subnet_bans"
diff --git a/lib/philomena_web/templates/admin/subnet_ban/index.html.slime b/lib/philomena_web/templates/admin/subnet_ban/index.html.slime
index f6b4dc5d..ff139197 100644
--- a/lib/philomena_web/templates/admin/subnet_ban/index.html.slime
+++ b/lib/philomena_web/templates/admin/subnet_ban/index.html.slime
@@ -1,16 +1,16 @@
h1 Subnet Bans
-- route = fn p -> Routes.admin_subnet_ban_path(@conn, :index, p) end
+- route = fn p -> ~p"/admin/subnet_bans?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @subnet_bans, route: route, params: page_params(@conn.params)
-= form_for :subnet_ban, Routes.admin_subnet_ban_path(@conn, :index), [method: "get", class: "hform"], fn f ->
+= form_for :subnet_ban, ~p"/admin/subnet_bans", [method: "get", class: "hform"], fn f ->
.field
= text_input f, :q, name: "q", class: "hform__text input", placeholder: "Search"
= submit "Search", class: "button hform__button"
.block
.block__header
- a href=Routes.admin_subnet_ban_path(@conn, :new)
+ a href=~p"/admin/subnet_bans/new"
i.fa.fa-plus>
' New subnet ban
@@ -31,7 +31,7 @@ h1 Subnet Bans
= for ban <- @subnet_bans do
tr
td
- = link ban.specification, to: Routes.ip_profile_path(@conn, :show, to_string(ban.specification))
+ = link ban.specification, to: ~p"/ip_profiles/#{to_string(ban.specification)}"
td
=> pretty_time ban.created_at
@@ -53,10 +53,10 @@ h1 Subnet Bans
= ban.generated_ban_id
td
- => link "Edit", to: Routes.admin_subnet_ban_path(@conn, :edit, ban)
+ => link "Edit", to: ~p"/admin/subnet_bans/#{ban}/edit"
= if @current_user.role == "admin" do
' •
- => link "Destroy", to: Routes.admin_subnet_ban_path(@conn, :delete, ban), data: [confirm: "Are you really, really sure?", method: "delete"]
+ => link "Destroy", to: ~p"/admin/subnet_bans/#{ban}", data: [confirm: "Are you really, really sure?", method: "delete"]
.block__header.block__header--light
= pagination
diff --git a/lib/philomena_web/templates/admin/subnet_ban/new.html.slime b/lib/philomena_web/templates/admin/subnet_ban/new.html.slime
index 50d01a78..7732231b 100644
--- a/lib/philomena_web/templates/admin/subnet_ban/new.html.slime
+++ b/lib/philomena_web/templates/admin/subnet_ban/new.html.slime
@@ -1,5 +1,5 @@
h1 New Subnet Ban
-= render PhilomenaWeb.Admin.SubnetBanView, "_form.html", changeset: @changeset, action: Routes.admin_subnet_ban_path(@conn, :create), conn: @conn
+= render PhilomenaWeb.Admin.SubnetBanView, "_form.html", changeset: @changeset, action: ~p"/admin/subnet_bans", conn: @conn
br
-= link "Back", to: Routes.admin_subnet_ban_path(@conn, :index)
+= link "Back", to: ~p"/admin/subnet_bans"
diff --git a/lib/philomena_web/templates/admin/user/_form.html.slime b/lib/philomena_web/templates/admin/user/_form.html.slime
index 34275f4a..faf4218a 100644
--- a/lib/philomena_web/templates/admin/user/_form.html.slime
+++ b/lib/philomena_web/templates/admin/user/_form.html.slime
@@ -34,7 +34,7 @@
.table-list__label
.table-list__label__text Avatar
.table-list__label__input
- = link "Remove avatar", to: Routes.admin_user_avatar_path(@conn, :delete, @user), class: "button", data: [method: "delete", confirm: "Are you really, really sure?"]
+ = link "Remove avatar", to: ~p"/admin/users/#{@user}/avatar", class: "button", data: [method: "delete", confirm: "Are you really, really sure?"]
.block
.block__header
diff --git a/lib/philomena_web/templates/admin/user/edit.html.slime b/lib/philomena_web/templates/admin/user/edit.html.slime
index bb1e6d02..e7a649de 100644
--- a/lib/philomena_web/templates/admin/user/edit.html.slime
+++ b/lib/philomena_web/templates/admin/user/edit.html.slime
@@ -1,3 +1,3 @@
h1 Editing user
-= render PhilomenaWeb.Admin.UserView, "_form.html", Map.put(assigns, :action, Routes.admin_user_path(@conn, :update, @user))
+= render PhilomenaWeb.Admin.UserView, "_form.html", Map.put(assigns, :action, ~p"/admin/users/#{@user}")
diff --git a/lib/philomena_web/templates/admin/user/force_filter/new.html.slime b/lib/philomena_web/templates/admin/user/force_filter/new.html.slime
index 9d214dd1..eda33725 100644
--- a/lib/philomena_web/templates/admin/user/force_filter/new.html.slime
+++ b/lib/philomena_web/templates/admin/user/force_filter/new.html.slime
@@ -2,7 +2,7 @@ h1
' Force-assigning a filter for user
= @user.name
-= form_for @changeset, Routes.admin_user_force_filter_path(@conn, :create, @user), [method: "post"], fn f ->
+= form_for @changeset, ~p"/admin/users/#{@user}/force_filter", [method: "post"], fn f ->
.field
=> text_input f, :forced_filter_id, placeholder: "Filter ID", class: "input", required: true
.field
diff --git a/lib/philomena_web/templates/admin/user/index.html.slime b/lib/philomena_web/templates/admin/user/index.html.slime
index cf240141..7157e7d9 100644
--- a/lib/philomena_web/templates/admin/user/index.html.slime
+++ b/lib/philomena_web/templates/admin/user/index.html.slime
@@ -1,15 +1,15 @@
h1 Users
-= form_for :user, Routes.admin_user_path(@conn, :index), [method: "get", class: "hform"], fn f ->
+= form_for :user, ~p"/admin/users", [method: "get", class: "hform"], fn f ->
.field
=> text_input f, :q, name: "q", class: "hform__text input", placeholder: "Search query"
= submit "Search", class: "button hform__button"
-=> link "Site staff", to: Routes.admin_user_path(@conn, :index, staff: 1)
+=> link "Site staff", to: ~p"/admin/users?#{[staff: 1]}"
' •
-=> link "2FA users", to: Routes.admin_user_path(@conn, :index, twofactor: 1)
+=> link "2FA users", to: ~p"/admin/users?#{[twofactor: 1]}"
-- route = fn p -> Routes.admin_user_path(@conn, :index, p) end
+- route = fn p -> ~p"/admin/users?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @users, route: route, conn: @conn, params: page_params(@conn.params)
.block
@@ -30,7 +30,7 @@ h1 Users
= for user <- @users do
tr
td
- = link user.name, to: Routes.profile_path(@conn, :show, user)
+ = link user.name, to: ~p"/profiles/#{user}"
= cond do
- user.otp_required_for_login ->
@@ -71,7 +71,7 @@ h1 Users
td
= if can?(@conn, :edit, user) do
- => link to: Routes.admin_user_path(@conn, :edit, user) do
+ => link to: ~p"/admin/users/#{user}/edit" do
i.fa.fa-fw.fa-user-edit
' Edit
@@ -82,11 +82,11 @@ h1 Users
/' •
= if can?(@conn, :index, Philomena.Bans.User) do
- => link to: Routes.admin_user_ban_path(@conn, :new, username: user.name) do
+ => link to: ~p"/admin/user_bans/new?#{[username: user.name]}" do
i.fa.fa-fw.fa-ban
' Ban
= if can?(@conn, :edit, Philomena.ArtistLinks.ArtistLink) do
- => link to: Routes.profile_artist_link_path(@conn, :new, user) do
+ => link to: ~p"/profiles/#{user}/artist_links/new" do
i.fa.fa-fw.fa-link
' Add link
diff --git a/lib/philomena_web/templates/admin/user_ban/edit.html.slime b/lib/philomena_web/templates/admin/user_ban/edit.html.slime
index ff4f23bb..604f0ed6 100644
--- a/lib/philomena_web/templates/admin/user_ban/edit.html.slime
+++ b/lib/philomena_web/templates/admin/user_ban/edit.html.slime
@@ -1,6 +1,6 @@
h1 Editing ban
-= render PhilomenaWeb.Admin.UserBanView, "_form.html", changeset: @changeset, action: Routes.admin_user_ban_path(@conn, :update, @user), conn: @conn
+= render PhilomenaWeb.Admin.UserBanView, "_form.html", changeset: @changeset, action: ~p"/admin/user_bans/#{@user}", conn: @conn
br
-= link "Back", to: Routes.admin_user_ban_path(@conn, :index)
+= link "Back", to: ~p"/admin/user_bans"
diff --git a/lib/philomena_web/templates/admin/user_ban/index.html.slime b/lib/philomena_web/templates/admin/user_ban/index.html.slime
index c81d4ab2..3f76034d 100644
--- a/lib/philomena_web/templates/admin/user_ban/index.html.slime
+++ b/lib/philomena_web/templates/admin/user_ban/index.html.slime
@@ -1,16 +1,16 @@
h1 User Bans
-- route = fn p -> Routes.admin_user_ban_path(@conn, :index, p) end
+- route = fn p -> ~p"/admin/user_bans?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @user_bans, route: route, params: page_params(@conn.params)
-= form_for :user_ban, Routes.admin_user_ban_path(@conn, :index), [method: "get", class: "hform"], fn f ->
+= form_for :user_ban, ~p"/admin/user_bans", [method: "get", class: "hform"], fn f ->
.field
= text_input f, :q, name: "q", class: "hform__text input", placeholder: "Search"
= submit "Search", class: "button hform__button"
.block
.block__header
- a href=Routes.admin_user_ban_path(@conn, :new)
+ a href=~p"/admin/user_bans/new"
i.fa.fa-plus>
' New user ban
@@ -31,7 +31,7 @@ h1 User Bans
= for ban <- @user_bans do
tr
td
- = link ban.user.name, to: Routes.profile_path(@conn, :show, ban.user)
+ = link ban.user.name, to: ~p"/profiles/#{ban.user}"
td
=> pretty_time ban.created_at
@@ -53,10 +53,10 @@ h1 User Bans
= ban.generated_ban_id
td
- => link "Edit", to: Routes.admin_user_ban_path(@conn, :edit, ban)
+ => link "Edit", to: ~p"/admin/user_bans/#{ban}/edit"
= if @current_user.role == "admin" do
' •
- => link "Destroy", to: Routes.admin_user_ban_path(@conn, :delete, ban), data: [confirm: "Are you really, really sure?", method: "delete"]
+ => link "Destroy", to: ~p"/admin/user_bans/#{ban}", data: [confirm: "Are you really, really sure?", method: "delete"]
.block__header.block__header--light
= pagination
diff --git a/lib/philomena_web/templates/admin/user_ban/new.html.slime b/lib/philomena_web/templates/admin/user_ban/new.html.slime
index 468595cb..cdd82ff8 100644
--- a/lib/philomena_web/templates/admin/user_ban/new.html.slime
+++ b/lib/philomena_web/templates/admin/user_ban/new.html.slime
@@ -1,5 +1,5 @@
h1 New User Ban
-= render PhilomenaWeb.Admin.UserBanView, "_form.html", changeset: @changeset, action: Routes.admin_user_ban_path(@conn, :create), conn: @conn
+= render PhilomenaWeb.Admin.UserBanView, "_form.html", changeset: @changeset, action: ~p"/admin/user_bans", conn: @conn
br
-= link "Back", to: Routes.admin_user_ban_path(@conn, :index)
+= link "Back", to: ~p"/admin/user_bans"
diff --git a/lib/philomena_web/templates/advert/_box.html.slime b/lib/philomena_web/templates/advert/_box.html.slime
index 652401c9..0193d67c 100644
--- a/lib/philomena_web/templates/advert/_box.html.slime
+++ b/lib/philomena_web/templates/advert/_box.html.slime
@@ -4,7 +4,7 @@
=> link "Click here", to: "/pages/advertising"
' for information!
- a#imagespns__link href=Routes.advert_path(@conn, :show, @advert) rel="nofollow" title=@advert.title
+ a#imagespns__link href=~p"/adverts/#{@advert}" rel="nofollow" title=@advert.title
img src=advert_image_url(@advert) alt=@advert.title
p
diff --git a/lib/philomena_web/templates/api/rss/watched/index.html.eex b/lib/philomena_web/templates/api/rss/watched/index.html.eex
index de471d21..09451250 100644
--- a/lib/philomena_web/templates/api/rss/watched/index.html.eex
+++ b/lib/philomena_web/templates/api/rss/watched/index.html.eex
@@ -3,7 +3,7 @@
Derpibooru Watchlist
Your watched tags feed from Derpibooru
- <%= Routes.api_rss_watched_url(@conn, :index) %>
+ <%= url(~p"/api/v1/rss/watched") %>
<%= last_build_date() %>
<%= for image <- @images do %>
@@ -12,14 +12,14 @@
-
+ ">
]]>
<%= DateTime.to_iso8601(image.created_at) %>
- <%= Routes.image_url(@conn, :show, image) %>
- <%= Routes.image_url(@conn, :show, image) %>
+ <%= url(~p"/images/#{image}") %>
+ <%= url(~p"/images/#{image}") %>
<% end %>
diff --git a/lib/philomena_web/templates/avatar/edit.html.slime b/lib/philomena_web/templates/avatar/edit.html.slime
index 81bd63f5..3ee56baf 100644
--- a/lib/philomena_web/templates/avatar/edit.html.slime
+++ b/lib/philomena_web/templates/avatar/edit.html.slime
@@ -8,7 +8,7 @@
p Add a new avatar or remove your existing one here.
p Avatars must be less than 1000px tall and wide, and smaller than 300 kilobytes in size. PNG, JPEG, and GIF are acceptable.
- = form_for @changeset, Routes.avatar_path(@conn, :update), [method: "put", multipart: true], fn f ->
+ = form_for @changeset, ~p"/avatar", [method: "put", multipart: true], fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
@@ -37,10 +37,10 @@
=> submit "Update my avatar", class: "button"
br
- = button_to "Remove my avatar", Routes.avatar_path(@conn, :delete), method: "delete", class: "button", data: [confirm: "Are you really, really sure?"]
+ = button_to "Remove my avatar", ~p"/avatar", method: "delete", class: "button", data: [confirm: "Are you really, really sure?"]
br
= if blank?(@conn.params["profile"]) do
- = link "Back", to: Routes.registration_path(@conn, :edit)
+ = link "Back", to: ~p"/registrations/edit"
- else
- = link "Back", to: Routes.profile_path(@conn, :show, @current_user)
+ = link "Back", to: ~p"/profiles/#{@current_user}"
diff --git a/lib/philomena_web/templates/channel/_channel_box.html.slime b/lib/philomena_web/templates/channel/_channel_box.html.slime
index 8ca76dee..5182f56c 100644
--- a/lib/philomena_web/templates/channel/_channel_box.html.slime
+++ b/lib/philomena_web/templates/channel/_channel_box.html.slime
@@ -1,7 +1,7 @@
- link_class = "media-box__header media-box__header--channel media-box__header--link"
.media-box
- a.media-box__header.media-box__header--channel.media-box__header--link href=Routes.channel_path(@conn, :show, @channel) title=@channel.title
+ a.media-box__header.media-box__header--channel.media-box__header--link href=~p"/channels/#{@channel}" title=@channel.title
= @channel.title || @channel.short_name
.media-box__header.media-box__header--channel
@@ -17,22 +17,22 @@
| NSFW
.media-box__content.media-box__content--channel
- a href=Routes.channel_path(@conn, :show, @channel)
+ a href=~p"/channels/#{@channel}"
.image-constrained.media-box__content--channel
img src=channel_image(@channel) alt="#{@channel.title}"
= if @channel.associated_artist_tag do
- a href=Routes.tag_path(@conn, :show, @channel.associated_artist_tag) class=link_class
+ a href=~p"/tags/#{@channel.associated_artist_tag}" class=link_class
i.fa.fa-fw.fa-tags>
= @channel.associated_artist_tag.name
- else
.media-box__header.media-box__header--channel No artist tag
= if can?(@conn, :edit, @channel) do
- a href=Routes.channel_path(@conn, :edit, @channel) class=link_class
+ a href=~p"/channels/#{@channel}/edit" class=link_class
i.fas.fa-fw.fa-edit>
' Edit
- a href=Routes.channel_path(@conn, :delete, @channel) class=link_class data-method="delete" data-confirm="Are you really, really sure?"
+ a href=~p"/channels/#{@channel}" class=link_class data-method="delete" data-confirm="Are you really, really sure?"
i.fas.fa-fw.fa-trash>
' Delete
diff --git a/lib/philomena_web/templates/channel/edit.html.slime b/lib/philomena_web/templates/channel/edit.html.slime
index 47f0e53b..6eb25d31 100644
--- a/lib/philomena_web/templates/channel/edit.html.slime
+++ b/lib/philomena_web/templates/channel/edit.html.slime
@@ -1,3 +1,3 @@
h1 Editing Channel
-= render PhilomenaWeb.ChannelView, "_form.html", changeset: @changeset, action: Routes.channel_path(@conn, :update, @channel), conn: @conn
+= render PhilomenaWeb.ChannelView, "_form.html", changeset: @changeset, action: ~p"/channels/#{@channel}", conn: @conn
diff --git a/lib/philomena_web/templates/channel/index.html.slime b/lib/philomena_web/templates/channel/index.html.slime
index 7fd24c1c..50b0bbaa 100644
--- a/lib/philomena_web/templates/channel/index.html.slime
+++ b/lib/philomena_web/templates/channel/index.html.slime
@@ -1,9 +1,9 @@
h1 Livestreams
-- route = fn p -> Routes.channel_path(@conn, :index, p) end
+- route = fn p -> ~p"/channels?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @channels, route: route, conn: @conn, params: [cq: @conn.params["cq"]]
-= form_for :channels, Routes.channel_path(@conn, :index), [method: "get", class: "hform", enforce_utf8: false], fn f ->
+= form_for :channels, ~p"/channels", [method: "get", class: "hform", enforce_utf8: false], fn f ->
.field
= text_input f, :cq, name: :cq, value: @conn.params["cq"], class: "input hform__text", placeholder: "Search channels", autocapitalize: "none"
= submit "Search", class: "hform__button button"
@@ -13,11 +13,11 @@ h1 Livestreams
.page__pagination = pagination
= if @conn.cookies["chan_nsfw"] == "true" do
- a href=Routes.channel_nsfw_path(@conn, :delete) data-method="delete"
+ a href=~p"/channels/nsfw" data-method="delete"
i.fa.fa-eye-slash>
' Hide NSFW streams
- else
- a href=Routes.channel_nsfw_path(@conn, :create) data-method="create"
+ a href=~p"/channels/nsfw" data-method="create"
i.fa.fa-eye>
' Show NSFW streams
@@ -30,7 +30,7 @@ h1 Livestreams
br
= if can?(@conn, :create, Philomena.Channels.Channel) do
- = link "New Channel", to: Routes.channel_path(@conn, :new)
+ = link "New Channel", to: ~p"/channels/new"
h2 FAQ
p
diff --git a/lib/philomena_web/templates/channel/new.html.slime b/lib/philomena_web/templates/channel/new.html.slime
index 8a3551e9..a7361ef7 100644
--- a/lib/philomena_web/templates/channel/new.html.slime
+++ b/lib/philomena_web/templates/channel/new.html.slime
@@ -1,3 +1,3 @@
h1 Adding Channel
-= render PhilomenaWeb.ChannelView, "_form.html", changeset: @changeset, action: Routes.channel_path(@conn, :create), conn: @conn
+= render PhilomenaWeb.ChannelView, "_form.html", changeset: @changeset, action: ~p"/channels", conn: @conn
diff --git a/lib/philomena_web/templates/channel/subscription/_subscription.html.slime b/lib/philomena_web/templates/channel/subscription/_subscription.html.slime
index 362d9115..b0fdd6e3 100644
--- a/lib/philomena_web/templates/channel/subscription/_subscription.html.slime
+++ b/lib/philomena_web/templates/channel/subscription/_subscription.html.slime
@@ -1,8 +1,8 @@
elixir:
- watch_path = Routes.channel_subscription_path(@conn, :create, @channel)
+ watch_path = ~p"/channels/#{@channel}/subscription"
watch_class = if @watching, do: "hidden", else: ""
- unwatch_path = Routes.channel_subscription_path(@conn, :delete, @channel)
+ unwatch_path = ~p"/channels/#{@channel}/subscription"
unwatch_class = if @watching, do: "", else: "hidden"
= if @conn.assigns.current_user do
@@ -17,7 +17,7 @@ elixir:
span.hide-mobile
' Unsubscribe
- else
- a.media-box__header.media-box__header--channel.media-box__header--link href=Routes.session_path(@conn, :new)
+ a.media-box__header.media-box__header--channel.media-box__header--link href=~p"/sessions/new"
i.fa.fa-bell>
span.hide-mobile
' Subscribe
diff --git a/lib/philomena_web/templates/comment/_comment.html.slime b/lib/philomena_web/templates/comment/_comment.html.slime
index 508202ef..1ec574dd 100644
--- a/lib/philomena_web/templates/comment/_comment.html.slime
+++ b/lib/philomena_web/templates/comment/_comment.html.slime
@@ -9,7 +9,7 @@ article.block.communication id="comment_#{@comment.id}"
p
ul.horizontal-list
li
- = link(to: Routes.image_comment_approve_path(@conn, :create, @comment.image_id, @comment), data: [confirm: "Are you sure?"], method: "post", class: "button") do
+ = link(to: ~p"/images/#{@comment.image_id}/comments/#{@comment}/approve", data: [confirm: "Are you sure?"], method: "post", class: "button") do
i.fas.fa-check>
' Approve
li
@@ -17,7 +17,7 @@ article.block.communication id="comment_#{@comment.id}"
i.fa.fa-times>
' Reject
- = form_for :comment, Routes.image_comment_hide_path(@conn, :create, @comment.image_id, @comment), [class: "togglable-delete-form hidden flex", id: "inline-reject-form-comment-#{@comment.id}"], fn f ->
+ = form_for :comment, ~p"/images/#{@comment.image_id}/comments/#{@comment}/hide", [class: "togglable-delete-form hidden flex", id: "inline-reject-form-comment-#{@comment.id}"], fn f ->
= text_input f, :deletion_reason, class: "input input--wide", placeholder: "Deletion Reason", id: "inline-reject-reason-comment-#{@comment.id}", required: true
= submit "Delete", class: "button"
@@ -58,12 +58,12 @@ article.block.communication id="comment_#{@comment.id}"
.js-staff-action
= cond do
- @comment.hidden_from_users and not @comment.destroyed_content ->
- = link(to: Routes.image_comment_hide_path(@conn, :delete, @comment.image_id, @comment), data: [confirm: "Are you sure?"], method: "delete", class: "communication__interaction") do
+ = link(to: ~p"/images/#{@comment.image_id}/comments/#{@comment}/hide", data: [confirm: "Are you sure?"], method: "delete", class: "communication__interaction") do
i.fas.fa-check>
' Restore
= if can?(@conn, :delete, @comment) do
- = link(to: Routes.image_comment_delete_path(@conn, :create, @comment.image_id, @comment), data: [confirm: "Are you sure?"], method: "post", class: "communication__interaction") do
+ = link(to: ~p"/images/#{@comment.image_id}/comments/#{@comment}/delete", data: [confirm: "Are you sure?"], method: "post", class: "communication__interaction") do
i.fas.fa-times>
' Delete Contents
@@ -80,6 +80,6 @@ article.block.communication id="comment_#{@comment.id}"
.communication__info.js-staff-action
=<> link_to_fingerprint(@conn, @comment.fingerprint)
- = form_for :comment, Routes.image_comment_hide_path(@conn, :create, @comment.image_id, @comment), [class: "togglable-delete-form hidden flex", id: "inline-del-form-comment-#{@comment.id}"], fn f ->
+ = form_for :comment, ~p"/images/#{@comment.image_id}/comments/#{@comment}/hide", [class: "togglable-delete-form hidden flex", id: "inline-del-form-comment-#{@comment.id}"], fn f ->
= text_input f, :deletion_reason, class: "input input--wide", placeholder: "Deletion Reason", id: "inline-del-reason-comment-#{@comment.id}", required: true
= submit "Delete", class: "button"
diff --git a/lib/philomena_web/templates/comment/_comment_options.html.slime b/lib/philomena_web/templates/comment/_comment_options.html.slime
index 5f8c3674..36167c77 100644
--- a/lib/philomena_web/templates/comment/_comment_options.html.slime
+++ b/lib/philomena_web/templates/comment/_comment_options.html.slime
@@ -2,13 +2,13 @@ div
' Posted
=> pretty_time(@comment.created_at)
- a.communication__interaction href=Routes.image_comment_report_path(@conn, :new, @comment.image, @comment)
+ a.communication__interaction href=~p"/images/#{@comment.image}/comments/#{@comment}/reports/new"
i.fa.fa-flag>
' Report
= if not is_nil(@comment.edited_at) and can?(@conn, :show, @comment) do
br
- a href=Routes.image_comment_history_path(@conn, :index, @comment.image, @comment)
+ a href=~p"/images/#{@comment.image}/comments/#{@comment}/history"
' Edited
=> pretty_time(@comment.edited_at)
@@ -17,7 +17,7 @@ div
=> @comment.edit_reason
div
- - link_path = Routes.image_path(@conn, :show, @comment.image) <> "#comment_#{@comment.id}"
+ - link_path = ~p"/images/#{@comment.image}" <> "#comment_#{@comment.id}"
- safe_author = PhilomenaWeb.PostView.markdown_safe_author(@comment)
- quote_body = if @comment.hidden_from_users, do: "", else: @comment.body
@@ -36,6 +36,6 @@ div
= if can?(@conn, :edit, @comment) do
span.owner-options
strong
- a.communication__interaction href=Routes.image_comment_path(@conn, :edit, @comment.image, @comment)
+ a.communication__interaction href=~p"/images/#{@comment.image}/comments/#{@comment}/edit"
i.fas.fa-edit>
' Edit
diff --git a/lib/philomena_web/templates/comment/_comment_with_image.html.slime b/lib/philomena_web/templates/comment/_comment_with_image.html.slime
index 8faaca31..fce128bf 100644
--- a/lib/philomena_web/templates/comment/_comment_with_image.html.slime
+++ b/lib/philomena_web/templates/comment/_comment_with_image.html.slime
@@ -41,12 +41,12 @@ article.block.communication id="comment_#{@comment.id}"
.js-staff-action
= cond do
- @comment.hidden_from_users and not @comment.destroyed_content ->
- = link(to: Routes.image_comment_hide_path(@conn, :delete, @comment.image_id, @comment), data: [confirm: "Are you sure?"], method: "delete", class: "communication__interaction") do
+ = link(to: ~p"/images/#{@comment.image_id}/comments/#{@comment}/hide", data: [confirm: "Are you sure?"], method: "delete", class: "communication__interaction") do
i.fas.fa-check>
' Restore
= if can?(@conn, :delete, @comment) do
- = link(to: Routes.image_comment_delete_path(@conn, :create, @comment.image_id, @comment), data: [confirm: "Are you sure?"], method: "post", class: "communication__interaction") do
+ = link(to: ~p"/images/#{@comment.image_id}/comments/#{@comment}/delete", data: [confirm: "Are you sure?"], method: "post", class: "communication__interaction") do
i.fas.fa-times>
' Delete Contents
@@ -63,6 +63,6 @@ article.block.communication id="comment_#{@comment.id}"
.communication__info.js-staff-action
=<> link_to_fingerprint(@conn, @comment.fingerprint)
- = form_for :comment, Routes.image_comment_hide_path(@conn, :create, @comment.image_id, @comment), [class: "togglable-delete-form hidden flex", id: "inline-del-form-comment-#{@comment.id}"], fn f ->
+ = form_for :comment, ~p"/images/#{@comment.image_id}/comments/#{@comment}/hide", [class: "togglable-delete-form hidden flex", id: "inline-del-form-comment-#{@comment.id}"], fn f ->
= text_input f, :deletion_reason, class: "input input--wide", placeholder: "Deletion Reason", id: "inline-del-reason-comment-#{@comment.id}", required: true
= submit "Delete", class: "button"
diff --git a/lib/philomena_web/templates/comment/index.html.slime b/lib/philomena_web/templates/comment/index.html.slime
index d8bb174f..ae3e2eb0 100644
--- a/lib/philomena_web/templates/comment/index.html.slime
+++ b/lib/philomena_web/templates/comment/index.html.slime
@@ -1,6 +1,6 @@
h1 Comments
-= form_for :comments, Routes.comment_path(@conn, :index), [method: "get", class: "hform", enforce_utf8: false], fn f ->
+= form_for :comments, ~p"/comments", [method: "get", class: "hform", enforce_utf8: false], fn f ->
.field
= text_input f, :cq, name: :cq, value: @conn.params["cq"], class: "input hform__text", placeholder: "Search comments", autocapitalize: "none"
= submit "Search", class: "hform__button button"
@@ -14,7 +14,7 @@ h2 Search Results
= cond do
- Enum.any?(@comments) ->
- - route = fn p -> Routes.comment_path(@conn, :index, p) end
+ - route = fn p -> ~p"/comments?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @comments, route: route, params: [cq: @conn.params["cq"]], conn: @conn
= for {body, comment} <- @comments, comment.image.hidden_from_users == false do
@@ -68,35 +68,35 @@ table.table
td Literal
td Matches the author of this comment. Anonymous authors will never match this term.
td
- code = link "author:Joey", to: Routes.comment_path(@conn, :index, cq: "author:Joey")
+ code = link "author:Joey", to: ~p"/comments?#{[cq: "author:Joey"]}"
tr
td
code body
td Full Text
td Matches the body of this comment. This is the default field.
td
- code = link "body:test", to: Routes.comment_path(@conn, :index, cq: "body:test")
+ code = link "body:test", to: ~p"/comments?#{[cq: "body:test"]}"
tr
td
code created_at
td Date/Time Range
td Matches the creation time of this comment.
td
- code = link "created_at:2015", to: Routes.comment_path(@conn, :index, cq: "created_at:2015")
+ code = link "created_at:2015", to: ~p"/comments?#{[cq: "created_at:2015"]}"
tr
td
code id
td Numeric Range
td Matches the numeric surrogate key for this comment.
td
- code = link "id:1000000", to: Routes.comment_path(@conn, :index, cq: "id:1000000")
+ code = link "id:1000000", to: ~p"/comments?#{[cq: "id:1000000"]}"
tr
td
code image_id
td Literal
td Matches the numeric surrogate key for the image this comment belongs to.
td
- code = link "image_id:1000000", to: Routes.comment_path(@conn, :index, cq: "image_id:1000000")
+ code = link "image_id:1000000", to: ~p"/comments?#{[cq: "image_id:1000000"]}"
tr
td
code my
@@ -105,11 +105,11 @@ table.table
code> my:comments
' matches comments you have posted if you are signed in.
td
- code = link "my:comments", to: Routes.comment_path(@conn, :index, cq: "my:comments")
+ code = link "my:comments", to: ~p"/comments?#{[cq: "my:comments"]}"
tr
td
code user_id
td Literal
td Matches comments with the specified user_id. Anonymous users will never match this term.
td
- code = link "user_id:211190", to: Routes.comment_path(@conn, :index, cq: "user_id:211190")
+ code = link "user_id:211190", to: ~p"/comments?#{[cq: "user_id:211190"]}"
diff --git a/lib/philomena_web/templates/commission/_directory_results.html.slime b/lib/philomena_web/templates/commission/_directory_results.html.slime
index b61eed56..a5e7ed0d 100644
--- a/lib/philomena_web/templates/commission/_directory_results.html.slime
+++ b/lib/philomena_web/templates/commission/_directory_results.html.slime
@@ -1,5 +1,5 @@
elixir:
- route = fn p -> Routes.commission_path(@conn, :index, p) end
+ route = fn p -> ~p"/commissions?#{p}" end
pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @commissions, route: route, conn: @conn, params: [commission: @conn.params["commission"]]
.block
@@ -9,10 +9,10 @@ elixir:
.page__options
= cond do
- not is_nil(@conn.assigns.current_user) and not is_nil(@conn.assigns.current_user.commission) ->
- = link "View my listing", to: Routes.profile_commission_path(@conn, :show, @conn.assigns.current_user)
+ = link "View my listing", to: ~p"/profiles/#{@conn.assigns.current_user}/commission"
- not is_nil(@conn.assigns.current_user) ->
- = link "Create my listing", to: Routes.profile_commission_path(@conn, :new, @conn.assigns.current_user)
+ = link "Create my listing", to: ~p"/profiles/#{@conn.assigns.current_user}/commission/new"
- true ->
@@ -58,7 +58,7 @@ elixir:
p
strong
- = link "More information", to: Routes.profile_commission_path(@conn, :show, c.user)
+ = link "More information", to: ~p"/profiles/#{c.user}/commission"
- true ->
p We couldn't find any commission listings to display. Sorry!
diff --git a/lib/philomena_web/templates/commission/_directory_sidebar.html.slime b/lib/philomena_web/templates/commission/_directory_sidebar.html.slime
index fcfcfe29..6bf4c0a2 100644
--- a/lib/philomena_web/templates/commission/_directory_sidebar.html.slime
+++ b/lib/philomena_web/templates/commission/_directory_sidebar.html.slime
@@ -2,7 +2,7 @@
.block__header
span.block__header__title Search
.block__content
- = form_for @conn, Routes.commission_path(@conn, :index), [as: :commission, method: "get", class: "hform"], fn f ->
+ = form_for @conn, ~p"/commissions", [as: :commission, method: "get", class: "hform"], fn f ->
.field = label f, :categories, "Art Categories:"
= for {name, value} <- categories() do
diff --git a/lib/philomena_web/templates/confirmation/new.html.slime b/lib/philomena_web/templates/confirmation/new.html.slime
index 2f4a5177..7972f595 100644
--- a/lib/philomena_web/templates/confirmation/new.html.slime
+++ b/lib/philomena_web/templates/confirmation/new.html.slime
@@ -1,6 +1,6 @@
h1 Resend confirmation instructions
-= form_for :user, Routes.confirmation_path(@conn, :create), fn f ->
+= form_for :user, ~p"/confirmations", fn f ->
.field
= email_input f, :email, placeholder: "Email", class: "input", required: true
diff --git a/lib/philomena_web/templates/conversation/index.html.slime b/lib/philomena_web/templates/conversation/index.html.slime
index d8a5aed7..ea476547 100644
--- a/lib/philomena_web/templates/conversation/index.html.slime
+++ b/lib/philomena_web/templates/conversation/index.html.slime
@@ -1,5 +1,5 @@
elixir:
- route = fn p -> Routes.conversation_path(@conn, :index, p) end
+ route = fn p -> ~p"/conversations?#{p}" end
pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @conversations, route: route, conn: @conn
h1 My Conversations
@@ -8,7 +8,7 @@ h1 My Conversations
.page__pagination = pagination
.page__info
- a href=Routes.conversation_path(@conn, :new)
+ a href=~p"/conversations/new"
i.fa.fa-paper-plane>
' Create New Conversation
@@ -23,7 +23,7 @@ h1 My Conversations
= for {c, count} <- @conversations do
tr class=conversation_class(@conn.assigns.current_user, c)
td.table--communication-list__name
- => link c.title, to: Routes.conversation_path(@conn, :show, c)
+ => link c.title, to: ~p"/conversations/#{c}"
.small-text.hide-mobile
=> count
@@ -38,7 +38,7 @@ h1 My Conversations
td.table--communication-list__options
=> link "Last message", to: last_message_path(@conn, c, count)
' •
- => link "Hide", to: Routes.conversation_hide_path(@conn, :create, c), data: [method: "post"], data: [confirm: "Are you really, really sure?"]
+ => link "Hide", to: ~p"/conversations/#{c}/hide", data: [method: "post"], data: [confirm: "Are you really, really sure?"]
.block__header.block__header--light.page__header
.page__pagination = pagination
diff --git a/lib/philomena_web/templates/conversation/message/_form.html.slime b/lib/philomena_web/templates/conversation/message/_form.html.slime
index 7234a3e7..cbaec375 100644
--- a/lib/philomena_web/templates/conversation/message/_form.html.slime
+++ b/lib/philomena_web/templates/conversation/message/_form.html.slime
@@ -1,4 +1,4 @@
-= form_for @changeset, Routes.conversation_message_path(@conn, :create, @conversation), fn f ->
+= form_for @changeset, ~p"/conversations/#{@conversation}/messages", fn f ->
.block
.communication-edit__wrap
= render PhilomenaWeb.MarkdownView, "_input.html", conn: @conn, f: f, action_icon: "pencil-alt", action_text: "Reply"
diff --git a/lib/philomena_web/templates/conversation/new.html.slime b/lib/philomena_web/templates/conversation/new.html.slime
index a6800652..595daccc 100644
--- a/lib/philomena_web/templates/conversation/new.html.slime
+++ b/lib/philomena_web/templates/conversation/new.html.slime
@@ -1,7 +1,7 @@
h1 New Conversation
.block
.block__header
- => link "Conversations", to: Routes.conversation_path(@conn, :index)
+ => link "Conversations", to: ~p"/conversations"
' »
span.block__header__title New Conversation
@@ -20,7 +20,7 @@ h1 New Conversation
- _ ->
/ Nothing
-= form_for @changeset, Routes.conversation_path(@conn, :create), fn f ->
+= form_for @changeset, ~p"/conversations", fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
diff --git a/lib/philomena_web/templates/conversation/show.html.slime b/lib/philomena_web/templates/conversation/show.html.slime
index 9c69b9bc..5af5ead9 100644
--- a/lib/philomena_web/templates/conversation/show.html.slime
+++ b/lib/philomena_web/templates/conversation/show.html.slime
@@ -1,14 +1,14 @@
elixir:
- route = fn p -> Routes.conversation_path(@conn, :show, @conversation, p) end
+ route = fn p -> ~p"/conversations/#{@conversation}?#{p}" end
pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @messages, route: route, conn: @conn
other = other_party(@current_user, @conversation)
h1 = @conversation.title
.block
.block__header
- => link "Message Center", to: Routes.conversation_path(@conn, :index)
+ => link "Message Center", to: ~p"/conversations"
' »
- => link @conversation.title, to: Routes.conversation_path(@conn, :show, @conversation)
+ => link @conversation.title, to: ~p"/conversations/#{@conversation}"
' Conversation with
=> render PhilomenaWeb.UserAttributionView, "_user.html", object: %{user: other}, conn: @conn
.block__header--sub.block__header--light.page__header
@@ -18,11 +18,11 @@ h1 = @conversation.title
.page__pagination = pagination
.page__info
= if hidden_by?(@current_user, @conversation) do
- = link "Restore conversation", to: Routes.conversation_hide_path(@conn, :delete, @conversation), data: [method: "delete"]
+ = link "Restore conversation", to: ~p"/conversations/#{@conversation}/hide", data: [method: "delete"]
- else
- = link "Remove conversation", to: Routes.conversation_hide_path(@conn, :create, @conversation), data: [method: "post", confirm: "Are you really, really sure?"]
- = link "Report conversation", to: Routes.conversation_report_path(@conn, :new, @conversation)
- = link "Mark as unread", to: Routes.conversation_read_path(@conn, :delete, @conversation), data: [method: "delete"]
+ = link "Remove conversation", to: ~p"/conversations/#{@conversation}/hide", data: [method: "post", confirm: "Are you really, really sure?"]
+ = link "Report conversation", to: ~p"/conversations/#{@conversation}/reports/new"
+ = link "Mark as unread", to: ~p"/conversations/#{@conversation}/read", data: [method: "delete"]
= for {message, body} <- @messages do
= render PhilomenaWeb.MessageView, "_message.html", message: message, body: body, conn: @conn
@@ -59,5 +59,5 @@ h1 = @conversation.title
p You've managed to send over 1,000 messages in this conversation!
p We'd like to ask you to make a new conversation. Don't worry, this one won't go anywhere if you need to refer back to it.
p
- => link "Click here", to: Routes.conversation_path(@conn, :new, receipient: other.name)
+ => link "Click here", to: ~p"/conversations/new?#{[receipient: other.name]}"
' to make a new conversation with this user.
diff --git a/lib/philomena_web/templates/dnp_entry/edit.html.slime b/lib/philomena_web/templates/dnp_entry/edit.html.slime
index 2761b395..969f4ffd 100644
--- a/lib/philomena_web/templates/dnp_entry/edit.html.slime
+++ b/lib/philomena_web/templates/dnp_entry/edit.html.slime
@@ -1,2 +1,2 @@
h2 Edit DNP Request
-= render PhilomenaWeb.DnpEntryView, "_form.html", changeset: @changeset, action: Routes.dnp_entry_path(@conn, :update, @dnp_entry, tag_id: @dnp_entry.tag_id), conn: @conn, selectable_tags: @selectable_tags
+= render PhilomenaWeb.DnpEntryView, "_form.html", changeset: @changeset, action: ~p"/dnp/#{@dnp_entry}?#{[tag_id: @dnp_entry.tag_id]}", conn: @conn, selectable_tags: @selectable_tags
diff --git a/lib/philomena_web/templates/dnp_entry/index.html.slime b/lib/philomena_web/templates/dnp_entry/index.html.slime
index 01952ede..b4463eb5 100644
--- a/lib/philomena_web/templates/dnp_entry/index.html.slime
+++ b/lib/philomena_web/templates/dnp_entry/index.html.slime
@@ -16,13 +16,13 @@ br
.block__content
= cond do
- not is_nil(@current_user) and Enum.any?(@linked_tags) ->
- = link "Create an entry", to: Routes.dnp_entry_path(@conn, :new)
+ = link "Create an entry", to: ~p"/dnp/new"
br
- = link "My Listings", to: Routes.dnp_entry_path(@conn, :index, mine: "1")
+ = link "My Listings", to: ~p"/dnp?#{[mine: "1"]}"
- not is_nil(@current_user) ->
' You must have a verified artist link to create and manage DNP entries.
- = link "Request an artist link", to: Routes.profile_artist_link_path(@conn, :new, @current_user)
+ = link "Request an artist link", to: ~p"/profiles/#{@current_user}/artist_links/new"
| .
- true ->
@@ -31,7 +31,7 @@ br
h3 The List
.block
- - route = fn p -> Routes.dnp_entry_path(@conn, :index, p) end
+ - route = fn p -> ~p"/dnp?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @dnp_entries, route: route, conn: @conn
.block__header.page__header
@@ -69,7 +69,7 @@ h3 The List
= pretty_time(entry.created_at)
td
- = link "More Info", to: Routes.dnp_entry_path(@conn, :show, entry)
+ = link "More Info", to: ~p"/dnp/#{entry}"
.block__header.page__header
.page__pagination = pagination
diff --git a/lib/philomena_web/templates/dnp_entry/new.html.slime b/lib/philomena_web/templates/dnp_entry/new.html.slime
index 95c822d2..1bb616f8 100644
--- a/lib/philomena_web/templates/dnp_entry/new.html.slime
+++ b/lib/philomena_web/templates/dnp_entry/new.html.slime
@@ -1,2 +1,2 @@
h2 New DNP Request
-= render PhilomenaWeb.DnpEntryView, "_form.html", changeset: @changeset, action: Routes.dnp_entry_path(@conn, :create, tag_id: @conn.params["tag_id"]), conn: @conn, selectable_tags: @selectable_tags
+= render PhilomenaWeb.DnpEntryView, "_form.html", changeset: @changeset, action: ~p"/dnp?#{[tag_id: @conn.params["tag_id"]]}", conn: @conn, selectable_tags: @selectable_tags
diff --git a/lib/philomena_web/templates/dnp_entry/show.html.slime b/lib/philomena_web/templates/dnp_entry/show.html.slime
index a672573a..31b893ea 100644
--- a/lib/philomena_web/templates/dnp_entry/show.html.slime
+++ b/lib/philomena_web/templates/dnp_entry/show.html.slime
@@ -6,9 +6,9 @@ h2
.block__header
span.block__header__title DNP Information
= if can?(@conn, :edit, @dnp_entry) do
- = link "Edit listing", to: Routes.dnp_entry_path(@conn, :edit, @dnp_entry, tag_id: @dnp_entry.tag_id)
+ = link "Edit listing", to: ~p"/dnp/#{@dnp_entry}/edit?#{[tag_id: @dnp_entry.tag_id]}"
- = link "Back to DNP List", to: Routes.dnp_entry_path(@conn, :index)
+ = link "Back to DNP List", to: ~p"/dnp"
.block__content
table.table
@@ -53,26 +53,26 @@ h2
= if can?(@conn, :index, Philomena.DnpEntries.DnpEntry) do
= case @dnp_entry.aasm_state do
- s when s in ["requested", "claimed"] ->
- => link "Claim", to: Routes.admin_dnp_entry_transition_path(@conn, :create, @dnp_entry, state: "claimed"), data: [method: "post", confirm: "Are you really, really sure?"]
+ => link "Claim", to: ~p"/admin/dnp_entries/#{@dnp_entry}/transition?#{[state: "claimed"]}", data: [method: "post", confirm: "Are you really, really sure?"]
' •
- => link "Approve", to: Routes.admin_dnp_entry_transition_path(@conn, :create, @dnp_entry, state: "listed"), data: [method: "post", confirm: "Are you really, really sure?"]
+ => link "Approve", to: ~p"/admin/dnp_entries/#{@dnp_entry}/transition?#{[state: "listed"]}", data: [method: "post", confirm: "Are you really, really sure?"]
' •
- => link "Close", to: Routes.admin_dnp_entry_transition_path(@conn, :create, @dnp_entry, state: "closed"), data: [method: "post", confirm: "Are you really, really sure?"]
+ => link "Close", to: ~p"/admin/dnp_entries/#{@dnp_entry}/transition?#{[state: "closed"]}", data: [method: "post", confirm: "Are you really, really sure?"]
- "listed" ->
- => link "Rescind", to: Routes.admin_dnp_entry_transition_path(@conn, :create, @dnp_entry, state: "rescinded"), data: [method: "post", confirm: "Are you really, really sure?"]
+ => link "Rescind", to: ~p"/admin/dnp_entries/#{@dnp_entry}/transition?#{[state: "rescinded"]}", data: [method: "post", confirm: "Are you really, really sure?"]
' •
- = link "Close", to: Routes.admin_dnp_entry_transition_path(@conn, :create, @dnp_entry, state: "closed"), data: [method: "post", confirm: "Are you really, really sure?"]
+ = link "Close", to: ~p"/admin/dnp_entries/#{@dnp_entry}/transition?#{[state: "closed"]}", data: [method: "post", confirm: "Are you really, really sure?"]
- s when s in ["rescinded", "acknowledged"] ->
- => link "Claim", to: Routes.admin_dnp_entry_transition_path(@conn, :create, @dnp_entry, state: "acknowledged"), data: [method: "post", confirm: "Are you really, really sure?"]
+ => link "Claim", to: ~p"/admin/dnp_entries/#{@dnp_entry}/transition?#{[state: "acknowledged"]}", data: [method: "post", confirm: "Are you really, really sure?"]
' •
- = link "Close", to: Routes.admin_dnp_entry_transition_path(@conn, :create, @dnp_entry, state: "closed"), data: [method: "post", confirm: "Are you really, really sure?"]
+ = link "Close", to: ~p"/admin/dnp_entries/#{@dnp_entry}/transition?#{[state: "closed"]}", data: [method: "post", confirm: "Are you really, really sure?"]
- _state ->
- => link "Claim", to: Routes.admin_dnp_entry_transition_path(@conn, :create, @dnp_entry, state: "claimed"), data: [method: "post", confirm: "Are you really, really sure?"]
+ => link "Claim", to: ~p"/admin/dnp_entries/#{@dnp_entry}/transition?#{[state: "claimed"]}", data: [method: "post", confirm: "Are you really, really sure?"]
= if assigns[:mod_notes] do
h4 Mod Notes
= render PhilomenaWeb.Admin.ModNoteView, "_table.html", mod_notes: @mod_notes, conn: @conn
- = link "Add New Note", to: Routes.admin_mod_note_path(@conn, :new, notable_id: @dnp_entry.id, notable_type: "DnpEntry")
+ = link "Add New Note", to: ~p"/admin/mod_notes/new?#{[notable_id: @dnp_entry.id, notable_type: "DnpEntry"]}"
diff --git a/lib/philomena_web/templates/duplicate_report/_form.html.slime b/lib/philomena_web/templates/duplicate_report/_form.html.slime
index 128de57b..19d1ec64 100644
--- a/lib/philomena_web/templates/duplicate_report/_form.html.slime
+++ b/lib/philomena_web/templates/duplicate_report/_form.html.slime
@@ -1,4 +1,4 @@
-= form_for @changeset, Routes.duplicate_report_path(@conn, :create), fn f ->
+= form_for @changeset, ~p"/duplicate_reports", fn f ->
= hidden_input f, :image_id, value: @image.id
.field
' Delete this image and redirect to
diff --git a/lib/philomena_web/templates/duplicate_report/_image_cell.html.slime b/lib/philomena_web/templates/duplicate_report/_image_cell.html.slime
index 1e262a35..9e52462c 100644
--- a/lib/philomena_web/templates/duplicate_report/_image_cell.html.slime
+++ b/lib/philomena_web/templates/duplicate_report/_image_cell.html.slime
@@ -18,12 +18,12 @@
= if can?(@conn, :edit, @report) and mergeable?(@report) do
= if @source do
- a href=Routes.duplicate_report_accept_reverse_path(@conn, :create, @report) data-method="post"
+ a href=~p"/duplicate_reports/#{@report}/accept_reverse" data-method="post"
button.button
' Keep Source
i.fa.fa-arrow-left
- else
- a href=Routes.duplicate_report_accept_path(@conn, :create, @report) data-method="post"
+ a href=~p"/duplicate_reports/#{@report}/accept" data-method="post"
button.button
i.fa.fa-arrow-right>
| Keep Target
diff --git a/lib/philomena_web/templates/duplicate_report/_list.html.slime b/lib/philomena_web/templates/duplicate_report/_list.html.slime
index 87de9fc0..bb18bb50 100644
--- a/lib/philomena_web/templates/duplicate_report/_list.html.slime
+++ b/lib/philomena_web/templates/duplicate_report/_list.html.slime
@@ -15,7 +15,7 @@
tr
= if same_aspect_ratio?(report) do
td.success
- a href=Routes.duplicate_report_path(@conn, :show, report)
+ a href=~p"/duplicate_reports/#{report}"
' Visual diff
| (Same aspect ratio)
@@ -139,13 +139,13 @@
= if can?(@conn, :edit, report) do
div
= if report.state == "open" do
- a href=(Routes.duplicate_report_claim_path(@conn, :create, report) <> "#report_options_#{report.id}") data-method="post"
+ a href=(~p"/duplicate_reports/#{report}/claim" <> "#report_options_#{report.id}") data-method="post"
button.button.button--separate-right
i.fa.fa-clipboard>
' Claim
= if report.state != "rejected" do
- a href=Routes.duplicate_report_reject_path(@conn, :create, report) data-method="post"
+ a href=~p"/duplicate_reports/#{report}/reject" data-method="post"
button.button
i.fa.fa-times>
' Reject
@@ -157,6 +157,6 @@
= if report.user do
' by
- =< link report.user.name, to: Routes.profile_path(@conn, :show, report.user)
+ =< link report.user.name, to: ~p"/profiles/#{report.user}"
= escape_nl2br(report.reason)
diff --git a/lib/philomena_web/templates/duplicate_report/index.html.slime b/lib/philomena_web/templates/duplicate_report/index.html.slime
index b29595f7..ef46cf6a 100644
--- a/lib/philomena_web/templates/duplicate_report/index.html.slime
+++ b/lib/philomena_web/templates/duplicate_report/index.html.slime
@@ -1,6 +1,6 @@
h1 Duplicate Reports
-- route = fn p -> Routes.duplicate_report_path(@conn, :index, p) end
+- route = fn p -> ~p"/duplicate_reports?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @duplicate_reports, route: route, conn: @conn, params: [states: @conn.params["states"] || ["open", "claimed"]]
.block
@@ -8,14 +8,14 @@ h1 Duplicate Reports
.page__pagination = pagination
.page__info
span.block__header__title Display only:
- => link "Open (All)", to: Routes.duplicate_report_path(@conn, :index, states: ~W(open claimed))
- => link "Open (Unclaimed)", to: Routes.duplicate_report_path(@conn, :index, states: ~W(open))
- => link "Open (Claimed)", to: Routes.duplicate_report_path(@conn, :index, states: ~W(claimed))
- => link "Open + Rejected", to: Routes.duplicate_report_path(@conn, :index, states: ~W(open rejected))
- => link "Rejected", to: Routes.duplicate_report_path(@conn, :index, states: ~W(rejected))
- => link "Rejected + Accepted", to: Routes.duplicate_report_path(@conn, :index, states: ~W(rejected accepted))
- => link "Accepted", to: Routes.duplicate_report_path(@conn, :index, states: ~W(accepted))
- = link "All", to: Routes.duplicate_report_path(@conn, :index, states: ~W(open rejected accepted claimed))
+ => link "Open (All)", to: ~p"/duplicate_reports?#{[states: ~W(open claimed)]}"
+ => link "Open (Unclaimed)", to: ~p"/duplicate_reports?#{[states: ~W(open)]}"
+ => link "Open (Claimed)", to: ~p"/duplicate_reports?#{[states: ~W(claimed)]}"
+ => link "Open + Rejected", to: ~p"/duplicate_reports?#{[states: ~W(open rejected)]}"
+ => link "Rejected", to: ~p"/duplicate_reports?#{[states: ~W(rejected)]}"
+ => link "Rejected + Accepted", to: ~p"/duplicate_reports?#{[states: ~W(rejected accepted)]}"
+ => link "Accepted", to: ~p"/duplicate_reports?#{[states: ~W(accepted)]}"
+ = link "All", to: ~p"/duplicate_reports?#{[states: ~W(open rejected accepted claimed)]}"
= render PhilomenaWeb.DuplicateReportView, "_list.html", duplicate_reports: @duplicate_reports, conn: @conn
diff --git a/lib/philomena_web/templates/filter/_filter.html.slime b/lib/philomena_web/templates/filter/_filter.html.slime
index 859608f7..ab4e9260 100644
--- a/lib/philomena_web/templates/filter/_filter.html.slime
+++ b/lib/philomena_web/templates/filter/_filter.html.slime
@@ -20,20 +20,20 @@
= length(@filter.hidden_tag_ids)
li
- = link "View this filter", to: Routes.filter_path(@conn, :show, @filter), class: "button"
+ = link "View this filter", to: ~p"/filters/#{@filter}", class: "button"
li
- = link "Copy and Customize", to: Routes.filter_path(@conn, :new, based_on: @filter), class: "button"
+ = link "Copy and Customize", to: ~p"/filters/new?#{[based_on: @filter]}", class: "button"
= if can?(@conn, :edit, @filter) do
li
- = link "Edit this filter", to: Routes.filter_path(@conn, :edit, @filter), class: "button"
+ = link "Edit this filter", to: ~p"/filters/#{@filter}/edit", class: "button"
= if @filter.id == @conn.assigns.current_filter.id do
li
strong Your current filter
- else
li
- = button_to "Use this filter", Routes.filter_current_path(@conn, :update, id: @filter), method: "put", class: "button"
+ = button_to "Use this filter", ~p"/filters/current?#{[id: @filter]}", method: "put", class: "button"
p
em
= @filter.description
diff --git a/lib/philomena_web/templates/filter/edit.html.slime b/lib/philomena_web/templates/filter/edit.html.slime
index 4ec94253..db0bf5d6 100644
--- a/lib/philomena_web/templates/filter/edit.html.slime
+++ b/lib/philomena_web/templates/filter/edit.html.slime
@@ -1,5 +1,5 @@
h2 Editing Filter
-= render PhilomenaWeb.FilterView, "_form.html", filter: @changeset, route: Routes.filter_path(@conn, :update, @filter)
+= render PhilomenaWeb.FilterView, "_form.html", filter: @changeset, route: ~p"/filters/#{@filter}"
= if not @filter.public and not @filter.system do
br
@@ -19,4 +19,4 @@ h2 Editing Filter
strong irreversible
' . Once you make a filter public, you cannot make it private again.
- = button_to "Convert to Public Filter", Routes.filter_public_path(@conn, :create, @filter), class: "button", method: "create", data: [confirm: "Are you really, really sure?"]
+ = button_to "Convert to Public Filter", ~p"/filters/#{@filter}/public", class: "button", method: "create", data: [confirm: "Are you really, really sure?"]
diff --git a/lib/philomena_web/templates/filter/index.html.slime b/lib/philomena_web/templates/filter/index.html.slime
index 1598658f..3474b6fb 100644
--- a/lib/philomena_web/templates/filter/index.html.slime
+++ b/lib/philomena_web/templates/filter/index.html.slime
@@ -28,7 +28,7 @@
h2 My Filters
= if @current_user do
p
- = link("Click here to make a new filter from scratch", to: Routes.filter_path(@conn, :new))
+ = link("Click here to make a new filter from scratch", to: ~p"/filters/new")
= for filter <- @my_filters do
= render PhilomenaWeb.FilterView, "_filter.html", conn: @conn, filter: filter
- else
@@ -43,12 +43,12 @@
h2 Recent Filters
p
' Clicking this button will clear the recent filters list in the header dropdown.
- = button_to "Clear recent filter list", Routes.filter_clear_recent_path(@conn, :delete), method: "delete", class: "button"
+ = button_to "Clear recent filter list", ~p"/filters/clear_recent", method: "delete", class: "button"
h2 Search Filters
p
' Some users maintain custom filters which are publicly shared; you can search these filters with the box below.
- = form_for :filters, Routes.filter_path(@conn, :index), [method: "get", class: "hform", enforce_utf8: false], fn f ->
+ = form_for :filters, ~p"/filters", [method: "get", class: "hform", enforce_utf8: false], fn f ->
.field
= text_input f, :fq, name: :fq, value: @conn.params["fq"], class: "input hform__text", placeholder: "Search filters", autocapitalize: "none"
= submit "Search", class: "hform__button button"
@@ -62,7 +62,7 @@
h2 Search Results
= cond do
- Enum.any?(@filters) ->
- - route = fn p -> Routes.filter_path(@conn, :index, p) end
+ - route = fn p -> ~p"/filters?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @filters, route: route, params: [fq: @conn.params["fq"]], conn: @conn
= for filter <- @filters do
@@ -99,49 +99,49 @@ table.table
td Literal
td Matches the creator of this filter.
td
- code = link "creator:AppleDash", to: Routes.filter_path(@conn, :index, fq: "creator:AppleDash")
+ code = link "creator:AppleDash", to: ~p"/filters?#{[fq: "creator:AppleDash"]}"
tr
td
code name
td Literal
td Matches the name of this filter. This is the default field.
td
- code = link "name:default", to: Routes.filter_path(@conn, :index, fq: "name:default")
+ code = link "name:default", to: ~p"/filters?#{[fq: "name:default"]}"
tr
td
code description
td Full Text
td Matches the description of this filter.
td
- code = link "description:the show's rating", to: Routes.filter_path(@conn, :index, fq: "description:the show's rating")
+ code = link "description:the show's rating", to: ~p"/filters?#{[fq: "description:the show's rating"]}"
tr
td
code created_at
td Date/Time Range
td Matches the creation time of this filter.
td
- code = link "created_at:2015", to: Routes.filter_path(@conn, :index, fq: "created_at:2015")
+ code = link "created_at:2015", to: ~p"/filters?#{[fq: "created_at:2015"]}"
tr
td
code id
td Numeric Range
td Matches the numeric surrogate key for this filter.
td
- code = link "id:1", to: Routes.filter_path(@conn, :index, fq: "id:1")
+ code = link "id:1", to: ~p"/filters?#{[fq: "id:1"]}"
tr
td
code spoilered_count
td Numeric Range
td Matches the number of spoilered tags in this filter.
td
- code = link "spoilered_count:1", to: Routes.filter_path(@conn, :index, fq: "spoilered_count:1")
+ code = link "spoilered_count:1", to: ~p"/filters?#{[fq: "spoilered_count:1"]}"
tr
td
code hidden_count
td Numeric Range
td Matches the number of hidden tags in this filter.
td
- code = link "hidden_count:1", to: Routes.filter_path(@conn, :index, fq: "hidden_count:1")
+ code = link "hidden_count:1", to: ~p"/filters?#{[fq: "hidden_count:1"]}"
tr
td
code my
@@ -150,14 +150,14 @@ table.table
code> my:filters
' matches filters you have published if you are signed in.
td
- code = link "my:filters", to: Routes.filter_path(@conn, :index, fq: "my:filters")
+ code = link "my:filters", to: ~p"/filters?#{[fq: "my:filters"]}"
tr
td
code system
td Boolean
td Matches system filters
td
- code = link "system:true", to: Routes.filter_path(@conn, :index, fq: "system:true")
+ code = link "system:true", to: ~p"/filters?#{[fq: "system:true"]}"
tr
td
code public
@@ -167,14 +167,14 @@ table.table
code> public:false
' matches only your own private filters.
td
- code = link "public:false", to: Routes.filter_path(@conn, :index, fq: "public:false")
+ code = link "public:false", to: ~p"/filters?#{[fq: "public:false"]}"
tr
td
code user_id
td Literal
td Matches filters with the specified user_id.
td
- code = link "user_id:307505", to: Routes.filter_path(@conn, :index, fq: "user_id:307505")
+ code = link "user_id:307505", to: ~p"/filters?#{[fq: "user_id:307505"]}"
= if @conn.params["fq"] do
- p = link("Back to filters", to: Routes.filter_path(@conn, :index))
+ p = link("Back to filters", to: ~p"/filters")
diff --git a/lib/philomena_web/templates/filter/new.html.slime b/lib/philomena_web/templates/filter/new.html.slime
index de881073..26dc5513 100644
--- a/lib/philomena_web/templates/filter/new.html.slime
+++ b/lib/philomena_web/templates/filter/new.html.slime
@@ -1,2 +1,2 @@
h2 Creating New Filter
-= render PhilomenaWeb.FilterView, "_form.html", filter: @changeset, route: Routes.filter_path(@conn, :create)
\ No newline at end of file
+= render PhilomenaWeb.FilterView, "_form.html", filter: @changeset, route: ~p"/filters"
\ No newline at end of file
diff --git a/lib/philomena_web/templates/filter/show.html.slime b/lib/philomena_web/templates/filter/show.html.slime
index 15608482..6e1221f3 100644
--- a/lib/philomena_web/templates/filter/show.html.slime
+++ b/lib/philomena_web/templates/filter/show.html.slime
@@ -18,14 +18,14 @@ h1
strong Your current filter
- else
li
- = button_to "Use this filter", Routes.filter_current_path(@conn, :update, id: @filter), method: "put", class: "button"
+ = button_to "Use this filter", ~p"/filters/current?#{[id: @filter]}", method: "put", class: "button"
= if can?(@conn, :edit, @filter) do
li
- = link "Edit this filter", to: Routes.filter_path(@conn, :edit, @filter), class: "button"
+ = link "Edit this filter", to: ~p"/filters/#{@filter}/edit", class: "button"
= if can?(@conn, :delete, @filter) do
- = button_to "Destroy this filter", Routes.filter_path(@conn, :delete, @filter), method: "delete", class: "button", data: [confirm: "Are you really, really sure?"]
+ = button_to "Destroy this filter", ~p"/filters/#{@filter}", method: "delete", class: "button", data: [confirm: "Are you really, really sure?"]
= if @filter.user do
p.filter-maintainer
@@ -61,4 +61,4 @@ h1
/p = link("Report filter to moderators", new_report_path(reportable_class: 'filter', reportable_id: @filter.id)
-p = link("Back to filters", to: Routes.filter_path(@conn, :index))
+p = link("Back to filters", to: ~p"/filters")
diff --git a/lib/philomena_web/templates/fingerprint_profile/show.html.slime b/lib/philomena_web/templates/fingerprint_profile/show.html.slime
index dae6b6a2..cfb36e1e 100644
--- a/lib/philomena_web/templates/fingerprint_profile/show.html.slime
+++ b/lib/philomena_web/templates/fingerprint_profile/show.html.slime
@@ -3,24 +3,24 @@ h1
' 's fingerprint profile
ul
- li = link "View images this fingerprint has uploaded", to: Routes.search_path(@conn, :index, q: "fingerprint:#{@fingerprint}")
- li = link "View comments this fingerprint has posted", to: Routes.comment_path(@conn, :index, cq: "fingerprint:#{@fingerprint}")
- li = link "View posts this fingerprint has made", to: Routes.post_path(@conn, :index, pq: "fingerprint:#{@fingerprint}")
+ li = link "View images this fingerprint has uploaded", to: ~p"/search?#{[q: "fingerprint:#{@fingerprint}"]}"
+ li = link "View comments this fingerprint has posted", to: ~p"/comments?#{[cq: "fingerprint:#{@fingerprint}"]}"
+ li = link "View posts this fingerprint has made", to: ~p"/posts?#{[pq: "fingerprint:#{@fingerprint}"]}"
= render PhilomenaWeb.BanView, "_bans.html", bans: @fingerprint_bans, conn: @conn
h2 Administration Options
ul
- li = link "View tag changes", to: Routes.fingerprint_profile_tag_change_path(@conn, :index, @fingerprint)
- li = link "View source URL history", to: Routes.fingerprint_profile_source_change_path(@conn, :index, @fingerprint)
- li = link "View reports this fingerprint has made", to: Routes.admin_report_path(@conn, :index, rq: "fingerprint:#{@fingerprint}")
- li = link "View fingerprint ban history", to: Routes.admin_fingerprint_ban_path(@conn, :index, fingerprint: @fingerprint)
- li = link "Ban this sucker", to: Routes.admin_fingerprint_ban_path(@conn, :new, fingerprint: @fingerprint)
+ li = link "View tag changes", to: ~p"/fingerprint_profiles/#{@fingerprint}/tag_changes"
+ li = link "View source URL history", to: ~p"/fingerprint_profiles/#{@fingerprint}/source_changes"
+ li = link "View reports this fingerprint has made", to: ~p"/admin/reports?#{[rq: "fingerprint:#{@fingerprint}"]}"
+ li = link "View fingerprint ban history", to: ~p"/admin/fingerprint_bans?#{[fingerprint: @fingerprint]}"
+ li = link "Ban this sucker", to: ~p"/admin/fingerprint_bans/new?#{[fingerprint: @fingerprint]}"
h2 Actions
ul
- li = link "Revert all tag changes", to: Routes.tag_change_full_revert_path(@conn, :create, [fingerprint: @fingerprint]), data: [confirm: "Are you really, really sure?", method: "create"]
- li = link "...the button above didn't work (use carefully, this is resource-intensive)", to: Routes.tag_change_full_revert_path(@conn, :create, [fingerprint: @fingerprint, batch_size: 1]), data: [confirm: "Please confirm that you're aware that this may crash the site and are ready to take on the full wrath of the admins if it does so after you press this button.", method: "create"]
+ li = link "Revert all tag changes", to: ~p"/tag_changes/full_revert?#{[fingerprint: @fingerprint]}", data: [confirm: "Are you really, really sure?", method: "create"]
+ li = link "...the button above didn't work (use carefully, this is resource-intensive)", to: ~p"/tag_changes/full_revert?#{[fingerprint: @fingerprint, batch_size: 1]}", data: [confirm: "Please confirm that you're aware that this may crash the site and are ready to take on the full wrath of the admins if it does so after you press this button.", method: "create"]
h4 Observed users
table.table
@@ -34,7 +34,7 @@ table.table
= for ufp <- @user_fps do
tr
td
- = link ufp.user.name, to: Routes.profile_path(@conn, :show, ufp.user)
+ = link ufp.user.name, to: ~p"/profiles/#{ufp.user}"
td
=> ufp.uses
' times
diff --git a/lib/philomena_web/templates/fingerprint_profile/source_change/index.html.slime b/lib/philomena_web/templates/fingerprint_profile/source_change/index.html.slime
index d1dd1440..0c92e88d 100644
--- a/lib/philomena_web/templates/fingerprint_profile/source_change/index.html.slime
+++ b/lib/philomena_web/templates/fingerprint_profile/source_change/index.html.slime
@@ -2,7 +2,7 @@ h1
' Source changes by
= @fingerprint
-- route = fn p -> Routes.fingerprint_profile_source_change_path(@conn, :index, @fingerprint, p) end
+- route = fn p -> ~p"/fingerprint_profiles/#{@fingerprint}/source_changes?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @source_changes, route: route, conn: @conn
= render PhilomenaWeb.SourceChangeView, "index.html", conn: @conn, source_changes: @source_changes, pagination: pagination
diff --git a/lib/philomena_web/templates/fingerprint_profile/tag_change/index.html.slime b/lib/philomena_web/templates/fingerprint_profile/tag_change/index.html.slime
index dd2b50ac..9a486e91 100644
--- a/lib/philomena_web/templates/fingerprint_profile/tag_change/index.html.slime
+++ b/lib/philomena_web/templates/fingerprint_profile/tag_change/index.html.slime
@@ -2,7 +2,7 @@ h1
' Tag changes by
= @fingerprint
-- route = fn p -> Routes.fingerprint_profile_tag_change_path(@conn, :index, @fingerprint, p) end
+- route = fn p -> ~p"/fingerprint_profiles/#{@fingerprint}/tag_changes?#{p}" end
- params = if @conn.params["added"], do: [added: @conn.params["added"]]
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @tag_changes, route: route, conn: @conn, params: params
@@ -11,8 +11,8 @@ h1
span.block__header__title
| Display only:
- = link "Removed", to: Routes.fingerprint_profile_tag_change_path(@conn, :index, @fingerprint, added: 0)
- = link "Added", to: Routes.fingerprint_profile_tag_change_path(@conn, :index, @fingerprint, added: 1)
- = link "All", to: Routes.fingerprint_profile_tag_change_path(@conn, :index, @fingerprint)
+ = link "Removed", to: ~p"/fingerprint_profiles/#{@fingerprint}/tag_changes?#{[added: 0]}"
+ = link "Added", to: ~p"/fingerprint_profiles/#{@fingerprint}/tag_changes?#{[added: 1]}"
+ = link "All", to: ~p"/fingerprint_profiles/#{@fingerprint}/tag_changes"
= render PhilomenaWeb.TagChangeView, "index.html", conn: @conn, tag_changes: @tag_changes, pagination: pagination
diff --git a/lib/philomena_web/templates/forum/index.html.slime b/lib/philomena_web/templates/forum/index.html.slime
index 3eaa978d..616376fc 100644
--- a/lib/philomena_web/templates/forum/index.html.slime
+++ b/lib/philomena_web/templates/forum/index.html.slime
@@ -1,7 +1,7 @@
h1 Discussion Forums
.block
.block__header
- a href=Routes.post_path(@conn, :index)
+ a href=~p"/posts"
i.fa.fa-fw.fa-search>
' Search Posts
span.block__header__item
@@ -19,16 +19,16 @@ h1 Discussion Forums
= for forum <- @forums do
tr
td.table--communication-list__name
- => link(forum.name, to: Routes.forum_path(@conn, :show, forum))
+ => link(forum.name, to: ~p"/forums/#{forum}")
.small-text = forum.description
td.table--communication-list__stats.hide-mobile = forum.topic_count
td.table--communication-list__stats.hide-mobile = forum.post_count
td.table--communication-list__last-post
= if forum.last_post do
strong
- => link(forum.last_post.topic.title, to: Routes.forum_topic_path(@conn, :show, forum.last_post.topic.forum, forum.last_post.topic))
+ => link(forum.last_post.topic.title, to: ~p"/forums/#{forum.last_post.topic.forum}/topics/#{forum.last_post.topic}")
br
- => link("Go to post", to: Routes.forum_topic_path(@conn, :show, forum.last_post.topic.forum, forum.last_post.topic, post_id: forum.last_post.id) <> "#post_#{forum.last_post.id}")
+ => link("Go to post", to: ~p"/forums/#{forum.last_post.topic.forum}/topics/#{forum.last_post.topic}?#{[post_id: forum.last_post.id]}" <> "#post_#{forum.last_post.id}")
' by
=> render PhilomenaWeb.UserAttributionView, "_anon_user.html", object: forum.last_post, conn: @conn
br
diff --git a/lib/philomena_web/templates/forum/show.html.slime b/lib/philomena_web/templates/forum/show.html.slime
index 23a6c676..870427ff 100644
--- a/lib/philomena_web/templates/forum/show.html.slime
+++ b/lib/philomena_web/templates/forum/show.html.slime
@@ -1,16 +1,16 @@
-- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @topics, route: fn p -> Routes.forum_path(@conn, :show, @forum, p) end
+- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @topics, route: fn p -> ~p"/forums/#{@forum}?#{p}" end
h1 = @forum.name
.block
.block__header
- => link("Forums", to: Routes.forum_path(@conn, :index))
+ => link("Forums", to: ~p"/forums")
' »
- => link(@forum.name, to: Routes.forum_path(@conn, :show, @forum))
- a href=Routes.forum_topic_path(@conn, :new, @forum)
+ => link(@forum.name, to: ~p"/forums/#{@forum}")
+ a href=~p"/forums/#{@forum}/topics/new"
i.fa.fa-fw.fa-edit>
' New Topic
- a href=Routes.post_path(@conn, :index, pq: "forum:#{@forum.short_name}")
+ a href=~p"/posts?#{[pq: "forum:#{@forum.short_name}"]}"
i.fa.fa-fw.fa-search>
' Search Posts
span.spacing-left
@@ -38,7 +38,7 @@ h1 = @forum.name
i.fa.fa-lock
= if topic.poll do
i.fas.fa-poll-h
- =< link(topic.title, to: Routes.forum_topic_path(@conn, :show, @forum, topic))
+ =< link(topic.title, to: ~p"/forums/#{@forum}/topics/#{topic}")
.small-text
' Posted
=> pretty_time(topic.created_at)
@@ -47,7 +47,7 @@ h1 = @forum.name
td.table--communication-list__stats.hide-mobile = topic.post_count
td.table--communication-list__last-post
= if topic.last_post do
- => link("Go to post", to: Routes.forum_topic_path(@conn, :show, topic.forum, topic, post_id: topic.last_post) <> "#post_#{topic.last_post.id}")
+ => link("Go to post", to: ~p"/forums/#{topic.forum}/topics/#{topic}?#{[post_id: topic.last_post]}" <> "#post_#{topic.last_post.id}")
' by
= render PhilomenaWeb.UserAttributionView, "_anon_user.html", object: topic.last_post, conn: @conn
br
diff --git a/lib/philomena_web/templates/forum/subscription/_subscription.html.slime b/lib/philomena_web/templates/forum/subscription/_subscription.html.slime
index f71096cd..42172150 100644
--- a/lib/philomena_web/templates/forum/subscription/_subscription.html.slime
+++ b/lib/philomena_web/templates/forum/subscription/_subscription.html.slime
@@ -1,8 +1,8 @@
elixir:
- watch_path = Routes.forum_subscription_path(@conn, :create, @forum)
+ watch_path = ~p"/forums/#{@forum}/subscription"
watch_class = if @watching, do: "hidden", else: ""
- unwatch_path = Routes.forum_subscription_path(@conn, :delete, @forum)
+ unwatch_path = ~p"/forums/#{@forum}/subscription"
unwatch_class = if @watching, do: "", else: "hidden"
= if @conn.assigns.current_user do
@@ -17,7 +17,7 @@ elixir:
span.hide-mobile
' Unsubscribe
- else
- a href=Routes.session_path(@conn, :new)
+ a href=~p"/sessions/new"
i.fa.fa-bell>
span.hide-mobile
' Subscribe
diff --git a/lib/philomena_web/templates/gallery/_gallery.html.slime b/lib/philomena_web/templates/gallery/_gallery.html.slime
index d7c18a80..60ae2d56 100644
--- a/lib/philomena_web/templates/gallery/_gallery.html.slime
+++ b/lib/philomena_web/templates/gallery/_gallery.html.slime
@@ -1,4 +1,4 @@
-- link = Routes.gallery_path(@conn, :show, @gallery)
+- link = ~p"/galleries/#{@gallery}"
.media-box
a.media-box__header.media-box__header--link href=link title=@gallery.title
diff --git a/lib/philomena_web/templates/gallery/edit.html.slime b/lib/philomena_web/templates/gallery/edit.html.slime
index fe0fc4af..80687435 100644
--- a/lib/philomena_web/templates/gallery/edit.html.slime
+++ b/lib/philomena_web/templates/gallery/edit.html.slime
@@ -1,3 +1,3 @@
h1 Editing Gallery
-= render PhilomenaWeb.GalleryView, "_form.html", conn: @conn, changeset: @changeset, action: Routes.gallery_path(@conn, :update, @gallery)
\ No newline at end of file
+= render PhilomenaWeb.GalleryView, "_form.html", conn: @conn, changeset: @changeset, action: ~p"/galleries/#{@gallery}"
\ No newline at end of file
diff --git a/lib/philomena_web/templates/gallery/index.html.slime b/lib/philomena_web/templates/gallery/index.html.slime
index 15b5312d..9750364c 100644
--- a/lib/philomena_web/templates/gallery/index.html.slime
+++ b/lib/philomena_web/templates/gallery/index.html.slime
@@ -1,5 +1,5 @@
elixir:
- route = fn p -> Routes.gallery_path(@conn, :index, p) end
+ route = fn p -> ~p"/galleries?#{p}" end
pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @galleries, route: route, params: [gallery: @conn.params["gallery"]]
.column-layout
@@ -8,7 +8,7 @@ elixir:
.block__content
h3 Search Galleries
- = form_for @conn, Routes.gallery_path(@conn, :index), [as: :gallery, method: "get", class: "hform"], fn f ->
+ = form_for @conn, ~p"/galleries", [as: :gallery, method: "get", class: "hform"], fn f ->
.field = label f, :title, "Title"
.field = text_input f, :title, class: "input hform__text", placeholder: "Gallery title (* as wildcard)"
diff --git a/lib/philomena_web/templates/gallery/new.html.slime b/lib/philomena_web/templates/gallery/new.html.slime
index 7a555f67..3aa4a7f3 100644
--- a/lib/philomena_web/templates/gallery/new.html.slime
+++ b/lib/philomena_web/templates/gallery/new.html.slime
@@ -1,3 +1,3 @@
h1 Create a Gallery
-= render PhilomenaWeb.GalleryView, "_form.html", conn: @conn, changeset: @changeset, action: Routes.gallery_path(@conn, :create)
\ No newline at end of file
+= render PhilomenaWeb.GalleryView, "_form.html", conn: @conn, changeset: @changeset, action: ~p"/galleries"
\ No newline at end of file
diff --git a/lib/philomena_web/templates/gallery/show.html.slime b/lib/philomena_web/templates/gallery/show.html.slime
index 63ad508b..3c61643a 100644
--- a/lib/philomena_web/templates/gallery/show.html.slime
+++ b/lib/philomena_web/templates/gallery/show.html.slime
@@ -1,7 +1,7 @@
elixir:
scope = scope(@conn)
- image_url = fn image, hit -> Routes.image_path(@conn, :show, image, Keyword.put(scope, :sort, hit["sort"])) end
- route = fn p -> Routes.gallery_path(@conn, :show, @gallery, p) end
+ image_url = fn image, hit -> ~p"/images/#{image}?#{Keyword.put(scope, :sort, hit["sort"])}" end
+ route = fn p -> ~p"/galleries/#{@gallery}?#{p}" end
pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @images, route: route, params: scope
info = render PhilomenaWeb.PaginationView, "_pagination_info.html", page: @images
@@ -19,12 +19,12 @@ elixir:
.flex__right.page__options
= render PhilomenaWeb.ImageView, "_random_button.html", conn: @conn, params: scope
- a href=Routes.gallery_report_path(@conn, :new, @gallery)
+ a href=~p"/galleries/#{@gallery}/reports/new"
i.fa.fa-exclamation-triangle>
span.hide-mobile Report
= if can?(@conn, :edit, @gallery) do
- a href=Routes.gallery_path(@conn, :edit, @gallery)
+ a href=~p"/galleries/#{@gallery}/edit"
i.fas.fa-edit>
span.hide-mobile Edit
@@ -33,11 +33,11 @@ elixir:
i.fa.fa-sort>
' Rearrange
- a.rearrange-button.js-save.hidden href="#" data-click-hide=".js-save,#gallery-rearrange-info" data-click-show=".js-rearrange" data-reorder-path=Routes.gallery_order_path(@conn, :update, @gallery)
+ a.rearrange-button.js-save.hidden href="#" data-click-hide=".js-save,#gallery-rearrange-info" data-click-show=".js-rearrange" data-reorder-path=~p"/galleries/#{@gallery}/order"
i.fa.fa-check>
' Save
- a href=Routes.gallery_path(@conn, :delete, @gallery) data-method="delete" data-confirm="Are you really, really sure?"
+ a href=~p"/galleries/#{@gallery}" data-method="delete" data-confirm="Are you really, really sure?"
i.fa.fa-trash>
span.hide-mobile Delete
@@ -47,7 +47,7 @@ elixir:
.block__header.block__header--light.block__header--sub
span.block__header__title A gallery by
- => link @gallery.creator.name, to: Routes.profile_path(@conn, :show, @gallery.creator)
+ => link @gallery.creator.name, to: ~p"/profiles/#{@gallery.creator}"
' with
=> @gallery.image_count
= pluralize("image", "images", @gallery.image_count)
diff --git a/lib/philomena_web/templates/gallery/subscription/_subscription.html.slime b/lib/philomena_web/templates/gallery/subscription/_subscription.html.slime
index b6c5d895..cf40adf9 100644
--- a/lib/philomena_web/templates/gallery/subscription/_subscription.html.slime
+++ b/lib/philomena_web/templates/gallery/subscription/_subscription.html.slime
@@ -1,8 +1,8 @@
elixir:
- watch_path = Routes.gallery_subscription_path(@conn, :create, @gallery)
+ watch_path = ~p"/galleries/#{@gallery}/subscription"
watch_class = if @watching, do: "hidden", else: ""
- unwatch_path = Routes.gallery_subscription_path(@conn, :delete, @gallery)
+ unwatch_path = ~p"/galleries/#{@gallery}/subscription"
unwatch_class = if @watching, do: "", else: "hidden"
= if @conn.assigns.current_user do
@@ -17,7 +17,7 @@ elixir:
span.hide-mobile
' Unsubscribe
- else
- a href=Routes.session_path(@conn, :new)
+ a href=~p"/sessions/new"
i.fa.fa-bell>
span.hide-mobile
' Subscribe
diff --git a/lib/philomena_web/templates/image/_add_to_gallery_dropdown.html.slime b/lib/philomena_web/templates/image/_add_to_gallery_dropdown.html.slime
index 3c7b7659..9c5174bb 100644
--- a/lib/philomena_web/templates/image/_add_to_gallery_dropdown.html.slime
+++ b/lib/philomena_web/templates/image/_add_to_gallery_dropdown.html.slime
@@ -8,7 +8,7 @@
.block
.block__content.add-to-gallery-list
.block__list
- a.block__list__link.primary href=Routes.gallery_path(@conn, :index, gallery: [include_image: @image.id])
+ a.block__list__link.primary href=~p"/galleries?#{[gallery: [include_image: @image.id]]}"
i.fa.fa-table>
span.hide-mobile Featured in
@@ -18,24 +18,24 @@
= if present do
/ Options to remove
li id="gallery_#{gallery.id}"
- a.block__list__link.js-gallery-add.hidden data-fetchcomplete-hide="#gallery_#{gallery.id} .js-gallery-add" data-fetchcomplete-show="#gallery_#{gallery.id} .js-gallery-remove" data-method="post" data-remote="true" href=Routes.gallery_image_path(@conn, :create, gallery, image_id: @image.id)
+ a.block__list__link.js-gallery-add.hidden data-fetchcomplete-hide="#gallery_#{gallery.id} .js-gallery-add" data-fetchcomplete-show="#gallery_#{gallery.id} .js-gallery-remove" data-method="post" data-remote="true" href=~p"/galleries/#{gallery}/images?#{[image_id: @image.id]}"
= gallery.title
- a.block__list__link.active.js-gallery-remove data-fetchcomplete-hide="#gallery_#{gallery.id} .js-gallery-remove" data-fetchcomplete-show="#gallery_#{gallery.id} .js-gallery-add" data-method="delete" data-remote="true" href=Routes.gallery_image_path(@conn, :delete, gallery, image_id: @image.id)
+ a.block__list__link.active.js-gallery-remove data-fetchcomplete-hide="#gallery_#{gallery.id} .js-gallery-remove" data-fetchcomplete-show="#gallery_#{gallery.id} .js-gallery-add" data-method="delete" data-remote="true" href=~p"/galleries/#{gallery}/images?#{[image_id: @image.id]}"
= gallery.title
- else
/ Options to add
li id="gallery_#{gallery.id}"
- a.block__list__link.js-gallery-add data-fetchcomplete-hide="#gallery_#{gallery.id} .js-gallery-add" data-fetchcomplete-show="#gallery_#{gallery.id} .js-gallery-remove" data-method="post" data-remote="true" href=Routes.gallery_image_path(@conn, :create, gallery, image_id: @image.id)
+ a.block__list__link.js-gallery-add data-fetchcomplete-hide="#gallery_#{gallery.id} .js-gallery-add" data-fetchcomplete-show="#gallery_#{gallery.id} .js-gallery-remove" data-method="post" data-remote="true" href=~p"/galleries/#{gallery}/images?#{[image_id: @image.id]}"
= gallery.title
- a.block__list__link.active.js-gallery-remove.hidden data-fetchcomplete-hide="#gallery_#{gallery.id} .js-gallery-remove" data-fetchcomplete-show="#gallery_#{gallery.id} .js-gallery-add" data-method="delete" data-remote="true" href=Routes.gallery_image_path(@conn, :delete, gallery, image_id: @image.id)
+ a.block__list__link.active.js-gallery-remove.hidden data-fetchcomplete-hide="#gallery_#{gallery.id} .js-gallery-remove" data-fetchcomplete-show="#gallery_#{gallery.id} .js-gallery-add" data-method="delete" data-remote="true" href=~p"/galleries/#{gallery}/images?#{[image_id: @image.id]}"
= gallery.title
.block__list
= if @conn.assigns.current_user do
- a.block__list__link.primary href=Routes.gallery_path(@conn, :new, with_image: @image.id)
+ a.block__list__link.primary href=~p"/galleries/new?#{[with_image: @image.id]}"
i.fa.fa-plus>
span.hide-limited-desktop.hide-mobile Create a gallery
- else
- a.block__list__link.primary href=Routes.session_path(@conn, :new)
+ a.block__list__link.primary href=~p"/sessions/new"
i.fa.fa-user-plus>
span.hide-limited-desktop.hide-mobile Sign in to create a gallery
diff --git a/lib/philomena_web/templates/image/_image_box.html.slime b/lib/philomena_web/templates/image/_image_box.html.slime
index e6210860..d8b16dca 100644
--- a/lib/philomena_web/templates/image/_image_box.html.slime
+++ b/lib/philomena_web/templates/image/_image_box.html.slime
@@ -1,5 +1,5 @@
elixir:
- link = assigns[:link] || Routes.image_path(@conn, :show, @image)
+ link = assigns[:link] || ~p"/images/#{@image}"
size_class =
case @size do
:thumb ->
diff --git a/lib/philomena_web/templates/image/_image_container.html.slime b/lib/philomena_web/templates/image/_image_container.html.slime
index 1a89d613..a7ecf49d 100644
--- a/lib/philomena_web/templates/image/_image_container.html.slime
+++ b/lib/philomena_web/templates/image/_image_container.html.slime
@@ -1,4 +1,4 @@
-- link = assigns[:link] || Routes.image_path(@conn, :show, @image)
+- link = assigns[:link] || ~p"/images/#{@image}"
= image_container @conn, @image, @size, fn ->
= cond do
diff --git a/lib/philomena_web/templates/image/_image_meta.html.slime b/lib/philomena_web/templates/image/_image_meta.html.slime
index 9688ee8c..23c88c19 100644
--- a/lib/philomena_web/templates/image/_image_meta.html.slime
+++ b/lib/philomena_web/templates/image/_image_meta.html.slime
@@ -1,13 +1,13 @@
.block.block__header
.flex.flex--wrap.image-metabar.center--layout id="image_meta_#{@image.id}"
.stretched-mobile-links
- a.js-prev href=Routes.image_navigate_path(@conn, :index, @image, [rel: "prev"] ++ scope(@conn)) title="Previous Image (j)"
+ a.js-prev href=~p"/images/#{@image}/navigate?#{[rel: "prev"] ++ scope(@conn)}" title="Previous Image (j)"
i.fa.fa-chevron-left
- a.js-up href=Routes.image_navigate_path(@conn, :index, @image, [rel: "find"] ++ scope(@conn)) title="Find this image in the global image list (i)"
+ a.js-up href=~p"/images/#{@image}/navigate?#{[rel: "find"] ++ scope(@conn)}" title="Find this image in the global image list (i)"
i.fa.fa-chevron-up
- a.js-next href=Routes.image_navigate_path(@conn, :index, @image, [rel: "next"] ++ scope(@conn)) title="Next Image (k)"
+ a.js-next href=~p"/images/#{@image}/navigate?#{[rel: "next"] ++ scope(@conn)}" title="Next Image (k)"
i.fa.fa-chevron-right
- a.js-rand href=Routes.image_random_path(@conn, :index, scope(@conn)) title="Random (r)"
+ a.js-rand href=~p"/images/random?#{scope(@conn)}" title="Random (r)"
i.fa.fa-random
.stretched-mobile-links
a.interaction--fave href="#" rel="nofollow" data-image-id=@image.id
@@ -34,7 +34,7 @@
.stretched-mobile-links
= render PhilomenaWeb.Image.SubscriptionView, "_subscription.html", watching: @watching, image: @image, conn: @conn
= render PhilomenaWeb.ImageView, "_add_to_gallery_dropdown.html", image: @image, user_galleries: @user_galleries, conn: @conn
- a href=Routes.image_related_path(@conn, :index, @image) title="Related Images"
+ a href=~p"/images/#{@image}/related" title="Related Images"
i.fa.fa-sitemap>
span.hide-limited-desktop.hide-mobile Related
.stretched-mobile-links
diff --git a/lib/philomena_web/templates/image/_image_target.html.slime b/lib/philomena_web/templates/image/_image_target.html.slime
index 3443c74a..fba84b3a 100644
--- a/lib/philomena_web/templates/image/_image_target.html.slime
+++ b/lib/philomena_web/templates/image/_image_target.html.slime
@@ -8,7 +8,7 @@
p
= img_tag(static_path(@conn, "/images/tagblocked.svg"), width: 250, height: 250, data: [click_unfilter: @image.id])
span.filter-explanation
- =< link("your current filter", to: Routes.filter_path(@conn, :show, @conn.assigns.current_filter), class: "filter-link")
+ =< link("your current filter", to: ~p"/filters/#{@conn.assigns.current_filter}", class: "filter-link")
' .
= if size == :full and not embed_display do
@@ -19,7 +19,7 @@
picture
- else
.image-show.hidden
- a href=Routes.image_path(@conn, :show, @image) title=title_text(@image)
+ a href=~p"/images/#{@image}" title=title_text(@image)
span.imgspoiler
- thumb_url = thumb_url(@image, can?(@conn, :show, @image), size)
diff --git a/lib/philomena_web/templates/image/_options.html.slime b/lib/philomena_web/templates/image/_options.html.slime
index f1514292..a955e063 100644
--- a/lib/philomena_web/templates/image/_options.html.slime
+++ b/lib/philomena_web/templates/image/_options.html.slime
@@ -2,13 +2,13 @@
#image_options_area
.block__header.block__header--js-tabbed
- a href="#" data-click-tab="reporting" data-load-tab=Routes.image_reporting_path(@conn, :show, @image)
+ a href="#" data-click-tab="reporting" data-load-tab=~p"/images/#{@image}/reporting"
i.fa.fa-exclamation-triangle>
| Report
a href="#" data-click-tab="sharing"
i.fa.fa-share>
| Share
- a href="#" data-click-tab="favoriters" data-load-tab=Routes.image_favorite_path(@conn, :index, @image)
+ a href="#" data-click-tab="favoriters" data-load-tab=~p"/images/#{@image}/favorites"
i.fa.fa-star>
| List favoriters
= if display_mod_tools? and not hide_staff_tools?(@conn) do
@@ -56,7 +56,7 @@
| Copy
br
textarea.input.input--wide.input--separate-top#bbcode_embed_full_tag rows="2" cols="100" readonly="readonly"
- = "[img]#{thumb_url(@image, false, :full)}[/img]\n[url=#{Routes.image_url(@conn, :show, @image)}]View on Derpibooru[/url]#{source_link}"
+ = "[img]#{thumb_url(@image, false, :full)}[/img]\n[url=#{url(~p"/images/#{@image}")}]View on Derpibooru[/url]#{source_link}"
p
strong> Thumbnailed BBcode
a href="#" data-click-copy="#bbcode_embed_thumbnail_tag"
@@ -64,11 +64,11 @@
| Copy
br
textarea.input.input--wide.input--separate-top#bbcode_embed_thumbnail_tag rows="2" cols="100" readonly="readonly"
- = "[img]#{thumb_url(@image, false, :medium)}[/img]\n[url=#{Routes.image_url(@conn, :show, @image)}]View on Derpibooru[/url]#{source_link}"
+ = "[img]#{thumb_url(@image, false, :medium)}[/img]\n[url=#{url(~p"/images/#{@image}")}]View on Derpibooru[/url]#{source_link}"
= if display_mod_tools? do
.block__tab.hidden data-tab="replace"
- = form_for @changeset, Routes.image_file_path(@conn, :update, @image), [method: "put", multipart: true], fn f ->
+ = form_for @changeset, ~p"/images/#{@image}/file", [method: "put", multipart: true], fn f ->
#js-image-upload-previews
p Upload a file from your computer
.field
@@ -85,7 +85,7 @@
.block__tab.hidden data-tab="administration"
.block.block--danger
- a.button.button--link> href=Routes.image_scratchpad_path(@conn, :edit, @image)
+ a.button.button--link> href=~p"/images/#{@image}/scratchpad/edit"
i.far.fa-edit
= if present?(@image.scratchpad) do
strong> Mod notes:
@@ -94,13 +94,13 @@
em No mod notes present
= if not @image.hidden_from_users do
- = form_for @changeset, Routes.image_delete_path(@conn, :create, @image), [method: "post"], fn f ->
+ = form_for @changeset, ~p"/images/#{@image}/delete", [method: "post"], fn f ->
= label f, :deletion_reason, "Deletion reason (cannot be empty)"
.field.field--inline
= text_input f, :deletion_reason, class: "input input--wide", placeholder: "Rule violation", required: true
= submit "Delete", class: "button button--state-danger button--separate-left"
- else
- = form_for @changeset, Routes.image_delete_path(@conn, :update, @image), [method: "put"], fn f ->
+ = form_for @changeset, ~p"/images/#{@image}/delete", [method: "put"], fn f ->
= label f, :deletion_reason, "Deletion reason (cannot be empty)"
.field.field--inline
= text_input f, :deletion_reason, class: "input input--wide", placeholder: "Rule violation", required: true
@@ -108,18 +108,18 @@
.flex.flex--spaced-out.flex--wrap
= if not @image.hidden_from_users do
- = form_for @changeset, Routes.image_feature_path(@conn, :create, @image), [method: "post"], fn _f ->
+ = form_for @changeset, ~p"/images/#{@image}/feature", [method: "post"], fn _f ->
.field
p Marks the image as featured
= submit "Feature", data: [confirm: "Are you really, really sure?"], class: "button button--state-success"
- else
- = button_to "Restore", Routes.image_delete_path(@conn, :delete, @image), method: "delete", class: "button button--state-success"
+ = button_to "Restore", ~p"/images/#{@image}/delete", method: "delete", class: "button button--state-success"
- = form_for @changeset, Routes.image_repair_path(@conn, :create, @image), [method: "post"], fn _f ->
+ = form_for @changeset, ~p"/images/#{@image}/repair", [method: "post"], fn _f ->
.field
= submit "Repair", class: "button button--state-success"
- = form_for @changeset, Routes.image_hash_path(@conn, :delete, @image), [method: "delete"], fn _f ->
+ = form_for @changeset, ~p"/images/#{@image}/hash", [method: "delete"], fn _f ->
.field
p Allows reuploading the image
.flex.flex--end-bunched
@@ -128,24 +128,24 @@
br
.flex.flex--spaced-out
= if @image.commenting_allowed do
- = button_to "Lock commenting", Routes.image_comment_lock_path(@conn, :create, @image), method: "post", class: "button"
+ = button_to "Lock commenting", ~p"/images/#{@image}/comment_lock", method: "post", class: "button"
- else
- = button_to "Unlock commenting", Routes.image_comment_lock_path(@conn, :delete, @image), method: "delete", class: "button"
+ = button_to "Unlock commenting", ~p"/images/#{@image}/comment_lock", method: "delete", class: "button"
= if @image.description_editing_allowed do
- = button_to "Lock description editing", Routes.image_description_lock_path(@conn, :create, @image), method: "post", class: "button"
+ = button_to "Lock description editing", ~p"/images/#{@image}/description_lock", method: "post", class: "button"
- else
- = button_to "Unlock description editing", Routes.image_description_lock_path(@conn, :delete, @image), method: "delete", class: "button"
+ = button_to "Unlock description editing", ~p"/images/#{@image}/description_lock", method: "delete", class: "button"
= if @image.tag_editing_allowed do
- = button_to "Lock tag editing", Routes.image_tag_lock_path(@conn, :create, @image), method: "post", class: "button"
+ = button_to "Lock tag editing", ~p"/images/#{@image}/tag_lock", method: "post", class: "button"
- else
- = button_to "Unlock tag editing", Routes.image_tag_lock_path(@conn, :delete, @image), method: "delete", class: "button"
+ = button_to "Unlock tag editing", ~p"/images/#{@image}/tag_lock", method: "delete", class: "button"
br
.flex.flex--spaced-out
- = link "Lock specific tags", to: Routes.image_tag_lock_path(@conn, :show, @image), class: "button"
+ = link "Lock specific tags", to: ~p"/images/#{@image}/tag_lock", class: "button"
= if not @image.approved and can?(@conn, :approve, @image) do
- = button_to "Approve image", Routes.image_approve_path(@conn, :create, @image), method: "post", class: "button button--state-success", data: [confirm: "Are you sure?"]
+ = button_to "Approve image", ~p"/images/#{@image}/approve", method: "post", class: "button button--state-success", data: [confirm: "Are you sure?"]
= if @image.hidden_from_users and can?(@conn, :destroy, @image) do
- = button_to "Destroy image", Routes.image_destroy_path(@conn, :create, @image), method: "post", class: "button button--state-danger", data: [confirm: "This action is IRREVERSIBLE. Are you sure?"]
+ = button_to "Destroy image", ~p"/images/#{@image}/destroy", method: "post", class: "button button--state-danger", data: [confirm: "This action is IRREVERSIBLE. Are you sure?"]
diff --git a/lib/philomena_web/templates/image/_random_button.html.slime b/lib/philomena_web/templates/image/_random_button.html.slime
index d383a3e3..c613c85c 100644
--- a/lib/philomena_web/templates/image/_random_button.html.slime
+++ b/lib/philomena_web/templates/image/_random_button.html.slime
@@ -1,3 +1,3 @@
-a href=Routes.image_random_path(@conn, :index, @params) title="Random Image"
+a href=~p"/images/random?#{@params}" title="Random Image"
i.fa.fa-random>
span.hide-mobile.hide-limited-desktop Random Image
diff --git a/lib/philomena_web/templates/image/_source.html.slime b/lib/philomena_web/templates/image/_source.html.slime
index 2d39b306..8fa32872 100644
--- a/lib/philomena_web/templates/image/_source.html.slime
+++ b/lib/philomena_web/templates/image/_source.html.slime
@@ -1,6 +1,6 @@
.js-sourcesauce
- has_sources = Enum.any?(@image.sources)
- = form_for @changeset, Routes.image_source_path(@conn, :update, @image), [method: "put", class: "hidden", id: "source-form", data: [remote: "true"]], fn f ->
+ = form_for @changeset, ~p"/images/#{@image}/sources", [method: "put", class: "hidden", id: "source-form", data: [remote: "true"]], fn f ->
= if can?(@conn, :edit_metadata, @image) and !@conn.assigns.current_ban do
= if @changeset.action do
.alert.alert-danger
@@ -54,14 +54,14 @@
- else
' Add
= if @source_change_count > 0 do
- a.button.button--link.button--inline href=Routes.image_source_change_path(@conn, :index, @image) title="Source history"
+ a.button.button--link.button--inline href=~p"/images/#{@image}/source_changes" title="Source history"
i.fa.fa-history>
spanspan.hide-mobile> History
| (
= @source_change_count
| )
= if can?(@conn, :hide, @image) and not hide_staff_tools?(@conn) do
- = form_for @changeset, Routes.image_source_history_path(@conn, :delete, @image), [method: "delete"], fn _f ->
+ = form_for @changeset, ~p"/images/#{@image}/source_history", [method: "delete"], fn _f ->
a.button.button--state-danger.button--inline type="submit" data-confirm="Are you really, really sure?" title="Wipe sources"
i.fas.fa-eraser>
' Wipe
diff --git a/lib/philomena_web/templates/image/_tags.html.slime b/lib/philomena_web/templates/image/_tags.html.slime
index 3c11c0c4..c4efb08a 100644
--- a/lib/philomena_web/templates/image/_tags.html.slime
+++ b/lib/philomena_web/templates/image/_tags.html.slime
@@ -12,7 +12,7 @@
' The following tags have been restricted on this image:
code= Enum.map_join(@image.locked_tags, ", ", & &1.name)
- = form_for @changeset, Routes.image_tag_path(@conn, :update, @image), [id: "tags-form", method: "put", data: [remote: "true"]], fn f ->
+ = form_for @changeset, ~p"/images/#{@image}/tags", [id: "tags-form", method: "put", data: [remote: "true"]], fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
@@ -66,7 +66,7 @@
i.fas.fa-edit>
' Edit
= if @tag_change_count > 0 do
- a.button.button--link.button--inline href=Routes.image_tag_change_path(@conn, :index, @image) title="Tag history"
+ a.button.button--link.button--inline href=~p"/images/#{@image}/tag_changes" title="Tag history"
i.fa.fa-history>
| History (
= @tag_change_count
diff --git a/lib/philomena_web/templates/image/_uploader.html.slime b/lib/philomena_web/templates/image/_uploader.html.slime
index 81d69284..504ab437 100644
--- a/lib/philomena_web/templates/image/_uploader.html.slime
+++ b/lib/philomena_web/templates/image/_uploader.html.slime
@@ -11,7 +11,7 @@ span.image_uploader
i.fas.fa-eye
= if can?(@conn, :show, :ip_address) do
- = form_for @changeset, Routes.image_uploader_path(@conn, :update, @image), [class: "block__content hidden", id: "uploader-form", data: [remote: "true", method: "put"]], fn f ->
+ = form_for @changeset, ~p"/images/#{@image}/uploader", [class: "block__content hidden", id: "uploader-form", data: [remote: "true", method: "put"]], fn f ->
=> label f, :username, "Uploader"
=> text_input f, :username, value: username(@image.user), class: "input input--short input--small"
@@ -21,6 +21,6 @@ span.image_uploader
.image-anonymous.hidden
= if @image.anonymous do
- = button_to "Reveal author", Routes.image_anonymous_path(@conn, :delete, @image), class: "button button--small", method: "delete", data: [confirm: "Are you really, really sure?"]
+ = button_to "Reveal author", ~p"/images/#{@image}/anonymous", class: "button button--small", method: "delete", data: [confirm: "Are you really, really sure?"]
- else
- = button_to "Hide author", Routes.image_anonymous_path(@conn, :create, @image), class: "button button--small", method: "create", data: [confirm: "Are you really, really sure?"]
+ = button_to "Hide author", ~p"/images/#{@image}/anonymous", class: "button button--small", method: "create", data: [confirm: "Are you really, really sure?"]
diff --git a/lib/philomena_web/templates/image/comment/_form.html.slime b/lib/philomena_web/templates/image/comment/_form.html.slime
index 39b8a519..731ba817 100644
--- a/lib/philomena_web/templates/image/comment/_form.html.slime
+++ b/lib/philomena_web/templates/image/comment/_form.html.slime
@@ -1,6 +1,6 @@
- options = if(assigns[:remote], do: [data: [remote: "true"], id: "js-comment-form"], else: [])
-= form_for @changeset, Routes.image_comment_path(@conn, :create, @image), options, fn f ->
+= form_for @changeset, ~p"/images/#{@image}/comments", options, fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
diff --git a/lib/philomena_web/templates/image/comment/edit.html.slime b/lib/philomena_web/templates/image/comment/edit.html.slime
index d7183a60..1b17c96a 100644
--- a/lib/philomena_web/templates/image/comment/edit.html.slime
+++ b/lib/philomena_web/templates/image/comment/edit.html.slime
@@ -1,4 +1,4 @@
-= form_for @changeset, Routes.image_comment_path(@conn, :update, @comment.image, @comment), fn f ->
+= form_for @changeset, ~p"/images/#{@comment.image}/comments/#{@comment}", fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
diff --git a/lib/philomena_web/templates/image/comment/history/index.html.slime b/lib/philomena_web/templates/image/comment/history/index.html.slime
index 3dd6e642..bb27e827 100644
--- a/lib/philomena_web/templates/image/comment/history/index.html.slime
+++ b/lib/philomena_web/templates/image/comment/history/index.html.slime
@@ -2,7 +2,7 @@ h1
' Viewing last 25 versions of comment by
= render PhilomenaWeb.UserAttributionView, "_anon_user.html", object: @comment, conn: @conn
' on image
- a href=Routes.image_path(@conn, :show, @comment.image)
+ a href=~p"/images/#{@comment.image}"
| #
= @comment.image_id
diff --git a/lib/philomena_web/templates/image/comment/index.html.slime b/lib/philomena_web/templates/image/comment/index.html.slime
index e0c3eee6..5e87cfe3 100644
--- a/lib/philomena_web/templates/image/comment/index.html.slime
+++ b/lib/philomena_web/templates/image/comment/index.html.slime
@@ -1,5 +1,5 @@
elixir:
- route = fn p -> Routes.image_comment_path(@conn, :index, @image, p) end
+ route = fn p -> ~p"/images/#{@image}/comments?#{p}" end
pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @comments, route: route
.block
diff --git a/lib/philomena_web/templates/image/deleted.html.slime b/lib/philomena_web/templates/image/deleted.html.slime
index 4177b0a3..fc425b36 100644
--- a/lib/philomena_web/templates/image/deleted.html.slime
+++ b/lib/philomena_web/templates/image/deleted.html.slime
@@ -4,7 +4,7 @@
h1 This image has been merged into another image
p
' This image was merged into image
- => link "##{@image.duplicate_id}", to: Routes.image_path(@conn, :show, @image.duplicate_id)
+ => link "##{@image.duplicate_id}", to: ~p"/images/#{@image.duplicate_id}"
' because it was determined to be a duplicate of that image.
- else
diff --git a/lib/philomena_web/templates/image/description/_form.html.slime b/lib/philomena_web/templates/image/description/_form.html.slime
index 6b4c4543..e47b5d3f 100644
--- a/lib/philomena_web/templates/image/description/_form.html.slime
+++ b/lib/philomena_web/templates/image/description/_form.html.slime
@@ -1,4 +1,4 @@
-= form_for @changeset, Routes.image_description_path(@conn, :update, @image), [class: "block hidden", id: "description-form", data: [remote: "true"]], fn f ->
+= form_for @changeset, ~p"/images/#{@image}/description", [class: "block hidden", id: "description-form", data: [remote: "true"]], fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
diff --git a/lib/philomena_web/templates/image/favorite/index.html.slime b/lib/philomena_web/templates/image/favorite/index.html.slime
index 1e606aad..ed239797 100644
--- a/lib/philomena_web/templates/image/favorite/index.html.slime
+++ b/lib/philomena_web/templates/image/favorite/index.html.slime
@@ -4,7 +4,7 @@ h5
= pluralize("user", "users", @image.faves_count)
= for fave <- Enum.sort_by(@image.faves, & String.downcase(&1.user.name)) do
- => link fave.user.name, to: Routes.profile_path(@conn, :show, fave.user), class: "interaction-user-list-item"
+ => link fave.user.name, to: ~p"/profiles/#{fave.user}", class: "interaction-user-list-item"
= if @has_votes do
h5
@@ -14,8 +14,8 @@ h5
= for upvote <- Enum.sort_by(@image.upvotes, & String.downcase(&1.user.name)) do
span.interaction-user-list-item
- => link upvote.user.name, to: Routes.profile_path(@conn, :show, upvote.user)
- => link "(x)", to: Routes.image_tamper_path(@conn, :create, @image, user_id: upvote.user_id), method: "post"
+ => link upvote.user.name, to: ~p"/profiles/#{upvote.user}"
+ => link "(x)", to: ~p"/images/#{@image}/tamper?#{[user_id: upvote.user_id]}", method: "post"
h5
' Downvoted by
@@ -24,8 +24,8 @@ h5
= for downvote <- Enum.sort_by(@image.downvotes, & String.downcase(&1.user.name)) do
span.interaction-user-list-item
- => link downvote.user.name, to: Routes.profile_path(@conn, :show, downvote.user)
- => link "(x)", to: Routes.image_tamper_path(@conn, :create, @image, user_id: downvote.user_id), method: "post"
+ => link downvote.user.name, to: ~p"/profiles/#{downvote.user}"
+ => link "(x)", to: ~p"/images/#{@image}/tamper?#{[user_id: downvote.user_id]}", method: "post"
h5
' Hidden by
@@ -33,4 +33,4 @@ h5
= pluralize("user", "users", @image.hides_count)
= for hide <- Enum.sort_by(@image.hides, & String.downcase(&1.user.name)) do
- => link hide.user.name, to: Routes.profile_path(@conn, :show, hide.user), class: "interaction-user-list-item"
+ => link hide.user.name, to: ~p"/profiles/#{hide.user}", class: "interaction-user-list-item"
diff --git a/lib/philomena_web/templates/image/index.html.slime b/lib/philomena_web/templates/image/index.html.slime
index a61acf49..ff5678cf 100644
--- a/lib/philomena_web/templates/image/index.html.slime
+++ b/lib/philomena_web/templates/image/index.html.slime
@@ -3,9 +3,9 @@ elixir:
params = assigns[:params] || assigns[:scope] || []
scope = assigns[:scope] || []
tags = assigns[:tags] || []
- route = assigns[:route] || fn p -> Routes.image_path(@conn, :index, p) end
- image_url = fn image -> Routes.image_path(@conn, :show, image, scope) end
- sorted_url = fn image, hit -> Routes.image_path(@conn, :show, image, Keyword.put(scope, :sort, hit["sort"])) end
+ route = assigns[:route] || fn p -> ~p"/images?#{p}" end
+ image_url = fn image -> ~p"/images/#{image}?#{scope}" end
+ sorted_url = fn image, hit -> ~p"/images/#{image}?#{Keyword.put(scope, :sort, hit["sort"])}" end
pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @images, route: route, params: params
info = render PhilomenaWeb.PaginationView, "_pagination_info.html", page: @images
diff --git a/lib/philomena_web/templates/image/new.html.slime b/lib/philomena_web/templates/image/new.html.slime
index 0f2a98be..ad596f17 100644
--- a/lib/philomena_web/templates/image/new.html.slime
+++ b/lib/philomena_web/templates/image/new.html.slime
@@ -1,4 +1,4 @@
-= form_for @changeset, Routes.image_path(@conn, :create), [multipart: true], fn f ->
+= form_for @changeset, ~p"/images", [multipart: true], fn f ->
.dnp-warning
h4
' Read the
diff --git a/lib/philomena_web/templates/image/related/index.html.slime b/lib/philomena_web/templates/image/related/index.html.slime
index 1feabfa1..421cee0a 100644
--- a/lib/philomena_web/templates/image/related/index.html.slime
+++ b/lib/philomena_web/templates/image/related/index.html.slime
@@ -8,4 +8,4 @@
.block__content.js-resizable-media-container
= for image <- @images do
- = render PhilomenaWeb.ImageView, "_image_box.html", image: image, link: Routes.image_path(@conn, :show, image), size: :thumb, conn: @conn
+ = render PhilomenaWeb.ImageView, "_image_box.html", image: image, link: ~p"/images/#{image}", size: :thumb, conn: @conn
diff --git a/lib/philomena_web/templates/image/reporting/show.html.slime b/lib/philomena_web/templates/image/reporting/show.html.slime
index 5a18b6c8..32216dbe 100644
--- a/lib/philomena_web/templates/image/reporting/show.html.slime
+++ b/lib/philomena_web/templates/image/reporting/show.html.slime
@@ -1,4 +1,4 @@
-a href=Routes.image_report_path(@conn, :new, @image)
+a href=~p"/images/#{@image}/reports/new"
button.button.button--link
i.fa.fa-exclamation-triangle>
' General reporting
@@ -15,7 +15,7 @@ a href=Routes.image_report_path(@conn, :new, @image)
- else
p
' You must
- a> href=Routes.session_path(@conn, :new) log in
+ a> href=~p"/sessions/new" log in
' to report duplicate images.
- target_reports = Enum.filter(@dupe_reports, & &1.duplicate_of_image_id == @image.id)
diff --git a/lib/philomena_web/templates/image/scratchpad/edit.html.slime b/lib/philomena_web/templates/image/scratchpad/edit.html.slime
index 31e37f9f..bd27ab6e 100644
--- a/lib/philomena_web/templates/image/scratchpad/edit.html.slime
+++ b/lib/philomena_web/templates/image/scratchpad/edit.html.slime
@@ -1,8 +1,8 @@
h1
' Editing moderation notes for image
- = link "##{@image.id}", to: Routes.image_path(@conn, :show, @image)
+ = link "##{@image.id}", to: ~p"/images/#{@image}"
-= form_for @changeset, Routes.image_scratchpad_path(@conn, :update, @image), fn f ->
+= form_for @changeset, ~p"/images/#{@image}/scratchpad", fn f ->
.field
= textarea f, :scratchpad, placeholder: "Scratchpad contents", class: "input input--wide"
diff --git a/lib/philomena_web/templates/image/show.html.slime b/lib/philomena_web/templates/image/show.html.slime
index 0c566314..2c2a8f23 100644
--- a/lib/philomena_web/templates/image/show.html.slime
+++ b/lib/philomena_web/templates/image/show.html.slime
@@ -24,5 +24,5 @@
- true ->
- #comments data-current-url=Routes.image_comment_path(@conn, :index, @image) data-loaded="true"
+ #comments data-current-url=~p"/images/#{@image}/comments" data-loaded="true"
= render PhilomenaWeb.Image.CommentView, "index.html", image: @image, comments: @comments, conn: @conn
diff --git a/lib/philomena_web/templates/image/source_change/index.html.slime b/lib/philomena_web/templates/image/source_change/index.html.slime
index 712f434a..bd5f4a57 100644
--- a/lib/philomena_web/templates/image/source_change/index.html.slime
+++ b/lib/philomena_web/templates/image/source_change/index.html.slime
@@ -1,10 +1,10 @@
h1
' Source changes for
- a href=Routes.image_path(@conn, :show, @image)
+ a href=~p"/images/#{@image}"
| image #
= @image.id
-- route = fn p -> Routes.image_source_change_path(@conn, :index, @image, p) end
+- route = fn p -> ~p"/images/#{@image}/source_changes?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @source_changes, route: route, conn: @conn
= render PhilomenaWeb.SourceChangeView, "index.html", conn: @conn, source_changes: @source_changes, pagination: pagination
\ No newline at end of file
diff --git a/lib/philomena_web/templates/image/subscription/_subscription.html.slime b/lib/philomena_web/templates/image/subscription/_subscription.html.slime
index 35c6883d..323fc0d5 100644
--- a/lib/philomena_web/templates/image/subscription/_subscription.html.slime
+++ b/lib/philomena_web/templates/image/subscription/_subscription.html.slime
@@ -1,8 +1,8 @@
elixir:
- watch_path = Routes.image_subscription_path(@conn, :create, @image)
+ watch_path = ~p"/images/#{@image}/subscription"
watch_class = if @watching, do: "hidden", else: ""
- unwatch_path = Routes.image_subscription_path(@conn, :delete, @image)
+ unwatch_path = ~p"/images/#{@image}/subscription"
unwatch_class = if @watching, do: "", else: "hidden"
= if @conn.assigns.current_user do
@@ -15,6 +15,6 @@ elixir:
i.fa.fa-bell-slash>
' Unsubscribe
- else
- a href=Routes.session_path(@conn, :new)
+ a href=~p"/sessions/new"
i.fa.fa-bell>
' Subscribe
diff --git a/lib/philomena_web/templates/image/tag_change/index.html.slime b/lib/philomena_web/templates/image/tag_change/index.html.slime
index 82d78789..cd79ec97 100644
--- a/lib/philomena_web/templates/image/tag_change/index.html.slime
+++ b/lib/philomena_web/templates/image/tag_change/index.html.slime
@@ -1,10 +1,10 @@
h1
' Tag changes for
- a href=Routes.image_path(@conn, :show, @image)
+ a href=~p"/images/#{@image}"
| image #
= @image.id
-- route = fn p -> Routes.image_tag_change_path(@conn, :index, @image, p) end
+- route = fn p -> ~p"/images/#{@image}/tag_changes?#{p}" end
- params = if @conn.params["added"], do: [added: @conn.params["added"]]
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @tag_changes, route: route, conn: @conn, params: params
@@ -13,8 +13,8 @@ h1
span.block__header__title
| Display only:
- = link "Removed", to: Routes.image_tag_change_path(@conn, :index, @image, added: 0)
- = link "Added", to: Routes.image_tag_change_path(@conn, :index, @image, added: 1)
- = link "All", to: Routes.image_tag_change_path(@conn, :index, @image)
+ = link "Removed", to: ~p"/images/#{@image}/tag_changes?#{[added: 0]}"
+ = link "Added", to: ~p"/images/#{@image}/tag_changes?#{[added: 1]}"
+ = link "All", to: ~p"/images/#{@image}/tag_changes"
= render PhilomenaWeb.TagChangeView, "index.html", conn: @conn, tag_changes: @tag_changes, pagination: pagination
diff --git a/lib/philomena_web/templates/image/tag_lock/show.html.slime b/lib/philomena_web/templates/image/tag_lock/show.html.slime
index 81a52cdf..e5a9841d 100644
--- a/lib/philomena_web/templates/image/tag_lock/show.html.slime
+++ b/lib/philomena_web/templates/image/tag_lock/show.html.slime
@@ -4,7 +4,7 @@ h1
| Editing locked tags on image #
= @image.id
-= form_for @changeset, Routes.image_tag_lock_path(@conn, :update, @image), fn f ->
+= form_for @changeset, ~p"/images/#{@image}/tag_lock", fn f ->
.field
= render PhilomenaWeb.TagView, "_tag_editor.html", f: f, name: :tag_input, type: :edit, extra: [value: tag_input]
= error_tag f, :tag_input
diff --git a/lib/philomena_web/templates/ip_profile/show.html.slime b/lib/philomena_web/templates/ip_profile/show.html.slime
index c752d9ff..eb3ac25c 100644
--- a/lib/philomena_web/templates/ip_profile/show.html.slime
+++ b/lib/philomena_web/templates/ip_profile/show.html.slime
@@ -3,24 +3,24 @@ h1
' 's IP profile
ul
- li = link "View images this IP has uploaded", to: Routes.search_path(@conn, :index, q: "ip:#{@ip}")
- li = link "View comments this IP has posted", to: Routes.comment_path(@conn, :index, cq: "ip:#{@ip}")
- li = link "View posts this IP has made", to: Routes.post_path(@conn, :index, pq: "ip:#{@ip}")
+ li = link "View images this IP has uploaded", to: ~p"/search?#{[q: "ip:#{@ip}"]}"
+ li = link "View comments this IP has posted", to: ~p"/comments?#{[cq: "ip:#{@ip}"]}"
+ li = link "View posts this IP has made", to: ~p"/posts?#{[pq: "ip:#{@ip}"]}"
= render PhilomenaWeb.BanView, "_bans.html", bans: @subnet_bans, conn: @conn
h2 Administration Options
ul
- li = link "View tag changes", to: Routes.ip_profile_tag_change_path(@conn, :index, to_string(@ip))
- li = link "View source URL history", to: Routes.ip_profile_source_change_path(@conn, :index, to_string(@ip))
- li = link "View reports this IP has made", to: Routes.admin_report_path(@conn, :index, rq: "ip:#{@ip}")
- li = link "View IP ban history", to: Routes.admin_subnet_ban_path(@conn, :index, ip: to_string(@ip))
- li = link "Ban this sucker", to: Routes.admin_subnet_ban_path(@conn, :new, specification: to_string(@ip))
+ li = link "View tag changes", to: ~p"/ip_profiles/#{to_string(@ip)}/tag_changes"
+ li = link "View source URL history", to: ~p"/ip_profiles/#{to_string(@ip)}/source_changes"
+ li = link "View reports this IP has made", to: ~p"/admin/reports?#{[rq: "ip:#{@ip}"]}"
+ li = link "View IP ban history", to: ~p"/admin/subnet_bans?#{[ip: to_string(@ip)]}"
+ li = link "Ban this sucker", to: ~p"/admin/subnet_bans/new?#{[specification: to_string(@ip)]}"
h2 Actions
ul
- li = link "Revert all tag changes", to: Routes.tag_change_full_revert_path(@conn, :create, [ip: to_string(@ip)]), data: [confirm: "Are you really, really sure?", method: "create"]
- li = link "...the button above didn't work (use carefully, this is resource-intensive)", to: Routes.tag_change_full_revert_path(@conn, :create, [ip: to_string(@ip), batch_size: 1]), data: [confirm: "Please confirm that you're aware that this may crash the site and are ready to take on the full wrath of the admins if it does so after you press this button.", method: "create"]
+ li = link "Revert all tag changes", to: ~p"/tag_changes/full_revert?#{[ip: to_string(@ip)]}", data: [confirm: "Are you really, really sure?", method: "create"]
+ li = link "...the button above didn't work (use carefully, this is resource-intensive)", to: ~p"/tag_changes/full_revert?#{[ip: to_string(@ip), batch_size: 1]}", data: [confirm: "Please confirm that you're aware that this may crash the site and are ready to take on the full wrath of the admins if it does so after you press this button.", method: "create"]
h4 Observed users
table.table
@@ -34,7 +34,7 @@ table.table
= for uip <- @user_ips do
tr
td
- = link uip.user.name, to: Routes.profile_path(@conn, :show, uip.user)
+ = link uip.user.name, to: ~p"/profiles/#{uip.user}"
td
=> uip.uses
' times
diff --git a/lib/philomena_web/templates/ip_profile/source_change/index.html.slime b/lib/philomena_web/templates/ip_profile/source_change/index.html.slime
index 5bf1bea1..d31a7968 100644
--- a/lib/philomena_web/templates/ip_profile/source_change/index.html.slime
+++ b/lib/philomena_web/templates/ip_profile/source_change/index.html.slime
@@ -2,7 +2,7 @@ h1
' Source changes by
= @ip
-- route = fn p -> Routes.ip_profile_source_change_path(@conn, :index, to_string(@ip), p) end
+- route = fn p -> ~p"/ip_profiles/#{to_string(@ip)}/source_changes?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @source_changes, route: route, conn: @conn
= render PhilomenaWeb.SourceChangeView, "index.html", conn: @conn, source_changes: @source_changes, pagination: pagination
diff --git a/lib/philomena_web/templates/ip_profile/tag_change/index.html.slime b/lib/philomena_web/templates/ip_profile/tag_change/index.html.slime
index 7d86ae72..4eb2f114 100644
--- a/lib/philomena_web/templates/ip_profile/tag_change/index.html.slime
+++ b/lib/philomena_web/templates/ip_profile/tag_change/index.html.slime
@@ -2,7 +2,7 @@ h1
' Tag changes by
= @ip
-- route = fn p -> Routes.ip_profile_tag_change_path(@conn, :index, to_string(@ip), p) end
+- route = fn p -> ~p"/ip_profiles/#{to_string(@ip)}/tag_changes?#{p}" end
- params = if @conn.params["added"], do: [added: @conn.params["added"]]
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @tag_changes, route: route, conn: @conn, params: params
@@ -11,8 +11,8 @@ h1
span.block__header__title
| Display only:
- = link "Removed", to: Routes.ip_profile_tag_change_path(@conn, :index, to_string(@ip), added: 0)
- = link "Added", to: Routes.ip_profile_tag_change_path(@conn, :index, to_string(@ip), added: 1)
- = link "All", to: Routes.ip_profile_tag_change_path(@conn, :index, to_string(@ip))
+ = link "Removed", to: ~p"/ip_profiles/#{to_string(@ip)}/tag_changes?#{[added: 0]}"
+ = link "Added", to: ~p"/ip_profiles/#{to_string(@ip)}/tag_changes?#{[added: 1]}"
+ = link "All", to: ~p"/ip_profiles/#{to_string(@ip)}/tag_changes"
= render PhilomenaWeb.TagChangeView, "index.html", conn: @conn, tag_changes: @tag_changes, pagination: pagination
diff --git a/lib/philomena_web/templates/layout/_header.html.slime b/lib/philomena_web/templates/layout/_header.html.slime
index 23935c9c..27a837c4 100644
--- a/lib/philomena_web/templates/layout/_header.html.slime
+++ b/lib/philomena_web/templates/layout/_header.html.slime
@@ -11,7 +11,7 @@ header.header
a.header__link.hide-mobile href="/images/new" title="Upload"
i.fa.fa-upload
- = form_for @conn, Routes.search_path(@conn, :index), [method: "get", class: "header__search flex flex--no-wrap flex--centered", enforce_utf8: false], fn f ->
+ = form_for @conn, ~p"/search", [method: "get", class: "header__search flex flex--no-wrap flex--centered", enforce_utf8: false], fn f ->
input.input.header__input.header__input--search#q name="q" title="For terms all required, separate with ',' or 'AND'; also supports 'OR' for optional terms and '-' or 'NOT' for negation. Search with a blank query for more options or click the ? for syntax help." value=@conn.params["q"] placeholder="Search" autocapitalize="none"
= if present?(@conn.params["sf"]) do
@@ -51,18 +51,18 @@ header.header
i.fa.fa-filter
span.hide-limited-desktop< Filters
- = form_for @user_changeset, Routes.filter_current_path(@conn, :update), [class: "header__filter-form", id: "filter-quick-form"], fn f ->
+ = form_for @user_changeset, ~p"/filters/current", [class: "header__filter-form", id: "filter-quick-form"], fn f ->
= select f, :current_filter_id, @available_filters, name: "id", id: "filter-quick-menu", class: "input header__input", data: [change_submit: "#filter-quick-form"], autocomplete: "off"
- = form_for @user_changeset, Routes.filter_spoiler_type_path(@conn, :update), [class: "header__filter-form hide-mobile hide-limited-desktop", id: "spoiler-quick-form"], fn f ->
+ = form_for @user_changeset, ~p"/filters/spoiler_type", [class: "header__filter-form hide-mobile hide-limited-desktop", id: "spoiler-quick-form"], fn f ->
= select f, :spoiler_type, @spoiler_types, id: "spoiler-quick-menu", class: "input header__input", data: [change_submit: "#spoiler-quick-form"], autocomplete: "off"
.dropdown.header__dropdown
- a.header__link.header__link-user href=Routes.profile_path(@conn, :show, @current_user)
+ a.header__link.header__link-user href=~p"/profiles/#{@current_user}"
= render PhilomenaWeb.UserAttributionView, "_user_avatar.html", object: %{user: @current_user}, class: "avatar--28px"
span.header__link-user__dropdown-arrow.hide-mobile data-click-preventdefault="true"
nav.dropdown__content.dropdown__content-right.hide-mobile.js-burger-links
- a.header__link href=Routes.profile_path(@conn, :show, @current_user)
+ a.header__link href=~p"/profiles/#{@current_user}"
= @current_user.name
a.header__link href="/search?q=my:watched"
i.fa.fa-fw.fa-eye>
@@ -73,7 +73,7 @@ header.header
a.header__link href="/search?q=my:upvotes"
i.fa.fa-fw.fa-arrow-up>
| Upvotes
- a.header__link href=Routes.gallery_path(@conn, :index, gallery: [creator: @current_user.name])
+ a.header__link href=~p"/galleries?#{[gallery: [creator: @current_user.name]]}"
i.fa.fa-fw.fa-image>
| Galleries
a.header__link href="/search?q=my:uploads"
@@ -85,7 +85,7 @@ header.header
a.header__link href="/posts?pq=my:posts"
i.fas.fa-fw.fa-pen-square>
| Posts
- a.header__link href=Routes.profile_artist_link_path(@conn, :index, @current_user)
+ a.header__link href=~p"/profiles/#{@current_user}/artist_links"
i.fa.fa-fw.fa-link>
| Links
a.header__link href="/settings/edit"
@@ -94,10 +94,10 @@ header.header
a.header__link href="/conversations"
i.fa.fa-fw.fa-envelope>
| Messages
- a.header__link href=Routes.registration_path(@conn, :edit)
+ a.header__link href=~p"/registrations/edit"
i.fa.fa-fw.fa-user>
| Account
- a.header__link href=Routes.session_path(@conn, :delete) data-method="delete"
+ a.header__link href=~p"/sessions" data-method="delete"
i.fa.fa-fw.fa-sign-out-alt>
| Logout
- else
@@ -109,9 +109,9 @@ header.header
a.header__link href="/settings/edit"
i.fa.fa-fw.fa-cogs.hide-desktop>
| Settings
- a.header__link href=Routes.registration_path(@conn, :new)
+ a.header__link href=~p"/registrations/new"
| Register
- a.header__link href=Routes.session_path(@conn, :new)
+ a.header__link href=~p"/sessions/new"
| Login
nav.header.header--secondary
diff --git a/lib/philomena_web/templates/layout/_header_navigation.html.slime b/lib/philomena_web/templates/layout/_header_navigation.html.slime
index 112b0c57..af53a163 100644
--- a/lib/philomena_web/templates/layout/_header_navigation.html.slime
+++ b/lib/philomena_web/templates/layout/_header_navigation.html.slime
@@ -22,7 +22,7 @@
i.fa.fa-caret-down<
.dropdown__content
= for forum <- @conn.assigns.forums do
- a.header__link href=Routes.forum_path(@conn, :show, forum)
+ a.header__link href=~p"/forums/#{forum}"
= forum.name
a.header__link href="/posts"
diff --git a/lib/philomena_web/templates/layout/_header_staff_links.html.slime b/lib/philomena_web/templates/layout/_header_staff_links.html.slime
index 52d6aef6..59c6126b 100644
--- a/lib/philomena_web/templates/layout/_header_staff_links.html.slime
+++ b/lib/philomena_web/templates/layout/_header_staff_links.html.slime
@@ -7,71 +7,71 @@
.dropdown__content.js-burger-links
= if manages_site_notices?(@conn) do
- = link to: Routes.admin_site_notice_path(@conn, :index), class: "header__link" do
+ = link to: ~p"/admin/site_notices", class: "header__link" do
i.fa.fa-fw.fa-info-circle>
' Site Notices
= if manages_users?(@conn) do
- = link to: Routes.admin_user_path(@conn, :index), class: "header__link" do
+ = link to: ~p"/admin/users", class: "header__link" do
i.fa.fa-fw.fa-users>
' Users
= if manages_forums?(@conn) do
- = link to: Routes.admin_forum_path(@conn, :index), class: "header__link" do
+ = link to: ~p"/admin/forums", class: "header__link" do
i.fa.fa-fw.fa-paragraph>
' Forums
= if manages_ads?(@conn) do
- = link to: Routes.admin_advert_path(@conn, :index), class: "header__link" do
+ = link to: ~p"/admin/adverts", class: "header__link" do
i.fa.fa-fw.fa-shopping-bag>
' Adverts
= if manages_badges?(@conn) do
- = link to: Routes.admin_badge_path(@conn, :index), class: "header__link" do
+ = link to: ~p"/admin/badges", class: "header__link" do
i.fa.fa-fw.fa-trophy>
' Badges
= if manages_static_pages?(@conn) do
- = link to: Routes.page_path(@conn, :index), class: "header__link" do
+ = link to: ~p"/pages", class: "header__link" do
i.fa.fa-fw.fa-sticky-note>
' Pages
= if manages_mod_notes?(@conn) do
- = link to: Routes.admin_mod_note_path(@conn, :index), class: "header__link" do
+ = link to: ~p"/admin/mod_notes", class: "header__link" do
i.fa.fa-fw.fa-clipboard>
' Mod Notes
= if can_see_moderation_log?(@conn) do
- = link to: Routes.moderation_log_path(@conn, :index), class: "header__link" do
+ = link to: ~p"/moderation_logs", class: "header__link" do
i.fa.fa-fw.fa-list-alt>
' Mod Logs
= if @pending_approval_count do
- = link to: Routes.admin_approval_path(@conn, :index), class: "header__link", title: "Approval Queue" do
+ = link to: ~p"/admin/approvals", class: "header__link", title: "Approval Queue" do
' Q
span.header__counter__admin
= @pending_approval_count
= if @duplicate_report_count do
- = link to: Routes.duplicate_report_path(@conn, :index), class: "header__link", title: "Duplicates" do
+ = link to: ~p"/duplicate_reports", class: "header__link", title: "Duplicates" do
' D
span.header__counter__admin
= @duplicate_report_count
= if @report_count do
- = link to: Routes.admin_report_path(@conn, :index), class: "header__link", title: "Reports" do
+ = link to: ~p"/admin/reports", class: "header__link", title: "Reports" do
' R
span.header__counter__admin
= @report_count
= if @artist_link_count do
- = link to: Routes.admin_artist_link_path(@conn, :index), class: "header__link", title: "Artist Links" do
+ = link to: ~p"/admin/artist_links", class: "header__link", title: "Artist Links" do
' L
span.header__counter__admin
= @artist_link_count
= if @dnp_entry_count do
- = link to: Routes.admin_dnp_entry_path(@conn, :index), class: "header__link", title: "DNP Requests" do
+ = link to: ~p"/admin/dnp_entries", class: "header__link", title: "DNP Requests" do
' S
span.header__counter__admin
= @dnp_entry_count
@@ -84,14 +84,14 @@
.dropdown__content.dropdown__content-right.js-burger-links
- = link to: Routes.admin_user_ban_path(@conn, :index), class: "header__link" do
+ = link to: ~p"/admin/user_bans", class: "header__link" do
i.fa.fa-fw.fa-user>
' User Bans
- = link to: Routes.admin_subnet_ban_path(@conn, :index), class: "header__link" do
+ = link to: ~p"/admin/subnet_bans", class: "header__link" do
i.fab.fa-fw.fa-internet-explorer>
' IP Bans
- = link to: Routes.admin_fingerprint_ban_path(@conn, :index), class: "header__link" do
+ = link to: ~p"/admin/fingerprint_bans", class: "header__link" do
i.fa.fa-fw.fa-desktop>
' FP Bans
diff --git a/lib/philomena_web/templates/layout/_opengraph.html.slime b/lib/philomena_web/templates/layout/_opengraph.html.slime
index 30ae6555..45585171 100644
--- a/lib/philomena_web/templates/layout/_opengraph.html.slime
+++ b/lib/philomena_web/templates/layout/_opengraph.html.slime
@@ -12,7 +12,7 @@ meta name="format-detection" content="telephone=no"
meta name="keywords" content=tag_list(image)
meta name="description" content=description
meta property="og:title" content=description
- meta property="og:url" content=Routes.image_url(@conn, :show, image)
+ meta property="og:url" content=url(~p"/images/#{image}")
= for tag <- artist_tags(image.tags) do
meta property="dc:creator" content=tag.name_in_namespace
@@ -20,9 +20,9 @@ meta name="format-detection" content="telephone=no"
= if image_has_sources(image) do
meta property="foaf:primaryTopic" content=image_first_source(image)
- link rel="alternate" type="application/json+oembed" href=Routes.api_json_oembed_url(@conn, :index, url: Routes.image_path(@conn, :show, image)) title="oEmbed JSON Profile"
+ link rel="alternate" type="application/json+oembed" href=url(~p"/api/v1/json/oembed?#{[url: ~p"/images/#{image}"]}") title="oEmbed JSON Profile"
- link rel="canonical" href=Routes.image_url(@conn, :show, image)
+ link rel="canonical" href=url(~p"/images/#{image}")
= cond do
- image.image_mime_type == "video/webm" and not filtered ->
diff --git a/lib/philomena_web/templates/message/_message.html.slime b/lib/philomena_web/templates/message/_message.html.slime
index 27f4bd96..9f750121 100644
--- a/lib/philomena_web/templates/message/_message.html.slime
+++ b/lib/philomena_web/templates/message/_message.html.slime
@@ -9,7 +9,7 @@ article.block.communication
p
ul.horizontal-list
li
- = link(to: Routes.conversation_message_approve_path(@conn, :create, @message.conversation_id, @message), data: [confirm: "Are you sure?"], method: "post", class: "button") do
+ = link(to: ~p"/conversations/#{@message.conversation_id}/messages/#{@message}/approve", data: [confirm: "Are you sure?"], method: "post", class: "button") do
i.fas.fa-check>
' Approve
diff --git a/lib/philomena_web/templates/moderation_log/index.html.slime b/lib/philomena_web/templates/moderation_log/index.html.slime
index a1927305..e2c81eef 100644
--- a/lib/philomena_web/templates/moderation_log/index.html.slime
+++ b/lib/philomena_web/templates/moderation_log/index.html.slime
@@ -1,5 +1,5 @@
elixir:
- route = fn p -> Routes.moderation_log_path(@conn, :index, p) end
+ route = fn p -> ~p"/moderation_logs?#{p}" end
pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @moderation_logs, route: route, conn: @conn
h1 Listing Moderation Logs
diff --git a/lib/philomena_web/templates/notification/_channel.html.slime b/lib/philomena_web/templates/notification/_channel.html.slime
index 3e40d6f3..1fc57157 100644
--- a/lib/philomena_web/templates/notification/_channel.html.slime
+++ b/lib/philomena_web/templates/notification/_channel.html.slime
@@ -1,14 +1,14 @@
.flex.flex--centered.flex__grow
div
strong>
- = link @notification.actor.title, to: Routes.channel_path(@conn, :show, @notification.actor)
+ = link @notification.actor.title, to: ~p"/channels/#{@notification.actor}"
=<> @notification.action
=> pretty_time @notification.updated_at
.flex.flex--centered.flex--no-wrap
- a.button.button--separate-right title="Delete" href=Routes.channel_read_path(@conn, :create, @notification.actor) data-method="post" data-remote="true" data-fetchcomplete-hide="#notification-#{@notification.id}"
+ a.button.button--separate-right title="Delete" href=~p"/channels/#{@notification.actor}/read" data-method="post" data-remote="true" data-fetchcomplete-hide="#notification-#{@notification.id}"
i.fa.fa-trash
- a.button title="Unsubscribe" href=Routes.channel_subscription_path(@conn, :delete, @notification.actor) data-method="delete" data-remote="true" data-fetchcomplete-hide="#notification-#{@notification.id}"
+ a.button title="Unsubscribe" href=~p"/channels/#{@notification.actor}/subscription" data-method="delete" data-remote="true" data-fetchcomplete-hide="#notification-#{@notification.id}"
i.fa.fa-bell-slash
\ No newline at end of file
diff --git a/lib/philomena_web/templates/notification/_forum.html.slime b/lib/philomena_web/templates/notification/_forum.html.slime
index 512c49ea..f7edb198 100644
--- a/lib/philomena_web/templates/notification/_forum.html.slime
+++ b/lib/philomena_web/templates/notification/_forum.html.slime
@@ -9,17 +9,17 @@
' titled
strong>
- = link topic.title, to: Routes.forum_topic_path(@conn, :show, forum, topic)
+ = link topic.title, to: ~p"/forums/#{forum}/topics/#{topic}"
' in
- => link forum.name, to: Routes.forum_path(@conn, :show, forum)
+ => link forum.name, to: ~p"/forums/#{forum}"
=> pretty_time @notification.updated_at
.flex.flex--centered.flex--no-wrap
- a.button.button--separate-right title="Delete" href=Routes.forum_read_path(@conn, :create, forum) data-method="post" data-remote="true" data-fetchcomplete-hide="#notification-#{@notification.id}"
+ a.button.button--separate-right title="Delete" href=~p"/forums/#{forum}/read" data-method="post" data-remote="true" data-fetchcomplete-hide="#notification-#{@notification.id}"
i.fa.fa-trash
- a.button title="Unsubscribe" href=Routes.forum_subscription_path(@conn, :delete, forum) data-method="delete" data-remote="true" data-fetchcomplete-hide="#notification-#{@notification.id}"
+ a.button title="Unsubscribe" href=~p"/forums/#{forum}/subscription" data-method="delete" data-remote="true" data-fetchcomplete-hide="#notification-#{@notification.id}"
i.fa.fa-bell-slash
\ No newline at end of file
diff --git a/lib/philomena_web/templates/notification/_gallery.html.slime b/lib/philomena_web/templates/notification/_gallery.html.slime
index 767cbc73..09e3eccc 100644
--- a/lib/philomena_web/templates/notification/_gallery.html.slime
+++ b/lib/philomena_web/templates/notification/_gallery.html.slime
@@ -4,13 +4,13 @@
=> @notification.action
strong>
- = link @notification.actor.title, to: Routes.gallery_path(@conn, :show, @notification.actor)
+ = link @notification.actor.title, to: ~p"/galleries/#{@notification.actor}"
=> pretty_time @notification.updated_at
.flex.flex--centered.flex--no-wrap
- a.button.button--separate-right title="Delete" href=Routes.gallery_read_path(@conn, :create, @notification.actor) data-method="post" data-remote="true" data-fetchcomplete-hide="#notification-#{@notification.id}"
+ a.button.button--separate-right title="Delete" href=~p"/galleries/#{@notification.actor}/read" data-method="post" data-remote="true" data-fetchcomplete-hide="#notification-#{@notification.id}"
i.fa.fa-trash
- a.button title="Unsubscribe" href=Routes.gallery_subscription_path(@conn, :delete, @notification.actor) data-method="delete" data-remote="true" data-fetchcomplete-hide="#notification-#{@notification.id}"
+ a.button title="Unsubscribe" href=~p"/galleries/#{@notification.actor}/subscription" data-method="delete" data-remote="true" data-fetchcomplete-hide="#notification-#{@notification.id}"
i.fa.fa-bell-slash
\ No newline at end of file
diff --git a/lib/philomena_web/templates/notification/_image.html.slime b/lib/philomena_web/templates/notification/_image.html.slime
index ebedb422..89814c39 100644
--- a/lib/philomena_web/templates/notification/_image.html.slime
+++ b/lib/philomena_web/templates/notification/_image.html.slime
@@ -7,13 +7,13 @@
=> @notification.action
strong>
- = link "##{@notification.actor_id}", to: Routes.image_path(@conn, :show, @notification.actor) <> "#comments"
+ = link "##{@notification.actor_id}", to: ~p"/images/#{@notification.actor}" <> "#comments"
=> pretty_time @notification.updated_at
.flex.flex--centered.flex--no-wrap
- a.button.button--separate-right title="Delete" href=Routes.image_read_path(@conn, :create, @notification.actor) data-method="post" data-remote="true" data-fetchcomplete-hide="#notification-#{@notification.id}"
+ a.button.button--separate-right title="Delete" href=~p"/images/#{@notification.actor}/read" data-method="post" data-remote="true" data-fetchcomplete-hide="#notification-#{@notification.id}"
i.fa.fa-trash
- a.button title="Unsubscribe" href=Routes.image_subscription_path(@conn, :delete, @notification.actor) data-method="delete" data-remote="true" data-fetchcomplete-hide="#notification-#{@notification.id}"
+ a.button title="Unsubscribe" href=~p"/images/#{@notification.actor}/subscription" data-method="delete" data-remote="true" data-fetchcomplete-hide="#notification-#{@notification.id}"
i.fa.fa-bell-slash
\ No newline at end of file
diff --git a/lib/philomena_web/templates/notification/_topic.html.slime b/lib/philomena_web/templates/notification/_topic.html.slime
index 1a1c5ff6..5ecefcfd 100644
--- a/lib/philomena_web/templates/notification/_topic.html.slime
+++ b/lib/philomena_web/templates/notification/_topic.html.slime
@@ -7,13 +7,13 @@
=> @notification.action
strong>
- = link topic.title, to: Routes.forum_topic_path(@conn, :show, topic.forum, topic, post_id: post.id) <> "#post_#{post.id}"
+ = link topic.title, to: ~p"/forums/#{topic.forum}/topics/#{topic}?#{[post_id: post.id]}" <> "#post_#{post.id}"
=> pretty_time @notification.updated_at
.flex.flex--centered.flex--no-wrap
- a.button.button--separate-right title="Delete" href=Routes.forum_topic_read_path(@conn, :create, topic.forum, topic) data-method="post" data-remote="true" data-fetchcomplete-hide="#notification-#{@notification.id}"
+ a.button.button--separate-right title="Delete" href=~p"/forums/#{topic.forum}/topics/#{topic}/read" data-method="post" data-remote="true" data-fetchcomplete-hide="#notification-#{@notification.id}"
i.fa.fa-trash
- a.button title="Unsubscribe" href=Routes.forum_topic_subscription_path(@conn, :delete, topic.forum, topic) data-method="delete" data-remote="true" data-fetchcomplete-hide="#notification-#{@notification.id}"
+ a.button title="Unsubscribe" href=~p"/forums/#{topic.forum}/topics/#{topic}/subscription" data-method="delete" data-remote="true" data-fetchcomplete-hide="#notification-#{@notification.id}"
i.fa.fa-bell-slash
\ No newline at end of file
diff --git a/lib/philomena_web/templates/notification/index.html.slime b/lib/philomena_web/templates/notification/index.html.slime
index 5478763b..9cec1086 100644
--- a/lib/philomena_web/templates/notification/index.html.slime
+++ b/lib/philomena_web/templates/notification/index.html.slime
@@ -1,4 +1,4 @@
-- route = fn p -> Routes.notification_path(@conn, :index, p) end
+- route = fn p -> ~p"/notifications?#{p}" end
h1 Notification Area
.walloftext
diff --git a/lib/philomena_web/templates/page/edit.html.slime b/lib/philomena_web/templates/page/edit.html.slime
index 2ac4387b..f141d06b 100644
--- a/lib/philomena_web/templates/page/edit.html.slime
+++ b/lib/philomena_web/templates/page/edit.html.slime
@@ -1,3 +1,3 @@
h1 Editing static page
-= render PhilomenaWeb.PageView, "_form.html", changeset: @changeset, action: Routes.page_path(@conn, :update, @static_page), conn: @conn
+= render PhilomenaWeb.PageView, "_form.html", changeset: @changeset, action: ~p"/pages/#{@static_page}", conn: @conn
diff --git a/lib/philomena_web/templates/page/history/index.html.slime b/lib/philomena_web/templates/page/history/index.html.slime
index cc7429f7..805492eb 100644
--- a/lib/philomena_web/templates/page/history/index.html.slime
+++ b/lib/philomena_web/templates/page/history/index.html.slime
@@ -1,6 +1,6 @@
h1
' Revision history for
- = link @static_page.title, to: Routes.page_path(@conn, :show, @static_page)
+ = link @static_page.title, to: ~p"/pages/#{@static_page}"
table.table
thead
@@ -12,7 +12,7 @@ table.table
tbody
= for version <- @versions do
tr
- td = link version.user.name, to: Routes.profile_path(@conn, :show, version.user)
+ td = link version.user.name, to: ~p"/profiles/#{version.user}"
td = pretty_time(version.created_at)
td.static-page__diff
= for diff <- version.difference do
diff --git a/lib/philomena_web/templates/page/index.html.slime b/lib/philomena_web/templates/page/index.html.slime
index 88731d64..5e535faa 100644
--- a/lib/philomena_web/templates/page/index.html.slime
+++ b/lib/philomena_web/templates/page/index.html.slime
@@ -8,7 +8,7 @@ table.table
tbody
= for static_page <- @static_pages do
tr
- td = link static_page.title, to: Routes.page_path(@conn, :show, static_page)
+ td = link static_page.title, to: ~p"/pages/#{static_page}"
br
-= link "New static page", to: Routes.page_path(@conn, :new)
+= link "New static page", to: ~p"/pages/new"
diff --git a/lib/philomena_web/templates/page/new.html.slime b/lib/philomena_web/templates/page/new.html.slime
index 48ad0fd1..c2b7b208 100644
--- a/lib/philomena_web/templates/page/new.html.slime
+++ b/lib/philomena_web/templates/page/new.html.slime
@@ -1,3 +1,3 @@
h1 New static page
-= render PhilomenaWeb.PageView, "_form.html", changeset: @changeset, action: Routes.page_path(@conn, :create), conn: @conn
+= render PhilomenaWeb.PageView, "_form.html", changeset: @changeset, action: ~p"/pages", conn: @conn
diff --git a/lib/philomena_web/templates/page/show.html.slime b/lib/philomena_web/templates/page/show.html.slime
index 9eadee5f..f5bc82cc 100644
--- a/lib/philomena_web/templates/page/show.html.slime
+++ b/lib/philomena_web/templates/page/show.html.slime
@@ -4,11 +4,11 @@ p
=> pretty_time(@static_page.updated_at)
p
- => link to: Routes.page_history_path(@conn, :index, @static_page) do
+ => link to: ~p"/pages/#{@static_page}/history" do
i.fa.fa-history>
' Revision history
= if can?(@conn, :edit, Philomena.StaticPages.StaticPage) do
- =< link to: Routes.page_path(@conn, :edit, @static_page) do
+ =< link to: ~p"/pages/#{@static_page}/edit" do
i.fa.fa-edit>
' Edit
diff --git a/lib/philomena_web/templates/password/edit.html.slime b/lib/philomena_web/templates/password/edit.html.slime
index 0046b4d9..00cf1f71 100644
--- a/lib/philomena_web/templates/password/edit.html.slime
+++ b/lib/philomena_web/templates/password/edit.html.slime
@@ -1,6 +1,6 @@
h1 Reset password
-= form_for @changeset, Routes.password_path(@conn, :update, @token), fn f ->
+= form_for @changeset, ~p"/passwords/#{@token}", fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
diff --git a/lib/philomena_web/templates/password/new.html.slime b/lib/philomena_web/templates/password/new.html.slime
index 20b84e85..3aac61b5 100644
--- a/lib/philomena_web/templates/password/new.html.slime
+++ b/lib/philomena_web/templates/password/new.html.slime
@@ -3,7 +3,7 @@ p
' Provide the email address you signed up with and we will email you
' password reset instructions.
-= form_for :user, Routes.password_path(@conn, :create), fn f ->
+= form_for :user, ~p"/passwords", fn f ->
.field
= email_input f, :email, class: "input", placeholder: "Email", required: true
diff --git a/lib/philomena_web/templates/post/_post.html.slime b/lib/philomena_web/templates/post/_post.html.slime
index d6f5c6a8..fc41fa73 100644
--- a/lib/philomena_web/templates/post/_post.html.slime
+++ b/lib/philomena_web/templates/post/_post.html.slime
@@ -9,7 +9,7 @@ article.block.communication id="post_#{@post.id}"
p
ul.horizontal-list
li
- = link(to: Routes.forum_topic_post_approve_path(@conn, :create, @post.topic.forum, @post.topic, @post), data: [confirm: "Are you sure?"], method: "post", class: "button") do
+ = link(to: ~p"/forums/#{@post.topic.forum}/topics/#{@post.topic}/posts/#{@post}/approve", data: [confirm: "Are you sure?"], method: "post", class: "button") do
i.fas.fa-check>
' Approve
li
@@ -17,7 +17,7 @@ article.block.communication id="post_#{@post.id}"
i.fa.fa-times>
' Reject
- = form_for :post, Routes.forum_topic_post_hide_path(@conn, :create, @post.topic.forum, @post.topic, @post), [class: "togglable-delete-form hidden flex", id: "inline-reject-form-post-#{@post.id}"], fn f ->
+ = form_for :post, ~p"/forums/#{@post.topic.forum}/topics/#{@post.topic}/posts/#{@post}/hide", [class: "togglable-delete-form hidden flex", id: "inline-reject-form-post-#{@post.id}"], fn f ->
= text_input f, :deletion_reason, class: "input input--wide", placeholder: "Deletion Reason", id: "inline-reject-reason-post-#{@post.id}", required: true
= submit "Delete", class: "button"
@@ -57,11 +57,11 @@ article.block.communication id="post_#{@post.id}"
= if can?(@conn, :hide, @post) and not hide_staff_tools?(@conn) do
= cond do
- @post.hidden_from_users and not @post.destroyed_content ->
- = link(to: Routes.forum_topic_post_hide_path(@conn, :delete, @post.topic.forum, @post.topic, @post), data: [confirm: "Are you sure?"], method: "delete", class: "communication__interaction") do
+ = link(to: ~p"/forums/#{@post.topic.forum}/topics/#{@post.topic}/posts/#{@post}/hide", data: [confirm: "Are you sure?"], method: "delete", class: "communication__interaction") do
i.fas.fa-check>
' Restore
= if can?(@conn, :delete, @post) do
- = link(to: Routes.forum_topic_post_delete_path(@conn, :create, @post.topic.forum, @post.topic, @post), data: [confirm: "Are you sure?"], method: "post", class: "communication__interaction") do
+ = link(to: ~p"/forums/#{@post.topic.forum}/topics/#{@post.topic}/posts/#{@post}/delete", data: [confirm: "Are you sure?"], method: "post", class: "communication__interaction") do
i.fas.fa-times>
' Delete Contents
@@ -78,6 +78,6 @@ article.block.communication id="post_#{@post.id}"
.communication__info
=<> link_to_fingerprint(@conn, @post.fingerprint)
- = form_for :post, Routes.forum_topic_post_hide_path(@conn, :create, @post.topic.forum, @post.topic, @post), [class: "togglable-delete-form hidden flex", id: "inline-del-form-post-#{@post.id}"], fn f ->
+ = form_for :post, ~p"/forums/#{@post.topic.forum}/topics/#{@post.topic}/posts/#{@post}/hide", [class: "togglable-delete-form hidden flex", id: "inline-del-form-post-#{@post.id}"], fn f ->
= text_input f, :deletion_reason, class: "input input--wide", placeholder: "Deletion Reason", id: "inline-del-reason-post-#{@post.id}", required: true
= submit "Delete", class: "button"
diff --git a/lib/philomena_web/templates/post/_post_options.html.slime b/lib/philomena_web/templates/post/_post_options.html.slime
index f17212b8..214cf1d3 100644
--- a/lib/philomena_web/templates/post/_post_options.html.slime
+++ b/lib/philomena_web/templates/post/_post_options.html.slime
@@ -2,13 +2,13 @@ div
' Posted
=> pretty_time(@post.created_at)
- a.communication__interaction href=Routes.forum_topic_post_report_path(@conn, :new, @post.topic.forum, @post.topic, @post)
+ a.communication__interaction href=~p"/forums/#{@post.topic.forum}/topics/#{@post.topic}/posts/#{@post}/reports/new"
i.fa.fa-flag>
' Report
= if not is_nil(@post.edited_at) and can?(@conn, :show, @post) do
br
- a href=Routes.forum_topic_post_history_path(@conn, :index, @post.topic.forum, @post.topic, @post)
+ a href=~p"/forums/#{@post.topic.forum}/topics/#{@post.topic}/posts/#{@post}/history"
' Edited
=> pretty_time(@post.edited_at)
@@ -17,7 +17,7 @@ div
=> @post.edit_reason
div
- - link_path = Routes.forum_topic_path(@conn, :show, @post.topic.forum, @post.topic, post_id: @post.id) <> "#post_#{@post.id}"
+ - link_path = ~p"/forums/#{@post.topic.forum}/topics/#{@post.topic}?#{[post_id: @post.id]}" <> "#post_#{@post.id}"
- safe_author = markdown_safe_author(@post)
- quote_body = if @post.hidden_from_users, do: "", else: @post.body
@@ -36,6 +36,6 @@ div
= if can?(@conn, :edit, @post) do
span.owner-options
strong
- a.communication__interaction href=Routes.forum_topic_post_path(@conn, :edit, @post.topic.forum, @post.topic, @post)
+ a.communication__interaction href=~p"/forums/#{@post.topic.forum}/topics/#{@post.topic}/posts/#{@post}/edit"
i.fas.fa-edit>
' Edit
diff --git a/lib/philomena_web/templates/post/index.html.slime b/lib/philomena_web/templates/post/index.html.slime
index 507fbd69..6313a9dc 100644
--- a/lib/philomena_web/templates/post/index.html.slime
+++ b/lib/philomena_web/templates/post/index.html.slime
@@ -1,6 +1,6 @@
h1 Posts
-= form_for :posts, Routes.post_path(@conn, :index), [method: "get", class: "hform", enforce_utf8: false], fn f ->
+= form_for :posts, ~p"/posts", [method: "get", class: "hform", enforce_utf8: false], fn f ->
.field
= text_input f, :pq, name: :pq, value: @conn.params["pq"], class: "input hform__text", placeholder: "Search posts", autocapitalize: "none"
= submit "Search", class: "hform__button button"
@@ -14,17 +14,17 @@ h2 Search Results
= cond do
- Enum.any?(@posts) ->
- - route = fn p -> Routes.post_path(@conn, :index, p) end
+ - route = fn p -> ~p"/posts?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @posts, route: route, params: [pq: @conn.params["pq"]], conn: @conn
= for {body, post} <- @posts, post.topic.hidden_from_users == false do
div
h3
- =<> link post.topic.forum.name, to: Routes.forum_path(@conn, :show, post.topic.forum)
+ =<> link post.topic.forum.name, to: ~p"/forums/#{post.topic.forum}"
| »
- =<> link post.topic.title, to: Routes.forum_topic_path(@conn, :show, post.topic.forum, post.topic)
+ =<> link post.topic.title, to: ~p"/forums/#{post.topic.forum}/topics/#{post.topic}"
| »
- - post_link = Routes.forum_topic_path(@conn, :show, post.topic.forum, post.topic, post_id: post.id) <> "#post_#{post.id}"
+ - post_link = ~p"/forums/#{post.topic.forum}/topics/#{post.topic}?#{[post_id: post.id]}" <> "#post_#{post.id}"
= if post.topic_position == 0 do
=<> link "Topic Opener", to: post_link
- else
@@ -79,28 +79,28 @@ table.table
td Literal
td Matches the author of this post. Anonymous authors will never match this term.
td
- code = link "author:Joey", to: Routes.post_path(@conn, :index, pq: "author:Joey")
+ code = link "author:Joey", to: ~p"/posts?#{[pq: "author:Joey"]}"
tr
td
code body
td Full Text
td Matches the body of this post. This is the default field.
td
- code = link "body:test", to: Routes.post_path(@conn, :index, pq: "body:test")
+ code = link "body:test", to: ~p"/posts?#{[pq: "body:test"]}"
tr
td
code created_at
td Date/Time Range
td Matches the creation time of this post.
td
- code = link "created_at:2015", to: Routes.post_path(@conn, :index, pq: "created_at:2015")
+ code = link "created_at:2015", to: ~p"/posts?#{[pq: "created_at:2015"]}"
tr
td
code id
td Numeric Range
td Matches the numeric surrogate key for this post.
td
- code = link "id:1000000", to: Routes.post_path(@conn, :index, pq: "id:1000000")
+ code = link "id:1000000", to: ~p"/posts?#{[pq: "id:1000000"]}"
tr
td
code my
@@ -109,46 +109,46 @@ table.table
code> my:posts
' matches posts you have posted if you are signed in.
td
- code = link "my:posts", to: Routes.post_path(@conn, :index, pq: "my:posts")
+ code = link "my:posts", to: ~p"/posts?#{[pq: "my:posts"]}"
tr
td
code subject
td Full Text
td Matches the title of the topic.
td
- code = link "subject:time wasting thread", to: Routes.post_path(@conn, :index, pq: "subject:time wasting thread")
+ code = link "subject:time wasting thread", to: ~p"/posts?#{[pq: "subject:time wasting thread"]}"
tr
td
code topic_id
td Literal
td Matches the numeric surrogate key for the topic this post belongs to.
td
- code = link "topic_id:7000", to: Routes.post_path(@conn, :index, pq: "topic_id:7000")
+ code = link "topic_id:7000", to: ~p"/posts?#{[pq: "topic_id:7000"]}"
tr
td
code topic_position
td Numeric Range
td Matches the offset from the beginning of the topic of this post. Positions begin at 0.
td
- code = link "topic_position:0", to: Routes.post_path(@conn, :index, pq: "topic_position:0")
+ code = link "topic_position:0", to: ~p"/posts?#{[pq: "topic_position:0"]}"
tr
td
code updated_at
td Date/Time Range
td Matches the creation or last edit time of this post.
td
- code = link "updated_at.gte:2 weeks ago", to: Routes.post_path(@conn, :index, pq: "updated_at.gte:2 weeks ago")
+ code = link "updated_at.gte:2 weeks ago", to: ~p"/posts?#{[pq: "updated_at.gte:2 weeks ago"]}"
tr
td
code user_id
td Literal
td Matches posts with the specified user_id. Anonymous users will never match this term.
td
- code = link "user_id:211190", to: Routes.post_path(@conn, :index, pq: "user_id:211190")
+ code = link "user_id:211190", to: ~p"/posts?#{[pq: "user_id:211190"]}"
tr
td
code forum
td Literal
td Matches the short name for the forum this post belongs to.
td
- code = link "forum:meta", to: Routes.post_path(@conn, :index, pq: "forum:meta")
+ code = link "forum:meta", to: ~p"/posts?#{[pq: "forum:meta"]}"
diff --git a/lib/philomena_web/templates/profile/_about_me.html.slime b/lib/philomena_web/templates/profile/_about_me.html.slime
index e4c4a782..5bad35b2 100644
--- a/lib/philomena_web/templates/profile/_about_me.html.slime
+++ b/lib/philomena_web/templates/profile/_about_me.html.slime
@@ -6,6 +6,6 @@
- current?(@user, @conn.assigns.current_user) ->
em
' Want to
- => link "add some info about yourself?", to: Routes.profile_description_path(@conn, :edit, @user)
+ => link "add some info about yourself?", to: ~p"/profiles/#{@user}/description/edit"
- true ->
diff --git a/lib/philomena_web/templates/profile/_admin_block.html.slime b/lib/philomena_web/templates/profile/_admin_block.html.slime
index 187772d2..ca2462ab 100644
--- a/lib/philomena_web/templates/profile/_admin_block.html.slime
+++ b/lib/philomena_web/templates/profile/_admin_block.html.slime
@@ -7,7 +7,7 @@
i.fa.fa-fw.fa-filter>
' Current Filter:
= if @filter do
- = link @filter.name, to: Routes.filter_path(@conn, :show, @filter)
+ = link @filter.name, to: ~p"/filters/#{@filter}"
- else
em
' (none)
@@ -52,127 +52,127 @@ a.label.label--primary.label--block href="#" data-click-toggle=".js-admin__optio
.profile-top__options.js-admin__options__toggle.hidden
ul.profile-admin__options__column
li
- = link to: Routes.profile_detail_path(@conn, :index, @user) do
+ = link to: ~p"/profiles/#{@user}/details" do
i.fa.fa-fw.fa-eye
span.admin__button View Details
li
- = link to: Routes.search_path(@conn, :index, q: "upvoted_by_id:#{@user.id}") do
+ = link to: ~p"/search?#{[q: "upvoted_by_id:#{@user.id}"]}" do
i.fa.fa-fw.fa-arrow-up
span.admin__button Upvotes
li
- = link to: Routes.search_path(@conn, :index, q: "downvoted_by_id:#{@user.id}") do
+ = link to: ~p"/search?#{[q: "downvoted_by_id:#{@user.id}"]}" do
i.fa.fa-fw.fa-arrow-down
span.admin__button Downvotes
li
- = link to: Routes.search_path(@conn, :index, q: "hidden_by_id:#{@user.id}") do
+ = link to: ~p"/search?#{[q: "hidden_by_id:#{@user.id}"]}" do
i.fa.fa-fw.fa-eye-slash
span.admin__button Hidden Images
li
- = link to: Routes.admin_report_path(@conn, :index, rq: "user_id:#{@user.id}") do
+ = link to: ~p"/admin/reports?#{[rq: "user_id:#{@user.id}"]}" do
i.fa.fa-fw.fa-exclamation
span.admin__button Reports
li
- = link to: Routes.profile_ip_history_path(@conn, :index, @user) do
+ = link to: ~p"/profiles/#{@user}/ip_history" do
i.fab.fa-fw.fa-internet-explorer
span.admin__button IP History
li
- = link to: Routes.profile_fp_history_path(@conn, :index, @user) do
+ = link to: ~p"/profiles/#{@user}/fp_history" do
i.fa.fa-fw.fa-desktop
span.admin__button FP History
li
- = link to: Routes.profile_alias_path(@conn, :index, @user) do
+ = link to: ~p"/profiles/#{@user}/aliases" do
i.fa.fa-fw.fa-users
span.admin__button Potential Aliases
= if can?(@conn, :index, %Philomena.Donations.Donation{}) do
li
- = link to: Routes.admin_donation_user_path(@conn, :show, @user) do
+ = link to: ~p"/admin/donations/user/#{@user}" do
i.fas.fa-fw.fa-dollar-sign
span.admin__button Donations
ul.profile-admin__options__column
= if can?(@conn, :edit, @user) do
li
- = link to: Routes.admin_user_path(@conn, :edit, @user) do
+ = link to: ~p"/admin/users/#{@user}/edit" do
i.fas.fa-fw.fa-edit
span.admin__button Edit User
li
- = link to: Routes.admin_user_force_filter_path(@conn, :new, @user) do
+ = link to: ~p"/admin/users/#{@user}/force_filter/new" do
i.fas.faw-fw.fa-filter
span.admin__button Force Filter
= if @forced do
li
- = link to: Routes.admin_user_force_filter_path(@conn, :delete, @user), data: [confirm: "Are you really, really sure?", method: "delete"] do
+ = link to: ~p"/admin/users/#{@user}/force_filter", data: [confirm: "Are you really, really sure?", method: "delete"] do
i.fas.fa-fw.fa-filter
span.admin__button Remove Force Filter
= if @user.deleted_at do
li
- = link to: Routes.admin_user_activation_path(@conn, :create, @user), data: [confirm: "Are you really, really sure?", method: "post"] do
+ = link to: ~p"/admin/users/#{@user}/activation", data: [confirm: "Are you really, really sure?", method: "post"] do
i.fa.fa-fw.fa-check
span.admin__button Reactivate Account
- else
li
- = link to: Routes.admin_user_activation_path(@conn, :delete, @user), data: [confirm: "Are you really, really sure?", method: "delete"] do
+ = link to: ~p"/admin/users/#{@user}/activation", data: [confirm: "Are you really, really sure?", method: "delete"] do
i.fa.fa-fw.fa-times
span.admin__button Deactivate Account
= if @user.locked_at do
li
- = link to: Routes.admin_user_unlock_path(@conn, :create, @user), data: [method: "post"] do
+ = link to: ~p"/admin/users/#{@user}/unlock", data: [method: "post"] do
i.fas.fa-fw.fa-unlock
span.admin__button Unlock Account
li
- = link to: Routes.admin_user_wipe_path(@conn, :create, @user), data: [confirm: "This is irreversible, destroying all identifying information including email. Are you sure?", method: "post"] do
+ = link to: ~p"/admin/users/#{@user}/wipe", data: [confirm: "This is irreversible, destroying all identifying information including email. Are you sure?", method: "post"] do
i.fas.fa-fw.fa-eraser
span.admin__button Wipe PII
= if can?(@conn, :edit, %Philomena.ArtistLinks.ArtistLink{}) do
li
- = link to: Routes.profile_artist_link_path(@conn, :new, @user) do
+ = link to: ~p"/profiles/#{@user}/artist_links/new" do
i.fa.fa-fw.fa-link
span.admin__button Add Artist Link
= if can?(@conn, :create, Philomena.Bans.User) do
li
- = link to: Routes.admin_user_ban_path(@conn, :new, username: @user.name) do
+ = link to: ~p"/admin/user_bans/new?#{[username: @user.name]}" do
i.fa.fa-fw.fa-ban
span.admin__button Ban this sucker
ul.profile-admin__options__column
= if can?(@conn, :index, Philomena.Users.User) do
li
- = link to: Routes.admin_user_api_key_path(@conn, :delete, @user), data: [confirm: "Are you really, really sure?", method: "delete"] do
+ = link to: ~p"/admin/users/#{@user}/api_key", data: [confirm: "Are you really, really sure?", method: "delete"] do
i.fas.fa-fw.fa-key
span.admin__button Reset API key
li
= if @user.verified do
- = link to: Routes.admin_user_verification_path(@conn, :delete, @user), data: [confirm: "Are you really, really sure?", method: "delete"] do
+ = link to: ~p"/admin/users/#{@user}/verification", data: [confirm: "Are you really, really sure?", method: "delete"] do
i.fas.fa-fw.fa-user-times
span.admin__button Revoke Verification
- else
- = link to: Routes.admin_user_verification_path(@conn, :create, @user), data: [confirm: "Are you really, really sure?", method: "create"] do
+ = link to: ~p"/admin/users/#{@user}/verification", data: [confirm: "Are you really, really sure?", method: "create"] do
i.fas.fa-fw.fa-user-check
span.admin__button Grant Verification
ul.profile-admin__options__column
= if can?(@conn, :index, Philomena.Users.User) do
li
- = link to: Routes.admin_user_vote_path(@conn, :delete, @user), data: [confirm: "Are you really, really sure?", method: "delete"] do
+ = link to: ~p"/admin/users/#{@user}/votes", data: [confirm: "Are you really, really sure?", method: "delete"] do
i.far.fa-fw.fa-file-excel
span.admin__button Remove All Votes/Faves
li
- = link to: Routes.admin_user_downvote_path(@conn, :delete, @user), data: [confirm: "Are you really, really sure?", method: "delete"] do
+ = link to: ~p"/admin/users/#{@user}/downvotes", data: [confirm: "Are you really, really sure?", method: "delete"] do
i.fa.fa-fw.fa-arrow-down
span.admin__button Remove All Downvotes
= if @user.role == "user" and can?(@conn, :revert, Philomena.TagChanges.TagChange) do
li
- = link to: Routes.tag_change_full_revert_path(@conn, :create, [user_id: @user.id]), data: [confirm: "Are you really, really sure?", method: "create"] do
+ = link to: ~p"/tag_changes/full_revert?#{[user_id: @user.id]}", data: [confirm: "Are you really, really sure?", method: "create"] do
i.fa.fa-fw.fa-tag
span.admin__button Revert All Tag Changes
diff --git a/lib/philomena_web/templates/profile/_commission.html.slime b/lib/philomena_web/templates/profile/_commission.html.slime
index db8e8d46..be102740 100644
--- a/lib/philomena_web/templates/profile/_commission.html.slime
+++ b/lib/philomena_web/templates/profile/_commission.html.slime
@@ -21,18 +21,18 @@
br
br
- = link "More information", to: Routes.profile_commission_path(@conn, :show, @user)
+ = link "More information", to: ~p"/profiles/#{@user}/commission"
- current?(@user, @conn.assigns.current_user) ->
= if Enum.any?(@conn.assigns.user.verified_links) do
em
' You don't have any commission information listed yet.
- => link "Click here", to: Routes.profile_commission_path(@conn, :new, @user)
+ => link "Click here", to: ~p"/profiles/#{@user}/commission/new"
' to set it up.
- else
em
' You must have a verified Artist Link to create a commission page.
- => link "Click here", to: Routes.profile_artist_link_path(@conn, :new, @user)
+ => link "Click here", to: ~p"/profiles/#{@user}/artist_links/new"
' to set one up.
- true ->
diff --git a/lib/philomena_web/templates/profile/_recent_comments.html.slime b/lib/philomena_web/templates/profile/_recent_comments.html.slime
index 02f460a0..2752b333 100644
--- a/lib/philomena_web/templates/profile/_recent_comments.html.slime
+++ b/lib/philomena_web/templates/profile/_recent_comments.html.slime
@@ -2,7 +2,7 @@
.block
.block__header
span.block__header__title Recent Comments
- = link "View all", to: Routes.comment_path(@conn, :index, cq: "user_id:#{@user.id}")
+ = link "View all", to: ~p"/comments?#{[cq: "user_id:#{@user.id}"]}"
.block__content
= for {body, comment} <- @comments, can?(@conn, :show, comment.image) do
diff --git a/lib/philomena_web/templates/profile/_recent_galleries.html.slime b/lib/philomena_web/templates/profile/_recent_galleries.html.slime
index d67f1061..8aee5f98 100644
--- a/lib/philomena_web/templates/profile/_recent_galleries.html.slime
+++ b/lib/philomena_web/templates/profile/_recent_galleries.html.slime
@@ -2,7 +2,7 @@
.block
.block__header
span.block__header__title Recent Galleries
- = link "View all", to: Routes.gallery_path(@conn, :index, gallery: [creator: @user.name])
+ = link "View all", to: ~p"/galleries?#{[gallery: [creator: @user.name]]}"
.block__content.js-resizable-media-container
= for gallery <- @galleries do
diff --git a/lib/philomena_web/templates/profile/_recent_posts.html.slime b/lib/philomena_web/templates/profile/_recent_posts.html.slime
index c7b91658..3b4b4814 100644
--- a/lib/philomena_web/templates/profile/_recent_posts.html.slime
+++ b/lib/philomena_web/templates/profile/_recent_posts.html.slime
@@ -2,13 +2,13 @@
.block
.block__header
span.block__header__title Recent Forum Posts
- = link "View all", to: Routes.post_path(@conn, :index, pq: "user_id:#{@user.id}")
+ = link "View all", to: ~p"/posts?#{[pq: "user_id:#{@user.id}"]}"
.block__content
.block
= for post <- @posts do
.block__content.alternating-color
' Post
- => link pretty_time(post.created_at), to: Routes.forum_topic_path(@conn, :show, post.topic.forum, post.topic, post_id: post) <> "#post_#{post.id}"
+ => link pretty_time(post.created_at), to: ~p"/forums/#{post.topic.forum}/topics/#{post.topic}?#{[post_id: post]}" <> "#post_#{post.id}"
' in topic
- => link post.topic.title, to: Routes.forum_topic_path(@conn, :show, post.topic.forum, post.topic)
+ => link post.topic.title, to: ~p"/forums/#{post.topic.forum}/topics/#{post.topic}"
diff --git a/lib/philomena_web/templates/profile/alias/_aliases.html.slime b/lib/philomena_web/templates/profile/alias/_aliases.html.slime
index 53913aad..38030e40 100644
--- a/lib/philomena_web/templates/profile/alias/_aliases.html.slime
+++ b/lib/philomena_web/templates/profile/alias/_aliases.html.slime
@@ -1,7 +1,7 @@
= for u <- @aliases do
tr
td
- = link u.name, to: Routes.profile_path(@conn, :show, u)
+ = link u.name, to: ~p"/profiles/#{u}"
td
= @type
diff --git a/lib/philomena_web/templates/profile/artist_link/edit.html.slime b/lib/philomena_web/templates/profile/artist_link/edit.html.slime
index 7c643cf4..c03ff454 100644
--- a/lib/philomena_web/templates/profile/artist_link/edit.html.slime
+++ b/lib/philomena_web/templates/profile/artist_link/edit.html.slime
@@ -1,2 +1,2 @@
h1 Edit Link
-= render PhilomenaWeb.Profile.ArtistLinkView, "_form.html", conn: @conn, changeset: @changeset, tag_name: tag_name(@artist_link), action: Routes.profile_artist_link_path(@conn, :update, @artist_link.user, @artist_link)
+= render PhilomenaWeb.Profile.ArtistLinkView, "_form.html", conn: @conn, changeset: @changeset, tag_name: tag_name(@artist_link), action: ~p"/profiles/#{@artist_link.user}/artist_links/#{@artist_link}"
diff --git a/lib/philomena_web/templates/profile/artist_link/index.html.slime b/lib/philomena_web/templates/profile/artist_link/index.html.slime
index 15f2999b..7cb3be11 100644
--- a/lib/philomena_web/templates/profile/artist_link/index.html.slime
+++ b/lib/philomena_web/templates/profile/artist_link/index.html.slime
@@ -1,6 +1,6 @@
h1 Artist Links
p
- a.button href=Routes.profile_artist_link_path(@conn, :new, @user)
+ a.button href=~p"/profiles/#{@user}/artist_links/new"
' Request a link
p
' Artist links associate your account on Derpibooru with tags about content you create and with accounts on sites elsewhere. This allows users to easily identify artists and staff to act more rapidly on takedown requests.
@@ -17,7 +17,7 @@ table.table
= for link <- @artist_links do
tr
td = link link.uri, to: link.uri
- td = link "View Details", to: Routes.profile_artist_link_path(@conn, :show, @user, link)
+ td = link "View Details", to: ~p"/profiles/#{@user}/artist_links/#{link}"
td = link.verification_code
th = verified_as_string(link)
th = public_as_string(link)
diff --git a/lib/philomena_web/templates/profile/artist_link/new.html.slime b/lib/philomena_web/templates/profile/artist_link/new.html.slime
index 762d9be9..a2566378 100644
--- a/lib/philomena_web/templates/profile/artist_link/new.html.slime
+++ b/lib/philomena_web/templates/profile/artist_link/new.html.slime
@@ -1,2 +1,2 @@
h1 Request Artist Link
-= render PhilomenaWeb.Profile.ArtistLinkView, "_form.html", changeset: @changeset, action: Routes.profile_artist_link_path(@conn, :create, @user), conn: @conn
+= render PhilomenaWeb.Profile.ArtistLinkView, "_form.html", changeset: @changeset, action: ~p"/profiles/#{@user}/artist_links", conn: @conn
diff --git a/lib/philomena_web/templates/profile/artist_link/show.html.slime b/lib/philomena_web/templates/profile/artist_link/show.html.slime
index d38133d4..73aedd3f 100644
--- a/lib/philomena_web/templates/profile/artist_link/show.html.slime
+++ b/lib/philomena_web/templates/profile/artist_link/show.html.slime
@@ -54,16 +54,16 @@ h3 Associated tag
= if can?(@conn, :index, Philomena.ArtistLinks.ArtistLink) do
p
- => link "Edit", to: Routes.profile_artist_link_path(@conn, :edit, @user, @artist_link)
+ => link "Edit", to: ~p"/profiles/#{@user}/artist_links/#{@artist_link}/edit"
' •
- => link "Verify", to: Routes.admin_artist_link_verification_path(@conn, :create, @artist_link), method: :post
+ => link "Verify", to: ~p"/admin/artist_links/#{@artist_link}/verification", method: :post
' •
- => link "Reject", to: Routes.admin_artist_link_reject_path(@conn, :create, @artist_link), method: :post
+ => link "Reject", to: ~p"/admin/artist_links/#{@artist_link}/reject", method: :post
= if not verified?(@artist_link) do
' •
= if contacted?(@artist_link) do
' Artist contacted
- else
- = link "Artist contacted", to: Routes.admin_artist_link_contact_path(@conn, :create, @artist_link), method: :post
+ = link "Artist contacted", to: ~p"/admin/artist_links/#{@artist_link}/contact", method: :post
-= link "Back", to: Routes.profile_artist_link_path(@conn, :index, @user)
+= link "Back", to: ~p"/profiles/#{@user}/artist_links"
diff --git a/lib/philomena_web/templates/profile/award/edit.html.slime b/lib/philomena_web/templates/profile/award/edit.html.slime
index 0216955e..94a5f3b6 100644
--- a/lib/philomena_web/templates/profile/award/edit.html.slime
+++ b/lib/philomena_web/templates/profile/award/edit.html.slime
@@ -1,3 +1,3 @@
h1 Editing award
-= render PhilomenaWeb.Profile.AwardView, "_form.html", changeset: @changeset, badges: @badges, action: Routes.profile_award_path(@conn, :update, @user, @award), conn: @conn
+= render PhilomenaWeb.Profile.AwardView, "_form.html", changeset: @changeset, badges: @badges, action: ~p"/profiles/#{@user}/awards/#{@award}", conn: @conn
diff --git a/lib/philomena_web/templates/profile/award/new.html.slime b/lib/philomena_web/templates/profile/award/new.html.slime
index 489bc93e..525e06cf 100644
--- a/lib/philomena_web/templates/profile/award/new.html.slime
+++ b/lib/philomena_web/templates/profile/award/new.html.slime
@@ -1,3 +1,3 @@
h1 New award
-= render PhilomenaWeb.Profile.AwardView, "_form.html", changeset: @changeset, badges: @badges, action: Routes.profile_award_path(@conn, :create, @user), conn: @conn
+= render PhilomenaWeb.Profile.AwardView, "_form.html", changeset: @changeset, badges: @badges, action: ~p"/profiles/#{@user}/awards", conn: @conn
diff --git a/lib/philomena_web/templates/profile/commission/_listing_items.html.slime b/lib/philomena_web/templates/profile/commission/_listing_items.html.slime
index 778daa01..49ead871 100644
--- a/lib/philomena_web/templates/profile/commission/_listing_items.html.slime
+++ b/lib/philomena_web/templates/profile/commission/_listing_items.html.slime
@@ -3,7 +3,7 @@
span.block__header__title Available Items and Prices
= if current?(@user, @conn.assigns.current_user) do
- = link "Add an item", to: Routes.profile_commission_item_path(@conn, :new, @user)
+ = link "Add an item", to: ~p"/profiles/#{@user}/commission/items/new"
.block__content
@@ -12,7 +12,7 @@
p You have not added any items to your commissions sheet yet.
p
' Your listing will not appear in search results until you
- = link "list at least one item", to: Routes.profile_commission_item_path(@conn, :new, @user)
+ = link "list at least one item", to: ~p"/profiles/#{@user}/commission/items/new"
' .
- else
p This artist has not added any items yet. Please check back later.
@@ -52,7 +52,7 @@
= if can?(@conn, :edit, @commission) do
td
- = link "Edit item", to: Routes.profile_commission_item_path(@conn, :edit, @user, item)
+ = link "Edit item", to: ~p"/profiles/#{@user}/commission/items/#{item}/edit"
br
br
- = link "Delete item", to: Routes.profile_commission_item_path(@conn, :delete, @user, item), data: [confirm: "Are you really, really sure?", method: "delete"]
+ = link "Delete item", to: ~p"/profiles/#{@user}/commission/items/#{item}", data: [confirm: "Are you really, really sure?", method: "delete"]
diff --git a/lib/philomena_web/templates/profile/commission/_listing_sidebar.html.slime b/lib/philomena_web/templates/profile/commission/_listing_sidebar.html.slime
index 544ed939..93db5128 100644
--- a/lib/philomena_web/templates/profile/commission/_listing_sidebar.html.slime
+++ b/lib/philomena_web/templates/profile/commission/_listing_sidebar.html.slime
@@ -71,18 +71,18 @@
span.block__header__title Options
.block__content
= if can?(@conn, :edit, @commission) do
- = link "Edit this listing", to: Routes.profile_commission_path(@conn, :edit, @user)
+ = link "Edit this listing", to: ~p"/profiles/#{@user}/commission/edit"
br
- = link "Delete this listing", to: Routes.profile_commission_path(@conn, :delete, @user), data: [confirm: "Are you really, really sure about that?", method: "delete"]
+ = link "Delete this listing", to: ~p"/profiles/#{@user}/commission", data: [confirm: "Are you really, really sure about that?", method: "delete"]
br
- = link "Report this listing", to: Routes.profile_commission_report_path(@conn, :new, @user)
+ = link "Report this listing", to: ~p"/profiles/#{@user}/commission/reports/new"
/ Share block
.block
.block__header
span.block__header__title Share this listing
.block__content
- - url = Routes.profile_commission_url(@conn, :show, @user)
+ - url = url(~p"/profiles/#{@user}/commission")
.field
label> for="commission_url" URL
diff --git a/lib/philomena_web/templates/profile/commission/edit.html.slime b/lib/philomena_web/templates/profile/commission/edit.html.slime
index aa6bab71..514d03f0 100644
--- a/lib/philomena_web/templates/profile/commission/edit.html.slime
+++ b/lib/philomena_web/templates/profile/commission/edit.html.slime
@@ -1,5 +1,5 @@
h1 Edit Commission Listing
p
- = link "Back to commission", to: Routes.profile_commission_path(@conn, :show, @user)
+ = link "Back to commission", to: ~p"/profiles/#{@user}/commission"
-= render PhilomenaWeb.Profile.CommissionView, "_form.html", changeset: @changeset, action: Routes.profile_commission_path(@conn, :update, @user), conn: @conn
\ No newline at end of file
+= render PhilomenaWeb.Profile.CommissionView, "_form.html", changeset: @changeset, action: ~p"/profiles/#{@user}/commission", conn: @conn
\ No newline at end of file
diff --git a/lib/philomena_web/templates/profile/commission/item/edit.html.slime b/lib/philomena_web/templates/profile/commission/item/edit.html.slime
index cb8124be..46d4e28b 100644
--- a/lib/philomena_web/templates/profile/commission/item/edit.html.slime
+++ b/lib/philomena_web/templates/profile/commission/item/edit.html.slime
@@ -1,5 +1,5 @@
h1 Edit Item on Listing
p
- = link "Back to listing", to: Routes.profile_commission_path(@conn, :show, @user)
+ = link "Back to listing", to: ~p"/profiles/#{@user}/commission"
-= render PhilomenaWeb.Profile.Commission.ItemView, "_form.html", conn: @conn, changeset: @changeset, action: Routes.profile_commission_item_path(@conn, :update, @user, @item)
+= render PhilomenaWeb.Profile.Commission.ItemView, "_form.html", conn: @conn, changeset: @changeset, action: ~p"/profiles/#{@user}/commission/items/#{@item}"
diff --git a/lib/philomena_web/templates/profile/commission/item/new.html.slime b/lib/philomena_web/templates/profile/commission/item/new.html.slime
index b2a75690..6897a066 100644
--- a/lib/philomena_web/templates/profile/commission/item/new.html.slime
+++ b/lib/philomena_web/templates/profile/commission/item/new.html.slime
@@ -1,5 +1,5 @@
h1 New Item on Listing
p
- = link "Back to listing", to: Routes.profile_commission_path(@conn, :show, @user)
+ = link "Back to listing", to: ~p"/profiles/#{@user}/commission"
-= render PhilomenaWeb.Profile.Commission.ItemView, "_form.html", conn: @conn, changeset: @changeset, action: Routes.profile_commission_item_path(@conn, :create, @user)
+= render PhilomenaWeb.Profile.Commission.ItemView, "_form.html", conn: @conn, changeset: @changeset, action: ~p"/profiles/#{@user}/commission/items"
diff --git a/lib/philomena_web/templates/profile/commission/new.html.slime b/lib/philomena_web/templates/profile/commission/new.html.slime
index 98653d8d..0e08e263 100644
--- a/lib/philomena_web/templates/profile/commission/new.html.slime
+++ b/lib/philomena_web/templates/profile/commission/new.html.slime
@@ -1,5 +1,5 @@
h1 New Commission Listing
p
- = link "Back to index", to: Routes.commission_path(@conn, :index)
+ = link "Back to index", to: ~p"/commissions"
-= render PhilomenaWeb.Profile.CommissionView, "_form.html", changeset: @changeset, action: Routes.profile_commission_path(@conn, :create, @user), conn: @conn
\ No newline at end of file
+= render PhilomenaWeb.Profile.CommissionView, "_form.html", changeset: @changeset, action: ~p"/profiles/#{@user}/commission", conn: @conn
\ No newline at end of file
diff --git a/lib/philomena_web/templates/profile/description/edit.html.slime b/lib/philomena_web/templates/profile/description/edit.html.slime
index bc09393a..a59ced13 100644
--- a/lib/philomena_web/templates/profile/description/edit.html.slime
+++ b/lib/philomena_web/templates/profile/description/edit.html.slime
@@ -1,6 +1,6 @@
h1 Updating Profile Description
-= form_for @changeset, Routes.profile_description_path(@conn, :update, @user), [method: "put"], fn f ->
+= form_for @changeset, ~p"/profiles/#{@user}/description", [method: "put"], fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
diff --git a/lib/philomena_web/templates/profile/detail/index.html.slime b/lib/philomena_web/templates/profile/detail/index.html.slime
index 2384a855..7d51cdfc 100644
--- a/lib/philomena_web/templates/profile/detail/index.html.slime
+++ b/lib/philomena_web/templates/profile/detail/index.html.slime
@@ -1,10 +1,10 @@
h2
- = link @user.name, to: Routes.profile_path(@conn, :show, @user)
+ = link @user.name, to: ~p"/profiles/#{@user}"
| 's User Details
h4 Mod Notes
= render PhilomenaWeb.Admin.ModNoteView, "_table.html", mod_notes: @mod_notes, conn: @conn
-= link "Add New Note", to: Routes.admin_mod_note_path(@conn, :new, notable_id: @user.id, notable_type: "User")
+= link "Add New Note", to: ~p"/admin/mod_notes/new?#{[notable_id: @user.id, notable_type: "User"]}"
h4 Name History
table.table
@@ -20,6 +20,6 @@ table.table
h4 More Details
ul
- li = link "IP Address Usage History", to: Routes.profile_ip_history_path(@conn, :index, @user)
- li = link "Fingerprint Usage History", to: Routes.profile_fp_history_path(@conn, :index, @user)
- li = link "Potential Aliases", to: Routes.profile_alias_path(@conn, :index, @user)
+ li = link "IP Address Usage History", to: ~p"/profiles/#{@user}/ip_history"
+ li = link "Fingerprint Usage History", to: ~p"/profiles/#{@user}/fp_history"
+ li = link "Potential Aliases", to: ~p"/profiles/#{@user}/aliases"
diff --git a/lib/philomena_web/templates/profile/fp_history/index.html.slime b/lib/philomena_web/templates/profile/fp_history/index.html.slime
index b67a9e3c..182c30c5 100644
--- a/lib/philomena_web/templates/profile/fp_history/index.html.slime
+++ b/lib/philomena_web/templates/profile/fp_history/index.html.slime
@@ -10,7 +10,7 @@ ul
ul
= for u <- @other_users[ufp.fingerprint] do
li
- => link u.user.name, to: Routes.profile_path(@conn, :show, u.user)
+ => link u.user.name, to: ~p"/profiles/#{u.user}"
| (
=> u.uses
' uses, last used
diff --git a/lib/philomena_web/templates/profile/ip_history/index.html.slime b/lib/philomena_web/templates/profile/ip_history/index.html.slime
index 3d494d78..d5ffc0ff 100644
--- a/lib/philomena_web/templates/profile/ip_history/index.html.slime
+++ b/lib/philomena_web/templates/profile/ip_history/index.html.slime
@@ -10,7 +10,7 @@ ul
ul
= for u <- @other_users[uip.ip] do
li
- => link u.user.name, to: Routes.profile_path(@conn, :show, u.user)
+ => link u.user.name, to: ~p"/profiles/#{u.user}"
| (
=> u.uses
' uses, last used
diff --git a/lib/philomena_web/templates/profile/scratchpad/edit.html.slime b/lib/philomena_web/templates/profile/scratchpad/edit.html.slime
index bb4ca474..9632e445 100644
--- a/lib/philomena_web/templates/profile/scratchpad/edit.html.slime
+++ b/lib/philomena_web/templates/profile/scratchpad/edit.html.slime
@@ -1,6 +1,6 @@
h1 Updating Moderation Scratchpad
-= form_for @changeset, Routes.profile_scratchpad_path(@conn, :update, @user), [method: "put"], fn f ->
+= form_for @changeset, ~p"/profiles/#{@user}/scratchpad", [method: "put"], fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
diff --git a/lib/philomena_web/templates/profile/show.html.slime b/lib/philomena_web/templates/profile/show.html.slime
index 21eacf74..3179e247 100644
--- a/lib/philomena_web/templates/profile/show.html.slime
+++ b/lib/philomena_web/templates/profile/show.html.slime
@@ -2,7 +2,7 @@
.profile-top__avatar
- avatar = render PhilomenaWeb.UserAttributionView, "_user_avatar.html", object: %{user: @user}, class: "avatar--125px"
= if current?(@user, @conn.assigns.current_user) do
- = link avatar, to: Routes.avatar_path(@conn, :edit, profile: true), title: "Change avatar"
+ = link avatar, to: ~p"/avatar/edit?#{[profile: true]}", title: "Change avatar"
- else
= avatar
.profile-top__name-and-links
@@ -14,7 +14,7 @@
br
= if can?(@conn, :edit_description, @user) do
- = link "Edit Personal Title", to: Routes.profile_description_path(@conn, :edit, @user)
+ = link "Edit Personal Title", to: ~p"/profiles/#{@user}/description/edit"
br
span
@@ -23,21 +23,21 @@
.profile-top__options
ul.profile-top__options__column
- li = link("Send message", to: Routes.conversation_path(@conn, :new, recipient: @user.name))
- li = link("Our conversations", to: Routes.conversation_path(@conn, :index, with: @user.id))
- li = link("Report this user", to: Routes.profile_report_path(@conn, :new, @user))
+ li = link("Send message", to: ~p"/conversations/new?#{[recipient: @user.name]}")
+ li = link("Our conversations", to: ~p"/conversations?#{[with: @user.id]}")
+ li = link("Report this user", to: ~p"/profiles/#{@user}/reports/new")
ul.profile-top__options__column
- li = link("Uploads", to: Routes.search_path(@conn, :index, q: "uploader_id:#{@user.id}"))
- li = link("Comments", to: Routes.comment_path(@conn, :index, cq: "user_id:#{@user.id}"))
- li = link("Posts", to: Routes.post_path(@conn, :index, pq: "user_id:#{@user.id}"))
+ li = link("Uploads", to: ~p"/search?#{[q: "uploader_id:#{@user.id}"]}")
+ li = link("Comments", to: ~p"/comments?#{[cq: "user_id:#{@user.id}"]}")
+ li = link("Posts", to: ~p"/posts?#{[pq: "user_id:#{@user.id}"]}")
= if current?(@user, @conn.assigns.current_user) do
- li = link "My reports", to: Routes.report_path(@conn, :index)
+ li = link "My reports", to: ~p"/reports"
ul.profile-top__options__column
- li = link("Favorites", to: Routes.search_path(@conn, :index, q: "faved_by_id:#{@user.id}"))
- li = link("Tag changes", to: Routes.profile_tag_change_path(@conn, :index, @user))
- li = link("Source changes", to: Routes.profile_source_change_path(@conn, :index, @user))
+ li = link("Favorites", to: ~p"/search?#{[q: "faved_by_id:#{@user.id}"]}")
+ li = link("Tag changes", to: ~p"/profiles/#{@user}/tag_changes")
+ li = link("Source changes", to: ~p"/profiles/#{@user}/source_changes")
= if can_index_user?(@conn) do
.js-staff-action
@@ -47,7 +47,7 @@
.block
i.fa.fa-fw.fa-filter>
strong.comment_deleted> Forced Filter:
- = link @forced.name, to: Routes.filter_path(@conn, :show, @forced)
+ = link @forced.name, to: ~p"/filters/#{@forced}"
= if (current?(@user, @conn.assigns.current_user) or can?(@conn, :index, Philomena.Bans.User)) and Enum.any?(@bans) do
.block
@@ -65,7 +65,7 @@
.block
= if current?(@user, @conn.assigns.current_user) or manages_links?(@conn, @user) do
- a.block__header--single-item href=Routes.profile_artist_link_path(@conn, :new, @user) Artist Links
+ a.block__header--single-item href=~p"/profiles/#{@user}/artist_links/new" Artist Links
- else
.block__header
span.block__header__title Artist Links
@@ -91,10 +91,10 @@
- else
' Hidden
' •
- a href=Routes.profile_artist_link_path(@conn, :edit, @user, link)
+ a href=~p"/profiles/#{@user}/artist_links/#{link}/edit"
' Edit
' •
- a href=Routes.admin_artist_link_reject_path(@conn, :create, link) data-method="post"
+ a href=~p"/admin/artist_links/#{link}/reject" data-method="post"
' Reject
- else
=> unless link.public do
@@ -103,7 +103,7 @@
.block
= if manages_awards?(@conn) and not hide_staff_tools?(@conn) do
- a.block__header--single-item href=Routes.profile_award_path(@conn, :new, @user) Badges
+ a.block__header--single-item href=~p"/profiles/#{@user}/awards/new" Badges
- else
.block__header
span.block__header__title Badges
@@ -120,16 +120,16 @@
= if manages_awards?(@conn) do
.flex__grow.center
- a href=Routes.profile_award_path(@conn, :delete, @user, award) data-method="delete" data-confirm="Are you really, really sure?"
+ a href=~p"/profiles/#{@user}/awards/#{award}" data-method="delete" data-confirm="Are you really, really sure?"
' Remove
br
- a href=Routes.profile_award_path(@conn, :edit, @user, award)
+ a href=~p"/profiles/#{@user}/awards/#{award}/edit"
' Edit
.block
.block__header
= if can?(@conn, :edit_description, @user) do
- a.block__header--single-item href=Routes.profile_description_path(@conn, :edit, @user) About Me
+ a.block__header--single-item href=~p"/profiles/#{@user}/description/edit" About Me
- else
span.block__header__title About Me
@@ -137,7 +137,7 @@
= if can_read_mod_notes?(@conn) and not hide_staff_tools?(@conn) do
.block
- a.block__header--single-item href=Routes.profile_detail_path(@conn, :index, @user) Mod Notes
+ a.block__header--single-item href=~p"/profiles/#{@user}/details" Mod Notes
table.table
thead
tr
@@ -150,15 +150,15 @@
td = pretty_time(mod_note.created_at)
= if can_index_user?(@conn) do
.block
- a.block__header--single-item href=Routes.profile_scratchpad_path(@conn, :edit, @user) Moderation Scratchpad
+ a.block__header--single-item href=~p"/profiles/#{@user}/scratchpad/edit" Moderation Scratchpad
.block__content.profile-about
= @scratchpad
.column-layout__main
= render PhilomenaWeb.ProfileView, "_statistics.html", user: @user, statistics: @statistics, conn: @conn
- = render PhilomenaWeb.ProfileView, "_recent_images.html", title: "Recent Artwork", images: @recent_artwork, view_all_path: Routes.search_path(@conn, :index, q: tag_disjunction(@tags)), conn: @conn
- = render PhilomenaWeb.ProfileView, "_recent_images.html", title: "Recent Uploads", images: @recent_uploads, view_all_path: Routes.search_path(@conn, :index, q: "uploader_id:#{@user.id}"), conn: @conn
- = render PhilomenaWeb.ProfileView, "_recent_images.html", title: "Recent Favorites", images: @recent_faves, view_all_path: Routes.search_path(@conn, :index, q: "faved_by_id:#{@user.id}"), conn: @conn
+ = render PhilomenaWeb.ProfileView, "_recent_images.html", title: "Recent Artwork", images: @recent_artwork, view_all_path: ~p"/search?#{[q: tag_disjunction(@tags)]}", conn: @conn
+ = render PhilomenaWeb.ProfileView, "_recent_images.html", title: "Recent Uploads", images: @recent_uploads, view_all_path: ~p"/search?#{[q: "uploader_id:#{@user.id}"]}", conn: @conn
+ = render PhilomenaWeb.ProfileView, "_recent_images.html", title: "Recent Favorites", images: @recent_faves, view_all_path: ~p"/search?#{[q: "faved_by_id:#{@user.id}"]}", conn: @conn
= render PhilomenaWeb.ProfileView, "_recent_galleries.html", galleries: @recent_galleries, user: @user, conn: @conn
= render PhilomenaWeb.ProfileView, "_recent_comments.html", comments: @recent_comments, user: @user, conn: @conn
= render PhilomenaWeb.ProfileView, "_recent_posts.html", posts: @recent_posts, user: @user, conn: @conn
diff --git a/lib/philomena_web/templates/profile/source_change/index.html.slime b/lib/philomena_web/templates/profile/source_change/index.html.slime
index 906a2820..d03fb4f5 100644
--- a/lib/philomena_web/templates/profile/source_change/index.html.slime
+++ b/lib/philomena_web/templates/profile/source_change/index.html.slime
@@ -1,9 +1,9 @@
h1
' Source changes by
- a href=Routes.profile_path(@conn, :show, @user)
+ a href=~p"/profiles/#{@user}"
= @user.name
-- route = fn p -> Routes.profile_source_change_path(@conn, :index, @user, p) end
+- route = fn p -> ~p"/profiles/#{@user}/source_changes?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @source_changes, route: route, conn: @conn
= render PhilomenaWeb.SourceChangeView, "index.html", conn: @conn, source_changes: @source_changes, pagination: pagination
\ No newline at end of file
diff --git a/lib/philomena_web/templates/profile/tag_change/index.html.slime b/lib/philomena_web/templates/profile/tag_change/index.html.slime
index 806d843a..0cbc97dd 100644
--- a/lib/philomena_web/templates/profile/tag_change/index.html.slime
+++ b/lib/philomena_web/templates/profile/tag_change/index.html.slime
@@ -1,20 +1,20 @@
h1
' Tag changes by
- a href=Routes.profile_path(@conn, :show, @user)
+ a href=~p"/profiles/#{@user}"
= @user.name
-- route = fn p -> Routes.profile_tag_change_path(@conn, :index, @user, p) end
+- route = fn p -> ~p"/profiles/#{@user}/tag_changes?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @tag_changes, route: route, conn: @conn, params: @pagination_params
.block
.block__header
- = form_for @conn, Routes.profile_tag_change_path(@conn, :index, @user), [method: "get", enforce_utf8: false], fn f ->
+ = form_for @conn, ~p"/profiles/#{@user}/tag_changes", [method: "get", enforce_utf8: false], fn f ->
= text_input f, :only_tag, class: "input", placeholder: "Tag", title: "Only show this tag", autocapitalize: "none"
= submit "Search", class: "button", title: "Search"
- = link "Removed", to: Routes.profile_tag_change_path(@conn, :index, @user, Keyword.merge(@pagination_params, added: 0))
- = link "Added", to: Routes.profile_tag_change_path(@conn, :index, @user, Keyword.merge(@pagination_params, added: 1))
- = link "All", to: Routes.profile_tag_change_path(@conn, :index, @user, Keyword.delete(@pagination_params, :added))
+ = link "Removed", to: ~p"/profiles/#{@user}/tag_changes?#{Keyword.merge(@pagination_params, added: 0)}"
+ = link "Added", to: ~p"/profiles/#{@user}/tag_changes?#{Keyword.merge(@pagination_params, added: 1)}"
+ = link "All", to: ~p"/profiles/#{@user}/tag_changes?#{Keyword.delete(@pagination_params, :added)}"
.block__header.block__header--light
span.block__header__title.page__info
diff --git a/lib/philomena_web/templates/registration/edit.html.slime b/lib/philomena_web/templates/registration/edit.html.slime
index 88bfd1aa..a0134b6e 100644
--- a/lib/philomena_web/templates/registration/edit.html.slime
+++ b/lib/philomena_web/templates/registration/edit.html.slime
@@ -6,16 +6,16 @@ p
p
' Looking for two factor authentication?
- = link "Click here!", to: Routes.registration_totp_path(@conn, :edit)
+ = link "Click here!", to: ~p"/registrations/totp/edit"
p
' Looking to change your avatar?
- = link "Click here!", to: Routes.avatar_path(@conn, :edit)
+ = link "Click here!", to: ~p"/avatar/edit"
= if can?(@conn, :change_username, @current_user) do
p
' Looking to change your username?
- = link "Click here!", to: Routes.registration_name_path(@conn, :edit)
+ = link "Click here!", to: ~p"/registrations/name/edit"
h3 API Key
p
@@ -33,7 +33,7 @@ p
h3 Change email
-= form_for @email_changeset, Routes.registration_email_path(@conn, :create), [method: :post], fn f ->
+= form_for @email_changeset, ~p"/registrations/email", [method: :post], fn f ->
= if @email_changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
@@ -51,7 +51,7 @@ h3 Change email
h3 Change password
-= form_for @password_changeset, Routes.registration_password_path(@conn, :update), fn f ->
+= form_for @password_changeset, ~p"/registrations/password", fn f ->
= if @password_changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
diff --git a/lib/philomena_web/templates/registration/name/edit.html.slime b/lib/philomena_web/templates/registration/name/edit.html.slime
index 529b57a1..1f9bce28 100644
--- a/lib/philomena_web/templates/registration/name/edit.html.slime
+++ b/lib/philomena_web/templates/registration/name/edit.html.slime
@@ -1,6 +1,6 @@
h1 Editing Name
-= form_for @changeset, Routes.registration_name_path(@conn, :update), [as: :user], fn f ->
+= form_for @changeset, ~p"/registrations/name", [as: :user], fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
@@ -14,4 +14,4 @@ h1 Editing Name
.action
= submit "Save", class: "button"
-p = link "Back", to: Routes.registration_path(@conn, :edit)
+p = link "Back", to: ~p"/registrations/edit"
diff --git a/lib/philomena_web/templates/registration/new.html.slime b/lib/philomena_web/templates/registration/new.html.slime
index 99e49ab6..82d8b8d5 100644
--- a/lib/philomena_web/templates/registration/new.html.slime
+++ b/lib/philomena_web/templates/registration/new.html.slime
@@ -1,6 +1,6 @@
h1 Register
-= form_for @changeset, Routes.registration_path(@conn, :create), fn f ->
+= form_for @changeset, ~p"/registrations", fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
diff --git a/lib/philomena_web/templates/registration/totp/edit.html.slime b/lib/philomena_web/templates/registration/totp/edit.html.slime
index 9c95f2f8..8fd3028b 100644
--- a/lib/philomena_web/templates/registration/totp/edit.html.slime
+++ b/lib/philomena_web/templates/registration/totp/edit.html.slime
@@ -1,6 +1,6 @@
h1 Two Factor Authentication
-= form_for @changeset, Routes.registration_totp_path(@conn, :update), [as: :user], fn f ->
+= form_for @changeset, ~p"/registrations/totp", [as: :user], fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
@@ -133,4 +133,4 @@ h1 Two Factor Authentication
= submit "Save Account", class: "button"
-p = link "Back", to: Routes.registration_path(@conn, :edit)
+p = link "Back", to: ~p"/registrations/edit"
diff --git a/lib/philomena_web/templates/report/index.html.slime b/lib/philomena_web/templates/report/index.html.slime
index 48bb98b8..a7e35224 100644
--- a/lib/philomena_web/templates/report/index.html.slime
+++ b/lib/philomena_web/templates/report/index.html.slime
@@ -2,7 +2,7 @@ h1 Your Reports
.block
.block__header
span.block__header__title Reports
- - route = fn p -> Routes.report_path(@conn, :index, p) end
+ - route = fn p -> ~p"/reports?#{p}" end
= render PhilomenaWeb.PaginationView, "_pagination.html", page: @reports, route: route, conn: @conn
.block__content
diff --git a/lib/philomena_web/templates/search/_form.html.slime b/lib/philomena_web/templates/search/_form.html.slime
index d5b52422..efc065af 100644
--- a/lib/philomena_web/templates/search/_form.html.slime
+++ b/lib/philomena_web/templates/search/_form.html.slime
@@ -1,6 +1,6 @@
h1 Search
-= form_for :search, Routes.search_path(@conn, :index), [id: "searchform", method: "get", class: "js-search-form", enforce_utf8: false], fn f ->
+= form_for :search, ~p"/search", [id: "searchform", method: "get", class: "js-search-form", enforce_utf8: false], fn f ->
= text_input f, :q, class: "input input--wide js-search-field", placeholder: "Search terms are chained with commas", autocapitalize: "none", name: "q", value: @conn.params["q"]
.block
diff --git a/lib/philomena_web/templates/search/index.html.slime b/lib/philomena_web/templates/search/index.html.slime
index 2c4cffe9..130d7dd4 100644
--- a/lib/philomena_web/templates/search/index.html.slime
+++ b/lib/philomena_web/templates/search/index.html.slime
@@ -1,6 +1,6 @@
= cond do
- Enum.any?(@images) or override_display(@tags) ->
- = render PhilomenaWeb.ImageView, "index.html", conn: @conn, tags: @tags, images: @images, header: "Searching for #{@conn.params["q"]}", route: fn p -> Routes.search_path(@conn, :index, p) end, scope: scope(@conn)
+ = render PhilomenaWeb.ImageView, "index.html", conn: @conn, tags: @tags, images: @images, header: "Searching for #{@conn.params["q"]}", route: fn p -> ~p"/search?#{p}" end, scope: scope(@conn)
- assigns[:error] ->
.block.block--fixed.block--danger
diff --git a/lib/philomena_web/templates/search/reverse/index.html.slime b/lib/philomena_web/templates/search/reverse/index.html.slime
index a4c24e01..876be913 100644
--- a/lib/philomena_web/templates/search/reverse/index.html.slime
+++ b/lib/philomena_web/templates/search/reverse/index.html.slime
@@ -1,6 +1,6 @@
h1 Reverse Search
-= form_for :image, Routes.search_reverse_path(@conn, :create), [multipart: true], fn f ->
+= form_for :image, ~p"/search/reverse", [multipart: true], fn f ->
p
' Basic image similarity search. Finds uploaded images similar to the one
' provided based on simple intensities and uses the median frame of
@@ -46,7 +46,7 @@ h1 Reverse Search
= for match <- @images do
tr
th
- h3 = link "##{match.id}", to: Routes.image_path(@conn, :show, match)
+ h3 = link "##{match.id}", to: ~p"/images/#{match}"
p
= if image_has_sources(match) do
span.source_url
diff --git a/lib/philomena_web/templates/session/new.html.slime b/lib/philomena_web/templates/session/new.html.slime
index 112ebaae..3d856c2d 100644
--- a/lib/philomena_web/templates/session/new.html.slime
+++ b/lib/philomena_web/templates/session/new.html.slime
@@ -1,13 +1,13 @@
h1 Sign in
-= form_for @conn, Routes.session_path(@conn, :create), [as: :user], fn f ->
+= form_for @conn, ~p"/sessions", [as: :user], fn f ->
= if @error_message do
.alert.alert-danger
p = @error_message
- p = link "Resend unlock instructions", to: Routes.unlock_path(@conn, :new)
- p = link "Resend confirmation email", to: Routes.confirmation_path(@conn, :new)
+ p = link "Resend unlock instructions", to: ~p"/unlocks/new"
+ p = link "Resend confirmation email", to: ~p"/confirmations/new"
- p = link "Forgot your password?", to: Routes.password_path(@conn, :new)
+ p = link "Forgot your password?", to: ~p"/passwords/new"
.field
= email_input f, :email, class: "input", required: true, placeholder: "Email", autofocus: true, pattern: ~S/[^\s]+@[^\s]+\.[^\s]+/
diff --git a/lib/philomena_web/templates/session/totp/new.html.slime b/lib/philomena_web/templates/session/totp/new.html.slime
index 0c3bf9eb..0a632f9f 100644
--- a/lib/philomena_web/templates/session/totp/new.html.slime
+++ b/lib/philomena_web/templates/session/totp/new.html.slime
@@ -1,6 +1,6 @@
h1 Two Factor Authentication
-= form_for @changeset, Routes.session_totp_path(@conn, :create), [as: :user, method: "post"], fn f ->
+= form_for @changeset, ~p"/sessions/totp", [as: :user, method: "post"], fn f ->
.field
h4 Please enter your 2FA code
= text_input f, :twofactor_token, class: "input", placeholder: "6-digit code", required: true, autofocus: true, autocomplete: "off"
diff --git a/lib/philomena_web/templates/setting/edit.html.slime b/lib/philomena_web/templates/setting/edit.html.slime
index 2809de42..a2185cc0 100644
--- a/lib/philomena_web/templates/setting/edit.html.slime
+++ b/lib/philomena_web/templates/setting/edit.html.slime
@@ -1,5 +1,5 @@
h1 Content Settings
-= form_for @changeset, Routes.setting_path(@conn, :update), [method: "put"], fn f ->
+= form_for @changeset, ~p"/settings", [method: "put"], fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
@@ -51,7 +51,7 @@ h1 Content Settings
code>
= link("Click to show", to: "#", data: [click_show: "#rss-link", click_hide: "#rss-feed-button"])
#rss-link.hidden
- = url_input f, :subscribe_url, value: Routes.api_rss_watched_url(@conn, :index, key: @conn.assigns.current_user.authentication_token), class: "input input--wide"
+ = url_input f, :subscribe_url, value: url(~p"/api/v1/rss/watched?#{[key: @conn.assigns.current_user.authentication_token]}"), class: "input input--wide"
br
' Do not share this URL with anyone, it may allow an attacker to compromise your account.
@@ -184,7 +184,7 @@ h1 Content Settings
.block__tab.hidden data-tab="join-the-herd"
p
' Consider
- => link "creating an account!", to: Routes.registration_path(@conn, :new)
+ => link "creating an account!", to: ~p"/registrations/new"
br
' You will be able to customize the number of images and comments you get on a single page, as well as change the appearance of the site with custom themes.
diff --git a/lib/philomena_web/templates/source_change/index.html.slime b/lib/philomena_web/templates/source_change/index.html.slime
index 05971a76..fe4b37b2 100644
--- a/lib/philomena_web/templates/source_change/index.html.slime
+++ b/lib/philomena_web/templates/source_change/index.html.slime
@@ -16,7 +16,7 @@
= for source_change <- @source_changes do
tr
td.center
- = link source_change.image_id, to: Routes.image_path(@conn, :show, source_change.image)
+ = link source_change.image_id, to: ~p"/images/#{source_change.image}"
td.center
= render PhilomenaWeb.ImageView, "_image_container.html", image: source_change.image, size: :thumb_tiny, conn: @conn
diff --git a/lib/philomena_web/templates/staff/index.html.slime b/lib/philomena_web/templates/staff/index.html.slime
index 64e43a2a..c8373b59 100644
--- a/lib/philomena_web/templates/staff/index.html.slime
+++ b/lib/philomena_web/templates/staff/index.html.slime
@@ -37,12 +37,12 @@ h1 Staff
.block__content.staff-block__user
.staff-block__user-card
.staff-block__avatar
- a.profile-block href=Routes.profile_path(@conn, :show, user)
+ a.profile-block href=~p"/profiles/#{user}"
= render PhilomenaWeb.UserAttributionView, "_user_avatar.html", object: %{user: user}, class: "avatar--125px"
p
b = user.name
.staff-block__info
- = link to: Routes.conversation_path(@conn, :new, recipient: user.name), class: "button" do
+ = link to: ~p"/conversations/new?#{[recipient: user.name]}", class: "button" do
i.fa.fa-envelope>
' Send PM
hr.staff-block__separator
diff --git a/lib/philomena_web/templates/tag/_tag.html.slime b/lib/philomena_web/templates/tag/_tag.html.slime
index 4bc77882..0de59b7e 100644
--- a/lib/philomena_web/templates/tag/_tag.html.slime
+++ b/lib/philomena_web/templates/tag/_tag.html.slime
@@ -13,14 +13,14 @@ span.tag.dropdown data-tag-category="#{@tag.category}" data-tag-id="#{@tag.id}"
a.tag__name< href=pretty_tag_path(@tag) title="#{@tag.short_description}" = @tag.name
div.dropdown__content
- a.tag__dropdown__link.hidden data-method="delete" data-remote="true" data-tag-action="unwatch" href=Routes.tag_watch_path(@conn, :delete, @tag) Unwatch
- a.tag__dropdown__link.hidden data-method="post" data-remote="true" data-tag-action="watch" href=Routes.tag_watch_path(@conn, :create, @tag) Watch
+ a.tag__dropdown__link.hidden data-method="delete" data-remote="true" data-tag-action="unwatch" href=~p"/tags/#{@tag}/watch" Unwatch
+ a.tag__dropdown__link.hidden data-method="post" data-remote="true" data-tag-action="watch" href=~p"/tags/#{@tag}/watch" Watch
- a.tag__dropdown__link.hidden data-method="delete" data-remote="true" data-tag-action="unspoiler" href=Routes.filter_spoiler_path(@conn, :delete, tag: @tag) Unspoiler
- a.tag__dropdown__link.hidden data-method="post" data-remote="true" data-tag-action="spoiler" href=Routes.filter_spoiler_path(@conn, :create, tag: @tag) Spoiler
+ a.tag__dropdown__link.hidden data-method="delete" data-remote="true" data-tag-action="unspoiler" href=~p"/filters/spoiler?#{[tag: @tag]}" Unspoiler
+ a.tag__dropdown__link.hidden data-method="post" data-remote="true" data-tag-action="spoiler" href=~p"/filters/spoiler?#{[tag: @tag]}" Spoiler
- a.tag__dropdown__link.hidden data-method="delete" data-remote="true" data-tag-action="unhide" href=Routes.filter_hide_path(@conn, :delete, tag: @tag) Unhide
- a.tag__dropdown__link.hidden data-method="post" data-remote="true" data-tag-action="hide" href=Routes.filter_hide_path(@conn, :create, tag: @tag) Hide
+ a.tag__dropdown__link.hidden data-method="delete" data-remote="true" data-tag-action="unhide" href=~p"/filters/hide?#{[tag: @tag]}" Unhide
+ a.tag__dropdown__link.hidden data-method="post" data-remote="true" data-tag-action="hide" href=~p"/filters/hide?#{[tag: @tag]}" Hide
a.tag__dropdown__link.hidden href="/sessions/new" Sign in to Watch
a.tag__dropdown__link.hidden href="/filters" Filter
diff --git a/lib/philomena_web/templates/tag/_tag_info_row.html.slime b/lib/philomena_web/templates/tag/_tag_info_row.html.slime
index 5e38db97..2bd36b42 100644
--- a/lib/philomena_web/templates/tag/_tag_info_row.html.slime
+++ b/lib/philomena_web/templates/tag/_tag_info_row.html.slime
@@ -7,12 +7,12 @@
.flex__grow
= render PhilomenaWeb.TagView, "_tag.html", tag: @tag, conn: @conn
- = link "Tag changes", to: Routes.tag_tag_change_path(@conn, :index, @tag), class: "detail-link"
+ = link "Tag changes", to: ~p"/tags/#{@tag}/tag_changes", class: "detail-link"
= if manages_tags?(@conn) do
- = link "Edit details", to: Routes.tag_path(@conn, :edit, @tag), class: "detail-link"
- = link "Usage", to: Routes.tag_detail_path(@conn, :index, @tag), class: "detail-link"
+ = link "Edit details", to: ~p"/tags/#{@tag}/edit", class: "detail-link"
+ = link "Usage", to: ~p"/tags/#{@tag}/details", class: "detail-link"
= if manages_dnp?(@conn) do
- = link "Create new DNP entry", to: Routes.dnp_entry_path(@conn, :new, tag_id: @tag.id), class: "detail-link"
+ = link "Create new DNP entry", to: ~p"/dnp/new?#{[tag_id: @tag.id]}", class: "detail-link"
br
@@ -29,14 +29,14 @@
= if Enum.any?(@tag.aliases) do
strong> Aliases:
= if aliases_tags?(@conn) do
- = map_join(@tag.aliases, ", ", &link(&1.name, to: Routes.tag_alias_path(@conn, :edit, &1)))
+ = map_join(@tag.aliases, ", ", &link(&1.name, to: ~p"/tags/#{&1}/alias/edit"))
- else
= map_join(@tag.aliases, ", ", & &1.name)
br
= if Enum.any?(@tag.implied_tags) do
strong> Implies:
- = map_join(@tag.implied_tags, ", ", &link(&1.name, to: Routes.tag_path(@conn, :show, &1)))
+ = map_join(@tag.implied_tags, ", ", &link(&1.name, to: ~p"/tags/#{&1}"))
br
= if Enum.any?(@tag.hidden_links) and manages_links?(@conn) do
@@ -44,7 +44,7 @@
br
= for artist_link <- @tag.hidden_links do
- => link artist_link.user.name, to: Routes.profile_path(@conn, :show, artist_link.user)
+ => link artist_link.user.name, to: ~p"/profiles/#{artist_link.user}"
' →
=> link artist_link.uri, to: artist_link.uri
br
@@ -70,18 +70,18 @@
- users = Enum.map(@tag.public_links, & &1.user) |> Enum.uniq_by(& &1.id)
= for user <- users do
- => link user.name, to: Routes.profile_path(@conn, :show, user)
+ => link user.name, to: ~p"/profiles/#{user}"
br
= if Enum.any?(@tag.channels) do
strong> Associated streams:
= for channel <- @tag.channels do
- => link channel.title, to: Routes.channel_path(@conn, :show, channel)
+ => link channel.title, to: ~p"/channels/#{channel}"
= if can?(@conn, :edit, channel) do
| (
- = link "Edit", to: Routes.channel_path(@conn, :edit, channel)
+ = link "Edit", to: ~p"/channels/#{channel}/edit"
' )
br
@@ -94,7 +94,7 @@
.toggle-box-container
.toggle-box-container__content
= map_join @tag.implied_by_tags, ", ", fn tag ->
- = link tag.name, to: Routes.tag_path(@conn, :show, tag)
+ = link tag.name, to: ~p"/tags/#{tag}"
br
@@ -117,5 +117,5 @@
=> body
| (
- = link "more info", to: Routes.dnp_entry_path(@conn, :show, entry)
+ = link "more info", to: ~p"/dnp/#{entry}"
| )
diff --git a/lib/philomena_web/templates/tag/alias/edit.html.slime b/lib/philomena_web/templates/tag/alias/edit.html.slime
index 706545bc..346aae09 100644
--- a/lib/philomena_web/templates/tag/alias/edit.html.slime
+++ b/lib/philomena_web/templates/tag/alias/edit.html.slime
@@ -2,7 +2,7 @@ h1
' Aliasing tag
= @tag.name
-= form_for @changeset, Routes.tag_alias_path(@conn, :update, @tag), [method: "put"], fn f ->
+= form_for @changeset, ~p"/tags/#{@tag}/alias", [method: "put"], fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
@@ -17,7 +17,7 @@ h1
=> submit "Alias tag", class: "button"
br
-= button_to "Remove tag alias", Routes.tag_alias_path(@conn, :delete, @tag), method: "delete", class: "button", data: [confirm: "Are you really, really sure?", disable_with: raw("Saving…")]
+= button_to "Remove tag alias", ~p"/tags/#{@tag}/alias", method: "delete", class: "button", data: [confirm: "Are you really, really sure?", disable_with: raw("Saving…")]
br
-= link "Back", to: Routes.tag_path(@conn, :show, @tag)
+= link "Back", to: ~p"/tags/#{@tag}"
diff --git a/lib/philomena_web/templates/tag/detail/_filters.html.slime b/lib/philomena_web/templates/tag/detail/_filters.html.slime
index b09071a8..8dfdb621 100644
--- a/lib/philomena_web/templates/tag/detail/_filters.html.slime
+++ b/lib/philomena_web/templates/tag/detail/_filters.html.slime
@@ -9,7 +9,7 @@ table.table
tbody
= for filter <- @filters do
tr
- td = link filter.name, to: Routes.filter_path(@conn, :show, filter)
+ td = link filter.name, to: ~p"/filters/#{filter}"
td
= cond do
- filter.system ->
@@ -23,7 +23,7 @@ table.table
td
= if filter.user do
- = link filter.user.name, to: Routes.profile_path(@conn, :show, filter.user)
+ = link filter.user.name, to: ~p"/profiles/#{filter.user}"
- else
' No user associated
diff --git a/lib/philomena_web/templates/tag/detail/index.html.slime b/lib/philomena_web/templates/tag/detail/index.html.slime
index 8a11358a..5271cab2 100644
--- a/lib/philomena_web/templates/tag/detail/index.html.slime
+++ b/lib/philomena_web/templates/tag/detail/index.html.slime
@@ -1,6 +1,6 @@
h1
' Tag Usage for
- = link @tag.name, to: Routes.tag_path(@conn, :show, @tag)
+ = link @tag.name, to: ~p"/tags/#{@tag}"
h3 Filters that spoiler this tag:
= render PhilomenaWeb.Tag.DetailView, "_filters.html", filters: @filters_spoilering, conn: @conn
@@ -14,4 +14,4 @@ h3
| )
= for u <- @users_watching do
- = link u.name, to: Routes.profile_path(@conn, :show, u), class: "interaction-user-list-item"
+ = link u.name, to: ~p"/profiles/#{u}", class: "interaction-user-list-item"
diff --git a/lib/philomena_web/templates/tag/edit.html.slime b/lib/philomena_web/templates/tag/edit.html.slime
index ee2a6d4d..f5faedb7 100644
--- a/lib/philomena_web/templates/tag/edit.html.slime
+++ b/lib/philomena_web/templates/tag/edit.html.slime
@@ -1,10 +1,10 @@
h1 Editing Tag
-p = link "Edit image", to: Routes.tag_image_path(@conn, :edit, @tag)
+p = link "Edit image", to: ~p"/tags/#{@tag}/image/edit"
= if can?(@conn, :alias, @tag) do
- p = link "Edit aliases", to: Routes.tag_alias_path(@conn, :edit, @tag)
+ p = link "Edit aliases", to: ~p"/tags/#{@tag}/alias/edit"
-= form_for @changeset, Routes.tag_path(@conn, :update, @tag), [class: "form"], fn f ->
+= form_for @changeset, ~p"/tags/#{@tag}", [class: "form"], fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
@@ -44,10 +44,10 @@ br
label for="tag-management" Tag Processing
.toggle-box-container
.toggle-box-container__content
- = button_to "Rebuild index", Routes.tag_reindex_path(@conn, :create, @tag), method: "post", class: "button", data: [confirm: "Are you really, really sure?", disable_with: raw("Reindexing…")]
+ = button_to "Rebuild index", ~p"/tags/#{@tag}/reindex", method: "post", class: "button", data: [confirm: "Are you really, really sure?", disable_with: raw("Reindexing…")]
p Use this if the tag displays the wrong number of images or returns the wrong search results.
- = button_to "Destroy tag", Routes.tag_path(@conn, :delete, @tag), method: "delete", class: "button button--state-danger", data: [confirm: "Are you really, really sure?", disable_with: raw("Deleting…")]
+ = button_to "Destroy tag", ~p"/tags/#{@tag}", method: "delete", class: "button button--state-danger", data: [confirm: "Are you really, really sure?", disable_with: raw("Deleting…")]
p
strong Irreversible. Use with extreme caution!
ul
diff --git a/lib/philomena_web/templates/tag/image/edit.html.slime b/lib/philomena_web/templates/tag/image/edit.html.slime
index c452561f..778a9b87 100644
--- a/lib/philomena_web/templates/tag/image/edit.html.slime
+++ b/lib/philomena_web/templates/tag/image/edit.html.slime
@@ -15,7 +15,7 @@
p Add a new image or remove the existing one here.
p SVG is preferred.
- = form_for @changeset, Routes.tag_image_path(@conn, :update, @tag), [method: "put", multipart: true], fn f ->
+ = form_for @changeset, ~p"/tags/#{@tag}/image", [method: "put", multipart: true], fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
@@ -35,7 +35,7 @@
=> submit "Update tag image", class: "button"
br
- = button_to "Remove tag image", Routes.tag_image_path(@conn, :delete, @tag), method: "delete", class: "button", data: [confirm: "Are you really, really sure?"]
+ = button_to "Remove tag image", ~p"/tags/#{@tag}/image", method: "delete", class: "button", data: [confirm: "Are you really, really sure?"]
br
- = link "Back", to: Routes.tag_path(@conn, :show, @tag)
+ = link "Back", to: ~p"/tags/#{@tag}"
diff --git a/lib/philomena_web/templates/tag/index.html.slime b/lib/philomena_web/templates/tag/index.html.slime
index 605dfa9b..89931cea 100644
--- a/lib/philomena_web/templates/tag/index.html.slime
+++ b/lib/philomena_web/templates/tag/index.html.slime
@@ -1,6 +1,6 @@
h1 Tags
-= form_for :tags, Routes.tag_path(@conn, :index), [method: "get", class: "hform", enforce_utf8: false], fn f ->
+= form_for :tags, ~p"/tags", [method: "get", class: "hform", enforce_utf8: false], fn f ->
.field
= text_input f, :tq, name: :tq, value: @conn.params["tq"] || "*", class: "input hform__text", placeholder: "Search tags", autocapitalize: "none"
= submit "Search", class: "hform__button button"
@@ -15,7 +15,7 @@ h2 Search Results
= cond do
- Enum.any?(@tags) ->
- - route = fn p -> Routes.tag_path(@conn, :index, p) end
+ - route = fn p -> ~p"/tags?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @tags, route: route, params: [tq: @conn.params["tq"] || "*"]
= render PhilomenaWeb.TagView, "_tag_list.html", tags: @tags, conn: @conn
@@ -56,102 +56,102 @@ table.table
td Literal
td Matches the name of the target tag, if this tag is aliased.
td
- code = link "alias_of:twilight sparkle", to: Routes.tag_path(@conn, :index, tq: "alias_of:twilight sparkle")
+ code = link "alias_of:twilight sparkle", to: ~p"/tags?#{[tq: "alias_of:twilight sparkle"]}"
tr
td
code aliased
td Boolean
td Matches when this tag is aliased.
td
- code = link "aliased:true", to: Routes.tag_path(@conn, :index, tq: "aliased:true")
+ code = link "aliased:true", to: ~p"/tags?#{[tq: "aliased:true"]}"
tr
td
code aliases
td Literal
td Matches the name of any of this tag's aliases.
td
- code = link "aliases:ts", to: Routes.tag_path(@conn, :index, tq: "aliases:ts")
+ code = link "aliases:ts", to: ~p"/tags?#{[tq: "aliases:ts"]}"
tr
td
code analyzed_name
td Full Text
td Matches the name of this tag. This is the default field.
td
- code = link "analyzed_name:wing", to: Routes.tag_path(@conn, :index, tq: "analyzed_name:wing")
+ code = link "analyzed_name:wing", to: ~p"/tags?#{[tq: "analyzed_name:wing"]}"
tr
td
code category
td Literal
td Matches the category this tag belongs to.
td
- code = link "category:origin", to: Routes.tag_path(@conn, :index, tq: "category:origin")
+ code = link "category:origin", to: ~p"/tags?#{[tq: "category:origin"]}"
tr
td
code description
td Full Text
td Matches the text of the full description for this tag.
td
- code = link "description:species", to: Routes.tag_path(@conn, :index, tq: "description:species")
+ code = link "description:species", to: ~p"/tags?#{[tq: "description:species"]}"
tr
td
code id
td Numeric Range
td Matches the numeric surrogate key for this tag.
td
- code = link "id:40482", to: Routes.tag_path(@conn, :index, tq: "id:40482")
+ code = link "id:40482", to: ~p"/tags?#{[tq: "id:40482"]}"
tr
td
code images
td Numeric Range
td Matches tags with the specified image count.
td
- code = link "images.lte:1000", to: Routes.tag_path(@conn, :index, tq: "images.lte:1000")
+ code = link "images.lte:1000", to: ~p"/tags?#{[tq: "images.lte:1000"]}"
tr
td
code implied_by
td Literal
td Matches this tag if it is implied by the given tag.
td
- code = link "implied_by:transparent background", to: Routes.tag_path(@conn, :index, tq: "implied_by:transparent background")
+ code = link "implied_by:transparent background", to: ~p"/tags?#{[tq: "implied_by:transparent background"]}"
tr
td
code implies
td Literal
td Matches this tag if it implies the given tag.
td
- code = link "implies:shipping", to: Routes.tag_path(@conn, :index, tq: "implies:shipping")
+ code = link "implies:shipping", to: ~p"/tags?#{[tq: "implies:shipping"]}"
tr
td
code name
td Literal
td Matches the exact name of this tag.
td
- code = link "name:safe", to: Routes.tag_path(@conn, :index, tq: "name:safe")
+ code = link "name:safe", to: ~p"/tags?#{[tq: "name:safe"]}"
tr
td
code name_in_namespace
td Literal
td Matches the name of this tag with any namespace component removed.
td
- code = link "name_in_namespace:johnjoseco", to: Routes.tag_path(@conn, :index, tq: "name_in_namespace:johnjoseco")
+ code = link "name_in_namespace:johnjoseco", to: ~p"/tags?#{[tq: "name_in_namespace:johnjoseco"]}"
tr
td
code namespace
td Literal
td Matches tags with the given namespace.
td
- code = link "namespace:artist", to: Routes.tag_path(@conn, :index, tq: "namespace:artist")
+ code = link "namespace:artist", to: ~p"/tags?#{[tq: "namespace:artist"]}"
tr
td
code short_description
td Full Text
td Matches the text of the short description for this tag.
td
- code = link "short_description:gender", to: Routes.tag_path(@conn, :index, tq: "short_description:gender")
+ code = link "short_description:gender", to: ~p"/tags?#{[tq: "short_description:gender"]}"
tr
td
code slug
td Literal
td Matches the slug of this tag.
td
- code = link "slug:-fwslash-mlp-fwslash-", to: Routes.tag_path(@conn, :index, tq: "slug:-fwslash-mlp-fwslash-")
+ code = link "slug:-fwslash-mlp-fwslash-", to: ~p"/tags?#{[tq: "slug:-fwslash-mlp-fwslash-"]}"
diff --git a/lib/philomena_web/templates/tag/show.html.slime b/lib/philomena_web/templates/tag/show.html.slime
index a8b85c43..ad85fbed 100644
--- a/lib/philomena_web/templates/tag/show.html.slime
+++ b/lib/philomena_web/templates/tag/show.html.slime
@@ -1,3 +1,3 @@
-= render PhilomenaWeb.ImageView, "index.html", conn: @conn, tags: @tags, images: @images, header: "Images tagged #{@tag.name}", scope: scope(@conn), route: fn p -> Routes.tag_path(@conn, :show, @tag, p) end
+= render PhilomenaWeb.ImageView, "index.html", conn: @conn, tags: @tags, images: @images, header: "Images tagged #{@tag.name}", scope: scope(@conn), route: fn p -> ~p"/tags/#{@tag}?#{p}" end
= render PhilomenaWeb.SearchView, "_form.html", conn: @conn
diff --git a/lib/philomena_web/templates/tag/tag_change/index.html.slime b/lib/philomena_web/templates/tag/tag_change/index.html.slime
index caf85dbd..a91d1ede 100644
--- a/lib/philomena_web/templates/tag/tag_change/index.html.slime
+++ b/lib/philomena_web/templates/tag/tag_change/index.html.slime
@@ -1,9 +1,9 @@
h1
' Tag changes on tag
- a href=Routes.tag_path(@conn, :show, @tag)
+ a href=~p"/tags/#{@tag}"
= @tag.name
-- route = fn p -> Routes.tag_tag_change_path(@conn, :index, @tag, p) end
+- route = fn p -> ~p"/tags/#{@tag}/tag_changes?#{p}" end
- params = if @conn.params["added"], do: [added: @conn.params["added"]]
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @tag_changes, route: route, conn: @conn, params: params
@@ -12,8 +12,8 @@ h1
span.block__header__title
| Display only:
- = link "Removed", to: Routes.tag_tag_change_path(@conn, :index, @tag, added: 0)
- = link "Added", to: Routes.tag_tag_change_path(@conn, :index, @tag, added: 1)
- = link "All", to: Routes.tag_tag_change_path(@conn, :index, @tag)
+ = link "Removed", to: ~p"/tags/#{@tag}/tag_changes?#{[added: 0]}"
+ = link "Added", to: ~p"/tags/#{@tag}/tag_changes?#{[added: 1]}"
+ = link "All", to: ~p"/tags/#{@tag}/tag_changes"
= render PhilomenaWeb.TagChangeView, "index.html", conn: @conn, tag_changes: @tag_changes, pagination: pagination
diff --git a/lib/philomena_web/templates/tag_change/index.html.slime b/lib/philomena_web/templates/tag_change/index.html.slime
index a5f6b64b..cfffd345 100644
--- a/lib/philomena_web/templates/tag_change/index.html.slime
+++ b/lib/philomena_web/templates/tag_change/index.html.slime
@@ -7,7 +7,7 @@
i.fa.fa-check>
' Toggle all
-= form_for :tag_changes, Routes.tag_change_revert_path(@conn, :create), [class: "tag-changes-form"], fn _f ->
+= form_for :tag_changes, ~p"/tag_changes/revert", [class: "tag-changes-form"], fn _f ->
.block__content
table.table
thead
@@ -31,7 +31,7 @@
input type="checkbox" name="ids[]" value=tag_change.id
td.center
- = link tag_change.image_id, to: Routes.image_path(@conn, :show, tag_change.image)
+ = link tag_change.image_id, to: ~p"/images/#{tag_change.image}"
td.center
= render PhilomenaWeb.ImageView, "_image_container.html", image: tag_change.image, size: :thumb_tiny, conn: @conn
@@ -69,7 +69,7 @@
td.danger No
= if reverts_tag_changes?(@conn) do
td
- a href=Routes.image_tag_change_path(@conn, :delete, tag_change.image, tag_change) data-method="delete" data-confirm="Are you really, really sure?"
+ a href=~p"/images/#{tag_change.image}/tag_changes/#{tag_change}" data-method="delete" data-confirm="Are you really, really sure?"
' Delete from history
.block__header
diff --git a/lib/philomena_web/templates/topic/new.html.slime b/lib/philomena_web/templates/topic/new.html.slime
index 5d42d130..05236f7a 100644
--- a/lib/philomena_web/templates/topic/new.html.slime
+++ b/lib/philomena_web/templates/topic/new.html.slime
@@ -1,4 +1,4 @@
-= form_for @changeset, Routes.forum_topic_path(@conn, :create, @forum), fn f ->
+= form_for @changeset, ~p"/forums/#{@forum}/topics", fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
diff --git a/lib/philomena_web/templates/topic/poll/_display.html.slime b/lib/philomena_web/templates/topic/poll/_display.html.slime
index eb253fbc..780b6336 100644
--- a/lib/philomena_web/templates/topic/poll/_display.html.slime
+++ b/lib/philomena_web/templates/topic/poll/_display.html.slime
@@ -2,7 +2,7 @@
= link "Voting", to: "#", class: "selected", data: [click_tab: "voting"]
= if can?(@conn, :hide, @topic) do
- = link "Voters", to: "#", data: [click_tab: "voters", load_tab: Routes.forum_topic_poll_vote_path(@conn, :index, @forum, @topic)]
+ = link "Voters", to: "#", data: [click_tab: "voters", load_tab: ~p"/forums/#{@forum}/topics/#{@topic}/poll/votes"]
= link "Administrate", to: "#", data: [click_tab: "administration"]
.block__tab data-tab="voting"
@@ -31,6 +31,6 @@
.block__tab.hidden data-tab="voters"
p Loading…
.block__tab.hidden data-tab="administration"
- a.button.button--state-warning.js-staff-action> href=Routes.forum_topic_poll_path(@conn, :edit, @forum, @topic)
+ a.button.button--state-warning.js-staff-action> href=~p"/forums/#{@forum}/topics/#{@topic}/poll/edit"
i.fa.fa-edit>
| Edit
diff --git a/lib/philomena_web/templates/topic/poll/_vote_form.html.slime b/lib/philomena_web/templates/topic/poll/_vote_form.html.slime
index be90c184..08f209ff 100644
--- a/lib/philomena_web/templates/topic/poll/_vote_form.html.slime
+++ b/lib/philomena_web/templates/topic/poll/_vote_form.html.slime
@@ -1,4 +1,4 @@
-= form_for :poll_vote, Routes.forum_topic_poll_vote_path(@conn, :create, @forum, @topic), [class: "poll-vote-form"], fn _f ->
+= form_for :poll_vote, ~p"/forums/#{@forum}/topics/#{@topic}/poll/votes", [class: "poll-vote-form"], fn _f ->
h4.poll__header
' Poll:
= @poll.title
diff --git a/lib/philomena_web/templates/topic/poll/edit.html.slime b/lib/philomena_web/templates/topic/poll/edit.html.slime
index 1282a99e..03cf0640 100644
--- a/lib/philomena_web/templates/topic/poll/edit.html.slime
+++ b/lib/philomena_web/templates/topic/poll/edit.html.slime
@@ -1,6 +1,6 @@
h1 Editing Poll
-= form_for @changeset, Routes.forum_topic_poll_path(@conn, :update, @forum, @topic), fn f ->
+= form_for @changeset, ~p"/forums/#{@forum}/topics/#{@topic}/poll", fn f ->
= render PhilomenaWeb.Topic.PollView, "_form.html", f: f
br
diff --git a/lib/philomena_web/templates/topic/poll/vote/index.html.slime b/lib/philomena_web/templates/topic/poll/vote/index.html.slime
index 5b71a100..749d9cb3 100644
--- a/lib/philomena_web/templates/topic/poll/vote/index.html.slime
+++ b/lib/philomena_web/templates/topic/poll/vote/index.html.slime
@@ -4,8 +4,8 @@
= for vote <- option.poll_votes do
span.interaction-user-list-item
- => link vote.user.name, to: Routes.profile_path(@conn, :show, vote.user)
- /= link "(x)", to: Routes.forum_topic_poll_vote_path(@conn, :delete, @forum, @topic, vote)
+ => link vote.user.name, to: ~p"/profiles/#{vote.user}"
+ /= link "(x)", to: ~p"/forums/#{@forum}/topics/#{@topic}/poll/votes/#{vote}"
- else
p
diff --git a/lib/philomena_web/templates/topic/post/_form.html.slime b/lib/philomena_web/templates/topic/post/_form.html.slime
index aa69b979..dcb15f40 100644
--- a/lib/philomena_web/templates/topic/post/_form.html.slime
+++ b/lib/philomena_web/templates/topic/post/_form.html.slime
@@ -1,4 +1,4 @@
-= form_for @changeset, Routes.forum_topic_post_path(@conn, :create, @forum, @topic), fn f ->
+= form_for @changeset, ~p"/forums/#{@forum}/topics/#{@topic}/posts", fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
diff --git a/lib/philomena_web/templates/topic/post/edit.html.slime b/lib/philomena_web/templates/topic/post/edit.html.slime
index 5f815ff2..b7544121 100644
--- a/lib/philomena_web/templates/topic/post/edit.html.slime
+++ b/lib/philomena_web/templates/topic/post/edit.html.slime
@@ -1,4 +1,4 @@
-= form_for @changeset, Routes.forum_topic_post_path(@conn, :update, @post.topic.forum, @post.topic, @post), fn f ->
+= form_for @changeset, ~p"/forums/#{@post.topic.forum}/topics/#{@post.topic}/posts/#{@post}", fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
diff --git a/lib/philomena_web/templates/topic/post/history/index.html.slime b/lib/philomena_web/templates/topic/post/history/index.html.slime
index c2423ed6..e455ff57 100644
--- a/lib/philomena_web/templates/topic/post/history/index.html.slime
+++ b/lib/philomena_web/templates/topic/post/history/index.html.slime
@@ -2,7 +2,7 @@ h1
' Viewing last 25 versions of post by
= render PhilomenaWeb.UserAttributionView, "_anon_user.html", object: @post, conn: @conn
' in topic
- a href=(Routes.forum_topic_path(@conn, :show, @post.topic.forum, @post.topic, post_id: @post.id) <> "#post_#{@post.id}")
+ a href=(~p"/forums/#{@post.topic.forum}/topics/#{@post.topic}?#{[post_id: @post.id]}" <> "#post_#{@post.id}")
= @post.topic.title
= for version <- @versions do
diff --git a/lib/philomena_web/templates/topic/show.html.slime b/lib/philomena_web/templates/topic/show.html.slime
index ff54dffd..613db6d7 100644
--- a/lib/philomena_web/templates/topic/show.html.slime
+++ b/lib/philomena_web/templates/topic/show.html.slime
@@ -1,4 +1,4 @@
-- route = fn p -> Routes.forum_topic_path(@conn, :show, @forum, @topic, p) end
+- route = fn p -> ~p"/forums/#{@forum}/topics/#{@topic}?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @posts, route: route, last: true
h1 = @topic.title
@@ -16,22 +16,22 @@ h1 = @topic.title
strong> Deleted by:
em
strong
- = link(@topic.deleted_by.name, to: Routes.profile_path(@conn, :show, @topic.deleted_by))
+ = link(@topic.deleted_by.name, to: ~p"/profiles/#{@topic.deleted_by}")
p
- = link(to: Routes.forum_topic_hide_path(@conn, :delete, @forum, @topic), method: :delete, class: "button") do
+ = link(to: ~p"/forums/#{@forum}/topics/#{@topic}/hide", method: :delete, class: "button") do
i.fas.fa-check>
' Restore
/ Header section
.block
.block__header
- => link(@forum.name, to: Routes.forum_path(@conn, :show, @forum))
+ => link(@forum.name, to: ~p"/forums/#{@forum}")
' »
- => link(@topic.title, to: Routes.forum_topic_path(@conn, :show, @forum, @topic))
+ => link(@topic.title, to: ~p"/forums/#{@forum}/topics/#{@topic}")
= if not @topic.hidden_from_users or can?(@conn, :hide, @topic) do
- a href=Routes.post_path(@conn, :index, pq: "topic_id:#{@topic.id}")
+ a href=~p"/posts?#{[pq: "topic_id:#{@topic.id}"]}"
i.fa.fa-fw.fa-search>
' Search Posts
.flex.flex--wrap.block__header.block__header--light.page__header
@@ -86,7 +86,7 @@ h1 = @topic.title
' Locked by:
em
strong
- = link(@topic.locked_by.name, to: Routes.profile_path(@conn, :show, @topic.locked_by))
+ = link(@topic.locked_by.name, to: ~p"/profiles/#{@topic.locked_by}")
/ Post form
= cond do
@@ -116,43 +116,43 @@ h1 = @topic.title
p
= if not @topic.hidden_from_users do
= if @topic.sticky do
- = link(to: Routes.forum_topic_stick_path(@conn, :delete, @forum, @topic), method: :delete, class: "button") do
+ = link(to: ~p"/forums/#{@forum}/topics/#{@topic}/stick", method: :delete, class: "button") do
i.fas.fa-thumbtack>
' Unstick
- else
- = link(to: Routes.forum_topic_stick_path(@conn, :create, @forum, @topic), method: :post, class: "button") do
+ = link(to: ~p"/forums/#{@forum}/topics/#{@topic}/stick", method: :post, class: "button") do
i.fas.fa-thumbtack>
' Stick
= if @topic.locked_at do
- = link(to: Routes.forum_topic_lock_path(@conn, :delete, @forum, @topic), method: :delete, class: "button") do
+ = link(to: ~p"/forums/#{@forum}/topics/#{@topic}/lock", method: :delete, class: "button") do
i.fas.fa-unlock>
' Unlock
- else
- = form_for :topic, Routes.forum_topic_lock_path(@conn, :create, @forum, @topic), [method: :post, class: "hform"], fn f ->
+ = form_for :topic, ~p"/forums/#{@forum}/topics/#{@topic}/lock", [method: :post, class: "hform"], fn f ->
.field
= text_input f, :lock_reason, class: "input hform__text", placeholder: "Lock reason", required: true
= submit class: "hform__button button" do
i.fas.fa-lock>
' Lock
- = form_for @topic_changeset, Routes.forum_topic_path(@conn, :update, @forum, @topic), [method: :put, class: "hform"], fn f ->
+ = form_for @topic_changeset, ~p"/forums/#{@forum}/topics/#{@topic}", [method: :put, class: "hform"], fn f ->
.field
= text_input f, :title, class: "input hform__text", placeholder: "New Title"
= submit class: "hform__button button" do
i.fas.fa-pen>
' Set Title
- = form_for :topic, Routes.forum_topic_move_path(@conn, :create, @forum, @topic), [method: :post, class: "hform"], fn f ->
+ = form_for :topic, ~p"/forums/#{@forum}/topics/#{@topic}/move", [method: :post, class: "hform"], fn f ->
.field
= select f, :target_forum_id, Enum.map(@conn.assigns.forums, &{&1.name, &1.id}), class: "input hform__text"
= submit class: "hform__button button" do
i.fas.fa-truck>
' Move
- = form_for :topic, Routes.forum_topic_hide_path(@conn, :create, @forum, @topic), [method: :post, class: "hform"], fn f ->
+ = form_for :topic, ~p"/forums/#{@forum}/topics/#{@topic}/hide", [method: :post, class: "hform"], fn f ->
.field
= text_input f, :deletion_reason, class: "input hform__text", placeholder: "Deletion reason", required: true
= submit class: "hform__button button" do
diff --git a/lib/philomena_web/templates/topic/subscription/_subscription.html.slime b/lib/philomena_web/templates/topic/subscription/_subscription.html.slime
index 3a2aa6ca..0772283e 100644
--- a/lib/philomena_web/templates/topic/subscription/_subscription.html.slime
+++ b/lib/philomena_web/templates/topic/subscription/_subscription.html.slime
@@ -1,8 +1,8 @@
elixir:
- watch_path = Routes.forum_topic_subscription_path(@conn, :create, @forum, @topic)
+ watch_path = ~p"/forums/#{@forum}/topics/#{@topic}/subscription"
watch_class = if @watching, do: "hidden", else: ""
- unwatch_path = Routes.forum_topic_subscription_path(@conn, :delete, @forum, @topic)
+ unwatch_path = ~p"/forums/#{@forum}/topics/#{@topic}/subscription"
unwatch_class = if @watching, do: "", else: "hidden"
= if @conn.assigns.current_user do
@@ -17,7 +17,7 @@ elixir:
span.hide-mobile
' Unsubscribe
- else
- a href=Routes.session_path(@conn, :new)
+ a href=~p"/sessions/new"
i.fa.fa-bell>
span.hide-mobile
' Subscribe
diff --git a/lib/philomena_web/templates/unlock/new.html.slime b/lib/philomena_web/templates/unlock/new.html.slime
index 5d64af56..9c8e05cc 100644
--- a/lib/philomena_web/templates/unlock/new.html.slime
+++ b/lib/philomena_web/templates/unlock/new.html.slime
@@ -1,6 +1,6 @@
h1 Resend unlock instructions
-= form_for :user, Routes.unlock_path(@conn, :create), fn f ->
+= form_for :user, ~p"/unlocks", fn f ->
.field
= email_input f, :email, placeholder: "Email", class: "input", required: true
diff --git a/lib/philomena_web/templates/user_attribution/_anon_user.html.slime b/lib/philomena_web/templates/user_attribution/_anon_user.html.slime
index b27abcb2..f5914b85 100644
--- a/lib/philomena_web/templates/user_attribution/_anon_user.html.slime
+++ b/lib/philomena_web/templates/user_attribution/_anon_user.html.slime
@@ -1,13 +1,13 @@
= cond do
- not is_nil(@object.user) and not anonymous?(@object) ->
strong<>
- = link(@object.user.name, to: Routes.profile_path(@conn, :show, @object.user))
+ = link(@object.user.name, to: ~p"/profiles/#{@object.user}")
= if assigns[:awards] do
= render PhilomenaWeb.ProfileView, "_awards.html", awards: @object.user.awards
- not is_nil(@object.user) and (can?(@conn, :reveal_anon, @object) and not hide_staff_tools?(@conn)) ->
strong<>
- = link(anonymous_name(@object, true), to: Routes.profile_path(@conn, :show, @object.user))
+ = link(anonymous_name(@object, true), to: ~p"/profiles/#{@object.user}")
- true ->
strong<>
diff --git a/lib/philomena_web/templates/user_attribution/_user.html.slime b/lib/philomena_web/templates/user_attribution/_user.html.slime
index e58b85a4..efd160bb 100644
--- a/lib/philomena_web/templates/user_attribution/_user.html.slime
+++ b/lib/philomena_web/templates/user_attribution/_user.html.slime
@@ -1,5 +1,5 @@
= if !!@object.user do
strong<>
- = link(@object.user.name, to: Routes.profile_path(@conn, :show, @object.user))
+ = link(@object.user.name, to: ~p"/profiles/#{@object.user}")
= if assigns[:awards] do
= render PhilomenaWeb.ProfileView, "_awards.html", awards: @object.user.awards
\ No newline at end of file
diff --git a/lib/philomena_web/user_auth.ex b/lib/philomena_web/user_auth.ex
index af7166cf..bf45d8b6 100644
--- a/lib/philomena_web/user_auth.ex
+++ b/lib/philomena_web/user_auth.ex
@@ -196,7 +196,7 @@ defmodule PhilomenaWeb.UserAuth do
conn
|> put_flash(:error, "You must log in to access this page.")
|> maybe_store_return_to()
- |> redirect(to: Routes.session_path(conn, :new))
+ |> redirect(to: ~p"/sessions/new")
|> halt()
end
end
diff --git a/lib/philomena_web/views/admin/mod_note_view.ex b/lib/philomena_web/views/admin/mod_note_view.ex
index a873208a..463de66b 100644
--- a/lib/philomena_web/views/admin/mod_note_view.ex
+++ b/lib/philomena_web/views/admin/mod_note_view.ex
@@ -6,19 +6,19 @@ defmodule PhilomenaWeb.Admin.ModNoteView do
alias Philomena.DnpEntries.DnpEntry
def link_to_noted_thing(conn, %DnpEntry{tag: tag} = dnp_entry),
- do: link("DNP entry for #{tag.name}", to: Routes.dnp_entry_path(conn, :show, dnp_entry))
+ do: link("DNP entry for #{tag.name}", to: ~p"/dnp/#{dnp_entry}")
def link_to_noted_thing(conn, %Report{user: nil} = report),
- do: link("Report #{report.id}", to: Routes.admin_report_path(conn, :show, report))
+ do: link("Report #{report.id}", to: ~p"/admin/reports/#{report}")
def link_to_noted_thing(conn, %Report{user: user} = report),
do:
link("Report #{report.id} by #{user.name}",
- to: Routes.admin_report_path(conn, :show, report)
+ to: ~p"/admin/reports/#{report}"
)
def link_to_noted_thing(conn, %User{} = user),
- do: link("User #{user.name}", to: Routes.profile_path(conn, :show, user))
+ do: link("User #{user.name}", to: ~p"/profiles/#{user}")
def link_to_noted_thing(_conn, _notable), do: "Item permanently deleted"
end
diff --git a/lib/philomena_web/views/admin/report_view.ex b/lib/philomena_web/views/admin/report_view.ex
index a9cd5bcc..a192c4fd 100644
--- a/lib/philomena_web/views/admin/report_view.ex
+++ b/lib/philomena_web/views/admin/report_view.ex
@@ -28,10 +28,10 @@ defmodule PhilomenaWeb.Admin.ReportView do
def truncated_ip_link(conn, ip) do
case to_string(ip) do
<> = ip ->
- link(string <> "...", to: Routes.ip_profile_path(conn, :show, ip))
+ link(string <> "...", to: ~p"/ip_profiles/#{ip}")
ip ->
- link(ip, to: Routes.ip_profile_path(conn, :show, ip))
+ link(ip, to: ~p"/ip_profiles/#{ip}")
end
end
diff --git a/lib/philomena_web/views/conversation_view.ex b/lib/philomena_web/views/conversation_view.ex
index 4ce91283..c85902ab 100644
--- a/lib/philomena_web/views/conversation_view.ex
+++ b/lib/philomena_web/views/conversation_view.ex
@@ -35,6 +35,6 @@ defmodule PhilomenaWeb.ConversationView do
def last_message_path(conn, conversation, count) do
page = trunc(Float.ceil(count / 25))
- Routes.conversation_path(conn, :show, conversation, page: page)
+ ~p"/conversations/#{conversation}?#{[page: page]}"
end
end
diff --git a/lib/philomena_web/views/profile_view.ex b/lib/philomena_web/views/profile_view.ex
index 2a9fe461..2470d5cf 100644
--- a/lib/philomena_web/views/profile_view.ex
+++ b/lib/philomena_web/views/profile_view.ex
@@ -83,7 +83,7 @@ defmodule PhilomenaWeb.ProfileView do
abbrv = "(" <> abbrv <> ")"
- link(abbrv, to: Routes.profile_path(conn, :show, user))
+ link(abbrv, to: ~p"/profiles/#{user}")
end
def user_abbrv(_conn, _user), do: content_tag(:span, "(n/a)")
diff --git a/lib/philomena_web/views/report_view.ex b/lib/philomena_web/views/report_view.ex
index 27f6f5a2..e33493be 100644
--- a/lib/philomena_web/views/report_view.ex
+++ b/lib/philomena_web/views/report_view.ex
@@ -42,39 +42,39 @@ defmodule PhilomenaWeb.ReportView do
def pretty_state(_report), do: "Open"
def link_to_reported_thing(conn, %Image{} = r),
- do: link("Image >>#{r.id}", to: Routes.image_path(conn, :show, r))
+ do: link("Image >>#{r.id}", to: ~p"/images/#{r}")
def link_to_reported_thing(conn, %Comment{} = r),
do:
link("Comment on image >>#{r.image.id}",
- to: Routes.image_path(conn, :show, r.image) <> "#comment_#{r.id}"
+ to: ~p"/images/#{r.image}" <> "#comment_#{r.id}"
)
def link_to_reported_thing(conn, %Conversation{} = r),
do:
link("Conversation between #{r.from.name} and #{r.to.name}",
- to: Routes.conversation_path(conn, :show, r)
+ to: ~p"/conversations/#{r}"
)
def link_to_reported_thing(conn, %Commission{} = r),
do:
link("#{r.user.name}'s commission page",
- to: Routes.profile_commission_path(conn, :show, r.user)
+ to: ~p"/profiles/#{r.user}/commission"
)
def link_to_reported_thing(conn, %Gallery{} = r),
- do: link("Gallery '#{r.title}' by #{r.creator.name}", to: Routes.gallery_path(conn, :show, r))
+ do: link("Gallery '#{r.title}' by #{r.creator.name}", to: ~p"/galleries/#{r}")
def link_to_reported_thing(conn, %Post{} = r),
do:
link("Post in #{r.topic.title}",
to:
- Routes.forum_topic_path(conn, :show, r.topic.forum, r.topic, post_id: r.id) <>
+ ~p"/forums/#{r.topic.forum}/topics/#{r.topic}?#{[post_id: r.id]}" <>
"#post_#{r.id}"
)
def link_to_reported_thing(conn, %User{} = r),
- do: link("User '#{r.name}'", to: Routes.profile_path(conn, :show, r))
+ do: link("User '#{r.name}'", to: ~p"/profiles/#{r}")
def link_to_reported_thing(_conn, _reportable) do
"Reported item permanently destroyed."
diff --git a/test/philomena_web/controllers/confirmation_controller_test.exs b/test/philomena_web/controllers/confirmation_controller_test.exs
index 55cbb172..049fd6d1 100644
--- a/test/philomena_web/controllers/confirmation_controller_test.exs
+++ b/test/philomena_web/controllers/confirmation_controller_test.exs
@@ -12,7 +12,7 @@ defmodule PhilomenaWeb.ConfirmationControllerTest do
describe "GET /confirmations/new" do
test "renders the confirmation page", %{conn: conn} do
- conn = get(conn, Routes.confirmation_path(conn, :new))
+ conn = get(conn, ~p"/confirmations/new")
response = html_response(conn, 200)
assert response =~ "Resend confirmation instructions
"
end
@@ -22,7 +22,7 @@ defmodule PhilomenaWeb.ConfirmationControllerTest do
@tag :capture_log
test "sends a new confirmation token", %{conn: conn, user: user} do
conn =
- post(conn, Routes.confirmation_path(conn, :create), %{
+ post(conn, ~p"/confirmations", %{
"user" => %{"email" => user.email}
})
@@ -35,7 +35,7 @@ defmodule PhilomenaWeb.ConfirmationControllerTest do
Repo.update!(Users.User.confirm_changeset(user))
conn =
- post(conn, Routes.confirmation_path(conn, :create), %{
+ post(conn, ~p"/confirmations", %{
"user" => %{"email" => user.email}
})
@@ -46,7 +46,7 @@ defmodule PhilomenaWeb.ConfirmationControllerTest do
test "does not send confirmation token if email is invalid", %{conn: conn} do
conn =
- post(conn, Routes.confirmation_path(conn, :create), %{
+ post(conn, ~p"/confirmations", %{
"user" => %{"email" => "unknown@example.com"}
})
@@ -63,14 +63,14 @@ defmodule PhilomenaWeb.ConfirmationControllerTest do
Users.deliver_user_confirmation_instructions(user, url)
end)
- conn = get(conn, Routes.confirmation_path(conn, :show, token))
+ conn = get(conn, ~p"/confirmations/#{token}")
assert redirected_to(conn) == "/"
assert Flash.get(conn.assigns.flash, :info) =~ "Account confirmed successfully"
assert Users.get_user!(user.id).confirmed_at
refute get_session(conn, :user_token)
assert Repo.all(Users.UserToken) == []
- conn = get(conn, Routes.confirmation_path(conn, :show, token))
+ conn = get(conn, ~p"/confirmations/#{token}")
assert redirected_to(conn) == "/"
assert Flash.get(conn.assigns.flash, :error) =~
@@ -78,7 +78,7 @@ defmodule PhilomenaWeb.ConfirmationControllerTest do
end
test "does not confirm email with invalid token", %{conn: conn, user: user} do
- conn = get(conn, Routes.confirmation_path(conn, :show, "oops"))
+ conn = get(conn, ~p"/confirmations/oops")
assert redirected_to(conn) == "/"
assert Flash.get(conn.assigns.flash, :error) =~
diff --git a/test/philomena_web/controllers/password_controller_test.exs b/test/philomena_web/controllers/password_controller_test.exs
index 4d421f72..b74cf046 100644
--- a/test/philomena_web/controllers/password_controller_test.exs
+++ b/test/philomena_web/controllers/password_controller_test.exs
@@ -12,7 +12,7 @@ defmodule PhilomenaWeb.PasswordControllerTest do
describe "GET /passwords/new" do
test "renders the reset password page", %{conn: conn} do
- conn = get(conn, Routes.password_path(conn, :new))
+ conn = get(conn, ~p"/passwords/new")
html_response(conn, 200)
end
end
@@ -21,7 +21,7 @@ defmodule PhilomenaWeb.PasswordControllerTest do
@tag :capture_log
test "sends a new reset password token", %{conn: conn, user: user} do
conn =
- post(conn, Routes.password_path(conn, :create), %{
+ post(conn, ~p"/passwords", %{
"user" => %{"email" => user.email}
})
@@ -32,7 +32,7 @@ defmodule PhilomenaWeb.PasswordControllerTest do
test "does not send reset password token if email is invalid", %{conn: conn} do
conn =
- post(conn, Routes.password_path(conn, :create), %{
+ post(conn, ~p"/passwords", %{
"user" => %{"email" => "unknown@example.com"}
})
@@ -53,12 +53,12 @@ defmodule PhilomenaWeb.PasswordControllerTest do
end
test "renders reset password", %{conn: conn, token: token} do
- conn = get(conn, Routes.password_path(conn, :edit, token))
+ conn = get(conn, ~p"/passwords/#{token}/edit")
html_response(conn, 200)
end
test "does not render reset password with invalid token", %{conn: conn} do
- conn = get(conn, Routes.password_path(conn, :edit, "oops"))
+ conn = get(conn, ~p"/passwords/oops/edit")
assert redirected_to(conn) == "/"
assert Flash.get(conn.assigns.flash, :error) =~
@@ -78,14 +78,14 @@ defmodule PhilomenaWeb.PasswordControllerTest do
test "resets password once", %{conn: conn, user: user, token: token} do
conn =
- put(conn, Routes.password_path(conn, :update, token), %{
+ put(conn, ~p"/passwords/#{token}", %{
"user" => %{
"password" => "new valid password",
"password_confirmation" => "new valid password"
}
})
- assert redirected_to(conn) == Routes.session_path(conn, :new)
+ assert redirected_to(conn) == ~p"/sessions/new"
refute get_session(conn, :user_token)
assert Flash.get(conn.assigns.flash, :info) =~ "Password reset successfully"
assert Users.get_user_by_email_and_password(user.email, "new valid password", & &1)
@@ -93,7 +93,7 @@ defmodule PhilomenaWeb.PasswordControllerTest do
test "does not reset password on invalid data", %{conn: conn, token: token} do
conn =
- put(conn, Routes.password_path(conn, :update, token), %{
+ put(conn, ~p"/passwords/#{token}", %{
"user" => %{
"password" => "too short",
"password_confirmation" => "does not match"
@@ -106,7 +106,7 @@ defmodule PhilomenaWeb.PasswordControllerTest do
end
test "does not reset password with invalid token", %{conn: conn} do
- conn = put(conn, Routes.password_path(conn, :update, "oops"))
+ conn = put(conn, ~p"/passwords/oops")
assert redirected_to(conn) == "/"
assert Flash.get(conn.assigns.flash, :error) =~
diff --git a/test/philomena_web/controllers/registration/email_controller_test.exs b/test/philomena_web/controllers/registration/email_controller_test.exs
index 2107a80f..756fea2e 100644
--- a/test/philomena_web/controllers/registration/email_controller_test.exs
+++ b/test/philomena_web/controllers/registration/email_controller_test.exs
@@ -11,19 +11,19 @@ defmodule PhilomenaWeb.Registration.EmailControllerTest do
@tag :capture_log
test "updates the user email", %{conn: conn, user: user} do
conn =
- post(conn, Routes.registration_email_path(conn, :create), %{
+ post(conn, ~p"/registrations/email", %{
"current_password" => valid_user_password(),
"user" => %{"email" => unique_user_email()}
})
- assert redirected_to(conn) == Routes.registration_path(conn, :edit)
+ assert redirected_to(conn) == ~p"/registrations/edit"
assert Flash.get(conn.assigns.flash, :info) =~ "A link to confirm your email"
assert Users.get_user_by_email(user.email)
end
test "does not update email on invalid data", %{conn: conn} do
conn =
- post(conn, Routes.registration_email_path(conn, :create), %{
+ post(conn, ~p"/registrations/email", %{
"current_password" => "invalid",
"user" => %{"email" => "with spaces"}
})
@@ -45,22 +45,22 @@ defmodule PhilomenaWeb.Registration.EmailControllerTest do
end
test "updates the user email once", %{conn: conn, user: user, token: token, email: email} do
- conn = get(conn, Routes.registration_email_path(conn, :show, token))
- assert redirected_to(conn) == Routes.registration_path(conn, :edit)
+ conn = get(conn, ~p"/registrations/email/#{token}")
+ assert redirected_to(conn) == ~p"/registrations/edit"
assert Flash.get(conn.assigns.flash, :info) =~ "Email changed successfully"
refute Users.get_user_by_email(user.email)
assert Users.get_user_by_email(email)
- conn = get(conn, Routes.registration_email_path(conn, :show, token))
- assert redirected_to(conn) == Routes.registration_path(conn, :edit)
+ conn = get(conn, ~p"/registrations/email/#{token}")
+ assert redirected_to(conn) == ~p"/registrations/edit"
assert Flash.get(conn.assigns.flash, :error) =~
"Email change link is invalid or it has expired"
end
test "does not update email with invalid token", %{conn: conn, user: user} do
- conn = get(conn, Routes.registration_email_path(conn, :show, "oops"))
- assert redirected_to(conn) == Routes.registration_path(conn, :edit)
+ conn = get(conn, ~p"/registrations/email/oops")
+ assert redirected_to(conn) == ~p"/registrations/edit"
assert Flash.get(conn.assigns.flash, :error) =~
"Email change link is invalid or it has expired"
@@ -70,8 +70,8 @@ defmodule PhilomenaWeb.Registration.EmailControllerTest do
test "redirects if user is not logged in", %{token: token} do
conn = build_conn()
- conn = get(conn, Routes.registration_email_path(conn, :show, token))
- assert redirected_to(conn) == Routes.session_path(conn, :new)
+ conn = get(conn, ~p"/registrations/email/#{token}")
+ assert redirected_to(conn) == ~p"/sessions/new"
end
end
end
diff --git a/test/philomena_web/controllers/registration/password_controller_test.exs b/test/philomena_web/controllers/registration/password_controller_test.exs
index 3e216805..b850e7af 100644
--- a/test/philomena_web/controllers/registration/password_controller_test.exs
+++ b/test/philomena_web/controllers/registration/password_controller_test.exs
@@ -10,7 +10,7 @@ defmodule PhilomenaWeb.Registration.PasswordControllerTest do
describe "PUT /registrations/password" do
test "updates the user password and resets tokens", %{conn: conn, user: user} do
new_password_conn =
- put(conn, Routes.registration_password_path(conn, :update), %{
+ put(conn, ~p"/registrations/password", %{
"current_password" => valid_user_password(),
"user" => %{
"password" => "new valid password",
@@ -18,7 +18,7 @@ defmodule PhilomenaWeb.Registration.PasswordControllerTest do
}
})
- assert redirected_to(new_password_conn) == Routes.registration_path(conn, :edit)
+ assert redirected_to(new_password_conn) == ~p"/registrations/edit"
assert get_session(new_password_conn, :user_token) != get_session(conn, :user_token)
assert Flash.get(new_password_conn.assigns.flash, :info) =~ "Password updated successfully"
assert Users.get_user_by_email_and_password(user.email, "new valid password", & &1)
@@ -26,7 +26,7 @@ defmodule PhilomenaWeb.Registration.PasswordControllerTest do
test "does not update password on invalid data", %{conn: conn} do
old_password_conn =
- put(conn, Routes.registration_password_path(conn, :update), %{
+ put(conn, ~p"/registrations/password", %{
"current_password" => "invalid",
"user" => %{
"password" => "too short",
@@ -34,7 +34,7 @@ defmodule PhilomenaWeb.Registration.PasswordControllerTest do
}
})
- assert redirected_to(old_password_conn) == Routes.registration_path(conn, :edit)
+ assert redirected_to(old_password_conn) == ~p"/registrations/edit"
assert Flash.get(old_password_conn.assigns.flash, :error) =~ "Failed to update password"
assert get_session(old_password_conn, :user_token) == get_session(conn, :user_token)
end
diff --git a/test/philomena_web/controllers/registration_controller_test.exs b/test/philomena_web/controllers/registration_controller_test.exs
index 0ee59d90..dc557666 100644
--- a/test/philomena_web/controllers/registration_controller_test.exs
+++ b/test/philomena_web/controllers/registration_controller_test.exs
@@ -5,13 +5,13 @@ defmodule PhilomenaWeb.RegistrationControllerTest do
describe "GET /registrations/new" do
test "renders registration page", %{conn: conn} do
- conn = get(conn, Routes.registration_path(conn, :new))
+ conn = get(conn, ~p"/registrations/new")
html_response(conn, 200)
end
test "redirects if already logged in", %{conn: conn} do
conn =
- conn |> log_in_user(confirmed_user_fixture()) |> get(Routes.registration_path(conn, :new))
+ conn |> log_in_user(confirmed_user_fixture()) |> get(~p"/registrations/new")
assert redirected_to(conn) == "/"
end
@@ -23,7 +23,7 @@ defmodule PhilomenaWeb.RegistrationControllerTest do
email = unique_user_email()
conn =
- post(conn, Routes.registration_path(conn, :create), %{
+ post(conn, ~p"/registrations", %{
"user" => %{"name" => email, "email" => email, "password" => valid_user_password()}
})
@@ -36,7 +36,7 @@ defmodule PhilomenaWeb.RegistrationControllerTest do
test "render errors for invalid data", %{conn: conn} do
conn =
- post(conn, Routes.registration_path(conn, :create), %{
+ post(conn, ~p"/registrations", %{
"user" => %{"email" => "with spaces", "password" => "too short"}
})
@@ -50,15 +50,15 @@ defmodule PhilomenaWeb.RegistrationControllerTest do
setup :register_and_log_in_user
test "renders settings page", %{conn: conn} do
- conn = get(conn, Routes.registration_path(conn, :edit))
+ conn = get(conn, ~p"/registrations/edit")
response = html_response(conn, 200)
assert response =~ "Settings"
end
test "redirects if user is not logged in" do
conn = build_conn()
- conn = get(conn, Routes.registration_path(conn, :edit))
- assert redirected_to(conn) == Routes.session_path(conn, :new)
+ conn = get(conn, ~p"/registrations/edit")
+ assert redirected_to(conn) == ~p"/sessions/new"
end
end
end
diff --git a/test/philomena_web/controllers/session_controller_test.exs b/test/philomena_web/controllers/session_controller_test.exs
index 78e14834..29d8d7f2 100644
--- a/test/philomena_web/controllers/session_controller_test.exs
+++ b/test/philomena_web/controllers/session_controller_test.exs
@@ -9,12 +9,12 @@ defmodule PhilomenaWeb.SessionControllerTest do
describe "GET /sessions/new" do
test "renders log in page", %{conn: conn} do
- conn = get(conn, Routes.session_path(conn, :new))
+ conn = get(conn, ~p"/sessions/new")
html_response(conn, 200)
end
test "redirects if already logged in", %{conn: conn, user: user} do
- conn = conn |> log_in_user(user) |> get(Routes.session_path(conn, :new))
+ conn = conn |> log_in_user(user) |> get(~p"/sessions/new")
assert redirected_to(conn) == "/"
end
end
@@ -22,7 +22,7 @@ defmodule PhilomenaWeb.SessionControllerTest do
describe "POST /sessions" do
test "logs the user in", %{conn: conn, user: user} do
conn =
- post(conn, Routes.session_path(conn, :create), %{
+ post(conn, ~p"/sessions", %{
"user" => %{"email" => user.email, "password" => valid_user_password()}
})
@@ -39,7 +39,7 @@ defmodule PhilomenaWeb.SessionControllerTest do
test "logs the user in with remember me", %{conn: conn, user: user} do
conn =
- post(conn, Routes.session_path(conn, :create), %{
+ post(conn, ~p"/sessions", %{
"user" => %{
"email" => user.email,
"password" => valid_user_password(),
@@ -53,7 +53,7 @@ defmodule PhilomenaWeb.SessionControllerTest do
test "emits error message with invalid credentials", %{conn: conn, user: user} do
conn =
- post(conn, Routes.session_path(conn, :create), %{
+ post(conn, ~p"/sessions", %{
"user" => %{"email" => user.email, "password" => "invalid_password"}
})
@@ -64,7 +64,7 @@ defmodule PhilomenaWeb.SessionControllerTest do
describe "DELETE /sessions" do
test "logs the user out", %{conn: conn, user: user} do
- conn = conn |> log_in_user(user) |> delete(Routes.session_path(conn, :delete))
+ conn = conn |> log_in_user(user) |> delete(~p"/sessions")
assert redirected_to(conn) == "/"
refute get_session(conn, :user_token)
assert Phoenix.Flash.get(conn.assigns.flash, :info) =~ "Logged out successfully"
diff --git a/test/philomena_web/controllers/unlock_controller_test.exs b/test/philomena_web/controllers/unlock_controller_test.exs
index d506e90a..bc8df85e 100644
--- a/test/philomena_web/controllers/unlock_controller_test.exs
+++ b/test/philomena_web/controllers/unlock_controller_test.exs
@@ -12,7 +12,7 @@ defmodule PhilomenaWeb.UnlockControllerTest do
describe "GET /unlocks/new" do
test "renders the unlock page", %{conn: conn} do
- conn = get(conn, Routes.unlock_path(conn, :new))
+ conn = get(conn, ~p"/unlocks/new")
response = html_response(conn, 200)
assert response =~ "Resend unlock instructions
"
end
@@ -22,7 +22,7 @@ defmodule PhilomenaWeb.UnlockControllerTest do
@tag :capture_log
test "sends a new unlock token", %{conn: conn, user: user} do
conn =
- post(conn, Routes.unlock_path(conn, :create), %{
+ post(conn, ~p"/unlocks", %{
"user" => %{"email" => user.email}
})
@@ -35,7 +35,7 @@ defmodule PhilomenaWeb.UnlockControllerTest do
Repo.update!(Users.User.unlock_changeset(user))
conn =
- post(conn, Routes.unlock_path(conn, :create), %{
+ post(conn, ~p"/unlocks", %{
"user" => %{"email" => user.email}
})
@@ -46,7 +46,7 @@ defmodule PhilomenaWeb.UnlockControllerTest do
test "does not send unlock token if email is invalid", %{conn: conn} do
conn =
- post(conn, Routes.unlock_path(conn, :create), %{
+ post(conn, ~p"/unlocks", %{
"user" => %{"email" => "unknown@example.com"}
})
@@ -63,20 +63,20 @@ defmodule PhilomenaWeb.UnlockControllerTest do
Users.deliver_user_unlock_instructions(user, url)
end)
- conn = get(conn, Routes.unlock_path(conn, :show, token))
+ conn = get(conn, ~p"/unlocks/#{token}")
assert redirected_to(conn) == "/"
assert Flash.get(conn.assigns.flash, :info) =~ "Account unlocked successfully"
refute Users.get_user!(user.id).locked_at
refute get_session(conn, :user_token)
assert Repo.all(Users.UserToken) == []
- conn = get(conn, Routes.unlock_path(conn, :show, token))
+ conn = get(conn, ~p"/unlocks/#{token}")
assert redirected_to(conn) == "/"
assert Flash.get(conn.assigns.flash, :error) =~ "Unlock link is invalid or it has expired"
end
test "does not unlock with invalid token", %{conn: conn, user: user} do
- conn = get(conn, Routes.unlock_path(conn, :show, "oops"))
+ conn = get(conn, ~p"/unlocks/oops")
assert redirected_to(conn) == "/"
assert Flash.get(conn.assigns.flash, :error) =~ "Unlock link is invalid or it has expired"
assert Users.get_user!(user.id).locked_at
diff --git a/test/philomena_web/user_auth_test.exs b/test/philomena_web/user_auth_test.exs
index e03912fe..deeaeca7 100644
--- a/test/philomena_web/user_auth_test.exs
+++ b/test/philomena_web/user_auth_test.exs
@@ -162,7 +162,7 @@ defmodule PhilomenaWeb.UserAuthTest do
test "redirects if user is not authenticated", %{conn: conn} do
conn = conn |> fetch_flash() |> UserAuth.require_authenticated_user([])
assert conn.halted
- assert redirected_to(conn) == Routes.session_path(conn, :new)
+ assert redirected_to(conn) == ~p"/sessions/new"
assert Phoenix.Flash.get(conn.assigns.flash, :error) ==
"You must log in to access this page."