Add a presentation of Plume and of the instance on the homepage
Fixes #132
This commit is contained in:
parent
0926a1d3b5
commit
ed8982b7fd
|
@ -0,0 +1,3 @@
|
||||||
|
-- This file should undo anything in `up.sql`
|
||||||
|
ALTER TABLE instances DROP COLUMN long_description_html;
|
||||||
|
ALTER TABLE instances DROP COLUMN short_description_html;
|
|
@ -0,0 +1,3 @@
|
||||||
|
-- Your SQL goes here
|
||||||
|
ALTER TABLE instances ADD COLUMN long_description_html VARCHAR NOT NULL DEFAULT '';
|
||||||
|
ALTER TABLE instances ADD COLUMN short_description_html VARCHAR NOT NULL DEFAULT '';
|
|
@ -145,7 +145,9 @@ impl Blog {
|
||||||
long_description: String::new(),
|
long_description: String::new(),
|
||||||
short_description: String::new(),
|
short_description: String::new(),
|
||||||
default_license: String::new(),
|
default_license: String::new(),
|
||||||
open_registrations: true
|
open_registrations: true,
|
||||||
|
short_description_html: String::new(),
|
||||||
|
long_description_html: String::new()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,6 +2,7 @@ use chrono::NaiveDateTime;
|
||||||
use diesel::{self, QueryDsl, RunQueryDsl, ExpressionMethods, PgConnection};
|
use diesel::{self, QueryDsl, RunQueryDsl, ExpressionMethods, PgConnection};
|
||||||
use std::iter::Iterator;
|
use std::iter::Iterator;
|
||||||
|
|
||||||
|
use plume_common::utils::md_to_html;
|
||||||
use ap_url;
|
use ap_url;
|
||||||
use users::User;
|
use users::User;
|
||||||
use schema::{instances, users};
|
use schema::{instances, users};
|
||||||
|
@ -17,7 +18,9 @@ pub struct Instance {
|
||||||
pub open_registrations: bool,
|
pub open_registrations: bool,
|
||||||
pub short_description: String,
|
pub short_description: String,
|
||||||
pub long_description: String,
|
pub long_description: String,
|
||||||
pub default_license : String
|
pub default_license : String,
|
||||||
|
pub long_description_html: String,
|
||||||
|
pub short_description_html: String
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Insertable)]
|
#[derive(Insertable)]
|
||||||
|
@ -29,7 +32,9 @@ pub struct NewInstance {
|
||||||
pub open_registrations: bool,
|
pub open_registrations: bool,
|
||||||
pub short_description: String,
|
pub short_description: String,
|
||||||
pub long_description: String,
|
pub long_description: String,
|
||||||
pub default_license : String
|
pub default_license : String,
|
||||||
|
pub long_description_html: String,
|
||||||
|
pub short_description_html: String
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Instance {
|
impl Instance {
|
||||||
|
@ -78,12 +83,16 @@ impl Instance {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update(&self, conn: &PgConnection, name: String, open_registrations: bool, short_description: String, long_description: String) -> Instance {
|
pub fn update(&self, conn: &PgConnection, name: String, open_registrations: bool, short_description: String, long_description: String) -> Instance {
|
||||||
|
let (sd, _) = md_to_html(short_description.as_ref());
|
||||||
|
let (ld, _) = md_to_html(long_description.as_ref());
|
||||||
diesel::update(self)
|
diesel::update(self)
|
||||||
.set((
|
.set((
|
||||||
instances::name.eq(name),
|
instances::name.eq(name),
|
||||||
instances::open_registrations.eq(open_registrations),
|
instances::open_registrations.eq(open_registrations),
|
||||||
instances::short_description.eq(short_description),
|
instances::short_description.eq(short_description),
|
||||||
instances::long_description.eq(long_description),
|
instances::long_description.eq(long_description),
|
||||||
|
instances::short_description_html.eq(sd),
|
||||||
|
instances::long_description_html.eq(ld)
|
||||||
)).get_result::<Instance>(conn)
|
)).get_result::<Instance>(conn)
|
||||||
.expect("Couldn't update instance")
|
.expect("Couldn't update instance")
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,8 @@ table! {
|
||||||
short_description -> Text,
|
short_description -> Text,
|
||||||
long_description -> Text,
|
long_description -> Text,
|
||||||
default_license -> Text,
|
default_license -> Text,
|
||||||
|
long_description_html -> Varchar,
|
||||||
|
short_description_html -> Varchar,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -189,7 +189,9 @@ impl User {
|
||||||
long_description: String::new(),
|
long_description: String::new(),
|
||||||
short_description: String::new(),
|
short_description: String::new(),
|
||||||
default_license: String::new(),
|
default_license: String::new(),
|
||||||
open_registrations: true
|
open_registrations: true,
|
||||||
|
short_description_html: String::new(),
|
||||||
|
long_description_html: String::new()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
41
po/de.po
41
po/de.po
|
@ -404,3 +404,44 @@ msgstr ""
|
||||||
|
|
||||||
msgid "No comments yet. Be the first to react!"
|
msgid "No comments yet. Be the first to react!"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "About this instance"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "What is Plume?"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Plume is a decentralized blogging engine."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Authors can manage various blogs from an unique website."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid ""
|
||||||
|
"Articles are also visible on other Plume websites, and you can interact with "
|
||||||
|
"them directly from other platforms like Mastodon."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#, fuzzy
|
||||||
|
msgid "Create your account"
|
||||||
|
msgstr "Account erstellen"
|
||||||
|
|
||||||
|
#, fuzzy
|
||||||
|
msgid "About {{ instance_name }}"
|
||||||
|
msgstr "Öffnen auf {{ instance_url }}"
|
||||||
|
|
||||||
|
msgid "Home to"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "people"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Who wrote"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#, fuzzy
|
||||||
|
msgid "articles"
|
||||||
|
msgstr "Neuer Artikel"
|
||||||
|
|
||||||
|
msgid "Read the detailed rules"
|
||||||
|
msgstr ""
|
||||||
|
|
39
po/en.po
39
po/en.po
|
@ -391,3 +391,42 @@ msgstr ""
|
||||||
|
|
||||||
msgid "No comments yet. Be the first to react!"
|
msgid "No comments yet. Be the first to react!"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "About this instance"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "What is Plume?"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Plume is a decentralized blogging engine."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Authors can manage various blogs from an unique website."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid ""
|
||||||
|
"Articles are also visible on other Plume websites, and you can interact with "
|
||||||
|
"them directly from other platforms like Mastodon."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Create your account"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#, fuzzy
|
||||||
|
msgid "About {{ instance_name }}"
|
||||||
|
msgstr "Welcome on {{ instance_name }}"
|
||||||
|
|
||||||
|
msgid "Home to"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "people"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Who wrote"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "articles"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Read the detailed rules"
|
||||||
|
msgstr ""
|
||||||
|
|
41
po/fr.po
41
po/fr.po
|
@ -400,3 +400,44 @@ msgstr ""
|
||||||
|
|
||||||
msgid "No comments yet. Be the first to react!"
|
msgid "No comments yet. Be the first to react!"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "About this instance"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "What is Plume?"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Plume is a decentralized blogging engine."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Authors can manage various blogs from an unique website."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid ""
|
||||||
|
"Articles are also visible on other Plume websites, and you can interact with "
|
||||||
|
"them directly from other platforms like Mastodon."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#, fuzzy
|
||||||
|
msgid "Create your account"
|
||||||
|
msgstr "Créer mon compte"
|
||||||
|
|
||||||
|
#, fuzzy
|
||||||
|
msgid "About {{ instance_name }}"
|
||||||
|
msgstr "Ouvrir sur {{ instance_url }}"
|
||||||
|
|
||||||
|
msgid "Home to"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "people"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Who wrote"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#, fuzzy
|
||||||
|
msgid "articles"
|
||||||
|
msgstr "Nouvel article"
|
||||||
|
|
||||||
|
msgid "Read the detailed rules"
|
||||||
|
msgstr ""
|
||||||
|
|
41
po/pl.po
41
po/pl.po
|
@ -403,5 +403,46 @@ msgstr ""
|
||||||
msgid "No comments yet. Be the first to react!"
|
msgid "No comments yet. Be the first to react!"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "About this instance"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "What is Plume?"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Plume is a decentralized blogging engine."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Authors can manage various blogs from an unique website."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid ""
|
||||||
|
"Articles are also visible on other Plume websites, and you can interact with "
|
||||||
|
"them directly from other platforms like Mastodon."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#, fuzzy
|
||||||
|
msgid "Create your account"
|
||||||
|
msgstr "Utwórz konto"
|
||||||
|
|
||||||
|
#, fuzzy
|
||||||
|
msgid "About {{ instance_name }}"
|
||||||
|
msgstr "Otwórz na {{ instance_url }}"
|
||||||
|
|
||||||
|
msgid "Home to"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "people"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Who wrote"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#, fuzzy
|
||||||
|
msgid "articles"
|
||||||
|
msgstr "Nowy artykuł"
|
||||||
|
|
||||||
|
msgid "Read the detailed rules"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#~ msgid "Logowanie"
|
#~ msgid "Logowanie"
|
||||||
#~ msgstr "Zaloguj się"
|
#~ msgstr "Zaloguj się"
|
||||||
|
|
36
po/plume.pot
36
po/plume.pot
|
@ -384,3 +384,39 @@ msgstr ""
|
||||||
|
|
||||||
msgid "No comments yet. Be the first to react!"
|
msgid "No comments yet. Be the first to react!"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "About this instance"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "What is Plume?"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Plume is a decentralized blogging engine."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Authors can manage various blogs from an unique website."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Articles are also visible on other Plume websites, and you can interact with them directly from other platforms like Mastodon."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Create your account"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "About {{ instance_name }}"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Home to"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "people"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Who wrote"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "articles"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Read the detailed rules"
|
||||||
|
msgstr ""
|
||||||
|
|
|
@ -26,7 +26,9 @@ fn paginated_index(conn: DbConn, user: Option<User>, page: Page) -> Template {
|
||||||
"account": user,
|
"account": user,
|
||||||
"recents": recents.into_iter().map(|p| p.to_json(&*conn)).collect::<Vec<serde_json::Value>>(),
|
"recents": recents.into_iter().map(|p| p.to_json(&*conn)).collect::<Vec<serde_json::Value>>(),
|
||||||
"page": page.page,
|
"page": page.page,
|
||||||
"n_pages": Page::total(Post::count(&*conn) as i32)
|
"n_pages": Page::total(Post::count(&*conn) as i32),
|
||||||
|
"n_users": User::count_local(&*conn),
|
||||||
|
"n_articles": Post::count_local(&*conn)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
|
|
|
@ -155,7 +155,9 @@ fn quick_setup(conn: DbConn) {
|
||||||
long_description: String::new(),
|
long_description: String::new(),
|
||||||
short_description: String::new(),
|
short_description: String::new(),
|
||||||
default_license: String::from("CC-0"),
|
default_license: String::from("CC-0"),
|
||||||
open_registrations: true
|
open_registrations: true,
|
||||||
|
short_description_html: String::new(),
|
||||||
|
long_description_html: String::new()
|
||||||
});
|
});
|
||||||
|
|
||||||
println!("{}\n", " ✔️ Your instance was succesfully created!".green());
|
println!("{}\n", " ✔️ Your instance was succesfully created!".green());
|
||||||
|
|
|
@ -38,6 +38,10 @@ small {
|
||||||
padding: 5em;
|
padding: 5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.spaced {
|
||||||
|
margin: 4rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* == Header ==
|
* == Header ==
|
||||||
*/
|
*/
|
||||||
|
@ -509,6 +513,34 @@ form.new-post input[type="submit"]:hover { background: #DADADA; }
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Presentation */
|
||||||
|
.presentation > h2, .presentation > a {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.presentation > a {
|
||||||
|
font-size: 1.2em;
|
||||||
|
margin: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Stats */
|
||||||
|
.stats {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
margin: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stats > div {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stats em {
|
||||||
|
text-align: center;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
/* ================= *
|
/* ================= *
|
||||||
* Small Screens *
|
* Small Screens *
|
||||||
* ================= */
|
* ================= */
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
</main>
|
</main>
|
||||||
<footer>
|
<footer>
|
||||||
<span>Plume 0.1.0</span>
|
<span>Plume 0.1.0</span>
|
||||||
|
<a href="/about">{{ "About this instance" | _ }}</a>
|
||||||
<a href="https://github.com/Plume-org/Plume">{{ "Source code" | _ }}</a>
|
<a href="https://github.com/Plume-org/Plume">{{ "Source code" | _ }}</a>
|
||||||
<a href="https://riot.im/app/#/room/#funkwhale-troubleshooting:matrix.org">{{ "Matrix room" | _ }}</a>
|
<a href="https://riot.im/app/#/room/#funkwhale-troubleshooting:matrix.org">{{ "Matrix room" | _ }}</a>
|
||||||
{% if account %}
|
{% if account %}
|
||||||
|
|
|
@ -15,4 +15,37 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{{ macros::paginate(page=page, total=n_pages) }}
|
{{ 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 %}
|
{% endblock content %}
|
||||||
|
|
Loading…
Reference in New Issue