Doc + little CSS adjustement
This commit is contained in:
parent
58e299b337
commit
2b7e88ae95
4 changed files with 19 additions and 5 deletions
|
|
@ -68,6 +68,10 @@ body {
|
|||
.header-menu {
|
||||
.user-menu {
|
||||
margin: consts.$margin;
|
||||
|
||||
.user-edit-link {
|
||||
margin-left: consts.$margin;
|
||||
}
|
||||
}
|
||||
|
||||
#select-website-language {
|
||||
|
|
|
|||
|
|
@ -12,8 +12,6 @@
|
|||
{% if as_code %}
|
||||
</code></pre>
|
||||
{% endif %}
|
||||
|
||||
<a href="/">Go to home</a>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
|
@ -22,7 +22,13 @@ use crate::{
|
|||
pub fn setup_page(recipe_id: i64) {
|
||||
// Title.
|
||||
{
|
||||
let title: HtmlInputElement = by_id("input-title");
|
||||
// Here we check if the first element exists,
|
||||
// if not, the recipe edit page hasn't been loaded
|
||||
// and we return from the function without panicking.
|
||||
let title = match document().get_element_by_id("input-title") {
|
||||
Some(e) => e.dyn_into::<HtmlInputElement>().unwrap(),
|
||||
None => return,
|
||||
};
|
||||
|
||||
// Check if the recipe has been loaded.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use chrono::Weekday;
|
||||
use common::utils::substitute_with_names;
|
||||
use gloo::events::EventListener;
|
||||
use gloo::{events::EventListener, utils::document};
|
||||
use wasm_bindgen_futures::spawn_local;
|
||||
use web_sys::{Element, HtmlInputElement};
|
||||
|
||||
|
|
@ -14,7 +14,13 @@ use crate::{
|
|||
pub fn setup_page(recipe_id: i64, is_user_logged: bool, first_day_of_the_week: Weekday) {
|
||||
let recipe_scheduler = RecipeScheduler::new(!is_user_logged);
|
||||
|
||||
let add_to_planner: Element = selector("#recipe-view .add-to-planner");
|
||||
// Here we check if the first element exists,
|
||||
// if not, the recipe view page hasn't been loaded
|
||||
// and we return from the function without panicking.
|
||||
let add_to_planner = match document().query_selector("#recipe-view .add-to-planner") {
|
||||
Ok(Some(e)) => e,
|
||||
_ => return,
|
||||
};
|
||||
|
||||
EventListener::new(&add_to_planner, "click", move |_event| {
|
||||
spawn_local(async move {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue