add placeholder i18n segment to url paths
This commit is contained in:
parent
5c92213081
commit
82eeead643
12 changed files with 37 additions and 39 deletions
|
@ -158,7 +158,7 @@ async fn post_new_channel(
|
|||
};
|
||||
|
||||
Ok(Redirect::to(&format!(
|
||||
"{}/teams/{}/channels/{}",
|
||||
"{}/en/teams/{}/channels/{}",
|
||||
base_path,
|
||||
team.id.simple(),
|
||||
channel.id.simple()
|
||||
|
@ -276,7 +276,7 @@ async fn update_channel(
|
|||
));
|
||||
}
|
||||
Ok(Redirect::to(&format!(
|
||||
"{}/teams/{}/channels/{}",
|
||||
"{}/en/teams/{}/channels/{}",
|
||||
base_path,
|
||||
team_id.simple(),
|
||||
channel_id.simple()
|
||||
|
@ -366,7 +366,7 @@ async fn update_channel_email_recipient(
|
|||
mailer.send_batch(vec![email]).await.remove(0)?;
|
||||
|
||||
Ok(Redirect::to(&format!(
|
||||
"{}/teams/{}/channels/{}",
|
||||
"{}/en/teams/{}/channels/{}",
|
||||
base_path,
|
||||
team_id.simple(),
|
||||
channel_id.simple()
|
||||
|
@ -447,7 +447,7 @@ async fn verify_email(
|
|||
};
|
||||
|
||||
Ok(Redirect::to(&format!(
|
||||
"{}/teams/{}/channels/{}",
|
||||
"{}/en/teams/{}/channels/{}",
|
||||
base_path,
|
||||
team_id.simple(),
|
||||
channel_id.simple()
|
||||
|
|
|
@ -34,11 +34,11 @@ impl NavState {
|
|||
self.team_id = Some(team.id);
|
||||
self.navbar_active_item = "teams".to_string();
|
||||
self.breadcrumbs.push(Breadcrumb {
|
||||
href: format!("{}/teams", self.base_path),
|
||||
href: format!("{}/en/teams", self.base_path),
|
||||
label: "Teams".to_string(),
|
||||
});
|
||||
self.breadcrumbs.push(Breadcrumb {
|
||||
href: format!("{}/teams/{}", self.base_path, team.id.simple()),
|
||||
href: format!("{}/en/teams/{}", self.base_path, team.id.simple()),
|
||||
label: team.name.clone(),
|
||||
});
|
||||
self
|
||||
|
@ -50,12 +50,12 @@ impl NavState {
|
|||
))?;
|
||||
self.navbar_active_item = "projects".to_string();
|
||||
self.breadcrumbs.push(Breadcrumb {
|
||||
href: format!("{}/teams/{}/projects", self.base_path, team_id),
|
||||
href: format!("{}/en/teams/{}/projects", self.base_path, team_id),
|
||||
label: "Projects".to_string(),
|
||||
});
|
||||
self.breadcrumbs.push(Breadcrumb {
|
||||
href: format!(
|
||||
"{}/teams/{}/projects/{}",
|
||||
"{}/en/teams/{}/projects/{}",
|
||||
self.base_path,
|
||||
team_id,
|
||||
project.id.simple()
|
||||
|
|
|
@ -230,7 +230,7 @@ async fn update_enabled_channels(
|
|||
.unwrap()?;
|
||||
|
||||
Ok(Redirect::to(&format!(
|
||||
"{}/teams/{}/projects/{}",
|
||||
"{}/en/teams/{}/projects/{}",
|
||||
base_path, team_id, project_id
|
||||
))
|
||||
.into_response())
|
||||
|
|
|
@ -18,12 +18,15 @@ use crate::{
|
|||
|
||||
pub fn new_router(state: AppState) -> Router<()> {
|
||||
let base_path = state.settings.base_path.clone();
|
||||
let app = Router::new()
|
||||
let ui_router = Router::new()
|
||||
.route("/", get(landing_page))
|
||||
.merge(channels_router::new_router())
|
||||
.merge(projects_router::new_router())
|
||||
.merge(teams_router::new_router())
|
||||
.merge(teams_router::new_router());
|
||||
let app = Router::new()
|
||||
.route("/", get(landing_page))
|
||||
.merge(v0_router::new_router())
|
||||
.nest("/en", ui_router)
|
||||
.nest("/auth", auth::new_router())
|
||||
.layer(SetResponseHeaderLayer::if_not_present(
|
||||
CACHE_CONTROL,
|
||||
|
@ -57,5 +60,5 @@ pub fn new_router(state: AppState) -> Router<()> {
|
|||
}
|
||||
|
||||
async fn landing_page(State(Settings { base_path, .. }): State<Settings>) -> impl IntoResponse {
|
||||
Redirect::to(&format!("{}/teams", base_path))
|
||||
Redirect::to(&format!("{}/en/teams", base_path))
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ async fn teams_page(
|
|||
let nav_state = NavState::new()
|
||||
.set_base_path(&base_path)
|
||||
.push_slug(Breadcrumb {
|
||||
href: "teams".to_string(),
|
||||
href: "en/teams".to_string(),
|
||||
label: "Teams".to_string(),
|
||||
})
|
||||
.set_navbar_active_item("teams");
|
||||
|
@ -76,7 +76,7 @@ async fn team_page(
|
|||
State(Settings { base_path, .. }): State<Settings>,
|
||||
Path(team_id): Path<Uuid>,
|
||||
) -> impl IntoResponse {
|
||||
Redirect::to(&format!("{}/teams/{}/projects", base_path, team_id))
|
||||
Redirect::to(&format!("{}/en/teams/{}/projects", base_path, team_id))
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
|
@ -96,7 +96,7 @@ async fn post_new_api_key(
|
|||
|
||||
ApiKey::generate_for_team(&db_conn, team.id).await?;
|
||||
Ok(Redirect::to(&format!(
|
||||
"{}/teams/{}/projects",
|
||||
"{}/en/teams/{}/projects",
|
||||
base_path,
|
||||
team.id.hyphenated()
|
||||
))
|
||||
|
@ -113,7 +113,7 @@ async fn new_team_page(
|
|||
let nav_state = NavState::new()
|
||||
.set_base_path(&base_path)
|
||||
.push_slug(Breadcrumb {
|
||||
href: "new-team".to_string(),
|
||||
href: "en/new-team".to_string(),
|
||||
label: "New Team".to_string(),
|
||||
})
|
||||
.set_navbar_active_item("teams");
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<section class="mb-4">
|
||||
<form
|
||||
method="post"
|
||||
action="{{ base_path }}/teams/{{ nav_state.team_id.unwrap().simple() }}/channels/{{ channel.id.simple() }}/update-channel"
|
||||
action="{{ base_path }}/en/teams/{{ nav_state.team_id.unwrap().simple() }}/channels/{{ channel.id.simple() }}/update-channel"
|
||||
>
|
||||
<div class="mb-3">
|
||||
<label for="channel-name-input" class="form-label">Channel Name</label>
|
||||
|
@ -51,7 +51,7 @@
|
|||
<section class="mb-4">
|
||||
<form
|
||||
method="post"
|
||||
action="{{ base_path }}/teams/{{ nav_state.team_id.unwrap().simple() }}/channels/{{ channel.id.simple() }}/update-email-recipient"
|
||||
action="{{ base_path }}/en/teams/{{ nav_state.team_id.unwrap().simple() }}/channels/{{ channel.id.simple() }}/update-email-recipient"
|
||||
>
|
||||
<div class="mb-3">
|
||||
<label for="channel-recipient-input" class="form-label">Recipient Email</label>
|
||||
|
@ -81,7 +81,7 @@
|
|||
<section class="mb-4">
|
||||
<form
|
||||
method="post"
|
||||
action="{{ base_path }}/teams/{{ nav_state.team_id.unwrap().simple() }}/channels/{{ channel.id.simple() }}/verify-email"
|
||||
action="{{ base_path }}/en/teams/{{ nav_state.team_id.unwrap().simple() }}/channels/{{ channel.id.simple() }}/verify-email"
|
||||
>
|
||||
<div class="mb-3">
|
||||
<label for="channel-recipient-verification-code" class="form-label">
|
||||
|
@ -114,7 +114,7 @@
|
|||
<form
|
||||
id="email-verification-form"
|
||||
method="post"
|
||||
action="{{ base_path }}/teams/{{ nav_state.team_id.unwrap().simple() }}/channels/{{ channel.id.simple() }}/update-email-recipient"
|
||||
action="{{ base_path }}/en/teams/{{ nav_state.team_id.unwrap().simple() }}/channels/{{ channel.id.simple() }}/update-email-recipient"
|
||||
>
|
||||
<input type="hidden" name="recipient" value="{{ email_data.recipient }}">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<li>
|
||||
<form
|
||||
method="post"
|
||||
action="{{ base_path }}/teams/{{ nav_state.team_id.unwrap().simple() }}/new-channel"
|
||||
action="{{ base_path }}/en/teams/{{ nav_state.team_id.unwrap().simple() }}/new-channel"
|
||||
>
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<input type="hidden" name="channel_type" value="email">
|
||||
|
@ -41,7 +41,7 @@
|
|||
Channels are places to send messages, alerts, and so on. Once created, they
|
||||
can be connected to specific projects at the
|
||||
<a
|
||||
href="{{ base_path }}/teams/{{ nav_state.team_id.unwrap().simple() }}/projects"
|
||||
href="{{ base_path }}/en/teams/{{ nav_state.team_id.unwrap().simple() }}/projects"
|
||||
>Projects page</a>.
|
||||
</div>
|
||||
<section class="mb-3">
|
||||
|
@ -50,7 +50,7 @@
|
|||
{% for channel in channels %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{ base_path }}/teams/{{ nav_state.team_id.unwrap().simple() }}/channels/{{ channel.id.simple() }}">
|
||||
<a href="{{ base_path }}/en/teams/{{ nav_state.team_id.unwrap().simple() }}/channels/{{ channel.id.simple() }}">
|
||||
{{ channel.name }}
|
||||
</a>
|
||||
</td>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<a
|
||||
class="nav-link{% if nav_state.navbar_active_item == "teams" %} active{% endif %}"
|
||||
{% if nav_state.navbar_active_item == "teams" %}aria-current="page"{% endif %}
|
||||
href="{{ base_path }}/teams"
|
||||
href="{{ base_path }}/en/teams"
|
||||
>
|
||||
Teams
|
||||
</a>
|
||||
|
@ -28,7 +28,7 @@
|
|||
<a
|
||||
class="nav-link{% if nav_state.navbar_active_item == "projects" %} active{% endif %}"
|
||||
{% if nav_state.navbar_active_item == "projects" %}aria-current="page"{% endif %}
|
||||
href="{{ base_path }}/teams/{{ team_id.simple() }}/projects"
|
||||
href="{{ base_path }}/en/teams/{{ team_id.simple() }}/projects"
|
||||
>
|
||||
Projects
|
||||
</a>
|
||||
|
@ -37,7 +37,7 @@
|
|||
<a
|
||||
class="nav-link{% if nav_state.navbar_active_item == "channels" %} active{% endif %}"
|
||||
{% if nav_state.navbar_active_item == "channels" %}aria-current="page"{% endif %}
|
||||
href="{{ base_path }}/teams/{{ team_id.simple() }}/channels"
|
||||
href="{{ base_path }}/en/teams/{{ team_id.simple() }}/channels"
|
||||
>
|
||||
Channels
|
||||
</a>
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block main %}
|
||||
<nav class="container mt-4" aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{{ base_path }}/teams">Teams</a></li>
|
||||
<li class="breadcrumb-item active" aria-current="page">New Team</li>
|
||||
</ol>
|
||||
</nav>
|
||||
{% include "breadcrumbs.html" %}
|
||||
<main class="mt-5">
|
||||
<section class="container mb-3">
|
||||
<h1 class="mt-5">New Team</h1>
|
||||
|
@ -19,7 +14,7 @@
|
|||
</div>
|
||||
<div class="mb-3">
|
||||
<button class="btn btn-primary" type="submit">Submit</button>
|
||||
<a class="btn btn-secondary" role="button" href="{{ base_path }}/teams">
|
||||
<a class="btn btn-secondary" role="button" href="{{ base_path }}/en/teams">
|
||||
Cancel
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<h2>Enabled Channels</h2>
|
||||
<form
|
||||
method="post"
|
||||
action="{{ base_path }}/teams/{{ nav_state.team_id.unwrap().simple() }}/projects/{{ project.id.simple() }}/update-enabled-channels"
|
||||
action="{{ base_path }}/en/teams/{{ nav_state.team_id.unwrap().simple() }}/projects/{{ project.id.simple() }}/update-enabled-channels"
|
||||
>
|
||||
<div class="mb-3">
|
||||
<table class="table">
|
||||
|
@ -29,7 +29,7 @@
|
|||
<label for="enable-channel-switch-{{ channel.id.simple() }}">
|
||||
<a
|
||||
target="_blank"
|
||||
href="{{ base_path }}/teams/{{ nav_state.team_id.unwrap().simple() }}/channels/{{ channel.id.simple() }}"
|
||||
href="{{ base_path }}/en/teams/{{ nav_state.team_id.unwrap().simple() }}/channels/{{ channel.id.simple() }}"
|
||||
>
|
||||
{{ channel.name }}
|
||||
</a>
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
{% for project in projects %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{ base_path }}/teams/{{ nav_state.team_id.unwrap().simple() }}/projects/{{ project.id.simple() }}">
|
||||
<a href="{{ base_path }}/en/teams/{{ nav_state.team_id.unwrap().simple() }}/projects/{{ project.id.simple() }}">
|
||||
{{ project.name }}
|
||||
</a>
|
||||
</td>
|
||||
|
@ -53,7 +53,7 @@
|
|||
<h1 class="mb-4">API Keys</h1>
|
||||
</section>
|
||||
<section class="mb-3">
|
||||
<form method="post" action="{{ base_path }}/teams/{{ nav_state.team_id.unwrap().simple() }}/new-api-key">
|
||||
<form method="post" action="{{ base_path }}/en/teams/{{ nav_state.team_id.unwrap().simple() }}/new-api-key">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<button class="btn btn-primary" type="submit">Generate Key</button>
|
||||
</form>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<div class="d-flex justify-content-between align-items-center">
|
||||
<h1>Teams</h1>
|
||||
<div>
|
||||
<a href="{{ base_path }}/new-team" role="button" class="btn btn-primary">New Team</a>
|
||||
<a href="{{ base_path }}/en/new-team" role="button" class="btn btn-primary">New Team</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -24,7 +24,7 @@
|
|||
{% for team in teams %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{ base_path }}/teams/{{ team.id }}">
|
||||
<a href="{{ base_path }}/en/teams/{{ team.id }}">
|
||||
{{ team.name }}
|
||||
</a>
|
||||
</td>
|
||||
|
|
Loading…
Add table
Reference in a new issue