max / makenotwork
1 file changed,
+6 insertions,
-4 deletions
| @@ -174,13 +174,14 @@ | |||
| 174 | 174 | hx-post="/api/domains/verify" | |
| 175 | 175 | hx-vals='{"domain_id": "{{ cd.id }}"}' | |
| 176 | 176 | hx-target="#domain-verify-result" | |
| 177 | - | hx-swap="innerHTML">Check DNS</button> | |
| 177 | + | hx-swap="innerHTML" | |
| 178 | + | hx-on::after-request="if(event.detail.successful && event.detail.xhr.responseText.indexOf('verified successfully')!==-1) { var t=document.getElementById('settings-body'); if(t) htmx.ajax('GET','/dashboard/tabs/profile',{target:t,swap:'innerHTML'}); else { var b=document.getElementById('tab-profile'); if(b) b.click(); } }">Check DNS</button> | |
| 178 | 179 | <button class="danger" | |
| 179 | 180 | hx-delete="/api/domains/{{ cd.id }}" | |
| 180 | 181 | hx-confirm="Remove this domain?" | |
| 181 | 182 | hx-target="closest .form-section" | |
| 182 | 183 | hx-swap="outerHTML" | |
| 183 | - | hx-on::after-request="if(event.detail.successful) document.getElementById('tab-profile').click()">Remove</button> | |
| 184 | + | hx-on::after-request="if(event.detail.successful) { var t=document.getElementById('settings-body'); if(t) htmx.ajax('GET','/dashboard/tabs/profile',{target:t,swap:'innerHTML'}); else { var b=document.getElementById('tab-profile'); if(b) b.click(); } }">Remove</button> | |
| 184 | 185 | </div> | |
| 185 | 186 | <div id="domain-verify-result" style="margin-top: 0.75rem;"></div> | |
| 186 | 187 | {% else %} | |
| @@ -192,12 +193,13 @@ | |||
| 192 | 193 | hx-confirm="Remove this domain? Your domain will stop serving your content." | |
| 193 | 194 | hx-target="closest .form-section" | |
| 194 | 195 | hx-swap="outerHTML" | |
| 195 | - | hx-on::after-request="if(event.detail.successful) document.getElementById('tab-profile').click()">Remove Domain</button> | |
| 196 | + | hx-on::after-request="if(event.detail.successful) { var t=document.getElementById('settings-body'); if(t) htmx.ajax('GET','/dashboard/tabs/profile',{target:t,swap:'innerHTML'}); else { var b=document.getElementById('tab-profile'); if(b) b.click(); } }">Remove Domain</button> | |
| 196 | 197 | {% endif %} | |
| 197 | 198 | {% when None %} | |
| 198 | 199 | <form hx-post="/api/domains" | |
| 199 | 200 | hx-target="#domain-add-result" | |
| 200 | - | hx-swap="innerHTML"> | |
| 201 | + | hx-swap="innerHTML" | |
| 202 | + | hx-on::after-request="if(event.detail.successful) { var t=document.getElementById('settings-body'); if(t) htmx.ajax('GET','/dashboard/tabs/profile',{target:t,swap:'innerHTML'}); else { var b=document.getElementById('tab-profile'); if(b) b.click(); } }"> | |
| 201 | 203 | <div style="display: flex; gap: 0.75rem; align-items: flex-end;"> | |
| 202 | 204 | <div class="form-group" style="flex: 1; margin-bottom: 0;"> | |
| 203 | 205 | <label for="custom-domain">Domain</label> |