mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-11-26 05:21:00 +00:00
Reorganize the homepage
This commit is contained in:
parent
39342d2f72
commit
b66d4f73ce
13 changed files with 85 additions and 52 deletions
3
po/de.po
3
po/de.po
|
@ -542,5 +542,8 @@ msgstr ""
|
|||
msgid "Articles from {{ instance.name }}"
|
||||
msgstr "Über {{ instance_name }}"
|
||||
|
||||
msgid "View all"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "Your password should be at least 8 characters long"
|
||||
#~ msgstr "Das Passwort sollte mindestens 8 Zeichen lang sein"
|
||||
|
|
3
po/en.po
3
po/en.po
|
@ -528,3 +528,6 @@ msgstr ""
|
|||
#, fuzzy
|
||||
msgid "Articles from {{ instance.name }}"
|
||||
msgstr "Welcome on {{ instance_name }}"
|
||||
|
||||
msgid "View all"
|
||||
msgstr ""
|
||||
|
|
3
po/fr.po
3
po/fr.po
|
@ -536,3 +536,6 @@ msgstr "Tous les articles de la Fédiverse"
|
|||
|
||||
msgid "Articles from {{ instance.name }}"
|
||||
msgstr "Articles de {{ instance.name }}"
|
||||
|
||||
msgid "View all"
|
||||
msgstr "Tout afficher"
|
||||
|
|
3
po/gl.po
3
po/gl.po
|
@ -532,3 +532,6 @@ msgstr ""
|
|||
#, fuzzy
|
||||
msgid "Articles from {{ instance.name }}"
|
||||
msgstr "Acerca de {{ instance_name }}"
|
||||
|
||||
msgid "View all"
|
||||
msgstr ""
|
||||
|
|
3
po/nb.po
3
po/nb.po
|
@ -546,6 +546,9 @@ msgstr ""
|
|||
msgid "Articles from {{ instance.name }}"
|
||||
msgstr "Om {{ instance_name }}"
|
||||
|
||||
msgid "View all"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "One reshare"
|
||||
#~ msgid_plural "{{ count }} reshares"
|
||||
#~ msgstr[0] "Én deling"
|
||||
|
|
3
po/pl.po
3
po/pl.po
|
@ -545,6 +545,9 @@ msgstr ""
|
|||
msgid "Articles from {{ instance.name }}"
|
||||
msgstr "O {{ instance_name }}"
|
||||
|
||||
msgid "View all"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "One reshare"
|
||||
#~ msgid_plural "{{ count }} reshares"
|
||||
#~ msgstr[0] "Jedno udostępnienie"
|
||||
|
|
|
@ -516,3 +516,6 @@ msgstr ""
|
|||
|
||||
msgid "Articles from {{ instance.name }}"
|
||||
msgstr ""
|
||||
|
||||
msgid "View all"
|
||||
msgstr ""
|
||||
|
|
|
@ -55,7 +55,6 @@ fn main() {
|
|||
|
||||
routes::comments::create,
|
||||
|
||||
routes::instance::paginated_index,
|
||||
routes::instance::index,
|
||||
routes::instance::paginated_local,
|
||||
routes::instance::local,
|
||||
|
|
|
@ -15,18 +15,23 @@ use plume_models::{
|
|||
use inbox::Inbox;
|
||||
use routes::Page;
|
||||
|
||||
#[get("/?<page>")]
|
||||
fn paginated_index(conn: DbConn, user: Option<User>, page: Page) -> Template {
|
||||
#[get("/")]
|
||||
fn index(conn: DbConn, user: Option<User>) -> Template {
|
||||
match Instance::get_local(&*conn) {
|
||||
Some(inst) => {
|
||||
let recents = Post::get_recents_page(&*conn, page.limits());
|
||||
let federated = Post::get_recents_page(&*conn, Page::first().limits());
|
||||
let local = Post::get_instance_page(&*conn, inst.id, Page::first().limits());
|
||||
let user_feed = user.clone().map(|user| {
|
||||
let followed = user.get_following(&*conn);
|
||||
Post::user_feed_page(&*conn, followed.into_iter().map(|u| u.id).collect(), Page::first().limits())
|
||||
});
|
||||
|
||||
Template::render("instance/index", json!({
|
||||
"instance": inst,
|
||||
"account": user.map(|u| u.to_json(&*conn)),
|
||||
"recents": recents.into_iter().map(|p| p.to_json(&*conn)).collect::<Vec<serde_json::Value>>(),
|
||||
"page": page.page,
|
||||
"n_pages": Page::total(Post::count(&*conn) as i32),
|
||||
"federated": federated.into_iter().map(|p| p.to_json(&*conn)).collect::<Vec<serde_json::Value>>(),
|
||||
"local": local.into_iter().map(|p| p.to_json(&*conn)).collect::<Vec<serde_json::Value>>(),
|
||||
"user_feed": user_feed.map(|f| f.into_iter().map(|p| p.to_json(&*conn)).collect::<Vec<serde_json::Value>>()),
|
||||
"n_users": User::count_local(&*conn),
|
||||
"n_articles": Post::count_local(&*conn)
|
||||
}))
|
||||
|
@ -39,11 +44,6 @@ fn paginated_index(conn: DbConn, user: Option<User>, page: Page) -> Template {
|
|||
}
|
||||
}
|
||||
|
||||
#[get("/")]
|
||||
fn index(conn: DbConn, user: Option<User>) -> Template {
|
||||
paginated_index(conn, user, Page::first())
|
||||
}
|
||||
|
||||
#[get("/local?<page>")]
|
||||
fn paginated_local(conn: DbConn, user: Option<User>, page: Page) -> Template {
|
||||
let instance = Instance::get_local(&*conn).unwrap();
|
||||
|
|
|
@ -41,6 +41,10 @@
|
|||
margin: 4rem 0;
|
||||
}
|
||||
|
||||
.cards.spaced {
|
||||
margin: 1rem 0 5rem;
|
||||
}
|
||||
|
||||
.banner {
|
||||
background: #DADADA;
|
||||
padding-top: 2em;
|
||||
|
|
32
templates/instance/description.html.tera
Normal file
32
templates/instance/description.html.tera
Normal file
|
@ -0,0 +1,32 @@
|
|||
<section class="spaced">
|
||||
<div class="cards">
|
||||
<div class="presentation card">
|
||||
<h2>{{ "What is Plume?" | _ }}</h2>
|
||||
<main>
|
||||
<p>{{ "Plume is a decentralized blogging engine." | _ }}</p>
|
||||
<p>{{ "Authors can manage various blogs from an unique website." | _ }}</p>
|
||||
<p>{{ "Articles are also visible on other Plume websites, and you can interact with them directly from other platforms like Mastodon." | _ }}</p>
|
||||
</main>
|
||||
<a href="/users/new">{{ "Create your account" | _ }}</a>
|
||||
</div>
|
||||
<div class="presentation card">
|
||||
<h2>{{ "About {{ instance_name }}" | _(instance_name=instance.name) }}</h2>
|
||||
<main>
|
||||
{{ instance.short_description_html | safe }}
|
||||
<section class="stats">
|
||||
<div>
|
||||
<p>{{ "Home to" | _ }}</p>
|
||||
<em>{{ n_users }}</em>
|
||||
<p>{{ "people" | _ }}</p>
|
||||
</div>
|
||||
<div>
|
||||
<p>{{ "Who wrote" | _ }}</p>
|
||||
<em>{{ n_articles }}</em>
|
||||
<p>{{ "articles" | _ }}</p>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
<a href="/about">{{ "Read the detailed rules" | _ }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
|
@ -10,47 +10,16 @@
|
|||
|
||||
{% if account %}
|
||||
{{ macros::tabs(links=['/', '/feed', '/federated', '/local'], titles=['Latest articles', 'Your feed', 'Federated feed', 'Local feed'], selected=1) }}
|
||||
|
||||
{{ macros::home_feed(title='Your feed', link='/feed', articles=user_feed) }}
|
||||
{{ macros::home_feed(title='Federated feed', link='/federated', articles=federated) }}
|
||||
{{ macros::home_feed(title='Local feed', link='/local', articles=local) }}
|
||||
{% include "instance/description" %}
|
||||
{% else %}
|
||||
{{ macros::tabs(links=['/', '/federated', '/local'], titles=['Latest articles', 'Federated feed', 'Local feed'], selected=1) }}
|
||||
|
||||
{{ macros::home_feed(title='Federated feed', link='/federated', articles=federated) }}
|
||||
{% include "instance/description" %}
|
||||
{{ macros::home_feed(title='Local feed', link='/local', articles=local) }}
|
||||
{% endif %}
|
||||
|
||||
<div class="cards">
|
||||
{% for article in recents %}
|
||||
{{ macros::post_card(article=article) }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{{ macros::paginate(page=page, total=n_pages) }}
|
||||
|
||||
<section class="spaced">
|
||||
<div class="cards">
|
||||
<div class="presentation card">
|
||||
<h2>{{ "What is Plume?" | _ }}</h2>
|
||||
<main>
|
||||
<p>{{ "Plume is a decentralized blogging engine." | _ }}</p>
|
||||
<p>{{ "Authors can manage various blogs from an unique website." | _ }}</p>
|
||||
<p>{{ "Articles are also visible on other Plume websites, and you can interact with them directly from other platforms like Mastodon." | _ }}</p>
|
||||
</main>
|
||||
<a href="/users/new">{{ "Create your account" | _ }}</a>
|
||||
</div>
|
||||
<div class="presentation card">
|
||||
<h2>{{ "About {{ instance_name }}" | _(instance_name=instance.name) }}</h2>
|
||||
<main>
|
||||
{{ instance.short_description_html | safe }}
|
||||
<section class="stats">
|
||||
<div>
|
||||
<p>{{ "Home to" | _ }}</p>
|
||||
<em>{{ n_users }}</em>
|
||||
<p>{{ "people" | _ }}</p>
|
||||
</div>
|
||||
<div>
|
||||
<p>{{ "Who wrote" | _ }}</p>
|
||||
<em>{{ n_articles }}</em>
|
||||
<p>{{ "articles" | _ }}</p>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
<a href="/about">{{ "Read the detailed rules" | _ }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock content %}
|
||||
|
|
|
@ -76,3 +76,11 @@
|
|||
<use xlink:href="/static/images/feather-sprite.svg#{{ name }}"/>
|
||||
</svg>
|
||||
{% endmacro %}
|
||||
{% macro home_feed(title, link, articles) %}
|
||||
<h2>{{ title | _ }} — <a href="{{ link }}">{{ "View all" | _ }}</a></h2>
|
||||
<div class="cards spaced">
|
||||
{% for article in articles %}
|
||||
{{ macros::post_card(article=article) }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
|
Loading…
Reference in a new issue