feat: add embed snippet to profile settings
This commit is contained in:
@@ -379,6 +379,7 @@ pub struct ProfileSettingsTemplate<'a> {
|
||||
pub also_known_as: Option<&'a str>,
|
||||
pub profile_fields: &'a [(String, String)],
|
||||
pub saved: bool,
|
||||
pub embed_url: String,
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
|
||||
@@ -56,4 +56,10 @@
|
||||
|
||||
<button type="submit">Save</button>
|
||||
</form>
|
||||
|
||||
<section style="margin-top:2rem;padding-top:1rem;border-top:1px solid rgba(255,255,255,0.1)">
|
||||
<h3>Embed widget</h3>
|
||||
<p style="font-size:.85em;opacity:.7;margin-bottom:.5rem">Add your diary to your blog or website:</p>
|
||||
<pre style="background:rgba(255,255,255,0.06);padding:12px;border-radius:8px;font-size:.8em;overflow-x:auto;white-space:pre-wrap;word-break:break-all"><code><iframe src="{{ embed_url }}" width="100%" height="600" style="border:none;border-radius:8px" loading="lazy"></iframe></code></pre>
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1251,6 +1251,11 @@ pub async fn get_profile_settings(
|
||||
also_known_as: also_known_as.as_deref(),
|
||||
profile_fields: &profile_fields,
|
||||
saved,
|
||||
embed_url: format!(
|
||||
"{}/users/{}?embed=1",
|
||||
state.app_ctx.config.base_url,
|
||||
user_id.value()
|
||||
),
|
||||
})
|
||||
.into_response()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user