Also adds a parameter to `md_to_html` to only render inline elements (so that we don't have titles or images in blog descriptions). And moves the delete button for the blog on the edition page. I still have to update the SQLite migration once others PRs with migrations will be merged. Also, there will be a problem when you edit a blog while not owning its banner or icon: when validating they will be reset to their default values… I don't see a good solution to this until we have a better way to handle uploads with Rocket (the same is probably happening for articles btw). And the icon/banner are not federated yet, I don't know if I should add it to this PR or if it can come after?   Fixes #453 Fixes #454
		
			
				
	
	
		
			47 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
@use templates::{base, partials::post_card};
 | 
						|
@use template_utils::*;
 | 
						|
@use plume_models::blogs::Blog;
 | 
						|
@use plume_models::posts::Post;
 | 
						|
@use routes::*;
 | 
						|
 | 
						|
@(ctx: BaseContext, blogs: Vec<Blog>, drafts: Vec<Post>)
 | 
						|
 | 
						|
@:base(ctx, i18n!(ctx.1, "Your Dashboard"), {}, {}, {
 | 
						|
    <h1>@i18n!(ctx.1, "Your Dashboard")</h1>
 | 
						|
 | 
						|
    <section>
 | 
						|
        <h2>@i18n!(ctx.1, "Your Blogs")</h2>
 | 
						|
        @if blogs.is_empty() {
 | 
						|
            <p>@i18n!(ctx.1, "You don't have any blog yet. Create your own, or ask to join one.")</p>
 | 
						|
        }
 | 
						|
        <div class="cards">
 | 
						|
            @for blog in blogs {
 | 
						|
                <div class="card">
 | 
						|
                    @if blog.banner_id.is_some() {
 | 
						|
                        <div class="cover" style="background-image: url('@Html(blog.banner_url(ctx.0).unwrap_or_default())')"></div>
 | 
						|
                    }
 | 
						|
                    <h3><a href="@uri!(blogs::details: name = blog.actor_id, page = _)">@blog.title</a></h3>
 | 
						|
                    <main><p>@Html(blog.summary_html)</p></main>
 | 
						|
                </div>
 | 
						|
            }
 | 
						|
        </div>
 | 
						|
        <a class="button" href="@uri!(blogs::new)">@i18n!(ctx.1, "Start a new blog")</a>
 | 
						|
    </section>
 | 
						|
 | 
						|
    @if !drafts.is_empty() {
 | 
						|
        <section>
 | 
						|
            <h2>@i18n!(ctx.1, "Your Drafts")</h2>
 | 
						|
            <div class="cards">
 | 
						|
                @for draft in drafts {
 | 
						|
                    @:post_card(ctx, draft)
 | 
						|
                }
 | 
						|
            </div>
 | 
						|
        </section>
 | 
						|
    }
 | 
						|
 | 
						|
    <section>
 | 
						|
        <h2>@i18n!(ctx.1, "Your media")</h2>
 | 
						|
        <a class="button" href="@uri!(medias::list: page = _)">@i18n!(ctx.1, "Go to your gallery")</a>
 | 
						|
    </section>
 | 
						|
})
 |