2018-12-06 17:54:16 +00:00
|
|
|
@use templates::base;
|
|
|
|
@use template_utils::*;
|
2019-08-20 22:42:04 +00:00
|
|
|
@use plume_models::instance::Instance;
|
2018-12-06 17:54:16 +00:00
|
|
|
@use routes::user::UpdateUserForm;
|
|
|
|
@use validator::ValidationErrors;
|
2018-12-07 11:05:01 +00:00
|
|
|
@use routes::*;
|
2018-12-06 17:54:16 +00:00
|
|
|
|
|
|
|
@(ctx: BaseContext, form: UpdateUserForm, errors: ValidationErrors)
|
|
|
|
|
2019-02-02 14:23:50 +00:00
|
|
|
@:base(ctx, i18n!(ctx.1, "Edit your account"), {}, {}, {
|
2018-12-07 11:05:01 +00:00
|
|
|
@if let Some(u) = ctx.2.clone() {
|
|
|
|
<h1>@i18n!(ctx.1, "Your Profile")</h1>
|
2019-03-06 13:11:36 +00:00
|
|
|
<p>
|
2019-04-01 18:09:29 +00:00
|
|
|
@i18n!(ctx.1, "To change your avatar, upload it to your gallery and then select from there.")
|
2019-03-06 13:11:36 +00:00
|
|
|
<a href="@uri!(medias::new)">@i18n!(ctx.1, "Upload an avatar")</a>
|
|
|
|
</p>
|
2018-12-07 11:05:01 +00:00
|
|
|
<form method="post" action="@uri!(user::update: _name = u.username.clone())">
|
|
|
|
<!-- Rocket hack to use various HTTP methods -->
|
|
|
|
<input type=hidden name="_method" value="put">
|
2018-12-06 17:54:16 +00:00
|
|
|
|
2019-08-27 14:50:24 +00:00
|
|
|
@(Input::new("display_name", i18n!(ctx.1, ""))
|
|
|
|
.default(&form.display_name)
|
|
|
|
.error(&errors)
|
|
|
|
.html(ctx.1))
|
|
|
|
@(Input::new("email", i18n!(ctx.1, ""))
|
|
|
|
.default(&form.email)
|
|
|
|
.error(&errors)
|
|
|
|
.input_type("email")
|
|
|
|
.html(ctx.1))
|
2019-03-17 19:11:29 +00:00
|
|
|
<label for="summary">@i18n!(ctx.1, "Summary")</label>
|
|
|
|
<textarea id="summary" name="summary">@form.summary</textarea>
|
2018-12-06 17:54:16 +00:00
|
|
|
|
2019-08-20 22:42:04 +00:00
|
|
|
@if let Ok(themes) = Instance::list_themes() {
|
|
|
|
<label for="theme">@i18n!(ctx.1, "Theme")</label>
|
|
|
|
<select name="theme" id="theme">
|
|
|
|
<option value="" @if form.theme.is_none() { selected }>@i18n!(ctx.1, "Default theme")</option>
|
|
|
|
@for theme in themes {
|
|
|
|
<option value="@theme" @if Some(theme.clone()) == form.theme { selected }>@theme</option>
|
|
|
|
}
|
|
|
|
</select>
|
|
|
|
} else {
|
|
|
|
<p class="error">@i18n!(ctx.1, "Error while loading theme selector.")</p>
|
|
|
|
}
|
|
|
|
|
|
|
|
<label for="hide_custom_css">
|
|
|
|
<input type="checkbox" name="hide_custom_css" id="hide_custom_css" @if form.hide_custom_css { checked }>
|
|
|
|
@i18n!(ctx.1, "Never load blogs custom themes")
|
|
|
|
</label>
|
|
|
|
|
2018-12-07 11:05:01 +00:00
|
|
|
<input type="submit" value="@i18n!(ctx.1, "Update account")"/>
|
2018-12-06 17:54:16 +00:00
|
|
|
</form>
|
2018-12-07 11:05:01 +00:00
|
|
|
|
|
|
|
<h2>@i18n!(ctx.1, "Danger zone")</h2>
|
|
|
|
<p>@i18n!(ctx.1, "Be very careful, any action taken here can't be cancelled.")
|
|
|
|
@if !u.is_admin {
|
|
|
|
<form method="post" action="@uri!(user::delete: name = u.username)">
|
|
|
|
<input type="submit" class="inline-block button destructive" value="@i18n!(ctx.1, "Delete your account")">
|
|
|
|
</form>
|
|
|
|
} else {
|
2018-12-26 12:05:06 +00:00
|
|
|
<p>@i18n!(ctx.1, "Sorry, but as an admin, you can't leave your own instance.")</p>
|
2018-12-07 11:05:01 +00:00
|
|
|
}
|
2018-12-06 17:54:16 +00:00
|
|
|
}
|
|
|
|
})
|