-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
populated the other holiday home page tempates with js and reorganize…
…d js out of the base layout to a local folder and import from there
- Loading branch information
1 parent
b1a3ac9
commit 890d810
Showing
5 changed files
with
212 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
function Prompt() { | ||
|
||
let toast = function(c) { | ||
const{ | ||
msg = '', | ||
title = '', | ||
footer = '', | ||
} = c; | ||
|
||
const Toast = Swal.mixin({ | ||
toast: true, | ||
position: 'top-end', | ||
showConfirmButton: false, | ||
timer: 3000, | ||
timerProgressBar: true, | ||
didOpen: (toast) => { | ||
toast.addEventListener('mouseenter', Swal.stopTimer) | ||
toast.addEventListener('mouseleave', Swal.resumeTimer) | ||
} | ||
}) | ||
|
||
Toast.fire({ | ||
icon: 'success', | ||
title: title, | ||
text: msg, | ||
footer: footer, | ||
}) | ||
} | ||
|
||
let success = function(c) { | ||
const { | ||
msg = '', | ||
title = '', | ||
footer = '', | ||
} = c; | ||
|
||
Swal.fire({ | ||
icon: 'success', | ||
title: title, | ||
text: msg, | ||
footer: footer, | ||
}) | ||
} | ||
|
||
let error = function(c) { | ||
const { | ||
msg = '', | ||
title = '', | ||
footer = '', | ||
} = c; | ||
|
||
Swal.fire({ | ||
icon: 'error', | ||
title: title, | ||
text: msg, | ||
footer: footer, | ||
}) | ||
} | ||
|
||
async function custom(c) { | ||
const { | ||
icon ="", | ||
msg = "", | ||
title = "", | ||
showConfirmButton = true, | ||
} = c; | ||
|
||
const { value: result } = await Swal.fire({ | ||
icon: icon, | ||
title: title, | ||
html: msg, | ||
backdrop: false, | ||
focusConfirm: false, | ||
showCancelButton: true, | ||
showConfirmButton: showConfirmButton, | ||
willOpen: () => { | ||
if (c.willOpen !== undefined) { | ||
c.willOpen(); | ||
} | ||
}, | ||
didOpen: () => { | ||
if (c.didOpen !== undefined) { | ||
c.didOpen(); | ||
} | ||
}, | ||
preConfirm: () => { | ||
return [ | ||
document.getElementById('start').value, | ||
document.getElementById('end').value | ||
] | ||
} | ||
}) | ||
|
||
if (result) { | ||
if (result.dismiss !== Swal.DismissReason.cancel) { | ||
if (result.value !== "") { | ||
if (c.callback !== undefined) { | ||
c.callback(result); | ||
} | ||
} else { | ||
c.callback(false); | ||
} | ||
} else { | ||
c.callback(false); | ||
} | ||
} | ||
} | ||
|
||
return { | ||
toast: toast, | ||
success: success, | ||
error: error, | ||
custom: custom, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,6 +70,7 @@ | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/datepicker-full.min.js"></script> | ||
<script src="https://unpkg.com/notie"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> | ||
<script src="/static/js/app.js"></script> | ||
|
||
{{block "js" .}} | ||
|
||
|
@@ -126,122 +127,6 @@ | |
notify({{.}}, "warning") | ||
{{end}} | ||
|
||
function Prompt() { | ||
|
||
let toast = function(c) { | ||
const{ | ||
msg = '', | ||
title = '', | ||
footer = '', | ||
} = c; | ||
|
||
const Toast = Swal.mixin({ | ||
toast: true, | ||
position: 'top-end', | ||
showConfirmButton: false, | ||
timer: 3000, | ||
timerProgressBar: true, | ||
didOpen: (toast) => { | ||
toast.addEventListener('mouseenter', Swal.stopTimer) | ||
toast.addEventListener('mouseleave', Swal.resumeTimer) | ||
} | ||
}) | ||
|
||
Toast.fire({ | ||
icon: 'success', | ||
title: title, | ||
text: msg, | ||
footer: footer, | ||
}) | ||
} | ||
|
||
let success = function(c) { | ||
const { | ||
msg = '', | ||
title = '', | ||
footer = '', | ||
} = c; | ||
|
||
Swal.fire({ | ||
icon: 'success', | ||
title: title, | ||
text: msg, | ||
footer: footer, | ||
}) | ||
} | ||
|
||
let error = function(c) { | ||
const { | ||
msg = '', | ||
title = '', | ||
footer = '', | ||
} = c; | ||
|
||
Swal.fire({ | ||
icon: 'error', | ||
title: title, | ||
text: msg, | ||
footer: footer, | ||
}) | ||
} | ||
|
||
async function custom(c) { | ||
const { | ||
icon ="", | ||
msg = "", | ||
title = "", | ||
showConfirmButton = true, | ||
} = c; | ||
|
||
const { value: result } = await Swal.fire({ | ||
icon: icon, | ||
title: title, | ||
html: msg, | ||
backdrop: false, | ||
focusConfirm: false, | ||
showCancelButton: true, | ||
showConfirmButton: showConfirmButton, | ||
willOpen: () => { | ||
if (c.willOpen !== undefined) { | ||
c.willOpen(); | ||
} | ||
}, | ||
didOpen: () => { | ||
if (c.didOpen !== undefined) { | ||
c.didOpen(); | ||
} | ||
}, | ||
preConfirm: () => { | ||
return [ | ||
document.getElementById('start').value, | ||
document.getElementById('end').value | ||
] | ||
} | ||
}) | ||
|
||
if (result) { | ||
if (result.dismiss !== Swal.DismissReason.cancel) { | ||
if (result.value !== "") { | ||
if (c.callback !== undefined) { | ||
c.callback(result); | ||
} | ||
} else { | ||
c.callback(false); | ||
} | ||
} else { | ||
c.callback(false); | ||
} | ||
} | ||
} | ||
|
||
return { | ||
toast: toast, | ||
success: success, | ||
error: error, | ||
custom: custom, | ||
} | ||
} | ||
|
||
</script> | ||
|
||
</body> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters