1
0
Fork 0
mirror of https://github.com/Nutomic/ibis.git synced 2024-11-25 22:01:09 +00:00

Minor changes to create/edit article page (fixes #24)

This commit is contained in:
Felix Ableitner 2024-03-14 10:11:32 +01:00
parent 0ccfe062e7
commit a057f00e24
2 changed files with 33 additions and 30 deletions

View file

@ -61,7 +61,7 @@ pub fn CreateArticle() -> impl IntoView {
set_text.update(|p| *p = val);
} >
</textarea>
</div>
<div><a href="https://commonmark.org/help/" target="blank_">Markdown</a>" formatting is supported"</div>
{move || {
create_error
.get()
@ -70,7 +70,7 @@ pub fn CreateArticle() -> impl IntoView {
})
}}
<input type="text"
placeholder="Summary"
placeholder="Edit summary"
on:keyup=move |ev| {
let val = event_target_value(&ev);
set_summary.update(|p| *p = val);
@ -80,6 +80,7 @@ pub fn CreateArticle() -> impl IntoView {
on:click=move |_| submit_action.dispatch((title.get(), text.get(), summary.get()))>
Submit
</button>
</div>
}
}>
<Redirect path={format!("/article/{}", title.get().replace(' ', "_"))} />

View file

@ -113,6 +113,7 @@ pub fn EditArticle() -> impl IntoView {
}
// set initial text, otherwise submit with no changes results in empty text
set_text.set(article.article.text.clone());
let article_ = article.clone();
view! {
<div class="item-view">
<h1>{article_title(&article.article)}</h1>
@ -129,9 +130,9 @@ pub fn EditArticle() -> impl IntoView {
}>
{article.article.text.clone()}
</textarea>
</div>
<div><a href="https://commonmark.org/help/" target="blank_">Markdown</a>" formatting is supported"</div>
<input type="text"
placeholder="Summary"
placeholder="Edit summary"
value={summary.get_untracked()}
on:keyup=move |ev| {
let val = event_target_value(&ev);
@ -139,9 +140,10 @@ pub fn EditArticle() -> impl IntoView {
}/>
<button
prop:disabled=move || button_is_disabled.get()
on:click=move |_| submit_action.dispatch((text.get(), summary.get(), article.clone(), edit_response.get()))>
on:click=move |_| submit_action.dispatch((text.get(), summary.get(), article_.clone(), edit_response.get()))>
Submit
</button>
</div>
}
})
}