Class: FlashUnified::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- FlashUnified::Generators::InstallGenerator
- Defined in:
- lib/flash_unified/generators/install/install_generator.rb
Instance Method Summary collapse
-
#install ⇒ Object
Rails generator entrypoint (only task that performs copying).
- #show_importmap_instructions ⇒ Object
Instance Method Details
#install ⇒ Object
Rails generator entrypoint (only task that performs copying)
24 25 26 |
# File 'lib/flash_unified/generators/install/install_generator.rb', line 24 def install handle_installation end |
#show_importmap_instructions ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/flash_unified/generators/install/install_generator.rb', line 28 def show_importmap_instructions = "\n === FlashUnified installation instructions ===\n\n Quick start (Importmap)\n 1) Add to `config/importmap.rb`:\n\n pin \"flash_unified/all\", to: \"flash_unified/all.bundle.js\"\n\n 2) Import once in your JavaScript entry point (e.g. `app/javascript/application.js`):\n\n import \"flash_unified/all\";\n\n 3) In your layout (inside `<body>`):\n\n <%= flash_unified_sources %>\n <%= flash_container %>\n\n Auto-initialization is enabled by default. Control it via `<html>` attributes:\n - `data-flash-unified-auto-init=\"false\"` to disable all automatic wiring.\n - `data-flash-unified-enable-network-errors=\"true\"` to enable network error listeners.\n\n Advanced usage (optional)\n Manual control:\n\n import { renderFlashMessages, appendMessageToStorage } from \"flash_unified\";\n import { installTurboRenderListeners } from \"flash_unified/turbo_helpers\";\n installTurboRenderListeners();\n\n Network helpers:\n\n import { notifyNetworkError, notifyHttpError } from \"flash_unified/network_helpers\";\n // notifyNetworkError();\n // notifyHttpError(413);\n\n Propshaft / Sprockets quick start\n Place in `<head>`:\n\n <link rel=\"modulepreload\" href=\"<%= asset_path('flash_unified/all.bundle.js') %>\">\n <script type=\"importmap\">\n {\n \"imports\": {\n \"flash_unified/all\": \"<%= asset_path('flash_unified/all.bundle.js') %>\"\n }\n }\n </script>\n <script type=\"module\">\n import \"flash_unified/all\";\n </script>\n\n (Optionally map `flash_unified` or other modules if you need manual control APIs.)\n\n Layout helpers\n <%= flash_general_error_messages %>\n <%= flash_global_storage %>\n <%= flash_templates %>\n <%= flash_container %>\n <%= flash_storage %>\n\n Documentation\n - See README.md / README.ja.md for customization guidance and advanced scenarios.\n\n MSG\n\n say message\nend\n" |