diff --git a/migrations/2018-07-27-194816_instance_description_html/down.sql b/migrations/2018-07-27-194816_instance_description_html/down.sql new file mode 100644 index 00000000..99f0b18e --- /dev/null +++ b/migrations/2018-07-27-194816_instance_description_html/down.sql @@ -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; diff --git a/migrations/2018-07-27-194816_instance_description_html/up.sql b/migrations/2018-07-27-194816_instance_description_html/up.sql new file mode 100644 index 00000000..47cbee03 --- /dev/null +++ b/migrations/2018-07-27-194816_instance_description_html/up.sql @@ -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 ''; diff --git a/plume-models/src/blogs.rs b/plume-models/src/blogs.rs index 324b60ec..a992f748 100644 --- a/plume-models/src/blogs.rs +++ b/plume-models/src/blogs.rs @@ -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() }) } }; diff --git a/plume-models/src/instance.rs b/plume-models/src/instance.rs index 36f38470..5cb2a3fe 100644 --- a/plume-models/src/instance.rs +++ b/plume-models/src/instance.rs @@ -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::(conn) .expect("Couldn't update instance") } diff --git a/plume-models/src/schema.rs b/plume-models/src/schema.rs index 47ed12dd..79807097 100644 --- a/plume-models/src/schema.rs +++ b/plume-models/src/schema.rs @@ -57,6 +57,8 @@ table! { short_description -> Text, long_description -> Text, default_license -> Text, + long_description_html -> Varchar, + short_description_html -> Varchar, } } diff --git a/plume-models/src/users.rs b/plume-models/src/users.rs index 9878cec9..ad0373b7 100644 --- a/plume-models/src/users.rs +++ b/plume-models/src/users.rs @@ -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() }) } }; diff --git a/po/de.po b/po/de.po index 3f7117a3..020a7e07 100644 --- a/po/de.po +++ b/po/de.po @@ -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 "" diff --git a/po/en.po b/po/en.po index de5917b1..65f3682f 100644 --- a/po/en.po +++ b/po/en.po @@ -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 "" diff --git a/po/fr.po b/po/fr.po index 30abf90d..c99365f5 100644 --- a/po/fr.po +++ b/po/fr.po @@ -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 "" diff --git a/po/pl.po b/po/pl.po index 72f3f36b..25dff52c 100644 --- a/po/pl.po +++ b/po/pl.po @@ -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ę" diff --git a/po/plume.pot b/po/plume.pot index 41689c2f..d2a32d84 100644 --- a/po/plume.pot +++ b/po/plume.pot @@ -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 "" diff --git a/src/routes/instance.rs b/src/routes/instance.rs index e3b46d90..cf8ec983 100644 --- a/src/routes/instance.rs +++ b/src/routes/instance.rs @@ -26,7 +26,9 @@ fn paginated_index(conn: DbConn, user: Option, page: Page) -> Template { "account": user, "recents": recents.into_iter().map(|p| p.to_json(&*conn)).collect::>(), "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 => { diff --git a/src/setup.rs b/src/setup.rs index 1da87610..8efd038d 100644 --- a/src/setup.rs +++ b/src/setup.rs @@ -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()); diff --git a/static/main.css b/static/main.css index 481291fe..0ed247d8 100644 --- a/static/main.css +++ b/static/main.css @@ -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 * * ================= */ diff --git a/templates/base.html.tera b/templates/base.html.tera index f5c19712..5ec261e3 100644 --- a/templates/base.html.tera +++ b/templates/base.html.tera @@ -34,6 +34,7 @@