refactor: cloak elements that need alpine loaded
This commit is contained in:
parent
7b70a10463
commit
231eee3e10
7 changed files with 16 additions and 17 deletions
|
|
@ -98,9 +98,9 @@ mod get {
|
|||
h1 { "Mascarpone" }
|
||||
form hx-post=(post_url) hx-target-error="#error" x-data="{ user: '', pass: '' }" {
|
||||
label for="username" { "Username" }
|
||||
input name="username" #username autofocus x-model="user";
|
||||
input name="username" #username autofocus x-model="user" x-cloak;
|
||||
label for="password" { "Password" }
|
||||
input name="password" #password type="password" x-model="pass";
|
||||
input name="password" #password type="password" x-model="pass" x-cloak;
|
||||
|
||||
input type="submit" value="login" x-bind:disabled="!(user.length && pass.length)";
|
||||
#error {}
|
||||
|
|
|
|||
|
|
@ -64,14 +64,13 @@ mod get {
|
|||
fn scroll_to(id: DbId) -> String {
|
||||
format!(
|
||||
"\
|
||||
const top = document\
|
||||
const top=document\
|
||||
.getElementById('nav-link-{}')\
|
||||
?.getBoundingClientRect()\
|
||||
?.top;\
|
||||
console.log({{ top }});\
|
||||
top && document\
|
||||
top&&document\
|
||||
.getElementById('contacts-sidebar')\
|
||||
.scrollTo({{top: top+window.innerHeight/2,left:0,behavior:'instant'}});",
|
||||
.scrollTo({{top:top+window.innerHeight/2,left:0,behavior:'instant'}});",
|
||||
id
|
||||
)
|
||||
}
|
||||
|
|
@ -264,7 +263,7 @@ mod get {
|
|||
div #error;
|
||||
}
|
||||
|
||||
#fields x-data=(json!({ "status": contact.status() })) x-init=(scroll_to(contact_id)) {
|
||||
#fields x-data=(json!({ "status": contact.status() })) x-init=(scroll_to(contact_id)) x-cloak {
|
||||
label { @if contact.names.len() > 1 { "names" } @else { "name" }}
|
||||
div #names x-data=(format!("{{ names: {:?}, new_name: '' }}", &contact.names)) {
|
||||
template x-for="(name, idx) in names" {
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ pub async fn journal_section(
|
|||
are now, or leave everything blank to default to 'today'. Entries will be
|
||||
added to the top of the list regardless of date; refresh the page to re-sort."
|
||||
}
|
||||
form hx-post="/journal_entry" hx-target="next .entries" hx-target-error="#journal-error" hx-swap="afterbegin" hx-on::after-request="if(event.detail.successful) this.reset()" {
|
||||
form hx-post="/journal_entry" hx-target="next .entries" hx-target-error="#journal-error" hx-swap="afterbegin" hx-on::after-request="if(event.detail.successful) this.reset()" x-cloak {
|
||||
input name="date" placeholder=(Zoned::now().date().to_string());
|
||||
textarea name="value" placeholder="New entry..." autofocus {}
|
||||
input type="submit" value="Add Entry";
|
||||
|
|
|
|||
|
|
@ -151,7 +151,6 @@ impl Layout {
|
|||
(content)
|
||||
}
|
||||
}
|
||||
template #alpine-loaded x-cloak {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue