diff --git a/TODO.md b/TODO.md index a23a33a..8d2074d 100644 --- a/TODO.md +++ b/TODO.md @@ -1,7 +1,9 @@ TODO ==== -* [ ] Minitest +* [ ] Flash message + * [ ] https://reinteractive.com/articles/how-to-create-flash-messages-in-Rails-7 + * [ ] * [ ] Tailwind * [ ] copy TailAdmin (or WindMill) layout * [ ] https://demo.tailadmin.com/crm @@ -25,6 +27,7 @@ TODO New Notes --------- +* [x] Minitest * [x] Formatter * [x] wrap warning containing \n * [x] "\e[0;35mhello".length => 12 instead of 5! \ No newline at end of file diff --git a/app/javascript/application.js b/app/javascript/application.js index b8cbcf1..166ea10 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -7,4 +7,4 @@ import Toastify from 'toastify-js' window.Toastify=Toastify // Js Controllers -import "controllers" \ No newline at end of file +import "controllers" diff --git a/app/javascript/controllers/application.js b/app/javascript/controllers/application.js index 1213e85..c84f770 100644 --- a/app/javascript/controllers/application.js +++ b/app/javascript/controllers/application.js @@ -3,7 +3,7 @@ import { Application } from "@hotwired/stimulus" const application = Application.start() // Configure Stimulus development experience -application.debug = false +application.debug = true window.Stimulus = application export { application } diff --git a/app/javascript/controllers/toast_controller.js b/app/javascript/controllers/toast_controller.js new file mode 100644 index 0000000..b2dda29 --- /dev/null +++ b/app/javascript/controllers/toast_controller.js @@ -0,0 +1,8 @@ +import { Controller } from "@hotwired/stimulus" + +export default class extends Controller { + connect() { + console.log('toast.js: ', this.element) + this.element.textContent = "Toast #1" + } +} diff --git a/config/importmap.rb b/config/importmap.rb index 6ee0304..bac13c7 100644 --- a/config/importmap.rb +++ b/config/importmap.rb @@ -1,9 +1,9 @@ # Pin npm packages by running ./bin/importmap pin 'application' +pin_all_from 'app/javascript/controllers', under: 'controllers' + pin '@hotwired/turbo-rails', to: 'turbo.min.js', preload: true pin '@hotwired/stimulus', to: 'stimulus.min.js' pin '@hotwired/stimulus-loading', to: 'stimulus-loading.js' -pin_all_from 'app/javascript/controllers', under: 'controllers' - pin 'toastify-js' # @1.12.0