brut 0.16.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1088) hide show
  1. checksums.yaml +4 -4
  2. data/exe/brut +34 -0
  3. data/lib/brut/cli/apps/build_assets.rb +78 -48
  4. data/lib/brut/cli/apps/db.rb +168 -202
  5. data/lib/brut/cli/apps/deploy.rb +291 -0
  6. data/lib/brut/cli/apps/heroku_container_based_deploy.rb +7 -1
  7. data/{mkbrut/lib/mkbrut → lib/brut/cli/apps/new}/add_segment.rb +5 -5
  8. data/{mkbrut/lib/mkbrut → lib/brut/cli/apps/new}/add_segment_options.rb +1 -1
  9. data/lib/brut/cli/apps/new/app.rb +240 -0
  10. data/{mkbrut/lib/mkbrut → lib/brut/cli/apps/new}/app_id.rb +1 -1
  11. data/lib/brut/cli/apps/new/app_name.rb +29 -0
  12. data/{mkbrut/lib/mkbrut → lib/brut/cli/apps/new}/base.rb +9 -6
  13. data/lib/brut/cli/apps/new/erb_binding_delegate.rb +23 -0
  14. data/{mkbrut/lib/mkbrut → lib/brut/cli/apps/new}/internet_identifier.rb +5 -5
  15. data/{mkbrut/lib/mkbrut → lib/brut/cli/apps/new}/invalid_identifier.rb +1 -1
  16. data/{mkbrut/lib/mkbrut/app.rb → lib/brut/cli/apps/new/old_app.rb} +8 -11
  17. data/{mkbrut/lib/mkbrut → lib/brut/cli/apps/new}/ops/add_css_import.rb +1 -1
  18. data/{mkbrut/lib/mkbrut → lib/brut/cli/apps/new}/ops/add_i18n_message.rb +1 -1
  19. data/{mkbrut/lib/mkbrut → lib/brut/cli/apps/new}/ops/add_method.rb +1 -1
  20. data/{mkbrut/lib/mkbrut → lib/brut/cli/apps/new}/ops/append_to_file.rb +1 -1
  21. data/{mkbrut/lib/mkbrut → lib/brut/cli/apps/new}/ops/base_op.rb +3 -3
  22. data/{mkbrut/lib/mkbrut → lib/brut/cli/apps/new}/ops/copy_file.rb +1 -1
  23. data/{mkbrut/lib/mkbrut → lib/brut/cli/apps/new}/ops/insert_code_in_method.rb +1 -1
  24. data/{mkbrut/lib/mkbrut → lib/brut/cli/apps/new}/ops/insert_into_file.rb +1 -1
  25. data/{mkbrut/lib/mkbrut → lib/brut/cli/apps/new}/ops/insert_route.rb +1 -1
  26. data/{mkbrut/lib/mkbrut → lib/brut/cli/apps/new}/ops/mkdir.rb +1 -1
  27. data/{mkbrut/lib/mkbrut → lib/brut/cli/apps/new}/ops/prism_parsing_op.rb +1 -1
  28. data/{mkbrut/lib/mkbrut → lib/brut/cli/apps/new}/ops/render_template.rb +1 -1
  29. data/{mkbrut/lib/mkbrut → lib/brut/cli/apps/new}/ops/skip_file.rb +1 -1
  30. data/lib/brut/cli/apps/new/ops.rb +17 -0
  31. data/lib/brut/cli/apps/new/organization.rb +5 -0
  32. data/{mkbrut/lib/mkbrut → lib/brut/cli/apps/new}/prefix.rb +1 -1
  33. data/{mkbrut/lib/mkbrut → lib/brut/cli/apps/new}/segments/bare_bones.rb +12 -11
  34. data/{mkbrut/lib/mkbrut → lib/brut/cli/apps/new}/segments/demo.rb +16 -15
  35. data/{mkbrut/lib/mkbrut → lib/brut/cli/apps/new}/segments/heroku.rb +9 -5
  36. data/{mkbrut/lib/mkbrut → lib/brut/cli/apps/new}/segments/sidekiq.rb +44 -21
  37. data/lib/brut/cli/apps/new/segments.rb +8 -0
  38. data/lib/brut/cli/apps/new/version.rb +3 -0
  39. data/{mkbrut/lib/mkbrut → lib/brut/cli/apps/new}/versions.rb +2 -2
  40. data/lib/brut/cli/apps/new.rb +26 -0
  41. data/lib/brut/cli/apps/scaffold.rb +150 -141
  42. data/lib/brut/cli/apps/test.rb +95 -69
  43. data/lib/brut/cli/commands/base_command.rb +174 -0
  44. data/lib/brut/cli/commands/compound_command.rb +29 -0
  45. data/lib/brut/cli/commands/execution_context.rb +32 -0
  46. data/lib/brut/cli/commands/help.rb +26 -0
  47. data/lib/brut/cli/commands/output_error.rb +13 -0
  48. data/lib/brut/cli/commands/raise_error.rb +11 -0
  49. data/lib/brut/cli/commands.rb +8 -0
  50. data/lib/brut/cli/execute_result.rb +39 -0
  51. data/lib/brut/cli/executor.rb +9 -4
  52. data/lib/brut/cli/output.rb +13 -0
  53. data/lib/brut/cli/parsed_command_line.rb +143 -0
  54. data/lib/brut/cli/runner.rb +124 -0
  55. data/lib/brut/cli.rb +7 -29
  56. data/lib/brut/framework/container.rb +1 -1
  57. data/lib/brut/framework/mcp.rb +59 -13
  58. data/lib/brut/framework/project_environment.rb +3 -1
  59. data/lib/brut/junk_drawer.rb +3 -1
  60. data/lib/brut/spec_support/cli_command_support.rb +45 -0
  61. data/lib/brut/spec_support/e2e_test_server.rb +3 -0
  62. data/lib/brut/spec_support/general_support.rb +1 -1
  63. data/lib/brut/spec_support/matchers/have_executed.rb +35 -0
  64. data/lib/brut/spec_support/rspec_setup.rb +4 -8
  65. data/lib/brut/spec_support.rb +1 -0
  66. data/lib/brut/tui/ansi_escape_code.rb +104 -0
  67. data/lib/brut/tui/event_loop.rb +168 -0
  68. data/lib/brut/tui/events/base_event.rb +29 -0
  69. data/lib/brut/tui/events/event_bus.rb +73 -0
  70. data/lib/brut/tui/events/event_loop_started.rb +5 -0
  71. data/lib/brut/tui/events/exception.rb +24 -0
  72. data/lib/brut/tui/events/tick.rb +12 -0
  73. data/lib/brut/tui/events.rb +7 -0
  74. data/lib/brut/tui/markup_string.rb +70 -0
  75. data/lib/brut/tui/script/block_step.rb +17 -0
  76. data/lib/brut/tui/script/events/command_execution_failed.rb +4 -0
  77. data/lib/brut/tui/script/events/command_execution_succeeded.rb +3 -0
  78. data/lib/brut/tui/script/events/command_std_err.rb +3 -0
  79. data/lib/brut/tui/script/events/command_std_out.rb +14 -0
  80. data/lib/brut/tui/script/events/executing_command.rb +12 -0
  81. data/lib/brut/tui/script/events/message.rb +15 -0
  82. data/lib/brut/tui/script/events/phase_completed.rb +4 -0
  83. data/lib/brut/tui/script/events/phase_started.rb +14 -0
  84. data/lib/brut/tui/script/events/script_completed.rb +5 -0
  85. data/lib/brut/tui/script/events/script_started.rb +12 -0
  86. data/lib/brut/tui/script/events/step_completed.rb +3 -0
  87. data/lib/brut/tui/script/events/step_started.rb +12 -0
  88. data/lib/brut/tui/script/events.rb +14 -0
  89. data/lib/brut/tui/script/exec_step.rb +67 -0
  90. data/lib/brut/tui/script/logging_subscriber.rb +98 -0
  91. data/lib/brut/tui/script/puts_subscriber.rb +109 -0
  92. data/lib/brut/tui/script/step.rb +13 -0
  93. data/lib/brut/tui/script.rb +215 -0
  94. data/lib/brut/tui/terminal.rb +74 -0
  95. data/lib/brut/tui/terminal_theme.rb +144 -0
  96. data/lib/brut/tui/themes/dark.rb +14 -0
  97. data/lib/brut/tui/themes/light.rb +17 -0
  98. data/lib/brut/tui/themes/none.rb +9 -0
  99. data/lib/brut/tui/themes.rb +5 -0
  100. data/lib/brut/tui.rb +15 -0
  101. data/lib/brut/version.rb +1 -1
  102. data/lib/brut.rb +1 -0
  103. data/templates/Base/.env.development.local +2 -0
  104. data/templates/Base/bin/ci +42 -0
  105. data/{mkbrut/templates → templates}/Base/bin/release +2 -2
  106. data/templates/Base/bin/setup +174 -0
  107. data/{mkbrut/templates → templates}/Base/bin/watch-and-build-assets +1 -1
  108. data/{mkbrut/templates → templates}/Base/dx/docker-compose.env.erb +1 -1
  109. data/{mkbrut/templates → templates}/segments/Demo/app/src/front_end/css/fonts.css +1 -1
  110. data/{mkbrut/templates → templates}/segments/Heroku/deploy/Dockerfile +2 -2
  111. data/templates/segments/Heroku/deploy/docker_config.rb +30 -0
  112. metadata +254 -1009
  113. data/.gitignore +0 -55
  114. data/.projections.json +0 -10
  115. data/CHANGELOG.md +0 -167
  116. data/CODE_OF_CONDUCT.txt +0 -99
  117. data/Dockerfile.dx +0 -82
  118. data/Gemfile +0 -6
  119. data/Gemfile.lock +0 -243
  120. data/LICENSE.txt +0 -370
  121. data/README.md +0 -90
  122. data/Rakefile +0 -25
  123. data/assets/Logo-Square.pxd +0 -0
  124. data/assets/LogoPylon.pxd +0 -0
  125. data/assets/LogoStop.pxd +0 -0
  126. data/assets/LogoTall.pxd +0 -0
  127. data/assets/MetroIcon.graffle +0 -0
  128. data/assets/MetroLogo.graffle +0 -0
  129. data/assets/SocialImage.png +0 -0
  130. data/assets/SocialImage.pxd +0 -0
  131. data/assets/YouTubeThumb.pxd +0 -0
  132. data/bin/bin_kit.rb +0 -51
  133. data/bin/build +0 -86
  134. data/bin/ci +0 -40
  135. data/bin/dev +0 -20
  136. data/bin/docs +0 -79
  137. data/bin/generate-and-run-rubocop +0 -52
  138. data/bin/new-version +0 -8
  139. data/bin/publish +0 -61
  140. data/bin/rake +0 -27
  141. data/bin/rspec +0 -27
  142. data/bin/rubocop +0 -27
  143. data/bin/setup +0 -252
  144. data/bin/test +0 -18
  145. data/brut-css/.nvim.lua +0 -1
  146. data/brut-css/README.md +0 -28
  147. data/brut-css/bin/build +0 -50
  148. data/brut-css/bin/ci +0 -19
  149. data/brut-css/bin/dev +0 -1
  150. data/brut-css/bin/docs +0 -34
  151. data/brut-css/bin/publish +0 -21
  152. data/brut-css/bin/setup +0 -6
  153. data/brut-css/config/media-queries-all.css +0 -15
  154. data/brut-css/config/media-queries-minimal.css +0 -5
  155. data/brut-css/config/postcss.config.cjs +0 -7
  156. data/brut-css/config/pseudo-classes-all.css +0 -9
  157. data/brut-css/dx +0 -1
  158. data/brut-css/package-lock.json +0 -3165
  159. data/brut-css/package.json +0 -36
  160. data/brut-css/src/css/appearance.css +0 -145
  161. data/brut-css/src/css/border.css +0 -522
  162. data/brut-css/src/css/colors.css +0 -3502
  163. data/brut-css/src/css/dimensions.css +0 -548
  164. data/brut-css/src/css/flex.css +0 -179
  165. data/brut-css/src/css/index.css +0 -13
  166. data/brut-css/src/css/layout.css +0 -120
  167. data/brut-css/src/css/list.css +0 -41
  168. data/brut-css/src/css/positioning.css +0 -354
  169. data/brut-css/src/css/properties/colors.css +0 -455
  170. data/brut-css/src/css/properties/index.css +0 -3
  171. data/brut-css/src/css/properties/spacing.css +0 -140
  172. data/brut-css/src/css/properties/typography.css +0 -224
  173. data/brut-css/src/css/reset.css +0 -107
  174. data/brut-css/src/css/spacing.css +0 -585
  175. data/brut-css/src/css/typography.css +0 -519
  176. data/brut-css/src/css/utils.css +0 -104
  177. data/brut-css/src/docs/1_getting-started/1_overview.md +0 -46
  178. data/brut-css/src/docs/1_getting-started/2_installation.md +0 -25
  179. data/brut-css/src/docs/1_getting-started/3_core-concepts.md +0 -75
  180. data/brut-css/src/docs/1_getting-started/4_simple-example.md +0 -132
  181. data/brut-css/src/docs/1_getting-started/page.html.ejs +0 -10
  182. data/brut-css/src/docs/2_properties/page.html.ejs +0 -71
  183. data/brut-css/src/docs/3_classes/color-demo.html.ejs +0 -31
  184. data/brut-css/src/docs/3_classes/page.html.ejs +0 -87
  185. data/brut-css/src/docs/4_customization/1_design-system.md +0 -36
  186. data/brut-css/src/docs/4_customization/2_breakpoints.md +0 -75
  187. data/brut-css/src/docs/4_customization/3_pseudo-classes.md +0 -74
  188. data/brut-css/src/docs/4_customization/4_advanced-configuration.md +0 -40
  189. data/brut-css/src/docs/4_customization/page.html.ejs +0 -10
  190. data/brut-css/src/docs/docs.css +0 -98
  191. data/brut-css/src/docs/includes/body-and-header.html.ejs +0 -30
  192. data/brut-css/src/docs/includes/footer-and-rest.html.ejs +0 -9
  193. data/brut-css/src/docs/includes/head.html.ejs +0 -5
  194. data/brut-css/src/docs/includes/nav.html.ejs +0 -10
  195. data/brut-css/src/docs/index.html.ejs +0 -32
  196. data/brut-css/src/docs/prism-twilight.min.css +0 -1
  197. data/brut-css/src/js/Logger.js +0 -71
  198. data/brut-css/src/js/build.js +0 -111
  199. data/brut-css/src/js/cli/CLIArgError.js +0 -7
  200. data/brut-css/src/js/cli/Debug.js +0 -27
  201. data/brut-css/src/js/cli/DocsDir.js +0 -16
  202. data/brut-css/src/js/cli/DocsTemplateSourceDir.js +0 -16
  203. data/brut-css/src/js/cli/InputFile.js +0 -31
  204. data/brut-css/src/js/cli/MediaQueryConfigFile.js +0 -10
  205. data/brut-css/src/js/cli/OutputFile.js +0 -22
  206. data/brut-css/src/js/cli/ParsedArg.js +0 -17
  207. data/brut-css/src/js/cli/PathToBrutCSSRoot.js +0 -19
  208. data/brut-css/src/js/cli/PseudoClassConfigFile.js +0 -11
  209. data/brut-css/src/js/cli.js +0 -108
  210. data/brut-css/src/js/docGenerator.js +0 -467
  211. data/brut-css/src/js/mediaQueryConfigParser.js +0 -98
  212. data/brut-css/src/js/post-css-plugins/addMediaQueriesPlugin.js +0 -49
  213. data/brut-css/src/js/post-css-plugins/addPseudoClassesPlugin.js +0 -42
  214. data/brut-css/src/js/post-css-plugins/generateDocumentationPlugin/Category.js +0 -9
  215. data/brut-css/src/js/post-css-plugins/generateDocumentationPlugin/DocState.js +0 -185
  216. data/brut-css/src/js/post-css-plugins/generateDocumentationPlugin/Documentable.js +0 -8
  217. data/brut-css/src/js/post-css-plugins/generateDocumentationPlugin/Group.js +0 -7
  218. data/brut-css/src/js/post-css-plugins/generateDocumentationPlugin/ParsedComment.js +0 -73
  219. data/brut-css/src/js/post-css-plugins/generateDocumentationPlugin/Property.js +0 -9
  220. data/brut-css/src/js/post-css-plugins/generateDocumentationPlugin/PropertyCategory.js +0 -4
  221. data/brut-css/src/js/post-css-plugins/generateDocumentationPlugin/PropertyGroup.js +0 -8
  222. data/brut-css/src/js/post-css-plugins/generateDocumentationPlugin/Rule.js +0 -12
  223. data/brut-css/src/js/post-css-plugins/generateDocumentationPlugin/RuleCategory.js +0 -4
  224. data/brut-css/src/js/post-css-plugins/generateDocumentationPlugin/RuleGroup.js +0 -8
  225. data/brut-css/src/js/post-css-plugins/generateDocumentationPlugin/SeeRef.js +0 -5
  226. data/brut-css/src/js/post-css-plugins/generateDocumentationPlugin/SeeURL.js +0 -9
  227. data/brut-css/src/js/post-css-plugins/generateDocumentationPlugin.js +0 -49
  228. data/brut-css/src/js/post-css-plugins/generateRootCustomPropertiesPlugin.js +0 -45
  229. data/brut-css/src/js/pseudoClassConfigParser.js +0 -145
  230. data/brut-js/.projections.json +0 -10
  231. data/brut-js/README.md +0 -118
  232. data/brut-js/bin/build +0 -19
  233. data/brut-js/bin/ci +0 -5
  234. data/brut-js/bin/docs +0 -25
  235. data/brut-js/bin/publish +0 -21
  236. data/brut-js/bin/setup +0 -6
  237. data/brut-js/docs/README.md +0 -8
  238. data/brut-js/docs/jsdoc-plugins/customElementTag.js +0 -8
  239. data/brut-js/docs/jsdoc-theme/publish.js +0 -692
  240. data/brut-js/docs/jsdoc-theme/static/scripts/linenumber.js +0 -25
  241. data/brut-js/docs/jsdoc-theme/static/scripts/prettify/Apache-License-2.0.txt +0 -202
  242. data/brut-js/docs/jsdoc-theme/static/scripts/prettify/lang-css.js +0 -2
  243. data/brut-js/docs/jsdoc-theme/static/scripts/prettify/prettify.js +0 -28
  244. data/brut-js/docs/jsdoc-theme/static/styles/jsdoc-default.css +0 -327
  245. data/brut-js/docs/jsdoc-theme/static/styles/prettify-jsdoc.css +0 -111
  246. data/brut-js/docs/jsdoc-theme/static/styles/prettify-tomorrow.css +0 -132
  247. data/brut-js/docs/jsdoc-theme/tmpl/augments.tmpl +0 -10
  248. data/brut-js/docs/jsdoc-theme/tmpl/container.tmpl +0 -199
  249. data/brut-js/docs/jsdoc-theme/tmpl/details.tmpl +0 -143
  250. data/brut-js/docs/jsdoc-theme/tmpl/example.tmpl +0 -2
  251. data/brut-js/docs/jsdoc-theme/tmpl/examples.tmpl +0 -13
  252. data/brut-js/docs/jsdoc-theme/tmpl/exceptions.tmpl +0 -32
  253. data/brut-js/docs/jsdoc-theme/tmpl/layout.tmpl +0 -38
  254. data/brut-js/docs/jsdoc-theme/tmpl/mainpage.tmpl +0 -14
  255. data/brut-js/docs/jsdoc-theme/tmpl/members.tmpl +0 -38
  256. data/brut-js/docs/jsdoc-theme/tmpl/method.tmpl +0 -131
  257. data/brut-js/docs/jsdoc-theme/tmpl/modifies.tmpl +0 -14
  258. data/brut-js/docs/jsdoc-theme/tmpl/params.tmpl +0 -131
  259. data/brut-js/docs/jsdoc-theme/tmpl/properties.tmpl +0 -108
  260. data/brut-js/docs/jsdoc-theme/tmpl/returns.tmpl +0 -19
  261. data/brut-js/docs/jsdoc-theme/tmpl/source.tmpl +0 -8
  262. data/brut-js/docs/jsdoc-theme/tmpl/tutorial.tmpl +0 -19
  263. data/brut-js/docs/jsdoc-theme/tmpl/type.tmpl +0 -7
  264. data/brut-js/docs/jsdoc.config.json +0 -23
  265. data/brut-js/docs/package-lock.json +0 -343
  266. data/brut-js/docs/package.json +0 -7
  267. data/brut-js/dx +0 -1
  268. data/brut-js/package-lock.json +0 -2210
  269. data/brut-js/package.json +0 -36
  270. data/brut-js/specs/AjaxSubmit.spec.js +0 -453
  271. data/brut-js/specs/Autosubmit.spec.js +0 -127
  272. data/brut-js/specs/ConfirmSubmit.spec.js +0 -224
  273. data/brut-js/specs/ConstraintViolationMessage.spec.js +0 -33
  274. data/brut-js/specs/ConstraintViolationMessages.spec.js +0 -32
  275. data/brut-js/specs/CopyToClipboard.spec.js +0 -35
  276. data/brut-js/specs/Form.spec.js +0 -137
  277. data/brut-js/specs/I18nTranslation.spec.js +0 -19
  278. data/brut-js/specs/LocaleDetection.spec.js +0 -22
  279. data/brut-js/specs/Message.spec.js +0 -15
  280. data/brut-js/specs/SpecHelper.js +0 -23
  281. data/brut-js/specs/Tabs.spec.js +0 -41
  282. data/brut-js/specs/Toast.spec.js +0 -34
  283. data/brut-js/specs/config/asset_metadata.json +0 -7
  284. data/brut-js/src/AjaxSubmit.js +0 -499
  285. data/brut-js/src/Autosubmit.js +0 -63
  286. data/brut-js/src/BaseCustomElement.js +0 -261
  287. data/brut-js/src/ConfirmSubmit.js +0 -137
  288. data/brut-js/src/ConfirmationDialog.js +0 -143
  289. data/brut-js/src/ConstraintViolationMessage.js +0 -140
  290. data/brut-js/src/ConstraintViolationMessages.js +0 -98
  291. data/brut-js/src/CopyToClipboard.js +0 -96
  292. data/brut-js/src/Form.js +0 -147
  293. data/brut-js/src/I18nTranslation.js +0 -64
  294. data/brut-js/src/LocaleDetection.js +0 -117
  295. data/brut-js/src/Logger.js +0 -90
  296. data/brut-js/src/Message.js +0 -62
  297. data/brut-js/src/RichString.js +0 -116
  298. data/brut-js/src/Tabs.js +0 -168
  299. data/brut-js/src/Toast.js +0 -102
  300. data/brut-js/src/Tracing.js +0 -247
  301. data/brut-js/src/appForTestingOnly.js +0 -15
  302. data/brut-js/src/index.js +0 -133
  303. data/brut-js/src/testing/AssetMetadata.js +0 -35
  304. data/brut-js/src/testing/AssetMetadataLoader.js +0 -25
  305. data/brut-js/src/testing/CustomElementTest.js +0 -235
  306. data/brut-js/src/testing/DOMCreator.js +0 -45
  307. data/brut-js/src/testing/index.js +0 -48
  308. data/brut.gemspec +0 -71
  309. data/brutrb.com/.vitepress/config.mjs +0 -164
  310. data/brutrb.com/.vitepress/plugins/jsdocLinker.js +0 -34
  311. data/brutrb.com/.vitepress/plugins/rdocLinker.js +0 -18
  312. data/brutrb.com/.vitepress/theme/custom.css +0 -14
  313. data/brutrb.com/.vitepress/theme/index.js +0 -18
  314. data/brutrb.com/.vitepress/theme/style.css +0 -139
  315. data/brutrb.com/adrs.md +0 -16
  316. data/brutrb.com/ai.md +0 -68
  317. data/brutrb.com/assets.md +0 -131
  318. data/brutrb.com/bin/build +0 -5
  319. data/brutrb.com/bin/deploy +0 -7
  320. data/brutrb.com/bin/dev +0 -5
  321. data/brutrb.com/bin/setup +0 -6
  322. data/brutrb.com/brut-js.md +0 -128
  323. data/brutrb.com/business-logic.md +0 -55
  324. data/brutrb.com/cli.md +0 -274
  325. data/brutrb.com/components.md +0 -265
  326. data/brutrb.com/configuration.md +0 -256
  327. data/brutrb.com/css.md +0 -103
  328. data/brutrb.com/custom-element-tests.md +0 -148
  329. data/brutrb.com/database-access.md +0 -201
  330. data/brutrb.com/database-schema.md +0 -320
  331. data/brutrb.com/deployment.md +0 -158
  332. data/brutrb.com/dev-environment.md +0 -186
  333. data/brutrb.com/dir-structure.md +0 -120
  334. data/brutrb.com/doc-conventions.md +0 -41
  335. data/brutrb.com/dx +0 -1
  336. data/brutrb.com/end-to-end-tests.md +0 -176
  337. data/brutrb.com/features.md +0 -373
  338. data/brutrb.com/flash-and-session.md +0 -208
  339. data/brutrb.com/form-constraints.md +0 -266
  340. data/brutrb.com/forms.md +0 -238
  341. data/brutrb.com/getting-started.md +0 -142
  342. data/brutrb.com/handlers.md +0 -177
  343. data/brutrb.com/hooks.md +0 -176
  344. data/brutrb.com/i18n.md +0 -190
  345. data/brutrb.com/images/DevEnvironment.graffle +0 -0
  346. data/brutrb.com/images/DevEnvironment.png +0 -0
  347. data/brutrb.com/images/LogoSquare.png +0 -0
  348. data/brutrb.com/images/LogoStop.png +0 -0
  349. data/brutrb.com/images/LogoTall.png +0 -0
  350. data/brutrb.com/images/Makefile +0 -10
  351. data/brutrb.com/images/OverviewMetro.graffle +0 -0
  352. data/brutrb.com/images/OverviewMetro.png +0 -0
  353. data/brutrb.com/images/dev-env-overview.dot +0 -54
  354. data/brutrb.com/images/dev-env-overview.png +0 -0
  355. data/brutrb.com/images/dev-env-protocol.dot +0 -37
  356. data/brutrb.com/images/dev-env-protocol.png +0 -0
  357. data/brutrb.com/images/overview.graffle +0 -0
  358. data/brutrb.com/images/overview.png +0 -0
  359. data/brutrb.com/images/spa.dot +0 -19
  360. data/brutrb.com/images/spa.png +0 -0
  361. data/brutrb.com/images/tutorial/02-confirmation-dialog-browser-element-styled.png +0 -0
  362. data/brutrb.com/images/tutorial/02-confirmation-dialog-browser-element.png +0 -0
  363. data/brutrb.com/images/tutorial/02-confirmation-dialog-browser.png +0 -0
  364. data/brutrb.com/images/tutorial/02-confirmation-flow.graffle +0 -0
  365. data/brutrb.com/images/tutorial/02-confirmation-flow.png +0 -0
  366. data/brutrb.com/images/tutorial/basic-form-with-violations.png +0 -0
  367. data/brutrb.com/images/tutorial/basic-form.png +0 -0
  368. data/brutrb.com/images/tutorial/initial-home-page.png +0 -0
  369. data/brutrb.com/images/tutorial/new-post-editor.png +0 -0
  370. data/brutrb.com/images/tutorial/new-post-home-page.png +0 -0
  371. data/brutrb.com/images/tutorial/styled-form-with-server-side-violations.png +0 -0
  372. data/brutrb.com/images/tutorial/styled-form-with-violations.png +0 -0
  373. data/brutrb.com/images/tutorial/styled-home-page-with-posts.png +0 -0
  374. data/brutrb.com/images/tutorial/styled-home-page.png +0 -0
  375. data/brutrb.com/images/tutorial/welcome-to-brut.png +0 -0
  376. data/brutrb.com/images/workspace-protocol.dot +0 -44
  377. data/brutrb.com/images/workspace-protocol.png +0 -0
  378. data/brutrb.com/index.md +0 -34
  379. data/brutrb.com/instrumentation.md +0 -331
  380. data/brutrb.com/javascript.md +0 -122
  381. data/brutrb.com/jobs.md +0 -114
  382. data/brutrb.com/keyword-injection.md +0 -195
  383. data/brutrb.com/layouts.md +0 -156
  384. data/brutrb.com/lsp.md +0 -23
  385. data/brutrb.com/markdown-examples.md +0 -85
  386. data/brutrb.com/middleware.md +0 -80
  387. data/brutrb.com/overview.md +0 -68
  388. data/brutrb.com/package-lock.json +0 -2451
  389. data/brutrb.com/package.json +0 -11
  390. data/brutrb.com/pages.md +0 -290
  391. data/brutrb.com/public/SocialImage.png +0 -0
  392. data/brutrb.com/public/favicon.ico +0 -0
  393. data/brutrb.com/recipes/alternate-layouts.md +0 -32
  394. data/brutrb.com/recipes/authentication.md +0 -336
  395. data/brutrb.com/recipes/custom-flash.md +0 -51
  396. data/brutrb.com/recipes/dev-env-secrets.md +0 -87
  397. data/brutrb.com/recipes/form-errors.md +0 -148
  398. data/brutrb.com/recipes/indexed-forms.md +0 -149
  399. data/brutrb.com/recipes/migrations.md +0 -210
  400. data/brutrb.com/recipes/text-field-component.md +0 -182
  401. data/brutrb.com/roadmap.md +0 -52
  402. data/brutrb.com/routes.md +0 -189
  403. data/brutrb.com/security.md +0 -102
  404. data/brutrb.com/seed-data.md +0 -63
  405. data/brutrb.com/space-time-continuum.md +0 -81
  406. data/brutrb.com/tutorial.md +0 -138
  407. data/brutrb.com/tutorials/01-intro.md +0 -1654
  408. data/brutrb.com/tutorials/02-dialog.md +0 -569
  409. data/brutrb.com/unit-tests.md +0 -148
  410. data/brutrb.com/why.md +0 -19
  411. data/docker-compose.dx.yml +0 -25
  412. data/docs/404.html +0 -26
  413. data/docs/CNAME +0 -1
  414. data/docs/SocialImage.png +0 -0
  415. data/docs/adrs.html +0 -29
  416. data/docs/ai.html +0 -29
  417. data/docs/api/Brut/BackEnd/SeedData.html +0 -493
  418. data/docs/api/Brut/BackEnd/Sidekiq/Middlewares/Server/FlushSpans.html +0 -214
  419. data/docs/api/Brut/BackEnd/Sidekiq/Middlewares/Server.html +0 -125
  420. data/docs/api/Brut/BackEnd/Sidekiq/Middlewares.html +0 -125
  421. data/docs/api/Brut/BackEnd/Sidekiq.html +0 -125
  422. data/docs/api/Brut/BackEnd/Validators/FormValidator.html +0 -414
  423. data/docs/api/Brut/BackEnd/Validators.html +0 -128
  424. data/docs/api/Brut/BackEnd.html +0 -132
  425. data/docs/api/Brut/CLI/App.html +0 -1601
  426. data/docs/api/Brut/CLI/AppRunner.html +0 -491
  427. data/docs/api/Brut/CLI/Apps/BuildAssets/All.html +0 -264
  428. data/docs/api/Brut/CLI/Apps/BuildAssets/CSS.html +0 -306
  429. data/docs/api/Brut/CLI/Apps/BuildAssets/Images.html +0 -262
  430. data/docs/api/Brut/CLI/Apps/BuildAssets/JS.html +0 -314
  431. data/docs/api/Brut/CLI/Apps/BuildAssets.html +0 -183
  432. data/docs/api/Brut/CLI/Apps/DB/Create.html +0 -365
  433. data/docs/api/Brut/CLI/Apps/DB/Drop.html +0 -357
  434. data/docs/api/Brut/CLI/Apps/DB/Migrate.html +0 -389
  435. data/docs/api/Brut/CLI/Apps/DB/NewMigration.html +0 -339
  436. data/docs/api/Brut/CLI/Apps/DB/Rebuild.html +0 -329
  437. data/docs/api/Brut/CLI/Apps/DB/Seed.html +0 -347
  438. data/docs/api/Brut/CLI/Apps/DB/Status.html +0 -383
  439. data/docs/api/Brut/CLI/Apps/DB.html +0 -183
  440. data/docs/api/Brut/CLI/Apps/DeployBase/GitChecks.html +0 -270
  441. data/docs/api/Brut/CLI/Apps/DeployBase.html +0 -257
  442. data/docs/api/Brut/CLI/Apps/HerokuContainerBasedDeploy/Deploy.html +0 -587
  443. data/docs/api/Brut/CLI/Apps/HerokuContainerBasedDeploy.html +0 -196
  444. data/docs/api/Brut/CLI/Apps/Scaffold/Action/Route.html +0 -303
  445. data/docs/api/Brut/CLI/Apps/Scaffold/Action.html +0 -508
  446. data/docs/api/Brut/CLI/Apps/Scaffold/Component.html +0 -398
  447. data/docs/api/Brut/CLI/Apps/Scaffold/CustomElementTest.html +0 -374
  448. data/docs/api/Brut/CLI/Apps/Scaffold/DbModel.html +0 -384
  449. data/docs/api/Brut/CLI/Apps/Scaffold/E2ETest.html +0 -410
  450. data/docs/api/Brut/CLI/Apps/Scaffold/Form.html +0 -262
  451. data/docs/api/Brut/CLI/Apps/Scaffold/Page/Route.html +0 -303
  452. data/docs/api/Brut/CLI/Apps/Scaffold/Page.html +0 -480
  453. data/docs/api/Brut/CLI/Apps/Scaffold/RoutesEditor.html +0 -450
  454. data/docs/api/Brut/CLI/Apps/Scaffold/Test.html +0 -380
  455. data/docs/api/Brut/CLI/Apps/Scaffold.html +0 -253
  456. data/docs/api/Brut/CLI/Apps/Test/Audit.html +0 -470
  457. data/docs/api/Brut/CLI/Apps/Test/E2e.html +0 -407
  458. data/docs/api/Brut/CLI/Apps/Test/JS.html +0 -262
  459. data/docs/api/Brut/CLI/Apps/Test/Run.html +0 -578
  460. data/docs/api/Brut/CLI/Apps/Test.html +0 -253
  461. data/docs/api/Brut/CLI/Apps.html +0 -125
  462. data/docs/api/Brut/CLI/Command.html +0 -2425
  463. data/docs/api/Brut/CLI/Error.html +0 -139
  464. data/docs/api/Brut/CLI/ExecutionResults/Result.html +0 -664
  465. data/docs/api/Brut/CLI/ExecutionResults.html +0 -675
  466. data/docs/api/Brut/CLI/Executor.html +0 -561
  467. data/docs/api/Brut/CLI/InvalidOption.html +0 -245
  468. data/docs/api/Brut/CLI/Options.html +0 -880
  469. data/docs/api/Brut/CLI/Output.html +0 -699
  470. data/docs/api/Brut/CLI/SystemExecError.html +0 -451
  471. data/docs/api/Brut/CLI.html +0 -263
  472. data/docs/api/Brut/FactoryBot.html +0 -225
  473. data/docs/api/Brut/Framework/App.html +0 -1097
  474. data/docs/api/Brut/Framework/Config.html +0 -1071
  475. data/docs/api/Brut/Framework/Container.html +0 -1464
  476. data/docs/api/Brut/Framework/Error.html +0 -140
  477. data/docs/api/Brut/Framework/Errors/AbstractMethod.html +0 -232
  478. data/docs/api/Brut/Framework/Errors/Bug.html +0 -234
  479. data/docs/api/Brut/Framework/Errors/MissingConfiguration.html +0 -257
  480. data/docs/api/Brut/Framework/Errors/MissingParameter.html +0 -273
  481. data/docs/api/Brut/Framework/Errors/NoClassForPath.html +0 -471
  482. data/docs/api/Brut/Framework/Errors/NotFound.html +0 -308
  483. data/docs/api/Brut/Framework/Errors/NotImplemented.html +0 -234
  484. data/docs/api/Brut/Framework/Errors.html +0 -351
  485. data/docs/api/Brut/Framework/FussyTypeEnforcement.html +0 -392
  486. data/docs/api/Brut/Framework/MCP.html +0 -871
  487. data/docs/api/Brut/Framework/ProjectEnvironment.html +0 -648
  488. data/docs/api/Brut/Framework.html +0 -129
  489. data/docs/api/Brut/FrontEnd/AssetPathResolver.html +0 -317
  490. data/docs/api/Brut/FrontEnd/Component/Helpers.html +0 -420
  491. data/docs/api/Brut/FrontEnd/Component.html +0 -434
  492. data/docs/api/Brut/FrontEnd/Components/ConstraintViolations.html +0 -491
  493. data/docs/api/Brut/FrontEnd/Components/FormTag.html +0 -526
  494. data/docs/api/Brut/FrontEnd/Components/I18nTranslations.html +0 -313
  495. data/docs/api/Brut/FrontEnd/Components/Input.html +0 -195
  496. data/docs/api/Brut/FrontEnd/Components/Inputs/ButtonTag.html +0 -447
  497. data/docs/api/Brut/FrontEnd/Components/Inputs/CsrfToken.html +0 -339
  498. data/docs/api/Brut/FrontEnd/Components/Inputs/InputTag.html +0 -568
  499. data/docs/api/Brut/FrontEnd/Components/Inputs/RadioButton.html +0 -419
  500. data/docs/api/Brut/FrontEnd/Components/Inputs/SelectTagWithOptions.html +0 -610
  501. data/docs/api/Brut/FrontEnd/Components/Inputs/TextareaTag.html +0 -534
  502. data/docs/api/Brut/FrontEnd/Components/Inputs.html +0 -125
  503. data/docs/api/Brut/FrontEnd/Components/LocaleDetection.html +0 -367
  504. data/docs/api/Brut/FrontEnd/Components/PageIdentifier.html +0 -355
  505. data/docs/api/Brut/FrontEnd/Components/TimeTag.html +0 -655
  506. data/docs/api/Brut/FrontEnd/Components/Traceparent.html +0 -352
  507. data/docs/api/Brut/FrontEnd/Components.html +0 -156
  508. data/docs/api/Brut/FrontEnd/CsrfProtector.html +0 -250
  509. data/docs/api/Brut/FrontEnd/Download.html +0 -467
  510. data/docs/api/Brut/FrontEnd/Flash.html +0 -1150
  511. data/docs/api/Brut/FrontEnd/Form.html +0 -1227
  512. data/docs/api/Brut/FrontEnd/Forms/Button.html +0 -331
  513. data/docs/api/Brut/FrontEnd/Forms/ButtonInputDefinition.html +0 -537
  514. data/docs/api/Brut/FrontEnd/Forms/ConstraintViolation.html +0 -590
  515. data/docs/api/Brut/FrontEnd/Forms/Input/Color.html +0 -201
  516. data/docs/api/Brut/FrontEnd/Forms/Input/TimeOfDay.html +0 -535
  517. data/docs/api/Brut/FrontEnd/Forms/Input.html +0 -1567
  518. data/docs/api/Brut/FrontEnd/Forms/InputDeclarations.html +0 -635
  519. data/docs/api/Brut/FrontEnd/Forms/InputDefinition.html +0 -1336
  520. data/docs/api/Brut/FrontEnd/Forms/RadioButtonGroupInput.html +0 -730
  521. data/docs/api/Brut/FrontEnd/Forms/RadioButtonGroupInputDefinition.html +0 -587
  522. data/docs/api/Brut/FrontEnd/Forms/SelectInput.html +0 -734
  523. data/docs/api/Brut/FrontEnd/Forms/SelectInputDefinition.html +0 -582
  524. data/docs/api/Brut/FrontEnd/Forms/ValidityState.html +0 -659
  525. data/docs/api/Brut/FrontEnd/Forms.html +0 -127
  526. data/docs/api/Brut/FrontEnd/GenericResponse.html +0 -377
  527. data/docs/api/Brut/FrontEnd/Handler.html +0 -442
  528. data/docs/api/Brut/FrontEnd/Handlers/CspReportingHandler.html +0 -318
  529. data/docs/api/Brut/FrontEnd/Handlers/InstrumentationHandler/TraceParent.html +0 -336
  530. data/docs/api/Brut/FrontEnd/Handlers/InstrumentationHandler.html +0 -399
  531. data/docs/api/Brut/FrontEnd/Handlers/LocaleDetectionHandler.html +0 -354
  532. data/docs/api/Brut/FrontEnd/Handlers/MissingHandler/Form.html +0 -151
  533. data/docs/api/Brut/FrontEnd/Handlers/MissingHandler.html +0 -315
  534. data/docs/api/Brut/FrontEnd/Handlers.html +0 -125
  535. data/docs/api/Brut/FrontEnd/HandlingResults.html +0 -339
  536. data/docs/api/Brut/FrontEnd/HttpMethod.html +0 -661
  537. data/docs/api/Brut/FrontEnd/HttpStatus.html +0 -496
  538. data/docs/api/Brut/FrontEnd/InlineSvgLocator.html +0 -284
  539. data/docs/api/Brut/FrontEnd/Layout.html +0 -486
  540. data/docs/api/Brut/FrontEnd/Middleware.html +0 -135
  541. data/docs/api/Brut/FrontEnd/Middlewares/AnnotateBrutOwnedPaths.html +0 -288
  542. data/docs/api/Brut/FrontEnd/Middlewares/Favicon.html +0 -292
  543. data/docs/api/Brut/FrontEnd/Middlewares/OpenTelemetrySpan.html +0 -324
  544. data/docs/api/Brut/FrontEnd/Middlewares/ReloadApp.html +0 -376
  545. data/docs/api/Brut/FrontEnd/Middlewares.html +0 -125
  546. data/docs/api/Brut/FrontEnd/Page.html +0 -781
  547. data/docs/api/Brut/FrontEnd/Pages/MissingPage.html +0 -797
  548. data/docs/api/Brut/FrontEnd/Pages.html +0 -125
  549. data/docs/api/Brut/FrontEnd/RequestContext.html +0 -1312
  550. data/docs/api/Brut/FrontEnd/RouteHook.html +0 -424
  551. data/docs/api/Brut/FrontEnd/RouteHooks/AgeFlash.html +0 -242
  552. data/docs/api/Brut/FrontEnd/RouteHooks/CSPNoInlineScripts.html +0 -249
  553. data/docs/api/Brut/FrontEnd/RouteHooks/CSPNoInlineStylesOrScripts/ReportOnly.html +0 -264
  554. data/docs/api/Brut/FrontEnd/RouteHooks/CSPNoInlineStylesOrScripts.html +0 -261
  555. data/docs/api/Brut/FrontEnd/RouteHooks/LocaleDetection.html +0 -284
  556. data/docs/api/Brut/FrontEnd/RouteHooks/SetupRequestContext.html +0 -252
  557. data/docs/api/Brut/FrontEnd/RouteHooks.html +0 -115
  558. data/docs/api/Brut/FrontEnd/Routing/FormHandlerRoute.html +0 -227
  559. data/docs/api/Brut/FrontEnd/Routing/FormRoute.html +0 -305
  560. data/docs/api/Brut/FrontEnd/Routing/MissingForm.html +0 -324
  561. data/docs/api/Brut/FrontEnd/Routing/MissingHandler.html +0 -319
  562. data/docs/api/Brut/FrontEnd/Routing/MissingPage.html +0 -315
  563. data/docs/api/Brut/FrontEnd/Routing/MissingPath.html +0 -315
  564. data/docs/api/Brut/FrontEnd/Routing/PageRoute.html +0 -327
  565. data/docs/api/Brut/FrontEnd/Routing/Route.html +0 -761
  566. data/docs/api/Brut/FrontEnd/Routing.html +0 -927
  567. data/docs/api/Brut/FrontEnd/Session.html +0 -1195
  568. data/docs/api/Brut/FrontEnd.html +0 -134
  569. data/docs/api/Brut/I18n/BaseMethods.html +0 -931
  570. data/docs/api/Brut/I18n/ForBackEnd.html +0 -302
  571. data/docs/api/Brut/I18n/ForCLI.html +0 -302
  572. data/docs/api/Brut/I18n/ForHTML.html +0 -296
  573. data/docs/api/Brut/I18n/HTTPAcceptLanguage/AlwaysEnglish.html +0 -316
  574. data/docs/api/Brut/I18n/HTTPAcceptLanguage.html +0 -930
  575. data/docs/api/Brut/I18n.html +0 -127
  576. data/docs/api/Brut/Instrumentation/LoggerSpanExporter.html +0 -435
  577. data/docs/api/Brut/Instrumentation/Methods/ClassMethods.html +0 -596
  578. data/docs/api/Brut/Instrumentation/Methods.html +0 -173
  579. data/docs/api/Brut/Instrumentation/OpenTelemetry/NormalizedAttributes.html +0 -286
  580. data/docs/api/Brut/Instrumentation/OpenTelemetry/Span.html +0 -302
  581. data/docs/api/Brut/Instrumentation/OpenTelemetry.html +0 -866
  582. data/docs/api/Brut/Instrumentation.html +0 -128
  583. data/docs/api/Brut/RubocopConfig.html +0 -237
  584. data/docs/api/Brut/SinatraHelpers/ClassMethods.html +0 -534
  585. data/docs/api/Brut/SinatraHelpers.html +0 -281
  586. data/docs/api/Brut/SpecSupport/ClockSupport.html +0 -383
  587. data/docs/api/Brut/SpecSupport/ComponentSupport.html +0 -496
  588. data/docs/api/Brut/SpecSupport/E2ETestServer.html +0 -503
  589. data/docs/api/Brut/SpecSupport/E2eSupport.html +0 -142
  590. data/docs/api/Brut/SpecSupport/EnhancedNode.html +0 -403
  591. data/docs/api/Brut/SpecSupport/FlashSupport.html +0 -278
  592. data/docs/api/Brut/SpecSupport/GeneralSupport/ClassMethods.html +0 -401
  593. data/docs/api/Brut/SpecSupport/GeneralSupport.html +0 -195
  594. data/docs/api/Brut/SpecSupport/HandlerSupport.html +0 -160
  595. data/docs/api/Brut/SpecSupport/Matchers/BeABug.html +0 -142
  596. data/docs/api/Brut/SpecSupport/Matchers/BePageFor.html +0 -142
  597. data/docs/api/Brut/SpecSupport/Matchers/BeRoutingFor.html +0 -155
  598. data/docs/api/Brut/SpecSupport/Matchers/HaveConstraintViolation.html +0 -583
  599. data/docs/api/Brut/SpecSupport/Matchers/HaveGenerated.html +0 -149
  600. data/docs/api/Brut/SpecSupport/Matchers/HaveHTMLAttribute.html +0 -466
  601. data/docs/api/Brut/SpecSupport/Matchers/HaveI18nString.html +0 -149
  602. data/docs/api/Brut/SpecSupport/Matchers/HaveLinkTo.html +0 -149
  603. data/docs/api/Brut/SpecSupport/Matchers/HaveRedirectedTo.html +0 -165
  604. data/docs/api/Brut/SpecSupport/Matchers/HaveReturnedHttpStatus.html +0 -158
  605. data/docs/api/Brut/SpecSupport/Matchers/HaveReturnedRackResponse.html +0 -156
  606. data/docs/api/Brut/SpecSupport/Matchers.html +0 -125
  607. data/docs/api/Brut/SpecSupport/RSpecSetup/OptionalSidekiqSupport.html +0 -335
  608. data/docs/api/Brut/SpecSupport/RSpecSetup.html +0 -637
  609. data/docs/api/Brut/SpecSupport/SessionSupport.html +0 -196
  610. data/docs/api/Brut/SpecSupport.html +0 -129
  611. data/docs/api/Brut.html +0 -341
  612. data/docs/api/Clock.html +0 -603
  613. data/docs/api/ModuleName.html +0 -595
  614. data/docs/api/RichString.html +0 -775
  615. data/docs/api/SemanticLogger/Appender/Async.html +0 -219
  616. data/docs/api/Sequel/Extensions/BrutInstrumentation.html +0 -119
  617. data/docs/api/Sequel/Extensions/BrutMigrations.html +0 -541
  618. data/docs/api/Sequel/Extensions.html +0 -117
  619. data/docs/api/Sequel/Plugins/CreatedAt/InstanceMethods.html +0 -105
  620. data/docs/api/Sequel/Plugins/CreatedAt.html +0 -125
  621. data/docs/api/Sequel/Plugins/ExternalId/ClassMethods.html +0 -207
  622. data/docs/api/Sequel/Plugins/ExternalId/InstanceMethods.html +0 -186
  623. data/docs/api/Sequel/Plugins/ExternalId.html +0 -218
  624. data/docs/api/Sequel/Plugins/FindBang/ClassMethods.html +0 -202
  625. data/docs/api/Sequel/Plugins/FindBang.html +0 -125
  626. data/docs/api/Sequel/Plugins.html +0 -117
  627. data/docs/api/Sequel.html +0 -117
  628. data/docs/api/_index.html +0 -1719
  629. data/docs/api/class_list.html +0 -54
  630. data/docs/api/css/common.css +0 -1
  631. data/docs/api/css/full_list.css +0 -59
  632. data/docs/api/css/style.css +0 -504
  633. data/docs/api/file.README.html +0 -172
  634. data/docs/api/file_list.html +0 -59
  635. data/docs/api/frames.html +0 -22
  636. data/docs/api/index.html +0 -172
  637. data/docs/api/js/app.js +0 -344
  638. data/docs/api/js/full_list.js +0 -242
  639. data/docs/api/js/jquery.js +0 -4
  640. data/docs/api/method_list.html +0 -4422
  641. data/docs/api/top-level-namespace.html +0 -112
  642. data/docs/assets/02-confirmation-dialog-browser-element-styled.3NEGM20-.png +0 -0
  643. data/docs/assets/02-confirmation-dialog-browser-element.DPsf0xUW.png +0 -0
  644. data/docs/assets/02-confirmation-dialog-browser.DH8ALFO4.png +0 -0
  645. data/docs/assets/02-confirmation-flow.D9gZ0S5U.png +0 -0
  646. data/docs/assets/DevEnvironment.DaFcVfwP.png +0 -0
  647. data/docs/assets/LogoStop.Gb3tDhL1.png +0 -0
  648. data/docs/assets/OverviewMetro.DUS-5fUZ.png +0 -0
  649. data/docs/assets/adrs.md.YglbWtQe.js +0 -1
  650. data/docs/assets/adrs.md.YglbWtQe.lean.js +0 -1
  651. data/docs/assets/ai.md.ChLnvDAX.js +0 -1
  652. data/docs/assets/ai.md.ChLnvDAX.lean.js +0 -1
  653. data/docs/assets/app.CovevI7X.js +0 -1
  654. data/docs/assets/assets.md.BEF6Oz6K.js +0 -19
  655. data/docs/assets/assets.md.BEF6Oz6K.lean.js +0 -1
  656. data/docs/assets/basic-form-with-violations.Cv6Y9-Q_.png +0 -0
  657. data/docs/assets/basic-form.DbHnu0oW.png +0 -0
  658. data/docs/assets/brut-js.md.BMz0X1Rz.js +0 -12
  659. data/docs/assets/brut-js.md.BMz0X1Rz.lean.js +0 -1
  660. data/docs/assets/business-logic.md.DbuaOYGU.js +0 -1
  661. data/docs/assets/business-logic.md.DbuaOYGU.lean.js +0 -1
  662. data/docs/assets/chunks/@localSearchIndexroot.BiNc3tFI.js +0 -1
  663. data/docs/assets/chunks/VPLocalSearchBox.CrvLAvKW.js +0 -8
  664. data/docs/assets/chunks/framework.C4nOkCZI.js +0 -18
  665. data/docs/assets/chunks/theme.BAi5_yQI.js +0 -2
  666. data/docs/assets/cli.md.DDMar_51.js +0 -122
  667. data/docs/assets/cli.md.DDMar_51.lean.js +0 -1
  668. data/docs/assets/components.md.9sqJ27Oc.js +0 -96
  669. data/docs/assets/components.md.9sqJ27Oc.lean.js +0 -1
  670. data/docs/assets/configuration.md.Cb_oAR8Z.js +0 -78
  671. data/docs/assets/configuration.md.Cb_oAR8Z.lean.js +0 -1
  672. data/docs/assets/css.md.K5rOCOQY.js +0 -21
  673. data/docs/assets/css.md.K5rOCOQY.lean.js +0 -1
  674. data/docs/assets/custom-element-tests.md.DiLe-eFw.js +0 -69
  675. data/docs/assets/custom-element-tests.md.DiLe-eFw.lean.js +0 -1
  676. data/docs/assets/database-access.md.Dc8l2Plf.js +0 -63
  677. data/docs/assets/database-access.md.Dc8l2Plf.lean.js +0 -1
  678. data/docs/assets/database-schema.md.BJ_JhXmO.js +0 -70
  679. data/docs/assets/database-schema.md.BJ_JhXmO.lean.js +0 -1
  680. data/docs/assets/deployment.md.CHTx2eTR.js +0 -55
  681. data/docs/assets/deployment.md.CHTx2eTR.lean.js +0 -1
  682. data/docs/assets/dev-env-protocol.DysDAtnz.png +0 -0
  683. data/docs/assets/dev-environment.md.B1S9p5ZK.js +0 -16
  684. data/docs/assets/dev-environment.md.B1S9p5ZK.lean.js +0 -1
  685. data/docs/assets/dir-structure.md.D1T2kGwj.js +0 -46
  686. data/docs/assets/dir-structure.md.D1T2kGwj.lean.js +0 -1
  687. data/docs/assets/doc-conventions.md.CDnWaEFg.js +0 -1
  688. data/docs/assets/doc-conventions.md.CDnWaEFg.lean.js +0 -1
  689. data/docs/assets/end-to-end-tests.md.BJJdNDYL.js +0 -28
  690. data/docs/assets/end-to-end-tests.md.BJJdNDYL.lean.js +0 -1
  691. data/docs/assets/features.md.BDWxnyNO.js +0 -154
  692. data/docs/assets/features.md.BDWxnyNO.lean.js +0 -1
  693. data/docs/assets/flash-and-session.md.CUsMxoNl.js +0 -79
  694. data/docs/assets/flash-and-session.md.CUsMxoNl.lean.js +0 -1
  695. data/docs/assets/form-constraints.md.KlfXSKm2.js +0 -90
  696. data/docs/assets/form-constraints.md.KlfXSKm2.lean.js +0 -1
  697. data/docs/assets/forms.md.BdpYpNIk.js +0 -64
  698. data/docs/assets/forms.md.BdpYpNIk.lean.js +0 -1
  699. data/docs/assets/getting-started.md.CKpNGvno.js +0 -31
  700. data/docs/assets/getting-started.md.CKpNGvno.lean.js +0 -1
  701. data/docs/assets/handlers.md.C5tUwmmo.js +0 -54
  702. data/docs/assets/handlers.md.C5tUwmmo.lean.js +0 -1
  703. data/docs/assets/hooks.md.CoiYCKRc.js +0 -80
  704. data/docs/assets/hooks.md.CoiYCKRc.lean.js +0 -1
  705. data/docs/assets/i18n.md.DxkCKhUw.js +0 -23
  706. data/docs/assets/i18n.md.DxkCKhUw.lean.js +0 -1
  707. data/docs/assets/index.md.DnphWyQd.js +0 -1
  708. data/docs/assets/index.md.DnphWyQd.lean.js +0 -1
  709. data/docs/assets/initial-home-page.DNIaYmgP.png +0 -0
  710. data/docs/assets/instrumentation.md.BcxjC4jd.js +0 -90
  711. data/docs/assets/instrumentation.md.BcxjC4jd.lean.js +0 -1
  712. data/docs/assets/javascript.md.D6fxhaQb.js +0 -31
  713. data/docs/assets/javascript.md.D6fxhaQb.lean.js +0 -1
  714. data/docs/assets/jobs.md.Bi3qb3v6.js +0 -25
  715. data/docs/assets/jobs.md.Bi3qb3v6.lean.js +0 -1
  716. data/docs/assets/keyword-injection.md.CqLnnzIz.js +0 -21
  717. data/docs/assets/keyword-injection.md.CqLnnzIz.lean.js +0 -1
  718. data/docs/assets/layouts.md.HEbeK7Jr.js +0 -68
  719. data/docs/assets/layouts.md.HEbeK7Jr.lean.js +0 -1
  720. data/docs/assets/lsp.md.bE9dW8n9.js +0 -1
  721. data/docs/assets/lsp.md.bE9dW8n9.lean.js +0 -1
  722. data/docs/assets/markdown-examples.md.BPmtHlc-.js +0 -33
  723. data/docs/assets/markdown-examples.md.BPmtHlc-.lean.js +0 -1
  724. data/docs/assets/middleware.md.BhOIsg59.js +0 -20
  725. data/docs/assets/middleware.md.BhOIsg59.lean.js +0 -1
  726. data/docs/assets/new-post-editor.DrHr-5oh.png +0 -0
  727. data/docs/assets/new-post-home-page.Bm34lyMg.png +0 -0
  728. data/docs/assets/overview.md.BpWAgPFH.js +0 -1
  729. data/docs/assets/overview.md.BpWAgPFH.lean.js +0 -1
  730. data/docs/assets/pages.md.B3sQXpEd.js +0 -45
  731. data/docs/assets/pages.md.B3sQXpEd.lean.js +0 -1
  732. data/docs/assets/recipes_alternate-layouts.md.C1QzVkA7.js +0 -22
  733. data/docs/assets/recipes_alternate-layouts.md.C1QzVkA7.lean.js +0 -1
  734. data/docs/assets/recipes_authentication.md.CyvoIW82.js +0 -157
  735. data/docs/assets/recipes_authentication.md.CyvoIW82.lean.js +0 -1
  736. data/docs/assets/recipes_custom-flash.md.6gFqf2uL.js +0 -26
  737. data/docs/assets/recipes_custom-flash.md.6gFqf2uL.lean.js +0 -1
  738. data/docs/assets/recipes_dev-env-secrets.md.DC_jVY9U.js +0 -12
  739. data/docs/assets/recipes_dev-env-secrets.md.DC_jVY9U.lean.js +0 -1
  740. data/docs/assets/recipes_form-errors.md.B5ptSzMO.js +0 -66
  741. data/docs/assets/recipes_form-errors.md.B5ptSzMO.lean.js +0 -1
  742. data/docs/assets/recipes_indexed-forms.md.BYYQGW2C.js +0 -74
  743. data/docs/assets/recipes_indexed-forms.md.BYYQGW2C.lean.js +0 -1
  744. data/docs/assets/recipes_migrations.md.Cid7-3cu.js +0 -97
  745. data/docs/assets/recipes_migrations.md.Cid7-3cu.lean.js +0 -1
  746. data/docs/assets/recipes_text-field-component.md.VhOsCtKI.js +0 -101
  747. data/docs/assets/recipes_text-field-component.md.VhOsCtKI.lean.js +0 -1
  748. data/docs/assets/roadmap.md.DqC1Y7Zt.js +0 -1
  749. data/docs/assets/roadmap.md.DqC1Y7Zt.lean.js +0 -1
  750. data/docs/assets/routes.md.C1dgIBtD.js +0 -21
  751. data/docs/assets/routes.md.C1dgIBtD.lean.js +0 -1
  752. data/docs/assets/security.md.Jn4SY1uK.js +0 -1
  753. data/docs/assets/security.md.Jn4SY1uK.lean.js +0 -1
  754. data/docs/assets/seed-data.md.UZW0WxYN.js +0 -14
  755. data/docs/assets/seed-data.md.UZW0WxYN.lean.js +0 -1
  756. data/docs/assets/spa.qejUdp-5.png +0 -0
  757. data/docs/assets/space-time-continuum.md.D9rYGDFH.js +0 -1
  758. data/docs/assets/space-time-continuum.md.D9rYGDFH.lean.js +0 -1
  759. data/docs/assets/style.B1z60PPQ.css +0 -1
  760. data/docs/assets/styled-form-with-server-side-violations.Bjxd8Dpv.png +0 -0
  761. data/docs/assets/styled-form-with-violations.Bv_sa9tg.png +0 -0
  762. data/docs/assets/styled-home-page-with-posts.Dd4kG89D.png +0 -0
  763. data/docs/assets/styled-home-page.BzdI7dWz.png +0 -0
  764. data/docs/assets/tutorial.md.BX6f6l00.js +0 -27
  765. data/docs/assets/tutorial.md.BX6f6l00.lean.js +0 -1
  766. data/docs/assets/tutorials_01-intro.md.CzZ3kpF_.js +0 -708
  767. data/docs/assets/tutorials_01-intro.md.CzZ3kpF_.lean.js +0 -1
  768. data/docs/assets/tutorials_02-dialog.md.Z_DOF2mU.js +0 -274
  769. data/docs/assets/tutorials_02-dialog.md.Z_DOF2mU.lean.js +0 -1
  770. data/docs/assets/unit-tests.md.vDsdBbO_.js +0 -13
  771. data/docs/assets/unit-tests.md.vDsdBbO_.lean.js +0 -1
  772. data/docs/assets/welcome-to-brut.VSWzl17-.png +0 -0
  773. data/docs/assets/why.md.4WpxdrQ2.js +0 -1
  774. data/docs/assets/why.md.4WpxdrQ2.lean.js +0 -1
  775. data/docs/assets/workspace-protocol.C0gXsoDb.png +0 -0
  776. data/docs/assets.html +0 -47
  777. data/docs/brut-css/brut.max.css +0 -22372
  778. data/docs/brut-css/classes/appearances.html +0 -783
  779. data/docs/brut-css/classes/background-colors.html +0 -3529
  780. data/docs/brut-css/classes/border-colors.html +0 -3529
  781. data/docs/brut-css/classes/borders.html +0 -2293
  782. data/docs/brut-css/classes/dimensions.html +0 -2581
  783. data/docs/brut-css/classes/flex.html +0 -917
  784. data/docs/brut-css/classes/foreground-colors.html +0 -3261
  785. data/docs/brut-css/classes/junk-drawer.html +0 -431
  786. data/docs/brut-css/classes/layout.html +0 -668
  787. data/docs/brut-css/classes/lists.html +0 -331
  788. data/docs/brut-css/classes/positioning.html +0 -1751
  789. data/docs/brut-css/classes/spacings.html +0 -2633
  790. data/docs/brut-css/classes/typography.html +0 -2206
  791. data/docs/brut-css/customization/advanced-configuration.html +0 -204
  792. data/docs/brut-css/customization/breakpoints.html +0 -227
  793. data/docs/brut-css/customization/design-system.html +0 -197
  794. data/docs/brut-css/customization/pseudo-classes.html +0 -228
  795. data/docs/brut-css/docs.css +0 -98
  796. data/docs/brut-css/getting-started/core-concepts.html +0 -234
  797. data/docs/brut-css/getting-started/installation.html +0 -190
  798. data/docs/brut-css/getting-started/overview.html +0 -210
  799. data/docs/brut-css/getting-started/simple-example.html +0 -285
  800. data/docs/brut-css/index.html +0 -193
  801. data/docs/brut-css/prism-twilight.min.css +0 -1
  802. data/docs/brut-css/properties/colors.html +0 -1548
  803. data/docs/brut-css/properties/spacings.html +0 -614
  804. data/docs/brut-css/properties/typography.html +0 -777
  805. data/docs/brut-js/api/AjaxSubmit.html +0 -452
  806. data/docs/brut-js/api/AjaxSubmit.js.html +0 -550
  807. data/docs/brut-js/api/Autosubmit.html +0 -192
  808. data/docs/brut-js/api/Autosubmit.js.html +0 -114
  809. data/docs/brut-js/api/BaseCustomElement.html +0 -1091
  810. data/docs/brut-js/api/BaseCustomElement.js.html +0 -312
  811. data/docs/brut-js/api/BrutCustomElements.html +0 -172
  812. data/docs/brut-js/api/BufferedLogger.html +0 -173
  813. data/docs/brut-js/api/ConfirmSubmit.html +0 -286
  814. data/docs/brut-js/api/ConfirmSubmit.js.html +0 -188
  815. data/docs/brut-js/api/ConfirmationDialog.html +0 -425
  816. data/docs/brut-js/api/ConfirmationDialog.js.html +0 -194
  817. data/docs/brut-js/api/ConstraintViolationMessage.html +0 -498
  818. data/docs/brut-js/api/ConstraintViolationMessage.js.html +0 -191
  819. data/docs/brut-js/api/ConstraintViolationMessages.html +0 -590
  820. data/docs/brut-js/api/ConstraintViolationMessages.js.html +0 -149
  821. data/docs/brut-js/api/CopyToClipboard.html +0 -345
  822. data/docs/brut-js/api/CopyToClipboard.js.html +0 -147
  823. data/docs/brut-js/api/Form.html +0 -291
  824. data/docs/brut-js/api/Form.js.html +0 -198
  825. data/docs/brut-js/api/I18nTranslation.html +0 -409
  826. data/docs/brut-js/api/I18nTranslation.js.html +0 -115
  827. data/docs/brut-js/api/LocaleDetection.html +0 -312
  828. data/docs/brut-js/api/LocaleDetection.js.html +0 -168
  829. data/docs/brut-js/api/Logger.html +0 -702
  830. data/docs/brut-js/api/Logger.js.html +0 -141
  831. data/docs/brut-js/api/Message.html +0 -238
  832. data/docs/brut-js/api/Message.js.html +0 -113
  833. data/docs/brut-js/api/PrefixedLogger.html +0 -369
  834. data/docs/brut-js/api/RichString.html +0 -1049
  835. data/docs/brut-js/api/RichString.js.html +0 -167
  836. data/docs/brut-js/api/Tabs.html +0 -295
  837. data/docs/brut-js/api/Tabs.js.html +0 -219
  838. data/docs/brut-js/api/Toast.html +0 -270
  839. data/docs/brut-js/api/Toast.js.html +0 -153
  840. data/docs/brut-js/api/Tracing.html +0 -277
  841. data/docs/brut-js/api/Tracing.js.html +0 -298
  842. data/docs/brut-js/api/external-CustomElementRegistry.html +0 -140
  843. data/docs/brut-js/api/external-Performance.html +0 -138
  844. data/docs/brut-js/api/external-Promise.html +0 -138
  845. data/docs/brut-js/api/external-ValidityState.html +0 -138
  846. data/docs/brut-js/api/external-Window.html +0 -233
  847. data/docs/brut-js/api/external-fetch.html +0 -138
  848. data/docs/brut-js/api/global.html +0 -400
  849. data/docs/brut-js/api/index.html +0 -168
  850. data/docs/brut-js/api/index.js.html +0 -184
  851. data/docs/brut-js/api/module-testing.html +0 -383
  852. data/docs/brut-js/api/scripts/linenumber.js +0 -25
  853. data/docs/brut-js/api/scripts/prettify/Apache-License-2.0.txt +0 -202
  854. data/docs/brut-js/api/scripts/prettify/lang-css.js +0 -2
  855. data/docs/brut-js/api/scripts/prettify/prettify.js +0 -28
  856. data/docs/brut-js/api/styles/jsdoc-default.css +0 -327
  857. data/docs/brut-js/api/styles/prettify-jsdoc.css +0 -111
  858. data/docs/brut-js/api/styles/prettify-tomorrow.css +0 -132
  859. data/docs/brut-js/api/testing.AssetMetadata.html +0 -172
  860. data/docs/brut-js/api/testing.AssetMetadataLoader.html +0 -171
  861. data/docs/brut-js/api/testing.CustomElementTest.html +0 -679
  862. data/docs/brut-js/api/testing.DOMCreator.html +0 -171
  863. data/docs/brut-js/api/testing_AssetMetadata.js.html +0 -86
  864. data/docs/brut-js/api/testing_AssetMetadataLoader.js.html +0 -76
  865. data/docs/brut-js/api/testing_CustomElementTest.js.html +0 -286
  866. data/docs/brut-js/api/testing_DOMCreator.js.html +0 -96
  867. data/docs/brut-js/api/testing_index.js.html +0 -99
  868. data/docs/brut-js.html +0 -40
  869. data/docs/business-logic.html +0 -29
  870. data/docs/cli.html +0 -150
  871. data/docs/components.html +0 -124
  872. data/docs/configuration.html +0 -106
  873. data/docs/css.html +0 -49
  874. data/docs/custom-element-tests.html +0 -97
  875. data/docs/database-access.html +0 -91
  876. data/docs/database-schema.html +0 -98
  877. data/docs/deployment.html +0 -83
  878. data/docs/dev-environment.html +0 -44
  879. data/docs/dir-structure.html +0 -74
  880. data/docs/doc-conventions.html +0 -29
  881. data/docs/end-to-end-tests.html +0 -56
  882. data/docs/favicon.ico +0 -0
  883. data/docs/features.html +0 -182
  884. data/docs/flash-and-session.html +0 -107
  885. data/docs/form-constraints.html +0 -118
  886. data/docs/forms.html +0 -92
  887. data/docs/getting-started.html +0 -59
  888. data/docs/handlers.html +0 -82
  889. data/docs/hashmap.json +0 -1
  890. data/docs/hooks.html +0 -108
  891. data/docs/i18n.html +0 -51
  892. data/docs/index.html +0 -29
  893. data/docs/instrumentation.html +0 -118
  894. data/docs/javascript.html +0 -59
  895. data/docs/jobs.html +0 -53
  896. data/docs/keyword-injection.html +0 -49
  897. data/docs/layouts.html +0 -96
  898. data/docs/lsp.html +0 -29
  899. data/docs/markdown-examples.html +0 -61
  900. data/docs/middleware.html +0 -48
  901. data/docs/overview.html +0 -29
  902. data/docs/pages.html +0 -73
  903. data/docs/recipes/alternate-layouts.html +0 -50
  904. data/docs/recipes/authentication.html +0 -185
  905. data/docs/recipes/custom-flash.html +0 -54
  906. data/docs/recipes/dev-env-secrets.html +0 -40
  907. data/docs/recipes/form-errors.html +0 -94
  908. data/docs/recipes/indexed-forms.html +0 -102
  909. data/docs/recipes/migrations.html +0 -125
  910. data/docs/recipes/text-field-component.html +0 -129
  911. data/docs/roadmap.html +0 -29
  912. data/docs/routes.html +0 -49
  913. data/docs/security.html +0 -29
  914. data/docs/seed-data.html +0 -42
  915. data/docs/space-time-continuum.html +0 -29
  916. data/docs/tutorial.html +0 -55
  917. data/docs/tutorials/01-intro.html +0 -736
  918. data/docs/tutorials/02-dialog.html +0 -302
  919. data/docs/unit-tests.html +0 -41
  920. data/docs/vp-icons.css +0 -1
  921. data/docs/why.html +0 -29
  922. data/docs-todo.md +0 -32
  923. data/dx/bash_customizations +0 -6
  924. data/dx/build +0 -73
  925. data/dx/build.pre +0 -15
  926. data/dx/docker-compose.env +0 -22
  927. data/dx/dx.sh.lib +0 -24
  928. data/dx/exec +0 -75
  929. data/dx/setupkit.sh.lib +0 -144
  930. data/dx/show-help-in-app-container-then-wait.sh +0 -38
  931. data/lib/brut/cli/app.rb +0 -238
  932. data/lib/brut/cli/app_runner.rb +0 -252
  933. data/lib/brut/cli/command.rb +0 -258
  934. data/lib/brut/cli/execution_results.rb +0 -119
  935. data/lib/brut/front_end/layouts/_internal.html.erb +0 -68
  936. data/lib/brut/front_end/pages/_missing_page.html.erb +0 -17
  937. data/mkbrut/.gitignore +0 -16
  938. data/mkbrut/CODE_OF_CONDUCT.txt +0 -100
  939. data/mkbrut/Gemfile +0 -3
  940. data/mkbrut/Gemfile.lock +0 -20
  941. data/mkbrut/LICENSE.txt +0 -370
  942. data/mkbrut/README.md +0 -145
  943. data/mkbrut/Rakefile +0 -2
  944. data/mkbrut/bin/build +0 -36
  945. data/mkbrut/bin/ci +0 -19
  946. data/mkbrut/bin/docs +0 -19
  947. data/mkbrut/bin/publish +0 -129
  948. data/mkbrut/bin/rake +0 -16
  949. data/mkbrut/bin/setup +0 -30
  950. data/mkbrut/brut-welcome.png +0 -0
  951. data/mkbrut/deploy/.dockerignore +0 -2
  952. data/mkbrut/deploy/Dockerfile +0 -25
  953. data/mkbrut/dx +0 -1
  954. data/mkbrut/exe/mkbrut +0 -5
  955. data/mkbrut/lib/mkbrut/app_name.rb +0 -29
  956. data/mkbrut/lib/mkbrut/app_options.rb +0 -36
  957. data/mkbrut/lib/mkbrut/cli.rb +0 -189
  958. data/mkbrut/lib/mkbrut/erb_binding_delegate.rb +0 -20
  959. data/mkbrut/lib/mkbrut/ops.rb +0 -17
  960. data/mkbrut/lib/mkbrut/organization.rb +0 -5
  961. data/mkbrut/lib/mkbrut/segments.rb +0 -8
  962. data/mkbrut/lib/mkbrut/version.rb +0 -3
  963. data/mkbrut/lib/mkbrut.rb +0 -20
  964. data/mkbrut/mkbrut.gemspec +0 -34
  965. data/mkbrut/templates/Base/app/src/front_end/images/LogoPylon.png +0 -0
  966. data/mkbrut/templates/Base/bin/build-assets +0 -7
  967. data/mkbrut/templates/Base/bin/ci +0 -39
  968. data/mkbrut/templates/Base/bin/db +0 -9
  969. data/mkbrut/templates/Base/bin/scaffold +0 -9
  970. data/mkbrut/templates/Base/bin/setup +0 -287
  971. data/mkbrut/templates/Base/bin/test +0 -9
  972. data/mkbrut/templates/Base/bin/test-server +0 -29
  973. data/mkbrut/templates/Base/dx/prune +0 -19
  974. data/mkbrut/templates/Base/dx/start +0 -30
  975. data/mkbrut/templates/Base/dx/stop +0 -23
  976. data/mkbrut/templates/segments/Heroku/deploy/heroku_config.rb +0 -27
  977. data/specs/brut/front_end/forms/input.spec.rb +0 -978
  978. data/specs/brut/front_end/forms/radio_button_group_input.spec.rb +0 -54
  979. data/specs/brut/front_end/forms/select_input.spec.rb +0 -54
  980. data/specs/brut/instrumentation/methods.spec.rb +0 -399
  981. data/specs/brut/junk_drawer.spec.rb +0 -79
  982. data/specs/spec_helper.rb +0 -27
  983. data/specs/support/matchers/have_constraint_violation.rb +0 -23
  984. data/specs/support/matchers.rb +0 -5
  985. data/specs/support.rb +0 -3
  986. /data/{mkbrut/lib/mkbrut → lib/brut/cli/apps/new}/prefixed_io.rb +0 -0
  987. /data/{mkbrut/templates → templates}/Base/.dockerignore +0 -0
  988. /data/{mkbrut/templates → templates}/Base/.env.development.erb +0 -0
  989. /data/{mkbrut/templates → templates}/Base/.env.test.erb +0 -0
  990. /data/{mkbrut/templates → templates}/Base/.gitignore +0 -0
  991. /data/{mkbrut/templates → templates}/Base/.projections.json +0 -0
  992. /data/{mkbrut/templates → templates}/Base/Dockerfile.dx +0 -0
  993. /data/{mkbrut/templates → templates}/Base/Gemfile.erb +0 -0
  994. /data/{mkbrut/templates → templates}/Base/Procfile.development +0 -0
  995. /data/{mkbrut/templates → templates}/Base/Procfile.test +0 -0
  996. /data/{mkbrut/templates → templates}/Base/README.md +0 -0
  997. /data/{mkbrut/templates → templates}/Base/README.md.erb +0 -0
  998. /data/{mkbrut/templates → templates}/Base/app/bootstrap.rb +0 -0
  999. /data/{mkbrut/templates → templates}/Base/app/config/i18n/en/1_defaults.rb +0 -0
  1000. /data/{mkbrut/templates → templates}/Base/app/config/i18n/en/2_app.rb +0 -0
  1001. /data/{mkbrut/templates → templates}/Base/app/public/static/manifest.json.erb +0 -0
  1002. /data/{mkbrut/templates → templates}/Base/app/src/app.rb.erb +0 -0
  1003. /data/{mkbrut/templates → templates}/Base/app/src/back_end/data_models/app_data_model.rb +0 -0
  1004. /data/{mkbrut/templates → templates}/Base/app/src/back_end/data_models/db.rb +0 -0
  1005. /data/{mkbrut/templates → templates}/Base/app/src/back_end/data_models/migrations/20240101130000_citext.rb +0 -0
  1006. /data/{mkbrut/templates → templates}/Base/app/src/back_end/data_models/seed/seed_data.rb +0 -0
  1007. /data/{mkbrut/templates → templates}/Base/app/src/front_end/components/app_component.rb +0 -0
  1008. /data/{mkbrut/templates → templates}/Base/app/src/front_end/components/custom_element_registration.rb.erb +0 -0
  1009. /data/{mkbrut/templates → templates}/Base/app/src/front_end/css/index.css +0 -0
  1010. /data/{mkbrut/templates → templates}/Base/app/src/front_end/css/svgs.css +0 -0
  1011. /data/{mkbrut/templates → templates}/Base/app/src/front_end/forms/app_form.rb +0 -0
  1012. /data/{mkbrut/templates → templates}/Base/app/src/front_end/handlers/app_handler.rb +0 -0
  1013. /data/{brutrb.com → templates/Base/app/src/front_end}/images/LogoPylon.png +0 -0
  1014. /data/{mkbrut/templates → templates}/Base/app/src/front_end/images/LogoTransit.png +0 -0
  1015. /data/{mkbrut/templates → templates}/Base/app/src/front_end/images/apple-touch-icon-120x120.png +0 -0
  1016. /data/{mkbrut/templates → templates}/Base/app/src/front_end/images/apple-touch-icon-152x152.png +0 -0
  1017. /data/{mkbrut/templates → templates}/Base/app/src/front_end/images/apple-touch-icon-167x167.png +0 -0
  1018. /data/{mkbrut/templates → templates}/Base/app/src/front_end/images/apple-touch-icon-180x180.png +0 -0
  1019. /data/{mkbrut/templates → templates}/Base/app/src/front_end/images/favicon.ico +0 -0
  1020. /data/{mkbrut/templates → templates}/Base/app/src/front_end/images/icon.png +0 -0
  1021. /data/{mkbrut/templates → templates}/Base/app/src/front_end/images/mkicons.sh +0 -0
  1022. /data/{mkbrut/templates → templates}/Base/app/src/front_end/js/index.js +0 -0
  1023. /data/{mkbrut/templates → templates}/Base/app/src/front_end/layouts/blank_layout.rb +0 -0
  1024. /data/{mkbrut/templates → templates}/Base/app/src/front_end/layouts/default_layout.rb.erb +0 -0
  1025. /data/{mkbrut/templates → templates}/Base/app/src/front_end/pages/app_page.rb +0 -0
  1026. /data/{mkbrut/templates → templates}/Base/app/src/front_end/pages/home_page.rb +0 -0
  1027. /data/{mkbrut/templates → templates}/Base/app/src/front_end/support/app_session.rb +0 -0
  1028. /data/{mkbrut/templates → templates}/Base/app/src/front_end/svgs/README.md +0 -0
  1029. /data/{mkbrut/templates → templates}/Base/app/src/front_end/svgs/comment-button.svg +0 -0
  1030. /data/{mkbrut/templates → templates}/Base/bin/README.md.erb +0 -0
  1031. /data/{mkbrut/templates → templates}/Base/bin/console +0 -0
  1032. /data/{mkbrut/templates → templates}/Base/bin/dbconsole +0 -0
  1033. /data/{mkbrut/templates → templates}/Base/bin/dev +0 -0
  1034. /data/{mkbrut/templates → templates}/Base/bin/run +0 -0
  1035. /data/{mkbrut/templates → templates}/Base/bin/run.run +0 -0
  1036. /data/{mkbrut/templates → templates}/Base/bin/startup-message +0 -0
  1037. /data/{mkbrut/templates → templates}/Base/config.ru +0 -0
  1038. /data/{mkbrut/templates → templates}/Base/docker-compose.dx.yml +0 -0
  1039. /data/{mkbrut/templates → templates}/Base/dx/README.md +0 -0
  1040. /data/{mkbrut/templates → templates}/Base/dx/bash_customizations +0 -0
  1041. /data/{mkbrut/templates → templates}/Base/dx/bash_customizations.local +0 -0
  1042. /data/{mkbrut/templates → templates}/Base/dx/build +0 -0
  1043. /data/{mkbrut/templates → templates}/Base/dx/dx.sh.lib +0 -0
  1044. /data/{mkbrut/templates → templates}/Base/dx/exec +0 -0
  1045. /data/{dx → templates/Base/dx}/prune +0 -0
  1046. /data/{mkbrut/templates → templates}/Base/dx/show-help-in-app-container-then-wait.sh +0 -0
  1047. /data/{dx → templates/Base/dx}/start +0 -0
  1048. /data/{dx → templates/Base/dx}/stop +0 -0
  1049. /data/{mkbrut/templates → templates}/Base/package.json.erb +0 -0
  1050. /data/{mkbrut/templates → templates}/Base/puma.config.rb +0 -0
  1051. /data/{mkbrut/templates → templates}/Base/specs/e2e/home_page.spec.rb.erb +0 -0
  1052. /data/{mkbrut/templates → templates}/Base/specs/front_end/js/SpecHelper.js +0 -0
  1053. /data/{mkbrut/templates → templates}/Base/specs/front_end/pages/home_page.spec.rb +0 -0
  1054. /data/{mkbrut/templates → templates}/Base/specs/lint_factories.spec.rb +0 -0
  1055. /data/{mkbrut/templates → templates}/Base/specs/spec_helper.rb +0 -0
  1056. /data/{mkbrut/templates → templates}/Base/specs/support.rb +0 -0
  1057. /data/{mkbrut/templates → templates}/segments/BareBones/app/src/front_end/handlers/trigger_exception_handler.rb +0 -0
  1058. /data/{mkbrut/templates → templates}/segments/BareBones/app/src/front_end/js/Example.js.erb +0 -0
  1059. /data/{mkbrut/templates → templates}/segments/BareBones/specs/front_end/handlers/trigger_exception_handler.spec.rb +0 -0
  1060. /data/{mkbrut/templates → templates}/segments/BareBones/specs/front_end/js/Example.spec.js.erb +0 -0
  1061. /data/{mkbrut/templates → templates}/segments/Demo/app/src/back_end/data_models/db/guestbook_message.rb +0 -0
  1062. /data/{mkbrut/templates → templates}/segments/Demo/app/src/back_end/data_models/migrations/20250628194124_guestbook.rb +0 -0
  1063. /data/{mkbrut/templates → templates}/segments/Demo/app/src/front_end/components/flash_component.rb +0 -0
  1064. /data/{mkbrut/templates → templates}/segments/Demo/app/src/front_end/css/constraint-violations.css +0 -0
  1065. /data/{mkbrut/templates → templates}/segments/Demo/app/src/front_end/fonts/monaspace-xenon.ttf +0 -0
  1066. /data/{mkbrut/templates → templates}/segments/Demo/app/src/front_end/forms/guestbook_message_form.rb +0 -0
  1067. /data/{mkbrut/templates → templates}/segments/Demo/app/src/front_end/handlers/guestbook_message_handler.rb +0 -0
  1068. /data/{mkbrut/templates → templates}/segments/Demo/app/src/front_end/pages/guestbook_page/message_component.rb +0 -0
  1069. /data/{mkbrut/templates → templates}/segments/Demo/app/src/front_end/pages/guestbook_page.rb +0 -0
  1070. /data/{mkbrut/templates → templates}/segments/Demo/app/src/front_end/pages/new_guestbook_message_page.rb +0 -0
  1071. /data/{mkbrut/templates → templates}/segments/Demo/specs/back_end/data_models/db/guestbook_message.spec.rb +0 -0
  1072. /data/{mkbrut/templates → templates}/segments/Demo/specs/e2e/guest_message.spec.rb +0 -0
  1073. /data/{mkbrut/templates → templates}/segments/Demo/specs/factories/db/guestbook_message.factory.rb +0 -0
  1074. /data/{mkbrut/templates → templates}/segments/Demo/specs/front_end/components/flash_component.spec.rb +0 -0
  1075. /data/{mkbrut/templates → templates}/segments/Demo/specs/front_end/handlers/guestbook_message_handler.spec.rb +0 -0
  1076. /data/{mkbrut/templates → templates}/segments/Demo/specs/front_end/pages/guestbook_page/message_component.spec.rb +0 -0
  1077. /data/{mkbrut/templates → templates}/segments/Demo/specs/front_end/pages/guestbook_page.spec.rb +0 -0
  1078. /data/{mkbrut/templates → templates}/segments/Demo/specs/front_end/pages/new_guestbook_message_page.spec.rb +0 -0
  1079. /data/{mkbrut/templates → templates}/segments/Heroku/bin/deploy +0 -0
  1080. /data/{mkbrut/templates → templates}/segments/Heroku/deploy/docker-entrypoint +0 -0
  1081. /data/{mkbrut/templates → templates}/segments/Sidekiq/app/boot_sidekiq.rb +0 -0
  1082. /data/{mkbrut/templates → templates}/segments/Sidekiq/app/config/sidekiq.yml +0 -0
  1083. /data/{mkbrut/templates → templates}/segments/Sidekiq/app/src/back_end/jobs/app_job.rb +0 -0
  1084. /data/{mkbrut/templates → templates}/segments/Sidekiq/app/src/back_end/jobs/example_job.rb +0 -0
  1085. /data/{mkbrut/templates → templates}/segments/Sidekiq/app/src/back_end/segments/sidekiq_segment.rb +0 -0
  1086. /data/{mkbrut/templates → templates}/segments/Sidekiq/bin/run.sidekiq +0 -0
  1087. /data/{mkbrut/templates → templates}/segments/Sidekiq/specs/back_end/jobs/example_job.spec.rb +0 -0
  1088. /data/{mkbrut/templates → templates}/segments/Sidekiq/specs/integration/sidekiq_works.spec.rb +0 -0
@@ -1,90 +0,0 @@
1
- import{_ as i,c as a,o as t,ag as n}from"./chunks/framework.C4nOkCZI.js";const E=JSON.parse('{"title":"Form Constraint Validations","description":"","frontmatter":{},"headers":[],"relativePath":"form-constraints.md","filePath":"form-constraints.md"}'),e={name:"form-constraints.md"};function h(l,s,p,k,r,o){return t(),a("div",null,[...s[0]||(s[0]=[n(`<h1 id="form-constraint-validations" tabindex="-1">Form Constraint Validations <a class="header-anchor" href="#form-constraint-validations" aria-label="Permalink to &quot;Form Constraint Validations&quot;">​</a></h1><p>Aside from simply collecting data and submitting it to the server, form data has <em>constraints</em> that must be validated before data is accepted. Brut provides support for both client-side and server-side constraints.</p><h2 id="overview" tabindex="-1">Overview <a class="header-anchor" href="#overview" aria-label="Permalink to &quot;Overview&quot;">​</a></h2><p>When validating form data against its constraints, Brut provides assistance in two ways:</p><ul><li>Specifying constraint violations that only the server can evaluate.</li><li>Unifying the user experience for both client-side and server-side constraint violations.</li></ul><h3 id="specifying-constraints" tabindex="-1">Specifying Constraints <a class="header-anchor" href="#specifying-constraints" aria-label="Permalink to &quot;Specifying Constraints&quot;">​</a></h3><p>For both client and server-side constraint violations, Brut uses the <a href="/api/Brut/FrontEnd/Forms/ConstraintViolation.html" target="_self" rel="noopener" data-no-router><code>Brut::FrontEnd::Forms::ConstraintViolation</code></a> class to represent a specific error on a specific field. This class is a wrapper around an i18n key, context to generate that key&#39;s messaging, and a flag indicating if the violation is server or client side.</p><p>To specify a server-side constraint violation on a form, call <code>server_side_constraint_violation</code>:</p><div class="language-ruby vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ruby</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">form.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">server_side_constraint_violation</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span></span>
2
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> input_name:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> :name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
3
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> key:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> :name_is_taken</span></span>
4
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div><p>The <code>input_name</code> is the same value you used when creating your form class, and <code>key</code> is an <a href="/i18n.html">I18n</a> key that will have <code>cv.ss</code> prepended to it (for **c*onstratin <strong>v</strong>iolation, <strong>s</strong>server <strong>s</strong>ide). Thus, the key in the above example is <code>&quot;cv.ss.name_is_taken&quot;</code>.</p><p>Brut forms will automatically add client-side constraints based on the value assigned to the input. For example, since <code>name</code> must be 3 or more characters, this code would implicitly set <code>:rangeOverflow</code> as a client-side constraint violation:</p><div class="language-ruby vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ruby</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">form.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">input</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">:name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">).</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">value</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;xx&quot;</span></span></code></pre></div><h3 id="accessing-constraints-when-generating-html" tabindex="-1">Accessing Constraints when Generating HTML <a class="header-anchor" href="#accessing-constraints-when-generating-html" aria-label="Permalink to &quot;Accessing Constraints when Generating HTML&quot;">​</a></h3><p><a href="/api/Brut/FrontEnd/Form.html" target="_self" rel="noopener" data-no-router><code>Brut::FrontEnd::Form</code></a> provides the method <code>constraint_violations</code> to access the constraints, however we recommend using the <a href="/api/Brut/FrontEnd/Components/ConstraintViolations.html" target="_self" rel="noopener" data-no-router><code>Brut::FrontEnd::Components::ConstraintViolations</code></a> component instead. This component generates particular markup useful for unifying the UX around constraint violations, which we&#39;ll discuss in a moment.</p><div class="language-ruby vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ruby</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">class</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> NewWidgetPage</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> &lt;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> AppPage</span></span>
5
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> include</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> Brut</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">::</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">FrontEnd</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">::</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">Components</span></span>
6
- <span class="line"></span>
7
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> initialize</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">form:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> nil</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
8
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> @form </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> form </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">||</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> NewWidgetForm</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">new</span></span>
9
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> end</span></span>
10
- <span class="line"></span>
11
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> private</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> attr_reader</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> :form</span></span>
12
- <span class="line"></span>
13
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> page_template</span></span>
14
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> FormTag</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">for:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> form) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">do</span></span>
15
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> Components</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">::</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">InputTag</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">form:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">input_name:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> :name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
16
- <span class="line highlighted"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> Components</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">::</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">ConstraintViolations</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">form:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> input_name:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> :name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
17
- <span class="line"></span>
18
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> Components</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">::</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">InputTag</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">form:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">input_name:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> :quantity</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
19
- <span class="line highlighted"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> Components</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">::</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">ConstraintViolations</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">form:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> input_name:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> :quantity</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
20
- <span class="line"></span>
21
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> Components</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">::</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">TextareaTag</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">form:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">input_name:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> :description</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
22
- <span class="line highlighted"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> Components</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">::</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">ConstraintViolations</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">form:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> input_name:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> :description</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
23
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> end</span></span>
24
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> end</span></span>
25
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">end</span></span></code></pre></div><p>Among other things, <code>ConstraintViolations</code> will translate all server-side constraint violations into the currently selected locale, if there are any.</p><h3 id="styling-server-and-client-side-constraint-violations" tabindex="-1">Styling Server and Client-Side Constraint Violations <a class="header-anchor" href="#styling-server-and-client-side-constraint-violations" aria-label="Permalink to &quot;Styling Server and Client-Side Constraint Violations&quot;">​</a></h3><p>Without any server-side constraint violations, this is the HTML that would be generated for the &quot;name&quot; input tag:</p><div class="language-html vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">html</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&lt;</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">input</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;text&quot;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;name&quot;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> required</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> minlength</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;3&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
26
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&lt;</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">brut-cv-messages</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> input-name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;name&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;&lt;/</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">brut-cv-messages</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span></code></pre></div><p><a href="/brut-js/api/ConstraintViolationMessages.html" target="_self" rel="noopener" data-no-router><code style="white-space:nowrap;">&lt;brut-cv-messages&gt;</code></a> is an autonomous custom element that serves two purposes:</p><ul><li>It is part of how client-side constraint violations are shown to the visitor.</li><li>It can be used to target CSS for styling, without the need for <code>&lt;div&gt;</code> and <code>data-</code> elements. It&#39;s more explicitly for constraint violation messaging.</li></ul><p>To make <a href="/brut-js/api/ConstraintViolationMessages.html" target="_self" rel="noopener" data-no-router><code style="white-space:nowrap;">&lt;brut-cv-messages&gt;</code></a> work with client-side constraint violations, the <code>&lt;form&gt;</code> must be contained by a <a href="/brut-js/api/Form.html" target="_self" rel="noopener" data-no-router><code style="white-space:nowrap;">&lt;brut-form&gt;</code></a>:</p><div class="language-ruby vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ruby</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> page_template</span></span>
27
- <span class="line highlighted"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> brut_form </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">do</span></span>
28
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> FormTag</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">for:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> form) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">do</span></span>
29
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> Components</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">::</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">InputTag</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">form:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">input_name:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> :name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
30
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> Components</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">::</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">ConstraintViolations</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">form:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> input_name:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> :name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
31
- <span class="line"></span>
32
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> Components</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">::</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">InputTag</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">form:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">input_name:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> :quantity</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
33
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> Components</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">::</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">ConstraintViolations</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">form:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> input_name:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> :quantity</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
34
- <span class="line"></span>
35
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> Components</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">::</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">TextareaTag</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">form:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">input_name:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> :description</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
36
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> Components</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">::</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">ConstraintViolations</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">form:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> input_name:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> :description</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
37
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> end</span></span>
38
- <span class="line highlighted"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> end</span></span>
39
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">end</span></span></code></pre></div><p><a href="/brut-js/api/Form.html" target="_self" rel="noopener" data-no-router><code style="white-space:nowrap;">&lt;brut-form&gt;</code></a> listens for events from the <code>&lt;form&gt;</code> it contains. For an &quot;invalid&quot; events, it will locate the element relevant to the event, locate its <a href="/brut-js/api/ConstraintViolationMessages.html" target="_self" rel="noopener" data-no-router><code style="white-space:nowrap;">&lt;brut-cv-messages&gt;</code></a> tag, and insert one <a href="/brut-js/api/ConstraintViolationMessage.html" target="_self" rel="noopener" data-no-router><code style="white-space:nowrap;">&lt;brut-cv&gt;</code></a> tag for each error from the inputs <code>ValidityState</code>. That may look like so:</p><div class="language-html vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">html</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&lt;</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">input</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;text&quot;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;name&quot;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> required</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> minlength</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;3&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
40
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&lt;</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">brut-cv-messages</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> input-name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;name&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
41
- <span class="line highlighted"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &lt;</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">brut-cv</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> input-name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;name&quot;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> client-side</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> key</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;rangeUnderflow&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;&lt;/</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">brut-cv</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
42
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&lt;/</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">brut-cv-messages</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span></code></pre></div><p>They <code>key</code> attribute is for an I18n key that is expected to be on the page inside a <a href="/brut-js/api/I18nTranslation.html" target="_self" rel="noopener" data-no-router><code style="white-space:nowrap;">&lt;brut-i18n-translation&gt;</code></a> element. These are typically included in the <a href="/layouts.html">layout</a>, and generate HTML like so:</p><div class="language-html vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">html</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&lt;</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">brut-i18n-translation</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> key</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;cv.cs.rangeUnderflow&quot;</span></span>
43
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> value</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;%{field} is too short&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;&lt;/</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">brut-i18n-translation</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span></code></pre></div><p><a href="/brut-js/api/ConstraintViolationMessage.html" target="_self" rel="noopener" data-no-router><code style="white-space:nowrap;">&lt;brut-cv&gt;</code></a> will, whenever its <code>key</code> attribute is set or changed, locate the corrsponding <a href="/brut-js/api/I18nTranslation.html" target="_self" rel="noopener" data-no-router><code style="white-space:nowrap;">&lt;brut-i18n-translation&gt;</code></a> element, and perform substitution, result in this HTML:</p><div class="language-html vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">html</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&lt;</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">input</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;text&quot;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;name&quot;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> required</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> minlength</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;3&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
44
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&lt;</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">brut-cv-messages</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> input-name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;name&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
45
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &lt;</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">brut-cv</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> input-name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;name&quot;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> client-side</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> key</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;rangeUnderflow&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
46
- <span class="line highlighted"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> This field is too short</span></span>
47
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &lt;/</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">brut-cv</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
48
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&lt;/</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">brut-cv-messages</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span></code></pre></div><p>Presumably, your layout rendered <a href="/brut-js/api/I18nTranslation.html" target="_self" rel="noopener" data-no-router><code style="white-space:nowrap;">&lt;brut-i18n-translation&gt;</code></a> tags with the visitor&#39;s chosen locale (which would be the default behavior of the layout included with a new app).</p><p>Coming back to the use of <code>ConstraintViolations</code>, if there were a server-side violation, the same general markup is generated:</p><div class="language-html vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">html</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&lt;</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">input</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;text&quot;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;name&quot;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> required</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> minlength</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;3&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
49
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&lt;</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">brut-cv-messages</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> input-name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;name&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
50
- <span class="line highlighted"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &lt;</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">brut-cv</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> server-generated</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> server-side</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
51
- <span class="line highlighted"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> This name has already been taken.</span></span>
52
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &lt;/</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">brut-cv</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
53
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&lt;/</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">brut-cv-messages</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span></code></pre></div><p>The <code>server-genereted</code> and <code>server-side</code> attributes is set, which can help with CSS targeting.</p><p>The <em>last</em> piece of this puzzle is a solution for the issue where forms that have not yet been submitted are considered to have invalid values by the browser. <a href="/brut-js/api/Form.html" target="_self" rel="noopener" data-no-router><code style="white-space:nowrap;">&lt;brut-form&gt;</code></a> will add the <code>submitted-invalid</code> attribute to itself whenever form submission has been prevented by invalid attributes.</p><p>This might lead to HTML like so:</p><div class="language-html vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">html</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line highlighted"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&lt;</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">brut-form</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> submitted-invalid</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
54
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &lt;</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">form</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> ...</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
55
- <span class="line"></span>
56
- <span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> &lt;!-- .. --&gt;</span></span>
57
- <span class="line"></span>
58
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &lt;</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">input</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;text&quot;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;name&quot;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> required</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> minlength</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;3&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
59
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &lt;</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">brut-cv-messages</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> input-name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;name&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
60
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &lt;</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">brut-cv</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> input-name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;name&quot;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> client-side</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> key</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;rangeUnderflow&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
61
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> This field is too short</span></span>
62
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &lt;/</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">brut-cv</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
63
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &lt;/</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">brut-cv-messages</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
64
- <span class="line"></span>
65
- <span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> &lt;!-- ... --&gt;</span></span>
66
- <span class="line"></span>
67
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &lt;/</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">form</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
68
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&lt;/</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">brut-form</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span></code></pre></div><p>This is everything you need to style all constraint violations the same:</p><div class="language-css vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">css</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">/* By default, brut-cv is hidden */</span></span>
69
- <span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">brut-cv</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span></span>
70
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> display</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">none</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
71
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span>
72
- <span class="line"></span>
73
- <span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">/* brut-cv inside a submitted-invalid</span></span>
74
- <span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> OR brut-cv from the server ARE shown */</span></span>
75
- <span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">brut-form</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">[</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">submitted-invalid</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">] </span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">brut-cv</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
76
- <span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">brut-cv</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">[</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">server-generated</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">] {</span></span>
77
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> display</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">block</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
78
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> color</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">red</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">; </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">/* e.g. */</span></span>
79
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><p>If JavaScript is not enabled, everything degrades properly, as long as your handler re-checks the client-side validations (we&#39;ll discuss in the next module):</p><div class="language-ruby vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ruby</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> handle</span></span>
80
- <span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # This will be true by virtue of the form&#39;s</span></span>
81
- <span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # values having been set to values that violate</span></span>
82
- <span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # one or more client-side violations.</span></span>
83
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> @form.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">constraint_violations?</span></span>
84
- <span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # ...</span></span>
85
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> end</span></span>
86
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">end</span></span></code></pre></div><h2 id="testing" tabindex="-1">Testing <a class="header-anchor" href="#testing" aria-label="Permalink to &quot;Testing&quot;">​</a></h2><p>Testing client-side validations must be done with end-to-end tests. Writing code like so will work just fine:</p><div class="language-ruby vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ruby</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">button</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> = page.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">locator</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;brut-form button&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
87
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">button.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">click</span></span>
88
- <span class="line"></span>
89
- <span class="line"><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">brut_cv</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> = page.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">locator</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;brut-cv-messages[input-name=&#39;name&#39;] brut-cv&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
90
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">expect</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(brut_cv).</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">to</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> have_text</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;too short&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div><p>Playwright will wait for the <code>brut-cv</code> containing the text &quot;too short&quot; to appear on the page, so you should not have any race conditions.</p><h2 id="recommended-practices" tabindex="-1">Recommended Practices <a class="header-anchor" href="#recommended-practices" aria-label="Permalink to &quot;Recommended Practices&quot;">​</a></h2><h3 id="utility-css-is-tricky-here" tabindex="-1">Utility CSS is Tricky Here <a class="header-anchor" href="#utility-css-is-tricky-here" aria-label="Permalink to &quot;Utility CSS is Tricky Here&quot;">​</a></h3><p>Utility CSS like BrutCSS or TailwindCSS isn&#39;t well-suited to targeting elements based on custom elements or attributes. You will need to write CSS or need to create your own utility CSS for these situations.</p><p>In our opinion, writing CSS for something like this isn&#39;t a big deal as it can reduce duplcation via the use of custom properties from your CSS library/design system and it tends to be stable once created.</p><h3 id="learn-to-be-ok-with-the-browser-s-ux" tabindex="-1">Learn to Be OK with the Browser&#39;s UX <a class="header-anchor" href="#learn-to-be-ok-with-the-browser-s-ux" aria-label="Permalink to &quot;Learn to Be OK with the Browser&#39;s UX&quot;">​</a></h3><p>One complain about client-side constraint violations is that the browser often provides UX that you cannot control. This isn&#39;t ideal, but it does have the virtue of being accessible and obvious. Visitors also really don&#39;t care about how ugly it is as much as you might think. The utility and accessibility offset is as worthwhile tradeoff.</p><h2 id="technical-notes" tabindex="-1">Technical Notes <a class="header-anchor" href="#technical-notes" aria-label="Permalink to &quot;Technical Notes&quot;">​</a></h2><div class="important custom-block github-alert"><p class="custom-block-title">IMPORTANT</p><p>Technical Notes are for deeper understanding and debugging. While we will try to keep them up-to-date with changes to Brut&#39;s internals, the source code is always more correct.</p></div><p><em>Last Updated July 6, 2025</em></p><p>Nothing at this time.</p>`,54)])])}const g=i(e,[["render",h]]);export{E as __pageData,g as default};
@@ -1 +0,0 @@
1
- import{_ as i,c as a,o as t,ag as n}from"./chunks/framework.C4nOkCZI.js";const E=JSON.parse('{"title":"Form Constraint Validations","description":"","frontmatter":{},"headers":[],"relativePath":"form-constraints.md","filePath":"form-constraints.md"}'),e={name:"form-constraints.md"};function h(l,s,p,k,r,o){return t(),a("div",null,[...s[0]||(s[0]=[n("",54)])])}const g=i(e,[["render",h]]);export{E as __pageData,g as default};
@@ -1,64 +0,0 @@
1
- import{_ as i,c as a,o as t,ag as e}from"./chunks/framework.C4nOkCZI.js";const c=JSON.parse('{"title":"Forms","description":"","frontmatter":{},"headers":[],"relativePath":"forms.md","filePath":"forms.md"}'),n={name:"forms.md"};function h(l,s,p,r,k,o){return t(),a("div",null,[...s[0]||(s[0]=[e(`<h1 id="forms" tabindex="-1">Forms <a class="header-anchor" href="#forms" aria-label="Permalink to &quot;Forms&quot;">​</a></h1><p>In HTML, forms are the way data is submit to the server. Forms attract complexity since they interact with user experience, data validation, and interaction with a back-end database.</p><h2 id="overview" tabindex="-1">Overview <a class="header-anchor" href="#overview" aria-label="Permalink to &quot;Overview&quot;">​</a></h2><p>Forms in Brut accomplish three things:</p><ul><li>Forms model the data elements of a <code>&lt;form&gt;</code>, including client-side constraints (which Brut can check server-side as well).</li><li>Forms assist in HTML generation, to ensure the HTML elements are consistent and correct.</li><li>Forms hold data submitted to the server. No need for strong parameters or digging into a Hash of Whatever.</li></ul><p>Since forms can lead to a lot of complexity, this module will stick to the very basics. There are several recipes we&#39;ll link to that explain more complex interactions with forms.</p><h3 id="declaring-form-data-elements" tabindex="-1">Declaring Form Data/Elements <a class="header-anchor" href="#declaring-form-data-elements" aria-label="Permalink to &quot;Declaring Form Data/Elements&quot;">​</a></h3><p>When you <a href="/routes.html">create a form route</a>, this imlplies a form class exists to specify the data:</p><div class="language-ruby vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ruby</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># app/src/app.rb</span></span>
2
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">routes </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">do</span></span>
3
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> form </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;new_widget&quot;</span></span>
4
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">end</span></span>
5
- <span class="line"></span>
6
- <span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># app/src/front_end/forms/new_widget_form.rb</span></span>
7
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">class</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> NewWidgetForm</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> &lt;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> AppForm</span></span>
8
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">end</span></span></code></pre></div><p><code>AppForm</code> extends <a href="/api/Brut/FrontEnd/Form.html" target="_self" rel="noopener" data-no-router><code>Brut::FrontEnd::Form</code></a>, which provides class methods you can use to declare your form&#39;s elements. Let&#39;s say our form has a name (that must be at least 3 characters), a quantity (integer greater than 0), and an optional description.</p><div class="language-ruby vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ruby</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">class</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> NewWidgetForm</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> &lt;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> AppForm</span></span>
9
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> input </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">:name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">minlength:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 3</span></span>
10
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> input </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">:quantity</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">type:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> :number</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">min:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 0</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">step:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 1</span></span>
11
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> input </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">:description</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">required:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> true</span></span>
12
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">end</span></span></code></pre></div><p><code>input</code> declares a form element that will ultimately be handled by an <code>&lt;input&gt;</code> or <code>&lt;textarea&gt;</code> tag. <code>select</code> and <code>radio_button_group</code> are also avaiable, and are discussed in recipes.</p><p><code>input</code> accepts an input name used for <code>&lt;input&gt;</code>&#39;s <code>name</code> attribute. It also accepts keyword arguments that match the initializer of <a href="/api/Brut/FrontEnd/Forms/InputDefinition.html" target="_self" rel="noopener" data-no-router><code>Brut::FrontEnd::Forms::InputDefinition</code></a>. You&#39;ll notice those values mirror the various attributes related to client-side constraint validations, for example <code>minlength:</code> and <code>pattern:</code>.</p><p>Form elements have some defaults, as described below:</p><table tabindex="0"><thead><tr><th>Declaration</th><th>Default Behavior</th></tr></thead><tbody><tr><td><code>input :email</code></td><td><code>type: :email</code></td></tr><tr><td><code>input :password</code></td><td><code>type: :password</code></td></tr><tr><td><code>input :password_confirmation</code></td><td><code>type: :password</code></td></tr><tr><td><code>input «any other name»</code></td><td><code>type: :text</code></td></tr><tr><td><code>input «name», type: :checkbox</code></td><td><code>required: false</code></td></tr><tr><td><code>input «name» type: «not checkbox»</code></td><td><code>required: true</code></td></tr></tbody></table><h3 id="using-forms-to-generate-html" tabindex="-1">Using Forms to Generate HTML <a class="header-anchor" href="#using-forms-to-generate-html" aria-label="Permalink to &quot;Using Forms to Generate HTML&quot;">​</a></h3><p>One reason Brut models forms as classes with declared inputs is that you can then use an instance of that class to generate HTML. Brut will generate appropriate HTML, optionally configured to show a pre-existing value from the form.</p><p>The classes that do this are in <a href="/api/Brut/FrontEnd/Components.html" target="_self" rel="noopener" data-no-router><code>Brut::FrontEnd::Components</code></a></p><table tabindex="0"><thead><tr><th>Class</th><th>Purpose</th></tr></thead><tbody><tr><td><a href="/api/Brut/FrontEnd/Components/FormTag.html" target="_self" rel="noopener" data-no-router><code>Brut::FrontEnd::Components::FormTag</code></a></td><td>Creates a <code>&lt;form&gt;</code> tag that submits to the form&#39;s configured route and includes <a href="/security.html">CSRF protection</a>.</td></tr><tr><td><a href="/api/Brut/FrontEnd/Components/InputTag.html" target="_self" rel="noopener" data-no-router><code>Brut::FrontEnd::Components::InputTag</code></a></td><td>Creates an <code>&lt;input&gt;</code> tag</td></tr><tr><td><a href="/api/Brut/FrontEnd/Components/RadioButton.html" target="_self" rel="noopener" data-no-router><code>Brut::FrontEnd::Components::RadioButton</code></a></td><td>Creates an <code>&lt;input type=&quot;radio&quot;&gt;</code> tag</td></tr><tr><td>for use in a radio button group.</td><td></td></tr><tr><td><a href="/api/Brut/FrontEnd/Components/SelectTagWithOptions.html" target="_self" rel="noopener" data-no-router><code>Brut::FrontEnd::Components::SelectTagWithOptions</code></a></td><td>Creates a <code>&lt;select&gt;</code> tag with</td></tr><tr><td><code>&lt;option&gt;</code> tags inside.</td><td></td></tr><tr><td><a href="/api/Brut/FrontEnd/Components/TextareaTag.html" target="_self" rel="noopener" data-no-router><code>Brut::FrontEnd::Components::TextareaTag</code></a></td><td>Creates a <code>&lt;textarea&gt;</code> tag.</td></tr><tr><td><a href="/api/Brut/FrontEnd/Components/ButtonTag.html" target="_self" rel="noopener" data-no-router><code>Brut::FrontEnd::Components::ButtonTag</code></a></td><td>Creates a <code>&lt;button&gt;</code> tag to submit the form.</td></tr></tbody></table><p>All of these classes have an initializer that accepts:</p><ul><li><code>form:</code> the form object, used to figure out the HTML attributes and current value of the element.</li><li><code>input_name:</code> to know which input is being generated.</li><li><code>index:</code> for <a href="/recipes/indexed-forms.html">indexed form elements</a>.</li><li><code>**html_attributes</code> any other HTML attributesyou&#39;d like to include.</li></ul><p>These class names are quite long, but since these are Phlex components, you can <code>include</code> <a href="/api/Brut/FrontEnd/Components.html" target="_self" rel="noopener" data-no-router><code>Brut::FrontEnd::Components</code></a> and access their initializers as a <a href="https://phlex.fun" target="_blank" rel="noreferrer">Phlex kit</a>:</p><div class="language-ruby vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ruby</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">class</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> NewWidgetPage</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> &lt;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> AppPage</span></span>
13
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> include</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> Brut</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">::</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">FrontEnd</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">::</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">Components</span></span>
14
- <span class="line"></span>
15
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> initialize</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">form:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> nil</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
16
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> @form </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> form </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">||</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> NewWidgetForm</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">new</span></span>
17
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> end</span></span>
18
- <span class="line"></span>
19
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> private</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> attr_reader</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> :form</span></span>
20
- <span class="line"></span>
21
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> page_template</span></span>
22
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> FormTag</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">for:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> form) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">do</span></span>
23
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> Components</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">::</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">InputTag</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">form:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">input_name:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> :name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
24
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> Components</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">::</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">InputTag</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">form:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">input_name:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> :quantity</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
25
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> Components</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">::</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">TextareaTag</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">form:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">input_name:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> :description</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
26
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> end</span></span>
27
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> end</span></span>
28
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">end</span></span></code></pre></div><p>Phlex kits provides a methods named for the class that call that class&#39; constructor.</p><p>The code above will generate this HTML</p><div class="language-html vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">html</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&lt;</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">form</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> action</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;/new_widgets&quot;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> method</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;post&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
29
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &lt;</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">input</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;hidden&quot;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;authenticity_token&quot;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> value</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">«value»</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
30
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &lt;</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">input</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;text&quot;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;name&quot;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> required</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> minlength</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;3&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
31
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &lt;</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">input</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;number&quot;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;quantity&quot;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> required</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> min</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;0&quot;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> step</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;1&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
32
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &lt;</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">textarea</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;description&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
33
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &lt;/</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">textarea</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
34
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&lt;/</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">form</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span></code></pre></div><p>Forms accept a single initializer parameter, <code>params</code> that is a <code>Hash</code>. <a href="/api/Brut/FrontEnd/Form.html" target="_self" rel="noopener" data-no-router><code>Brut::FrontEnd::Form</code></a> implements this initializer, and will pluck values from the hash to initialize the inputs:</p><div class="vp-code-group vp-adaptive-theme"><div class="tabs"><input type="radio" name="group-Pt-oW" id="tab-pFXr5Xe" checked><label data-title="Form Class" for="tab-pFXr5Xe">Form Class</label><input type="radio" name="group-Pt-oW" id="tab-EVtIW7I"><label data-title="HTML Generated" for="tab-EVtIW7I">HTML Generated</label></div><div class="blocks"><div class="language-ruby vp-adaptive-theme active"><button title="Copy Code" class="copy"></button><span class="lang">ruby</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">class</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> NewWidgetPage</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> &lt;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> AppPage</span></span>
35
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> include</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> Brut</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">::</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">FrontEnd</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">::</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">Components</span></span>
36
- <span class="line"></span>
37
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> initialize</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">form:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> nil</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
38
- <span class="line highlighted"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> @form </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> form </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">||</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> NewWidgetForm</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">new</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">( </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">params:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span></span>
39
- <span class="line highlighted"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> name:</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;My New Widget&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
40
- <span class="line highlighted"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> quantity:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 10</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
41
- <span class="line highlighted"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> })</span></span>
42
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> end</span></span>
43
- <span class="line"></span>
44
- <span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # ...</span></span>
45
- <span class="line"></span>
46
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">end</span></span></code></pre></div><div class="language-html vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">html</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&lt;</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">form</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> action</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;/new_widgets&quot;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> method</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;post&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
47
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &lt;</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">input</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;hidden&quot;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;authenticity_token&quot;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> value</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">«value»</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
48
- <span class="line highlighted"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &lt;</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">input</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;text&quot;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> value</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;My New Widget&quot;</span></span>
49
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;name&quot;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> required</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> minlength</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;3&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
50
- <span class="line highlighted"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &lt;</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">input</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;number&quot;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> value</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;10&quot;</span></span>
51
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;quantity&quot;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> required</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> min</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;0&quot;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> step</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;1&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
52
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &lt;</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">textarea</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;description&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
53
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &lt;/</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">textarea</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span>
54
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&lt;/</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">form</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">&gt;</span></span></code></pre></div></div></div><h3 id="accessing-data-in-a-submitted-form" tabindex="-1">Accessing Data in a Submitted Form <a class="header-anchor" href="#accessing-data-in-a-submitted-form" aria-label="Permalink to &quot;Accessing Data in a Submitted Form&quot;">​</a></h3><p>As mentioned in <a href="/routes.html">routes</a>, a <code>form</code> route implies not just a form class, but a <a href="/handlers.html">handler</a> class to receive the submitted data.</p><p>We&#39;ll discuss handlers in the next section, but they demonstrate how you can access a form&#39;s data:</p><div class="language-ruby vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ruby</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">class</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> NewWidgetHandler</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> &lt;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> AppHandler</span></span>
55
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> initialize</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">form:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
56
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> @form </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> form</span></span>
57
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> end</span></span>
58
- <span class="line"></span>
59
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> handle</span></span>
60
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> form.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">name</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # =&gt; whatever name was submitted</span></span>
61
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> form.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">quantity</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # =&gt; whatever quantity was submitted</span></span>
62
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> form.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">description</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # =&gt; description provided</span></span>
63
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> end</span></span>
64
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">end</span></span></code></pre></div><p>A few things to note about how this works:</p><ul><li>Only those inputs declared in the form class can be accessed. All other values are discarded. No need for &quot;strong parameters&quot;.</li><li>All values are strings, because this is what HTML provides.</li><li>Blank values are coerced to <code>nil</code>.</li></ul><p>The next module will deal with form constraints and validations, in particular how to manage the user experience around client-side constraint violations, how to re-check them server side, and how to perform server-side checks.</p><h2 id="testing" tabindex="-1">Testing <a class="header-anchor" href="#testing" aria-label="Permalink to &quot;Testing&quot;">​</a></h2><p>Form classes don&#39;t need any logic on them, but they can be given helper methods or other logic if it makes sense. To test them, test them like any other class - instantiate an object and examine the behavior of its methods.</p><h2 id="recommended-practices" tabindex="-1">Recommended Practices <a class="header-anchor" href="#recommended-practices" aria-label="Permalink to &quot;Recommended Practices&quot;">​</a></h2><h3 id="create-components-to-generate-form-controls" tabindex="-1">Create Components to Generate Form Controls <a class="header-anchor" href="#create-components-to-generate-form-controls" aria-label="Permalink to &quot;Create Components to Generate Form Controls&quot;">​</a></h3><p><a href="/api/Brut/FrontEnd/Components/Inputs.html" target="_self" rel="noopener" data-no-router><code>Brut::FrontEnd::Components::Inputs</code></a> will generate the basic tags like <code>&lt;input&gt;</code> or <code>&lt;select&gt;</code>. Everything else like <code>&lt;label&gt;</code> is up to you. We recommend that you create <a href="/components.html">components</a> to generate the markup required for <em>your</em> inputs and controls.</p><p>The recipe <a href="/recipes/text-field-component.html">&quot;Creating a Text Field&quot;</a> will walk you through the steps and considerations.</p><h3 id="take-advantage-of-client-side-constraints" tabindex="-1">Take Advantage of Client Side Constraints <a class="header-anchor" href="#take-advantage-of-client-side-constraints" aria-label="Permalink to &quot;Take Advantage of Client Side Constraints&quot;">​</a></h3><p>Even though client-side constraints can sometimes be awkward in certain browsers, they are going to be eminently usable and accessible, and you can easily re-validate them on the server side.</p><h2 id="technical-notes" tabindex="-1">Technical Notes <a class="header-anchor" href="#technical-notes" aria-label="Permalink to &quot;Technical Notes&quot;">​</a></h2><div class="important custom-block github-alert"><p class="custom-block-title">IMPORTANT</p><p>Technical Notes are for deeper understanding and debugging. While we will try to keep them up-to-date with changes to Brut&#39;s internals, the source code is always more correct.</p></div><p><em>Last Updated May 13, 2025</em></p><p>For HTML generation, there are few classes that work together:</p><ul><li><em>input definitions</em> define an input and tend to provide an API similar to HTML&#39;s. See <a href="/api/Brut/FrontEnd/Forms/InputDefinition.html" target="_self" rel="noopener" data-no-router><code>Brut::FrontEnd::Forms::InputDefinition</code></a>.</li><li><em>inputs</em> represent the runtime state of an input from the browser. Whereas an input definition has no state, the input does. It delegates much of its behavior to the underlying input definition. It&#39;s <code>value=</code> method performs client-side constraint validations by creating a <a href="/api/Brut/FrontEnd/Forms/ValidityState.html" target="_self" rel="noopener" data-no-router><code>Brut::FrontEnd::Forms::ValidityState</code></a> internally. See <a href="/api/Brut/FrontEnd/Forms/Input.html" target="_self" rel="noopener" data-no-router><code>Brut::FrontEnd::Forms::Input</code></a>.</li><li><a href="/api/Brut/FrontEnd/Forms/InputDeclarations.html" target="_self" rel="noopener" data-no-router><code>Brut::FrontEnd::Forms::InputDeclarations</code></a> is a module that allows creating input definitions inside your form class. It implements the class methods like <code>input</code>.</li><li><a href="/api/Brut/FrontEnd/Components/Inputs.html" target="_self" rel="noopener" data-no-router><code>Brut::FrontEnd::Components::Inputs</code></a> contains components used to generate <code>&lt;input&gt;</code> fields. These classes will coerce the value of the <code>input</code> they are given to generate the correct HTML.</li></ul>`,48)])])}const g=i(n,[["render",h]]);export{c as __pageData,g as default};
@@ -1 +0,0 @@
1
- import{_ as i,c as a,o as t,ag as e}from"./chunks/framework.C4nOkCZI.js";const c=JSON.parse('{"title":"Forms","description":"","frontmatter":{},"headers":[],"relativePath":"forms.md","filePath":"forms.md"}'),n={name:"forms.md"};function h(l,s,p,r,k,o){return t(),a("div",null,[...s[0]||(s[0]=[e("",48)])])}const g=i(n,[["render",h]]);export{c as __pageData,g as default};
@@ -1,31 +0,0 @@
1
- import{_ as s,c as e,o as t,ag as n}from"./chunks/framework.C4nOkCZI.js";const u=JSON.parse('{"title":"Getting Started","description":"","frontmatter":{},"headers":[],"relativePath":"getting-started.md","filePath":"getting-started.md"}'),i={name:"getting-started.md"};function p(l,a,o,r,d,h){return t(),e("div",null,[...a[0]||(a[0]=[n(`<h1 id="getting-started" tabindex="-1">Getting Started <a class="header-anchor" href="#getting-started" aria-label="Permalink to &quot;Getting Started&quot;">​</a></h1><p>Brut is developed alongside a separate gem called <code>mkbrut</code>, which allows you to create a new Brut app. It will set up your dev environment as well.</p><h2 id="get-mkbrut" tabindex="-1">Get <code>mkbrut</code> <a class="header-anchor" href="#get-mkbrut" aria-label="Permalink to &quot;Get \`mkbrut\`&quot;">​</a></h2><p>The simplest way to use <code>mkbrut</code> is to use an existing <a href="https://hub.docker.com/repository/docker/thirdtank/mkbrut/general" target="_blank" rel="noreferrer">Docker image</a>. You don&#39;t have to install or configure Ruby:</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>docker run \\</span></span>
2
- <span class="line"><span> --pull always \\</span></span>
3
- <span class="line"><span> -v &quot;$PWD&quot;:&quot;$PWD&quot; \\</span></span>
4
- <span class="line"><span> -w &quot;$PWD&quot; \\</span></span>
5
- <span class="line"><span> -u $(id -u):$(id -g) \\</span></span>
6
- <span class="line"><span> -it \\</span></span>
7
- <span class="line"><span> thirdtank/mkbrut \\</span></span>
8
- <span class="line"><span> mkbrut my-new-app</span></span></code></pre></div><p>If you already have Ruby 3.4 installed, you can install <code>mkbrut</code> directly:</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>&gt; gem install mkbrut</span></span>
9
- <span class="line"><span>&gt; mkbrut my-new-app</span></span></code></pre></div><h2 id="init-your-app" tabindex="-1">Init Your App <a class="header-anchor" href="#init-your-app" aria-label="Permalink to &quot;Init Your App&quot;">​</a></h2><p>A Brut app just needs a name, which will be used to derive a few more useful values. For now:</p><div class="vp-code-group vp-adaptive-theme"><div class="tabs"><input type="radio" name="group-P5Bg5" id="tab-eJX_7NJ" checked><label data-title="Docker-based" for="tab-eJX_7NJ">Docker-based</label><input type="radio" name="group-P5Bg5" id="tab-ZbKrgrB"><label data-title="RubyGems-based" for="tab-ZbKrgrB">RubyGems-based</label></div><div class="blocks"><div class="language- vp-adaptive-theme active"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>docker run \\</span></span>
10
- <span class="line"><span> --pull always \\</span></span>
11
- <span class="line"><span> -v &quot;$PWD&quot;:&quot;$PWD&quot; \\</span></span>
12
- <span class="line"><span> -w &quot;$PWD&quot; \\</span></span>
13
- <span class="line"><span> -u $(id -u):$(id -g) \\</span></span>
14
- <span class="line"><span> -it \\</span></span>
15
- <span class="line"><span> thirdtank/mkbrut \\</span></span>
16
- <span class="line"><span> mkbrut my-new-app</span></span></code></pre></div><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>mkbrut my-new-app</span></span></code></pre></div></div></div><p>This will create your new app, along with some demo routes, components, handlers, and tests. If this is your first time using Brut, we recommend you examine these demo components.</p><p>To create your app without the demo components:</p><div class="vp-code-group vp-adaptive-theme"><div class="tabs"><input type="radio" name="group-DNJdY" id="tab-4ZtwR1U" checked><label data-title="Docker-based" for="tab-4ZtwR1U">Docker-based</label><input type="radio" name="group-DNJdY" id="tab-a5yZ8qP"><label data-title="RubyGems-based" for="tab-a5yZ8qP">RubyGems-based</label></div><div class="blocks"><div class="language- vp-adaptive-theme active"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>docker run \\</span></span>
17
- <span class="line"><span> --pull always \\</span></span>
18
- <span class="line"><span> -v &quot;$PWD&quot;:&quot;$PWD&quot; \\</span></span>
19
- <span class="line"><span> -w &quot;$PWD&quot; \\</span></span>
20
- <span class="line"><span> -u $(id -u):$(id -g) \\</span></span>
21
- <span class="line"><span> -it \\</span></span>
22
- <span class="line"><span> thirdtank/mkbrut \\</span></span>
23
- <span class="line"><span> mkbrut my-new-app --no-demo</span></span></code></pre></div><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>mkbrut my-new-app --no-demo</span></span></code></pre></div></div></div><h2 id="start-your-dev-environment" tabindex="-1">Start Your Dev Environment <a class="header-anchor" href="#start-your-dev-environment" aria-label="Permalink to &quot;Start Your Dev Environment&quot;">​</a></h2><p>Brut includes a dev environment based on Docker. It uses Docker compose to run a Docker container where your app will run, a Docker container for Postgres, and a Docker container for local observability via OpenTelemetry.</p><ol><li><p><a href="https://docs.docker.com/get-started/get-docker/" target="_blank" rel="noreferrer">Install Docker</a></p></li><li><p>Build the image used to create you app&#39;s container:</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>&gt; dx/build</span></span></code></pre></div></li><li><p>Start up all the containers:</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>&gt; dx/start</span></span></code></pre></div></li><li><p>Now, install your aps gems and set it all up:</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>&gt; dx/exec bin/setup</span></span></code></pre></div></li></ol><p>Now, you&#39;re ready to go. See <a href="/dev-environment.html">Dev Environemnt</a> for details on how this all works.</p><div class="note custom-block github-alert"><p class="custom-block-title">NOTE</p><p>Instead of running <code>dx/exec</code> in front of your commands, you can instead do <code>dx/exec bash</code> to &quot;log in&quot; to the running container. You&#39;ll have a normal prompt and can issue commands directly from there.</p></div><h2 id="run-the-app" tabindex="-1">Run the App <a class="header-anchor" href="#run-the-app" aria-label="Permalink to &quot;Run the App&quot;">​</a></h2><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>dx/exec bin/dev</span></span></code></pre></div><p>You can now visit your app at <code>localhost:6502</code></p><p>You can make changes and see them when you reload. Open up <code>app/src/front_end/pages/home_page.rb</code> <em>in your editor running on your computer</em> and change the <code>h1</code> to look like so:</p><div class="language-ruby vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ruby</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">class</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> HomePage</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> &lt;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> AppPage</span></span>
24
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> page_template</span></span>
25
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> div</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">class:</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;flex flex-column items-center justify-center h-80vh&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">do</span></span>
26
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> img</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">src:</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;/static/images/icon.png&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">class:</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;h-50&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
27
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> h1</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">class:</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;ff-sans ma-0 lh-title f-5&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">do</span></span>
28
- <span class="line highlighted"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;Welcome to My New App!&quot;</span></span>
29
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> end</span></span>
30
- <span class="line"></span>
31
- <span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # ...</span></span></code></pre></div><p>When you reload your browser, you&#39;ll see your change</p><h2 id="run-the-tests" tabindex="-1">Run the Tests <a class="header-anchor" href="#run-the-tests" aria-label="Permalink to &quot;Run the Tests&quot;">​</a></h2><p>There are a few tests you can run, as well as some checks that you aren&#39;t using RubyGems with security vulnerabilities. Run it all now with <code>bin/ci</code>:</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>dx/exec bin/ci</span></span></code></pre></div><h2 id="now-build-the-rest-of-your-app-🦉" tabindex="-1">Now Build The Rest of Your App 🦉 <a class="header-anchor" href="#now-build-the-rest-of-your-app-🦉" aria-label="Permalink to &quot;Now Build The Rest of Your App 🦉&quot;">​</a></h2><p>You can <a href="/tutorial.html">follow the tutorial</a>, check out the <a href="/overview.html">conceptual overview</a>, or dive straight into the <a href="/api/index.html">API docs</a>. You might also want to check out the docs for <a href="/lsp.html">LSP Support</a>.</p>`,29)])])}const k=s(i,[["render",p]]);export{u as __pageData,k as default};
@@ -1 +0,0 @@
1
- import{_ as s,c as e,o as t,ag as n}from"./chunks/framework.C4nOkCZI.js";const u=JSON.parse('{"title":"Getting Started","description":"","frontmatter":{},"headers":[],"relativePath":"getting-started.md","filePath":"getting-started.md"}'),i={name:"getting-started.md"};function p(l,a,o,r,d,h){return t(),e("div",null,[...a[0]||(a[0]=[n("",29)])])}const k=s(i,[["render",p]]);export{u as __pageData,k as default};
@@ -1,54 +0,0 @@
1
- import{_ as a,c as i,o as e,ag as t}from"./chunks/framework.C4nOkCZI.js";const c=JSON.parse('{"title":"Handlers & Actions","description":"","frontmatter":{},"headers":[],"relativePath":"handlers.md","filePath":"handlers.md"}'),n={name:"handlers.md"};function l(h,s,r,o,d,p){return e(),i("div",null,[...s[0]||(s[0]=[t(`<h1 id="handlers-actions" tabindex="-1">Handlers &amp; Actions <a class="header-anchor" href="#handlers-actions" aria-label="Permalink to &quot;Handlers &amp; Actions&quot;">​</a></h1><p>Handlers process form submissions, and <em>actions</em> work similarly to process any arbitrary HTTP request.</p><h2 id="overview" tabindex="-1">Overview <a class="header-anchor" href="#overview" aria-label="Permalink to &quot;Overview&quot;">​</a></h2><p>Where a <a href="/pages.html">page</a> renders a web page in HTML, a <em>handler</em> responds to all other HTTP requests. To respond to such HTTP requests, you&#39;d first create a <a href="/routes.html">route</a>, using <code>form</code>, <code>action</code>, or <code>path</code>.</p><h3 id="handler-structure" tabindex="-1">Handler Structure <a class="header-anchor" href="#handler-structure" aria-label="Permalink to &quot;Handler Structure&quot;">​</a></h3><p>A handler&#39;s initializer is subject to <a href="/keyword-injection.html">keyword injection</a>, with the addition of the <code>form:</code> keyword, which, if present, will be an instance of the associated form class, populated with the data in the form submission (not available for <code>path</code> or <code>action</code> routes).</p><p>You must implement <code>handle</code> to process the form. <strong>A handler&#39;s public API, as called by Brut and your tests, is <code>handle!</code></strong>, however you implement <code>handle</code>, which <code>handle!</code> calls.</p><p><code>handle</code>&#39;s return value dictates what will happen next:</p><table tabindex="0"><thead><tr><th>Return Value</th><th>Behavior</th></tr></thead><tbody><tr><td>Instance of a page or component</td><td>That page or component&#39;s HTML is generated and returned. This is not a redirect, but more like <code>render :new</code> in a Rails controller</td></tr><tr><td><a href="/api/Brut/FrontEnd/HttpStatus.html" target="_self" rel="noopener" data-no-router><code>Brut::FrontEnd::HttpStatus</code></a></td><td>This HTTP status is returned with no body. Use <code>http_status</code> from <a href="/api/Brut/FrontEnd/HandlingResults.html" target="_self" rel="noopener" data-no-router><code>Brut::FrontEnd::HandlingResults</code></a> (included in all handlers) to create an instance from a number</td></tr><tr><td><code>URI</code></td><td>Redirect to the URI. Use <code>redirect_to</code> from <a href="/api/Brut/FrontEnd/HandlingResults.html" target="_self" rel="noopener" data-no-router><code>Brut::FrontEnd::HandlingResults</code></a> (included in all handlers) to generate a URI from a page class and parameters</td></tr><tr><td>Two element array with <em>element 0</em> being a <a href="/api/Brut/FrontEnd/HttpStatus.html" target="_self" rel="noopener" data-no-router><code>Brut::FrontEnd::HttpStatus</code></a>, and <em>element 1</em> being a page or component instance</td><td>Generates the page or component&#39;s HTML, but sets the given status instead of 200. Useful for Ajax responses where the HTTP status affects client-side behavior</td></tr><tr><td><a href="/api/Brut/FrontEnd/Download.html" target="_self" rel="noopener" data-no-router><code>Brut::FrontEnd::Download</code></a></td><td>Download a file</td></tr><tr><td><a href="/api/Brut/FrontEnd/GenericResponse.html" target="_self" rel="noopener" data-no-router><code>Brut::FrontEnd::GenericResponse</code></a></td><td>wrap any Rack response</td></tr></tbody></table><div class="important custom-block github-alert"><p class="custom-block-title">IMPORTANT</p><p>The only way to render something other than HTML is to do so as a <code>GenericResponse</code>, which is basically the low-level Rack API. Brut encourages Ajax responses to be HTML and for you to use the browser&#39;s APIs to interact with that HTML. Brut may make it easier to work with other types of content in the future.</p></div><h3 id="handling-a-form-submission" tabindex="-1">Handling a Form Submission <a class="header-anchor" href="#handling-a-form-submission" aria-label="Permalink to &quot;Handling a Form Submission&quot;">​</a></h3><p>A common pattern when handling a form submisssion is to check for any constraint violations. If there are some, re-generate the HTML for the page containing the form, highlighting the violations. Otherwise, save the data and redirect to another page.</p><p>Here&#39;s how that looks:</p><div class="language-ruby vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ruby</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">class</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> NewWidgetHandler</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> &lt;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> AppHandler</span></span>
2
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> initialize</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">form:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
3
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> @form </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> form</span></span>
4
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> end</span></span>
5
- <span class="line"></span>
6
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> handle</span></span>
7
- <span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # if no client-side violations were submitted</span></span>
8
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> @form.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">valid?</span></span>
9
- <span class="line"><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;"> widget</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> = </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">DB</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">::</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">Widget</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">find</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">name:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> form.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
10
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> widget</span></span>
11
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> @form.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">server_side_constraint_violation</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span></span>
12
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> input_name:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> :name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
13
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> key:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> :name_is_taken</span></span>
14
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> )</span></span>
15
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> end</span></span>
16
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> end</span></span>
17
- <span class="line"></span>
18
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> @form.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">constraint_violations?</span></span>
19
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> NewWidgetPage</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">new</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">form:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> @form)</span></span>
20
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> else</span></span>
21
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> DB</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">::</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">Widget</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">create</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">name:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> form.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
22
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> quantity:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> form.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">quantity</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
23
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> description:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> form.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">description</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
24
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> redirect_to</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">WidgetsPage</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
25
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> end</span></span>
26
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> end</span></span>
27
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">end</span></span></code></pre></div><p>Unlike a Rails controller, the return value of <code>handle</code> controls the behavior. As we saw in <a href="/form-constraints.html">Form Constraints</a>, the HTML generated by <code>NewWidgetPage</code> will show constraint violations, so by returning <code>NewWidgetPage.new(form: @form)</code>, the page has the same form instance, including all the constraint violations, and the visitor will see the problems.</p><h3 id="handling-other-requests" tabindex="-1">Handling Other Requests <a class="header-anchor" href="#handling-other-requests" aria-label="Permalink to &quot;Handling Other Requests&quot;">​</a></h3><p>Non-form submissions work similarly, however there is no form available. If the request could potentially involve a visitor-initiated error, you can use the <a href="/flash-and-session.html">flash</a> to communicate back. The flash is available for injection into the initializer and, assuming your page uses it to show messages, can allow for communication when something is wrong:</p><div class="language-ruby vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ruby</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">class</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> App</span></span>
28
- <span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # ...</span></span>
29
- <span class="line"></span>
30
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> routes </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">do</span></span>
31
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> action </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;/delete_widget/:widget_id&quot;</span></span>
32
- <span class="line"></span>
33
- <span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # ...</span></span>
34
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> end</span></span>
35
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">end</span></span>
36
- <span class="line"></span>
37
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">class</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> DeleteWidgetByIdHandler</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> &lt;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> AppHandler</span></span>
38
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> initialize</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">widget_id:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">flash:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
39
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> @widget_id </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> widget_id</span></span>
40
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> @flash </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> flash</span></span>
41
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> end</span></span>
42
- <span class="line"></span>
43
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> handle</span></span>
44
- <span class="line"><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;"> widget</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> = </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">DB</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">::</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">Widget</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">find!</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">id:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> @widget_id)</span></span>
45
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> widget.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">can_delete?</span></span>
46
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> widget.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">delete</span></span>
47
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> @flash.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">notice</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> :widget_deleted</span></span>
48
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> redirect_to</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">WidgetsPage</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
49
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> else</span></span>
50
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> @flash.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">alert</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> :widget_cannot_be_deleted</span></span>
51
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> WidgetsPage</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">new</span></span>
52
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> end</span></span>
53
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> end</span></span>
54
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">end</span></span></code></pre></div><h3 id="hooks" tabindex="-1">Hooks <a class="header-anchor" href="#hooks" aria-label="Permalink to &quot;Hooks&quot;">​</a></h3><p>A handler&#39;s public API is <code>handle!</code>, because it first calls <code>before_handle</code>. This operates as a before hook, and has the same return values as <code>handle</code>, with the exception of also recognizing <code>nil</code>, which indicates processing should proceed to <code>handle</code>.</p><p>Generally, you don&#39;t need to implement hooksd on a per-handler basis, but may find it useful in a shared super class to implement cross-cutting behavior.</p><h2 id="testing" tabindex="-1">Testing <a class="header-anchor" href="#testing" aria-label="Permalink to &quot;Testing&quot;">​</a></h2><p>See <a href="/unit-tests.html">Unit Testing</a> for some basic assumptions and configuration available for all Brut unit tests.</p><p>Handler tests should be straightforward: you create your handler, call <code>handle!</code> (remember, <code>handle!</code> is the public API, and will call your hooks, which you want in a test), then examine the result returned and any ancillary behavior, such as updated database records.</p><p>Some matchers are available to make assertions about <code>handle!</code>&#39;s return value:</p><ul><li><code>have_redirected_to</code> will check that the handler redirected to a give URI. See <a href="/api/Brut/SpecSupport/Matchers/HaveRedirectedTo.html" target="_self" rel="noopener" data-no-router><code>Brut::SpecSupport::Matchers::HaveRedirectedTo</code></a>.</li><li><code>have_generated</code> will check that the handler generated a specific page or component&#39;s HTML. See <code>&lt;D-f&gt;Brut::SpecSupport::Matchers::HaveGenerated</code>.</li><li><code>have_returned_http_status</code> will check that the handler returned an HTTP status. See <a href="/api/Brut/SpecSupport/Matchers/HaveReturnedHttpStatus.html" target="_self" rel="noopener" data-no-router><code>Brut::SpecSupport::Matchers::HaveReturnedHttpStatus</code></a>.</li><li><code>have_constraint_violation</code> will check if a form had a particular constraint violation set on it. See <a href="/api/Brut/SpecSupport/Matchers/HaveConstraintViolation.html" target="_self" rel="noopener" data-no-router><code>Brut::SpecSupport::Matchers::HaveConstraintViolation</code></a>.</li></ul><h2 id="recommended-practices" tabindex="-1">Recommended Practices <a class="header-anchor" href="#recommended-practices" aria-label="Permalink to &quot;Recommended Practices&quot;">​</a></h2><h3 id="you-don-t-always-need-resourceful-or-restful-routes" tabindex="-1">You Don&#39;t Always Need Resourceful or RESTful Routes <a class="header-anchor" href="#you-don-t-always-need-resourceful-or-restful-routes" aria-label="Permalink to &quot;You Don&#39;t Always Need Resourceful or RESTful Routes&quot;">​</a></h3><p>For any code where the browser is performing a submission, use either <code>form</code> or <code>action</code> to declare your route. These will both use an HTTP <code>POST</code> to your server and handler. In the example above, we had a <code>POST</code> to <code>/delete_widget/:widget_id</code>, and not, say, a <code>DELETE</code> to it.</p><p>The main reason is that a browser can only submit to a server using <code>GET</code> or <code>POST</code>, so there&#39;s little value in &quot;tunneling&quot; another verb of POST. It doesn&#39;t really matter. And, even though you may use Ajax to submit such data, having it degrade to normal browser-based HTTP is a good practice.</p><p>For API-like calls where a browser will never directly interact with the route, and it would only be via a server-to-server call, RESTful routes makes sense. But they don&#39;t need to be the default.</p><h3 id="avoid-business-logic-in-handlers" tabindex="-1">Avoid Business Logic in Handlers <a class="header-anchor" href="#avoid-business-logic-in-handlers" aria-label="Permalink to &quot;Avoid Business Logic in Handlers&quot;">​</a></h3><p>Since handlers bridge the gap between HTTP and your app, their API is naturally simplistic and String-based. The handler should defer to business logic (which can be done by either passing the form object directly, or extracting its data and passing that). Based on the response, the handler will then decide what HTTP response is approriate.</p><p>This means that your handlers will be relatively simple and their tests will as well. It does mean that their tests may require the use of mocks or stubs, but that&#39;s fine. Mocks and stubs exist for a reason.</p><h2 id="technical-notes" tabindex="-1">Technical Notes <a class="header-anchor" href="#technical-notes" aria-label="Permalink to &quot;Technical Notes&quot;">​</a></h2><div class="important custom-block github-alert"><p class="custom-block-title">IMPORTANT</p><p>Technical Notes are for deeper understanding and debugging. While we will try to keep them up-to-date with changes to Brut&#39;s internals, the source code is always more correct.</p></div><p><em>Last Updated May 5, 2025</em></p><p>None at this time.</p>`,38)])])}const g=a(n,[["render",l]]);export{c as __pageData,g as default};