1
0
Fork 0
mirror of https://github.com/Nutomic/ibis.git synced 2024-12-05 01:51:09 +00:00

Add message about new article approval

This commit is contained in:
Felix Ableitner 2024-11-25 12:17:09 +01:00
parent 1f7baddc29
commit 3ed0df90a1
2 changed files with 21 additions and 3 deletions

View file

@ -6,8 +6,12 @@ use crate::{
dark_mode::DarkMode, dark_mode::DarkMode,
pages::{ pages::{
article::{ article::{
actions::ArticleActions, create::CreateArticle, edit::EditArticle, actions::ArticleActions,
history::ArticleHistory, list::ListArticles, read::ReadArticle, create::CreateArticle,
edit::EditArticle,
history::ArticleHistory,
list::ListArticles,
read::ReadArticle,
}, },
diff::EditDiff, diff::EditDiff,
instance::{details::InstanceDetails, list::ListInstances}, instance::{details::InstanceDetails, list::ListInstances},

View file

@ -1,6 +1,10 @@
use crate::{ use crate::{
common::CreateArticleForm, common::CreateArticleForm,
frontend::{api::CLIENT, components::editor::EditorView}, frontend::{
api::CLIENT,
app::{is_admin, site, DefaultResource},
components::editor::EditorView,
},
}; };
use leptos::{html::Textarea, prelude::*}; use leptos::{html::Textarea, prelude::*};
use leptos_router::components::Redirect; use leptos_router::components::Redirect;
@ -47,9 +51,19 @@ pub fn CreateArticle() -> impl IntoView {
} }
} }
}); });
let show_approval_message = Signal::derive(move || {
site().with_default(|site| site.config.article_approval) && !is_admin()
});
view! { view! {
<h1 class="text-4xl font-bold font-serif my-4">Create new Article</h1> <h1 class="text-4xl font-bold font-serif my-4">Create new Article</h1>
<Suspense>
<Show when=move || show_approval_message.get()>
<div class="alert alert-warning mb-4">
New articles require admin approval before being published
</div>
</Show>
</Suspense>
<Show <Show
when=move || create_response.get().is_some() when=move || create_response.get().is_some()
fallback=move || { fallback=move || {