Sha256: 0a8d5f6436267340044ae631038e44729898ef8ff5b539a28fd5198459e177e2
Contents?: true
Size: 1.36 KB
Versions: 2
Compression:
Stored size: 1.36 KB
Contents
import React from "react"; import NewModelForm from "./components/NewModelForm"; import NewMigrationForm from "./components/NewMigrationForm"; import { createRoot } from "react-dom/client"; document.addEventListener("DOMContentLoaded", () => { $(".grid").masonry({ itemSelector: ".grid-item", percentPosition: true, columnWidth: ".grid-sizer", }); hljs.highlightAll(); const container1 = document.getElementById("react-container-new-model"); if (container1) { const root1 = createRoot(container1); // createRoot(container!) if you use TypeScript root1.render(<NewModelForm />); } const container2 = document.getElementById("react-container-new-migration"); if (container2) { const root2 = createRoot(container2); // createRoot(container!) if you use TypeScript root2.render(<NewMigrationForm />); } function camelize(str) { return str .replace(/(?:^\w|[A-Z]|\b\w)/g, function (word, index) { return word.toUpperCase(); }) .replace(/\s+/g, ""); } function sanitizeInput(e) { var currentInputValue = $(e.currentTarget).val(); var cleanInputValue = currentInputValue.replace(/[^a-zA-Z0-9]/g, ""); cleanInputValue = camelize(cleanInputValue); $(e.currentTarget).val(cleanInputValue); } $(document).on("keyup", "[data-selector='modelName']", function (e) { sanitizeInput(e); }); });
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
localtower-2.0.1 | app/javascript/application.js |
localtower-2.0.0 | app/javascript/application.js |