Introduce Sitemaps

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2020-08-12 16:05:34 +02:00
parent 9a0068dfea
commit c56fb710b6
21 changed files with 163 additions and 39 deletions

View File

@@ -8,11 +8,21 @@ defmodule Mobilizon.Web.PageController do
alias Mobilizon.Events.Event
alias Mobilizon.Federation.ActivityPub
alias Mobilizon.Tombstone
alias Mobilizon.Web.{ActivityPubController, Cache}
alias Mobilizon.Web.{ActivityPubController, Cache, PageController}
plug(:put_layout, false)
action_fallback(Mobilizon.Web.FallbackController)
defdelegate my_events(conn, params), to: PageController, as: :index
defdelegate create_event(conn, params), to: PageController, as: :index
defdelegate list_events(conn, params), to: PageController, as: :index
defdelegate explore_events(conn, params), to: PageController, as: :index
defdelegate edit_event(conn, params), to: PageController, as: :index
defdelegate moderation_report(conn, params), to: PageController, as: :index
defdelegate participation_email_confirmation(conn, params), to: PageController, as: :index
defdelegate user_email_validation(conn, params), to: PageController, as: :index
defdelegate my_groups(conn, params), to: PageController, as: :index
@spec index(Plug.Conn.t(), any) :: Plug.Conn.t()
def index(conn, _params), do: render(conn, :index)

View File

@@ -81,12 +81,12 @@ defmodule Mobilizon.Web.Router do
pipe_through(:activity_pub_signature)
get("/@:name", PageController, :actor)
get("/events/me", PageController, :index)
get("/events/me", PageController, :my_events)
get("/events/:uuid", PageController, :event)
get("/comments/:uuid", PageController, :comment)
get("/resource/:uuid", PageController, :resource, as: "resource")
get("/todo-list/:uuid", PageController, :todo_list, as: "todo_list")
get("/todo/:uuid", PageController, :todo, as: "todo")
get("/resource/:uuid", PageController, :resource)
get("/todo-list/:uuid", PageController, :todo_list)
get("/todo/:uuid", PageController, :todo)
get("/@:name/todos", PageController, :todos)
get("/@:name/resources", PageController, :resources)
get("/@:name/posts", PageController, :posts)
@@ -139,21 +139,20 @@ defmodule Mobilizon.Web.Router do
pipe_through(:browser)
# Because the "/events/:uuid" route caches all these, we need to force them
get("/events/create", PageController, :index)
get("/events/list", PageController, :index)
get("/events/me", PageController, :index)
get("/events/explore", PageController, :index)
get("/events/:uuid/edit", PageController, :index)
get("/events/create", PageController, :create_event)
get("/events/list", PageController, :list_events)
get("/events/me", PageController, :my_events)
get("/events/explore", PageController, :explore_events)
get("/events/:uuid/edit", PageController, :edit_event)
# This is a hack to ease link generation into emails
get("/moderation/reports/:id", PageController, :index, as: "moderation_report")
get("/moderation/reports/:id", PageController, :moderation_report)
get("/participation/email/confirm/:token", PageController, :index,
as: "participation_email_confirmation"
)
get("/participation/email/confirm/:token", PageController, :participation_email_confirmation)
get("/validate/email/:token", PageController, :index, as: "user_email_validation")
get("/groups/me", PageController, :index, as: "my_groups")
get("/validate/email/:token", PageController, :user_email_validation)
get("/groups/me", PageController, :my_groups)
get("/interact", PageController, :interact)

View File

@@ -54,7 +54,7 @@
<td bgcolor="#ffffff" align="center" style="padding: 20px 30px 60px 30px;">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" style="border-radius: 3px;" bgcolor="#3C376E"><a href="<%= participation_email_confirmation_url(Mobilizon.Web.Endpoint, :index, @participant.metadata.confirmation_token) %>" target="_blank" style="font-size: 20px; font-family: 'Roboto', Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;">
<td align="center" style="border-radius: 3px;" bgcolor="#3C376E"><a href="<%= page_url(Mobilizon.Web.Endpoint, :participation_email_confirmation, @participant.metadata.confirmation_token) %>" target="_blank" style="font-size: 20px; font-family: 'Roboto', Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;">
<%= gettext "Confirm my e-mail address" %>
</a></td>
</tr>

View File

@@ -2,5 +2,5 @@
==
<%= gettext "Hi there! You just registered to join this event: « %{title} ». Please confirm the e-mail address you provided:", title: @participant.event.title %>
<%= gettext "If you didn't trigger this email, you may safely ignore it." %>
<%= participation_email_confirmation_url(Mobilizon.Web.Endpoint, :index, @participant.metadata.confirmation_token) %>
<%= page_url(Mobilizon.Web.Endpoint, :participation_email_confirmation, @participant.metadata.confirmation_token) %>
<%= ngettext "Would you wish to cancel your attendance, visit the event page through the link above and click the « Attending » button.", "Would you wish to cancel your attendance to one or several events, visit the event pages through the links above and click the « Attending » button.", 1 %>

View File

@@ -47,7 +47,7 @@
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" style="border-radius: 3px;" bgcolor="#3C376E">
<a href="<%= user_email_validation_url(Mobilizon.Web.Endpoint, :index, @token) %>" target="_blank" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;">
<a href="<%= page_url(Mobilizon.Web.Endpoint, :user_email_validation, @token) %>" target="_blank" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;">
<%= gettext "Verify your email address" %>
</a>
</td>

View File

@@ -1,5 +1,5 @@
<%= gettext "Confirm new email" %>
==
<%= gettext "Hi there! It seems like you wanted to change the email address linked to your account on <b>%{instance}</b>. If you still wish to do so, please click the button below to confirm the change. You will then be able to log in to %{instance} with this new email address.", %{instance: @instance_name} %>
<%= user_email_validation_url(Mobilizon.Web.Endpoint, :index, @token) %>
<%= page_url(Mobilizon.Web.Endpoint, :user_email_validation, @token) %>
<%= gettext "If you didn't trigger the change yourself, please ignore this message." %>

View File

@@ -55,7 +55,7 @@
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" style="border-radius: 3px;" bgcolor="#3C376E">
<a href="<%= my_groups_url(Mobilizon.Web.Endpoint, :index) %>" target="_blank" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;">
<a href="<%= page_url(Mobilizon.Web.Endpoint, :my_groups) %>" target="_blank" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;">
<%= gettext "See my groups" %>
</a>
</td>

View File

@@ -1,9 +1,5 @@
<%= gettext "Come along!" %>
==
<%= gettext "%{inviter} just invited you to join their group %{group}", group: @group.name, inviter: @inviter.name %>
<%= gettext "To accept this invitation, head over to your groups." %>
<%= my_groups_url(Mobilizon.Web.Endpoint, :index) %>
<%= page_url(Mobilizon.Web.Endpoint, :my_groups) %>

View File

@@ -100,7 +100,7 @@
<td bgcolor="#ffffff" align="center" style="padding: 20px 30px 60px 30px;">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" style="border-radius: 3px;" bgcolor="#3C376E"><a href="<%= moderation_report_url(Mobilizon.Web.Endpoint, :index, @report.id) %>" target="_blank" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;">
<td align="center" style="border-radius: 3px;" bgcolor="#3C376E"><a href="<%= page_url(Mobilizon.Web.Endpoint, :moderation_report, @report.id) %>" target="_blank" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;">
<%= gettext "View report" %>
</a></td>
</tr>

View File

@@ -14,4 +14,4 @@
<%= gettext "Reason" %>
<%= @report.content %>
<% end %>
<%= gettext "View report:" %> <%= moderation_report_url(Mobilizon.Web.Endpoint, :index, @report.id) %>
<%= gettext "View report:" %> <%= page_url(Mobilizon.Web.Endpoint, :moderation_report, @report.id) %>