Add a presentation of Plume and of the instance on the homepage

Fixes #132
This commit is contained in:
Bat 2018-07-27 22:16:17 +02:00
parent 0926a1d3b5
commit ed8982b7fd
16 changed files with 295 additions and 6 deletions

View file

@ -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;

View file

@ -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 '';

View file

@ -145,7 +145,9 @@ impl Blog {
long_description: String::new(),
short_description: String::new(),
default_license: String::new(),
open_registrations: true
open_registrations: true,
short_description_html: String::new(),
long_description_html: String::new()
})
}
};

View file

@ -2,6 +2,7 @@ use chrono::NaiveDateTime;
use diesel::{self, QueryDsl, RunQueryDsl, ExpressionMethods, PgConnection};
use std::iter::Iterator;
use plume_common::utils::md_to_html;
use ap_url;
use users::User;
use schema::{instances, users};
@ -17,7 +18,9 @@ pub struct Instance {
pub open_registrations: bool,
pub short_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)]
@ -29,7 +32,9 @@ pub struct NewInstance {
pub open_registrations: bool,
pub short_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 {
@ -78,12 +83,16 @@ impl 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)
.set((
instances::name.eq(name),
instances::open_registrations.eq(open_registrations),
instances::short_description.eq(short_description),
instances::long_description.eq(long_description),
instances::short_description_html.eq(sd),
instances::long_description_html.eq(ld)
)).get_result::<Instance>(conn)
.expect("Couldn't update instance")
}

View file

@ -57,6 +57,8 @@ table! {
short_description -> Text,
long_description -> Text,
default_license -> Text,
long_description_html -> Varchar,
short_description_html -> Varchar,
}
}

View file

@ -189,7 +189,9 @@ impl User {
long_description: String::new(),
short_description: String::new(),
default_license: String::new(),
open_registrations: true
open_registrations: true,
short_description_html: String::new(),
long_description_html: String::new()
})
}
};

View file

@ -404,3 +404,44 @@ msgstr ""
msgid "No comments yet. Be the first to react!"
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 ""

View file

@ -391,3 +391,42 @@ msgstr ""
msgid "No comments yet. Be the first to react!"
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 ""

View file

@ -400,3 +400,44 @@ msgstr ""
msgid "No comments yet. Be the first to react!"
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 ""

View file

@ -403,5 +403,46 @@ msgstr ""
msgid "No comments yet. Be the first to react!"
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"
#~ msgstr "Zaloguj się"

View file

@ -384,3 +384,39 @@ msgstr ""
msgid "No comments yet. Be the first to react!"
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 ""

View file

@ -26,7 +26,9 @@ fn paginated_index(conn: DbConn, user: Option<User>, page: Page) -> Template {
"account": user,
"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)
"n_pages": Page::total(Post::count(&*conn) as i32),
"n_users": User::count_local(&*conn),
"n_articles": Post::count_local(&*conn)
}))
}
None => {

View file

@ -155,7 +155,9 @@ fn quick_setup(conn: DbConn) {
long_description: String::new(),
short_description: String::new(),
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());

View file

@ -38,6 +38,10 @@ small {
padding: 5em;
}
.spaced {
margin: 4rem 0;
}
/*
* == Header ==
*/
@ -509,6 +513,34 @@ form.new-post input[type="submit"]:hover { background: #DADADA; }
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 *
* ================= */

View file

@ -34,6 +34,7 @@
</main>
<footer>
<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://riot.im/app/#/room/#funkwhale-troubleshooting:matrix.org">{{ "Matrix room" | _ }}</a>
{% if account %}

View file

@ -15,4 +15,37 @@
{% 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 %}