address style improvments
This commit is contained in:
parent
6568f9fbc8
commit
a45bf45015
5 changed files with 54 additions and 16 deletions
|
|
@ -3,9 +3,6 @@ name = "mascarpone"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[build]
|
|
||||||
rustflags = ["--cfg=sqlx_macros_unstable"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1.0.100"
|
anyhow = "1.0.100"
|
||||||
axum = { version = "0.8.6", features = ["macros", "form"] }
|
axum = { version = "0.8.6", features = ["macros", "form"] }
|
||||||
|
|
|
||||||
5
Taskfile
5
Taskfile
|
|
@ -25,4 +25,9 @@ deploy_to_server() {
|
||||||
&& ssh -t "$where" "sudo mv -f mascarpone /usr/bin/ && sudo rm -rf /var/local/mascarpone/static && sudo mv -f static /var/local/mascarpone/ && sudo systemctl restart mascarpone"
|
&& ssh -t "$where" "sudo mv -f mascarpone /usr/bin/ && sudo rm -rf /var/local/mascarpone/static && sudo mv -f static /var/local/mascarpone/ && sudo systemctl restart mascarpone"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dev() {
|
||||||
|
refresh_sqlx_db > /dev/null
|
||||||
|
env DATABASE_URL=sqlite:some_user.db cargo run -- serve
|
||||||
|
}
|
||||||
|
|
||||||
"$@"
|
"$@"
|
||||||
|
|
|
||||||
3
build.rs
Normal file
3
build.rs
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
fn main() {
|
||||||
|
println!("cargo:rerun-if-changed=migrations");
|
||||||
|
}
|
||||||
|
|
@ -19,7 +19,7 @@ use crate::models::user::AuthSession;
|
||||||
use crate::models::{HydratedContact, JournalEntry};
|
use crate::models::{HydratedContact, JournalEntry};
|
||||||
use crate::{AppError, AppState};
|
use crate::{AppError, AppState};
|
||||||
|
|
||||||
#[derive(serde::Serialize)]
|
#[derive(serde::Serialize, Debug)]
|
||||||
pub struct Address {
|
pub struct Address {
|
||||||
pub id: DbId,
|
pub id: DbId,
|
||||||
pub contact_id: DbId,
|
pub contact_id: DbId,
|
||||||
|
|
@ -248,22 +248,29 @@ mod get {
|
||||||
label { "addresses" }
|
label { "addresses" }
|
||||||
div x-data=(json!({ "addresses": addresses, "new_label": "", "new_address": "" })) {
|
div x-data=(json!({ "addresses": addresses, "new_label": "", "new_address": "" })) {
|
||||||
template x-for="(address, index) in addresses" x-bind:key="index" {
|
template x-for="(address, index) in addresses" x-bind:key="index" {
|
||||||
div {
|
.address-input {
|
||||||
input name="address_label" x-show="addresses.length > 1" x-model="address.label" placeholder="label";
|
input name="address_label" x-show="addresses.length" x-model="address.label" placeholder="label";
|
||||||
input name="address_value" x-model="address.value" placeholder="address";
|
.grow-wrap x-bind:data-replicated-value="address.value" {
|
||||||
|
textarea name="address_value" x-model="address.value" placeholder="address" {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
div {
|
.address-input {
|
||||||
input x-show="addresses.length > 1" name="address_label" x-model="new_label" placeholder="label";
|
input x-show="addresses.length" name="address_label" x-model="new_label" placeholder="label";
|
||||||
input name="address_value" x-model="new_address" placeholder="new address";
|
.grow-wrap x-bind:data-replicated-value="new_address" {
|
||||||
|
textarea name="address_value" x-model="new_address" placeholder="new address" {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
input type="button" value="Add" x-on:click="addresses.push({ label: new_label, value: new_address }); new_label = ''; new_address = ''";
|
input type="button" value="Add" x-on:click="addresses.push({ label: new_label, value: new_address }); new_label = ''; new_address = ''";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.grow-wrap data-replicated-value=(text_body) {
|
div #text_body {
|
||||||
textarea name="text_body"
|
div { "Free text (supports markdown)" }
|
||||||
onInput="this.parentNode.dataset.replicatedValue = this.value"
|
.grow-wrap data-replicated-value=(text_body) {
|
||||||
{ (text_body) }
|
textarea name="text_body"
|
||||||
|
onInput="this.parentNode.dataset.replicatedValue = this.value"
|
||||||
|
{ (text_body) }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|
|
||||||
|
|
@ -33,9 +33,14 @@ main {
|
||||||
grid-template-columns: min-content auto;
|
grid-template-columns: min-content auto;
|
||||||
row-gap: 0.5em;
|
row-gap: 0.5em;
|
||||||
|
|
||||||
.label {
|
.label[data-is-empty="false"] {
|
||||||
color: var(--line-color);
|
color: var(--line-color);
|
||||||
text-align: right;
|
text-align: right;
|
||||||
|
margin-right: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.value {
|
||||||
|
white-space: pre-wrap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -72,14 +77,35 @@ main {
|
||||||
&>textarea,
|
&>textarea,
|
||||||
&::after {
|
&::after {
|
||||||
/* Identical styling required!! */
|
/* Identical styling required!! */
|
||||||
margin-top: 1em;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
max-width: 12em;
|
||||||
|
font: inherit;
|
||||||
|
border: 1px solid gray;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: 2px 0;
|
||||||
|
padding: 0.25em;
|
||||||
|
|
||||||
/* Place on top of each other */
|
/* Place on top of each other */
|
||||||
grid-area: 1 / 1 / 2 / 2;
|
grid-area: 1 / 1 / 2 / 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 650px) {
|
||||||
|
.address-input+.address-input {
|
||||||
|
margin-top: 0.5em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#text_body {
|
||||||
|
margin-top: 1em;
|
||||||
|
|
||||||
|
.grow-wrap>textarea,
|
||||||
|
.grow-wrap::after {
|
||||||
|
/* Identical styling required!! */
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.hint {
|
.hint {
|
||||||
font-size: small;
|
font-size: small;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue