Recipe edit, we can now delete groups, steps and ingredients

This commit is contained in:
Greg Burri 2024-12-28 22:52:07 +01:00
parent d4962c98ff
commit 5ce3391466
11 changed files with 183 additions and 68 deletions

View file

@ -0,0 +1,19 @@
#modal-dialog {
// visibility: hidden;
color: white;
max-width: 300px;
margin-left: -125px;
background-color: black;
text-align: center;
border-radius: 2px;
padding: 16px; // TODO: 'rem' better?
position: fixed;
z-index: 1;
left: 50%;
bottom: 30px;
box-shadow: -1px 1px 10px rgba(0, 0, 0, 0.3);
}
#modal-dialog.show {
visibility: visible;
}

View file

@ -1,4 +1,5 @@
@use 'toast.scss';
@use 'modal-dialog.scss';
@font-face {
font-family: Fira Code;

View file

@ -1,51 +1,3 @@
// use actix_web::{
// http::{header, header::ContentType, StatusCode},
// post, put, web, HttpMessage, HttpRequest, HttpResponse, Responder,
// };
// use log::{debug, error, info, log_enabled, Level};
// use ron::de::from_bytes;
// use super::Result;
// use crate::data::db;
// #[put("/ron-api/recipe/set-title")]
// pub async fn set_recipe_title(
// req: HttpRequest,
// body: web::Bytes,
// connection: web::Data<db::Connection>,
// ) -> Result<HttpResponse> {
// let ron_req: common::ron_api::SetRecipeTitle = from_bytes(&body)?;
// connection
// .set_recipe_title_async(ron_req.recipe_id, &ron_req.title)
// .await?;
// Ok(HttpResponse::Ok().finish())
// }
// #[put("/ron-api/recipe/set-description")]
// pub async fn set_recipe_description(
// req: HttpRequest,
// body: web::Bytes,
// connection: web::Data<db::Connection>,
// ) -> Result<HttpResponse> {
// let ron_req: common::ron_api::SetRecipeDescription = from_bytes(&body)?;
// connection
// .set_recipe_description_async(ron_req.recipe_id, &ron_req.description)
// .await?;
// Ok(HttpResponse::Ok().finish())
// }
// #[put("/ron-api/recipe/add-image)]
// #[put("/ron-api/recipe/rm-photo")]
// #[put("/ron-api/recipe/add-ingredient")]
// #[put("/ron-api/recipe/rm-ingredient")]
// #[put("/ron-api/recipe/set-ingredients-order")]
// #[put("/ron-api/recipe/add-group")]
// #[put("/ron-api/recipe/rm-group")]
// #[put("/ron-api/recipe/set-groups-order")]
// #[put("/ron-api/recipe/add-step")]
// #[put("/ron-api/recipe/rm-step")]
// #[put("/ron-api/recipe/set-steps-order")]
use axum::{
debug_handler,
extract::{Extension, Query, State},

View file

@ -18,6 +18,12 @@
<div id="toast"></div>
<dialog id="modal-dialog">
<div class="content"></div>
<input type="button" class="ok" value="OK" />
<input type="button" class="cancel" value="Cancel" />
</dialog>
{% block body_container %}{% endblock %}
<footer class="footer-container">gburri - 2025</footer>

View file

@ -93,15 +93,15 @@
</div>
<div class="ingredient">
<label for="input-ingredient-name">Name</label>
<input class="input-ingredient-name" type="text" />
<label for="input-ingredient-quantity">Quantity</label>
<input class="input-ingredient-quantity" type="number" step="0.1" min="0" max="10000" />
<label for="input-ingredient-unit">Unit</label>
<input class="input-ingredient-unit" type="text" />
<label for="input-ingredient-name">Name</label>
<input class="input-ingredient-name" type="text" />
<label for="input-ingredient-comment">Comment</label>
<input class="input-ingredient-comment" type="text" />