-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use rails-ujs instead of custom data confirm
- Loading branch information
1 parent
fb28a69
commit 06619e7
Showing
1 changed file
with
8 additions
and
17 deletions.
There are no files selected for viewing
25 changes: 8 additions & 17 deletions
25
lib/generators/admin/install/templates/erb/admin/base/_javascript_tags.html.erb
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 |
---|---|---|
@@ -1,30 +1,21 @@ | ||
<!-- Tabler Core --> | ||
<script src="https://cdn.jsdelivr.net/npm/@tabler/[email protected]/dist/js/tabler.min.js"></script> | ||
|
||
<!-- Time zone cookie --> | ||
<script type="module"> | ||
import cookies from "https://cdn.jsdelivr.net/npm/[email protected]/dist/js.cookie.min.mjs" | ||
const { timeZone } = new Intl.DateTimeFormat().resolvedOptions() | ||
cookies.set("time_zone", timeZone, { expires: 365 }) | ||
</script> | ||
|
||
<!-- Data confirm --> | ||
<script type="module"> | ||
document.addEventListener("click", (event) => { | ||
if (!event.target.matches("[data-confirm]")) return | ||
if (!confirm(event.target.dataset["confirm"])) event.preventDefault() | ||
}) | ||
</script> | ||
<script src="https://cdn.jsdelivr.net/npm/@rails/[email protected]/lib/assets/compiled/rails-ujs.min.js"></script> | ||
|
||
<!-- Stimulus controllers --> | ||
<script type="module"> | ||
import { Application, Controller } from "https://cdn.jsdelivr.net/npm/[email protected]/dist/stimulus.min.js" | ||
window.Stimulus = Application.start() | ||
|
||
// Flash message | ||
Stimulus.register("flash-message", class extends Controller { | ||
connect() { | ||
new bootstrap.Toast(this.element).show() | ||
} | ||
}) | ||
</script> | ||
|
||
<!-- Time zone cookie --> | ||
<script type="module"> | ||
import Cookies from "https://cdn.jsdelivr.net/npm/[email protected]/dist/js.cookie.min.mjs" | ||
const { timeZone } = new Intl.DateTimeFormat().resolvedOptions() | ||
Cookies.set("time_zone", timeZone, { expires: 365 }) | ||
</script> |