mirror of
https://github.com/Nutomic/ibis.git
synced 2024-11-29 13:01:09 +00:00
Minor changes to create/edit article page (fixes #24)
This commit is contained in:
parent
0ccfe062e7
commit
a057f00e24
2 changed files with 33 additions and 30 deletions
|
@ -61,7 +61,7 @@ pub fn CreateArticle() -> impl IntoView {
|
||||||
set_text.update(|p| *p = val);
|
set_text.update(|p| *p = val);
|
||||||
} >
|
} >
|
||||||
</textarea>
|
</textarea>
|
||||||
</div>
|
<div><a href="https://commonmark.org/help/" target="blank_">Markdown</a>" formatting is supported"</div>
|
||||||
{move || {
|
{move || {
|
||||||
create_error
|
create_error
|
||||||
.get()
|
.get()
|
||||||
|
@ -70,7 +70,7 @@ pub fn CreateArticle() -> impl IntoView {
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
<input type="text"
|
<input type="text"
|
||||||
placeholder="Summary"
|
placeholder="Edit summary"
|
||||||
on:keyup=move |ev| {
|
on:keyup=move |ev| {
|
||||||
let val = event_target_value(&ev);
|
let val = event_target_value(&ev);
|
||||||
set_summary.update(|p| *p = val);
|
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()))>
|
on:click=move |_| submit_action.dispatch((title.get(), text.get(), summary.get()))>
|
||||||
Submit
|
Submit
|
||||||
</button>
|
</button>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
}>
|
}>
|
||||||
<Redirect path={format!("/article/{}", title.get().replace(' ', "_"))} />
|
<Redirect path={format!("/article/{}", title.get().replace(' ', "_"))} />
|
||||||
|
|
|
@ -113,6 +113,7 @@ pub fn EditArticle() -> impl IntoView {
|
||||||
}
|
}
|
||||||
// set initial text, otherwise submit with no changes results in empty text
|
// set initial text, otherwise submit with no changes results in empty text
|
||||||
set_text.set(article.article.text.clone());
|
set_text.set(article.article.text.clone());
|
||||||
|
let article_ = article.clone();
|
||||||
view! {
|
view! {
|
||||||
<div class="item-view">
|
<div class="item-view">
|
||||||
<h1>{article_title(&article.article)}</h1>
|
<h1>{article_title(&article.article)}</h1>
|
||||||
|
@ -129,9 +130,9 @@ pub fn EditArticle() -> impl IntoView {
|
||||||
}>
|
}>
|
||||||
{article.article.text.clone()}
|
{article.article.text.clone()}
|
||||||
</textarea>
|
</textarea>
|
||||||
</div>
|
<div><a href="https://commonmark.org/help/" target="blank_">Markdown</a>" formatting is supported"</div>
|
||||||
<input type="text"
|
<input type="text"
|
||||||
placeholder="Summary"
|
placeholder="Edit summary"
|
||||||
value={summary.get_untracked()}
|
value={summary.get_untracked()}
|
||||||
on:keyup=move |ev| {
|
on:keyup=move |ev| {
|
||||||
let val = event_target_value(&ev);
|
let val = event_target_value(&ev);
|
||||||
|
@ -139,9 +140,10 @@ pub fn EditArticle() -> impl IntoView {
|
||||||
}/>
|
}/>
|
||||||
<button
|
<button
|
||||||
prop:disabled=move || button_is_disabled.get()
|
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
|
Submit
|
||||||
</button>
|
</button>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue