trestle 0.9.9 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (339) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/release.yml +26 -0
  3. data/.github/workflows/rspec.yml +37 -5
  4. data/.gitignore +3 -0
  5. data/Gemfile +14 -1
  6. data/README.md +3 -2
  7. data/app/assets/bundle/trestle/admin.css +23 -0
  8. data/app/assets/bundle/trestle/admin.js +83 -0
  9. data/app/assets/bundle/trestle/fa-brands-400.ttf +0 -0
  10. data/app/assets/bundle/trestle/fa-brands-400.woff2 +0 -0
  11. data/app/assets/bundle/trestle/fa-regular-400.ttf +0 -0
  12. data/app/assets/bundle/trestle/fa-regular-400.woff2 +0 -0
  13. data/app/assets/bundle/trestle/fa-solid-900.ttf +0 -0
  14. data/app/assets/bundle/trestle/fa-solid-900.woff2 +0 -0
  15. data/app/assets/bundle/trestle/locale/cs.js +110 -0
  16. data/app/assets/bundle/trestle/locale/de.js +116 -0
  17. data/app/assets/bundle/trestle/locale/en.js +329 -0
  18. data/app/assets/bundle/trestle/locale/es-MX.js +109 -0
  19. data/app/assets/bundle/trestle/locale/es.js +109 -0
  20. data/app/assets/bundle/trestle/locale/fr.js +111 -0
  21. data/app/assets/bundle/trestle/locale/ko.js +111 -0
  22. data/app/assets/bundle/trestle/locale/lv.js +109 -0
  23. data/app/assets/bundle/trestle/locale/nl.js +96 -0
  24. data/app/assets/bundle/trestle/locale/pl.js +99 -0
  25. data/app/assets/bundle/trestle/locale/pt-BR.js +98 -0
  26. data/app/assets/bundle/trestle/locale/vi.js +116 -0
  27. data/app/assets/bundle/trestle/locale/zh-CN.js +109 -0
  28. data/app/assets/bundle/trestle/photoswipe-063ce7be40e10b3e6848.digested.js +6 -0
  29. data/app/assets/sprockets/trestle/custom.css +1 -0
  30. data/app/assets/sprockets/trestle/icons/font-awesome.css.erb +32 -0
  31. data/app/assets/sprockets/trestle/manifest.js +4 -0
  32. data/app/assets/stylesheets/trestle/custom.css +6 -1
  33. data/app/controllers/concerns/trestle/controller/helpers.rb +2 -0
  34. data/app/controllers/concerns/trestle/controller/location.rb +1 -6
  35. data/app/controllers/concerns/trestle/controller/modal.rb +25 -0
  36. data/app/controllers/concerns/trestle/controller/turbo_stream.rb +12 -0
  37. data/app/controllers/concerns/trestle/resource/controller/actions.rb +39 -28
  38. data/app/controllers/concerns/trestle/resource/controller/redirection.rb +5 -5
  39. data/app/controllers/trestle/application_controller.rb +2 -1
  40. data/app/helpers/trestle/flash_helper.rb +10 -0
  41. data/app/helpers/trestle/form_helper.rb +3 -2
  42. data/app/helpers/trestle/format_helper.rb +2 -1
  43. data/app/helpers/trestle/i18n_helper.rb +46 -7
  44. data/app/helpers/trestle/modal_helper.rb +29 -0
  45. data/app/helpers/trestle/tab_helper.rb +1 -1
  46. data/app/helpers/trestle/turbo/frame_helper.rb +29 -0
  47. data/app/helpers/trestle/turbo/stream_helper.rb +9 -0
  48. data/app/helpers/trestle/turbo/tag_builder.rb +21 -0
  49. data/app/helpers/trestle/url_helper.rb +7 -4
  50. data/app/views/layouts/trestle/admin.html.erb +16 -18
  51. data/app/views/layouts/trestle/admin.turbo_stream.erb +4 -0
  52. data/app/views/layouts/trestle/modal.html.erb +5 -0
  53. data/app/views/trestle/_i18n.html.erb +12 -0
  54. data/app/views/trestle/_theme.html.erb +15 -0
  55. data/app/views/trestle/application/_header.html.erb +12 -10
  56. data/app/views/trestle/application/_layout.html.erb +6 -3
  57. data/app/views/trestle/application/_modal.html.erb +36 -0
  58. data/app/views/trestle/application/_tabs.html.erb +4 -4
  59. data/app/views/trestle/flash/_alert.html.erb +1 -1
  60. data/app/views/trestle/flash/_debug.html.erb +1 -1
  61. data/app/views/trestle/resource/_form.html.erb +5 -0
  62. data/app/views/trestle/resource/create.turbo_stream.erb +1 -0
  63. data/app/views/trestle/resource/destroy.turbo_stream.erb +1 -0
  64. data/app/views/trestle/resource/edit.html.erb +6 -2
  65. data/app/views/trestle/resource/index.html.erb +17 -10
  66. data/app/views/trestle/resource/new.html.erb +9 -2
  67. data/app/views/trestle/resource/show.html.erb +6 -2
  68. data/app/views/trestle/resource/update.turbo_stream.erb +1 -0
  69. data/app/views/trestle/shared/_sidebar.html.erb +10 -10
  70. data/frontend/css/components/_alerts.scss +41 -37
  71. data/frontend/css/components/_avatar.scss +12 -12
  72. data/frontend/css/components/_background.scss +8 -36
  73. data/frontend/css/components/_badges.scss +31 -0
  74. data/frontend/css/components/_breadcrumbs.scss +9 -30
  75. data/frontend/css/components/_buttons.scss +8 -7
  76. data/frontend/css/components/_datepicker.scss +15 -11
  77. data/frontend/css/components/_dropdown.scss +21 -9
  78. data/frontend/css/components/{_fields.scss → _forms.scss} +18 -5
  79. data/frontend/css/components/_grid.scss +29 -0
  80. data/frontend/css/components/_media-grid.scss +52 -44
  81. data/frontend/css/components/_modal.scss +37 -8
  82. data/frontend/css/components/_pagination.scss +5 -9
  83. data/frontend/css/components/_photoswipe.scss +8 -0
  84. data/frontend/css/components/_popover.scss +2 -1
  85. data/frontend/css/components/_scopes.scss +5 -11
  86. data/frontend/css/components/_select.scss +160 -31
  87. data/frontend/css/components/_sort.scss +1 -1
  88. data/frontend/css/components/_table.scss +61 -66
  89. data/frontend/css/components/_tabs.scss +20 -20
  90. data/frontend/css/components/_tags.scss +80 -15
  91. data/frontend/css/components/_toolbars.scss +18 -13
  92. data/frontend/css/components/_turbo.scss +3 -0
  93. data/frontend/css/core/_bootstrap.scss +46 -0
  94. data/frontend/css/core/_dependencies.scss +4 -3
  95. data/frontend/css/core/_functions.scss +31 -0
  96. data/frontend/css/core/_mixins.scss +2 -36
  97. data/frontend/css/core/_theme.scss +261 -0
  98. data/frontend/css/core/_typography.scss +16 -14
  99. data/frontend/css/icons/_fontawesome.scss +3 -15
  100. data/frontend/css/index.scss +15 -7
  101. data/frontend/css/layout/_base.scss +6 -4
  102. data/frontend/css/layout/_content-header.scss +71 -0
  103. data/frontend/css/layout/_footer.scss +5 -7
  104. data/frontend/css/layout/_header.scss +5 -3
  105. data/frontend/css/layout/_main-content.scss +107 -0
  106. data/frontend/css/layout/_navigation.scss +112 -50
  107. data/frontend/css/layout/_sidebar.scss +72 -36
  108. data/frontend/css/support/_sprockets.scss +2 -0
  109. data/frontend/css/support/_webpack.scss +2 -0
  110. data/frontend/css/variables/_bootstrap.scss +158 -55
  111. data/frontend/css/variables/_maps.scss +15 -0
  112. data/frontend/css/variables/_trestle.scss +70 -38
  113. data/frontend/js/controllers/application_controller.js +17 -0
  114. data/frontend/js/controllers/batch_action_controller.js +59 -0
  115. data/frontend/js/controllers/checkbox_select_controller.js +46 -0
  116. data/frontend/js/controllers/confirm_controller.js +115 -0
  117. data/frontend/js/controllers/confirm_delete_controller.js +11 -0
  118. data/frontend/js/controllers/datepicker_controller.js +12 -0
  119. data/frontend/js/controllers/datetimepicker_controller.js +13 -0
  120. data/frontend/js/controllers/deprecated/init_controller.js +9 -0
  121. data/frontend/js/controllers/flatpickr_controller.js +50 -0
  122. data/frontend/js/controllers/follow_url_controller.js +36 -0
  123. data/frontend/js/controllers/form_error_controller.js +24 -0
  124. data/frontend/js/controllers/form_loading_controller.js +50 -0
  125. data/frontend/js/controllers/gallery_controller.js +12 -0
  126. data/frontend/js/controllers/index.js +19 -0
  127. data/frontend/js/controllers/keyboard_submit_controller.js +25 -0
  128. data/frontend/js/controllers/lightbox_controller.js +158 -0
  129. data/frontend/js/controllers/mobile_sidebar_controller.js +30 -0
  130. data/frontend/js/controllers/modal_controller.js +36 -0
  131. data/frontend/js/controllers/modal_frame_controller.js +11 -0
  132. data/frontend/js/controllers/modal_trigger_controller.js +74 -0
  133. data/frontend/js/{components/navigation.js → controllers/navigation_controller.js} +14 -10
  134. data/frontend/js/controllers/navigation_tooltip_controller.js +32 -0
  135. data/frontend/js/controllers/popover_controller.js +87 -0
  136. data/frontend/js/controllers/reloadable_controller.js +34 -0
  137. data/frontend/js/controllers/select_controller.js +49 -0
  138. data/frontend/js/controllers/sidebar_controller.js +33 -0
  139. data/frontend/js/controllers/tab_errors_controller.js +45 -0
  140. data/frontend/js/controllers/tabs_controller.js +45 -0
  141. data/frontend/js/controllers/timepicker_controller.js +14 -0
  142. data/frontend/js/controllers/toggle_attr_controller.js +27 -0
  143. data/frontend/js/controllers/toggle_class_controller.js +27 -0
  144. data/frontend/js/controllers/tooltip_controller.js +13 -0
  145. data/frontend/js/controllers/wrapper_controller.js +43 -0
  146. data/frontend/js/core/backdrop.js +100 -0
  147. data/frontend/js/core/error_modal.js +65 -0
  148. data/frontend/js/core/fetch.js +32 -0
  149. data/frontend/js/core/i18n.js +24 -10
  150. data/frontend/js/core/modal.js +52 -0
  151. data/frontend/js/core/stream_actions.js +56 -0
  152. data/frontend/js/core/turbo_errors.js +9 -0
  153. data/frontend/js/{core → deprecated}/events.js +1 -8
  154. data/frontend/js/deprecated/tooltip.js +8 -0
  155. data/frontend/js/index.js +28 -40
  156. data/frontend/js/mixins/index.js +5 -0
  157. data/frontend/js/mixins/photoswipe.js +10 -0
  158. data/frontend/js/util/bootstrap.js +93 -0
  159. data/i18n/config.yml +14 -0
  160. data/i18n/environment.rb +8 -0
  161. data/i18n/export +3 -0
  162. data/i18n/template.erb +1 -0
  163. data/lib/generators/trestle/install/install_generator.rb +3 -8
  164. data/lib/generators/trestle/install/templates/trestle.rb.erb +5 -5
  165. data/lib/trestle/color.rb +113 -0
  166. data/lib/trestle/configuration.rb +16 -8
  167. data/lib/trestle/engine.rb +28 -20
  168. data/lib/trestle/form/fields/check_box_helpers.rb +7 -18
  169. data/lib/trestle/form/fields/collection_select.rb +1 -1
  170. data/lib/trestle/form/fields/color_field.rb +4 -0
  171. data/lib/trestle/form/fields/date_field.rb +4 -0
  172. data/lib/trestle/form/fields/date_picker.rb +10 -4
  173. data/lib/trestle/form/fields/date_select.rb +1 -1
  174. data/lib/trestle/form/fields/datetime_field.rb +4 -0
  175. data/lib/trestle/form/fields/datetime_select.rb +1 -1
  176. data/lib/trestle/form/fields/file_field.rb +3 -28
  177. data/lib/trestle/form/fields/form_control.rb +2 -2
  178. data/lib/trestle/form/fields/form_group.rb +1 -1
  179. data/lib/trestle/form/fields/grouped_collection_select.rb +1 -1
  180. data/lib/trestle/form/fields/radio_button_helpers.rb +5 -17
  181. data/lib/trestle/form/fields/range_field.rb +1 -5
  182. data/lib/trestle/form/fields/select.rb +17 -1
  183. data/lib/trestle/form/fields/time_field.rb +4 -0
  184. data/lib/trestle/form/fields/time_select.rb +1 -1
  185. data/lib/trestle/form/fields/time_zone_select.rb +1 -1
  186. data/lib/trestle/form/renderer.rb +4 -1
  187. data/lib/trestle/form.rb +16 -1
  188. data/lib/trestle/resource/toolbar.rb +18 -8
  189. data/lib/trestle/sprockets_compressor.rb +16 -0
  190. data/lib/trestle/table/actions_column.rb +2 -2
  191. data/lib/trestle/table/row.rb +2 -1
  192. data/lib/trestle/table/select_column.rb +3 -6
  193. data/lib/trestle/table.rb +6 -1
  194. data/lib/trestle/toolbar/context.rb +7 -4
  195. data/lib/trestle/toolbar/item.rb +1 -1
  196. data/lib/trestle/toolbar/menu.rb +11 -11
  197. data/lib/trestle/version.rb +1 -1
  198. data/lib/trestle.rb +2 -23
  199. data/package.json +31 -27
  200. data/trestle.gemspec +6 -11
  201. data/webpack.config.js +10 -10
  202. data/yarn.lock +1523 -1274
  203. metadata +177 -210
  204. data/app/assets/bundle/trestle/bundle.css +0 -12
  205. data/app/assets/bundle/trestle/bundle.js +0 -89
  206. data/app/assets/bundle/trestle/fa-brands-400.eot +0 -0
  207. data/app/assets/bundle/trestle/fa-brands-400.svg +0 -3717
  208. data/app/assets/bundle/trestle/fa-brands-400.woff +0 -0
  209. data/app/assets/bundle/trestle/fa-regular-400.eot +0 -0
  210. data/app/assets/bundle/trestle/fa-regular-400.svg +0 -801
  211. data/app/assets/bundle/trestle/fa-regular-400.woff +0 -0
  212. data/app/assets/bundle/trestle/fa-solid-900.eot +0 -0
  213. data/app/assets/bundle/trestle/fa-solid-900.svg +0 -5034
  214. data/app/assets/bundle/trestle/fa-solid-900.woff +0 -0
  215. data/app/assets/javascripts/trestle/admin.js +0 -3
  216. data/app/assets/javascripts/trestle/i18n.js.erb +0 -8
  217. data/app/assets/stylesheets/trestle/admin.css +0 -2
  218. data/app/assets/stylesheets/trestle/icons/_font-awesome.css.erb +0 -40
  219. data/app/controllers/concerns/trestle/controller/dialog.rb +0 -16
  220. data/app/views/trestle/application/_dialog.html.erb +0 -34
  221. data/frontend/css/components/_color-vars.scss +0 -10
  222. data/frontend/css/components/_custom-forms.scss +0 -35
  223. data/frontend/css/components/_magnific-popup.scss +0 -36
  224. data/frontend/css/components/_turbolinks.scss +0 -3
  225. data/frontend/css/layout/_content.scss +0 -169
  226. data/frontend/js/components/confirmation.js +0 -32
  227. data/frontend/js/components/datepicker.js +0 -69
  228. data/frontend/js/components/dialog.js +0 -149
  229. data/frontend/js/components/file.js +0 -7
  230. data/frontend/js/components/form.js +0 -100
  231. data/frontend/js/components/gallery.js +0 -33
  232. data/frontend/js/components/pagination.js +0 -51
  233. data/frontend/js/components/select.js +0 -18
  234. data/frontend/js/components/sidebar.js +0 -75
  235. data/frontend/js/components/table.js +0 -61
  236. data/frontend/js/components/tabs.js +0 -59
  237. data/frontend/js/components/tooltips.js +0 -25
  238. data/frontend/js/core/contexts.js +0 -17
  239. data/frontend/js/core/turbolinks.js +0 -3
  240. data/frontend/js/core/visit.js +0 -16
  241. data/frontend/theme/trestle/_theme.scss +0 -4
  242. data/frontend/theme/trestle/_variables.scss +0 -4
  243. data/frontend/theme/trestle/theme/_defaults.scss +0 -152
  244. data/frontend/theme/trestle/theme/_functions.scss +0 -44
  245. data/frontend/theme/trestle/theme/_variables.scss +0 -15
  246. data/frontend/theme/trestle/theme/bootstrap/_alert.scss +0 -19
  247. data/frontend/theme/trestle/theme/bootstrap/_badge.scss +0 -25
  248. data/frontend/theme/trestle/theme/bootstrap/_buttons.scss +0 -93
  249. data/frontend/theme/trestle/theme/bootstrap/_color-vars.scss +0 -11
  250. data/frontend/theme/trestle/theme/bootstrap/_custom-forms.scss +0 -93
  251. data/frontend/theme/trestle/theme/bootstrap/_dropdown.scss +0 -6
  252. data/frontend/theme/trestle/theme/bootstrap/_forms.scss +0 -6
  253. data/frontend/theme/trestle/theme/bootstrap/_links.scss +0 -7
  254. data/frontend/theme/trestle/theme/bootstrap/_list-group.scss +0 -31
  255. data/frontend/theme/trestle/theme/bootstrap/_nav.scss +0 -6
  256. data/frontend/theme/trestle/theme/bootstrap/_pagination.scss +0 -18
  257. data/frontend/theme/trestle/theme/bootstrap/_progress.scss +0 -3
  258. data/frontend/theme/trestle/theme/bootstrap/_tables.scss +0 -41
  259. data/frontend/theme/trestle/theme/bootstrap/_utilities.scss +0 -3
  260. data/frontend/theme/trestle/theme/bootstrap/utilities/_background.scss +0 -17
  261. data/frontend/theme/trestle/theme/bootstrap/utilities/_borders.scss +0 -5
  262. data/frontend/theme/trestle/theme/bootstrap/utilities/_text.scss +0 -18
  263. data/frontend/theme/trestle/theme/trestle/_background.scss +0 -61
  264. data/frontend/theme/trestle/theme/trestle/_datepicker.scss +0 -58
  265. data/frontend/theme/trestle/theme/trestle/_headers.scss +0 -4
  266. data/frontend/theme/trestle/theme/trestle/_navbar.scss +0 -15
  267. data/frontend/theme/trestle/theme/trestle/_navigation.scss +0 -5
  268. data/frontend/theme/trestle/theme/trestle/_select2.scss +0 -22
  269. data/frontend/theme/trestle/theme/trestle/_tags.scss +0 -12
  270. data/frontend/theme/trestle/theme/trestle/_turbolinks.scss +0 -3
  271. data/frontend/theme/trestle/theme.scss +0 -29
  272. data/lib/generators/trestle/install/templates/_theme.scss +0 -13
  273. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ar-dz.js +0 -0
  274. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ar.js +0 -0
  275. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/at.js +0 -0
  276. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/az.js +0 -0
  277. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/be.js +0 -0
  278. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/bg.js +0 -0
  279. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/bn.js +0 -0
  280. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/bs.js +0 -0
  281. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/cat.js +0 -0
  282. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ckb.js +0 -0
  283. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/cs.js +0 -0
  284. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/cy.js +0 -0
  285. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/da.js +0 -0
  286. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/de.js +0 -0
  287. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/default.js +0 -0
  288. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/eo.js +0 -0
  289. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/es.js +0 -0
  290. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/et.js +0 -0
  291. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/fa.js +0 -0
  292. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/fi.js +0 -0
  293. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/fo.js +0 -0
  294. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/fr.js +0 -0
  295. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ga.js +0 -0
  296. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/gr.js +0 -0
  297. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/he.js +0 -0
  298. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/hi.js +0 -0
  299. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/hr.js +0 -0
  300. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/hu.js +0 -0
  301. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/hy.js +0 -0
  302. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/id.js +0 -0
  303. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/is.js +0 -0
  304. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/it.js +0 -0
  305. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ja.js +0 -0
  306. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ka.js +0 -0
  307. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/km.js +0 -0
  308. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ko.js +0 -0
  309. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/kz.js +0 -0
  310. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/lt.js +0 -0
  311. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/lv.js +0 -0
  312. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/mk.js +0 -0
  313. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/mn.js +0 -0
  314. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ms.js +0 -0
  315. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/my.js +0 -0
  316. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/nl.js +0 -0
  317. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/nn.js +0 -0
  318. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/no.js +0 -0
  319. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/pa.js +0 -0
  320. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/pl.js +0 -0
  321. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/pt.js +0 -0
  322. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ro.js +0 -0
  323. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ru.js +0 -0
  324. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/si.js +0 -0
  325. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/sk.js +0 -0
  326. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/sl.js +0 -0
  327. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/sq.js +0 -0
  328. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/sr-cyr.js +0 -0
  329. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/sr.js +0 -0
  330. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/sv.js +0 -0
  331. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/th.js +0 -0
  332. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/tr.js +0 -0
  333. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/uk.js +0 -0
  334. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/uz.js +0 -0
  335. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/uz_latn.js +0 -0
  336. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/vn.js +0 -0
  337. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/zh-tw.js +0 -0
  338. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/zh.js +0 -0
  339. /data/app/assets/{stylesheets → sprockets}/trestle/_custom.css +0 -0
@@ -14,6 +14,7 @@ module Trestle
14
14
  def new
15
15
  respond_to do |format|
16
16
  format.html
17
+ format.turbo_stream { render turbo_stream: turbo_stream.modal }
17
18
  format.json { render json: instance }
18
19
 
19
20
  yield format if block_given?
@@ -23,20 +24,20 @@ module Trestle
23
24
  def create
24
25
  if save_instance
25
26
  respond_to do |format|
26
- format.html do
27
- flash[:message] = flash_message("create.success", title: "Success!", message: "The %{lowercase_model_name} was successfully created.")
28
- redirect_to_return_location(:create, instance) { admin.instance_path(instance) }
29
- end
27
+ flash[:message] = flash_message("create.success", title: "Success!", message: "The %{lowercase_model_name} was successfully created.")
28
+
29
+ format.html { redirect_to_return_location(:create, instance) { admin.instance_path(instance) } }
30
+ format.turbo_stream { flash.discard } if modal_request?
30
31
  format.json { render json: instance, status: :created, location: admin.instance_path(instance) }
31
32
 
32
33
  yield format if block_given?
33
34
  end
34
35
  else
35
36
  respond_to do |format|
36
- format.html do
37
- flash.now[:error] = flash_message("create.failure", title: "Warning!", message: "Please correct the errors below.")
38
- render "new", status: :unprocessable_entity
39
- end
37
+ flash.now[:error] = flash_message("create.failure", title: "Warning!", message: "Please correct the errors below.")
38
+
39
+ format.html { render "new", status: :unprocessable_entity }
40
+ format.turbo_stream { render "create", status: :unprocessable_entity } if modal_request?
40
41
  format.json { render json: instance.errors, status: :unprocessable_entity }
41
42
 
42
43
  yield format if block_given?
@@ -55,6 +56,7 @@ module Trestle
55
56
  else
56
57
  respond_to do |format|
57
58
  format.html
59
+ format.turbo_stream { render turbo_stream: turbo_stream.modal } if modal_request?
58
60
  format.json { render json: instance }
59
61
 
60
62
  yield format if block_given?
@@ -73,6 +75,7 @@ module Trestle
73
75
  else
74
76
  respond_to do |format|
75
77
  format.html
78
+ format.turbo_stream { render turbo_stream: turbo_stream.modal } if modal_request?
76
79
  format.json { render json: instance }
77
80
 
78
81
  yield format if block_given?
@@ -83,20 +86,20 @@ module Trestle
83
86
  def update
84
87
  if update_instance
85
88
  respond_to do |format|
86
- format.html do
87
- flash[:message] = flash_message("update.success", title: "Success!", message: "The %{lowercase_model_name} was successfully updated.")
88
- redirect_to_return_location(:update, instance) { admin.instance_path(instance) }
89
- end
89
+ flash[:message] = flash_message("update.success", title: "Success!", message: "The %{lowercase_model_name} was successfully updated.")
90
+
91
+ format.html { redirect_to_return_location(:update, instance) { admin.instance_path(instance) } }
92
+ format.turbo_stream { flash.discard }
90
93
  format.json { render json: instance, status: :ok }
91
94
 
92
95
  yield format if block_given?
93
96
  end
94
97
  else
95
98
  respond_to do |format|
96
- format.html do
97
- flash.now[:error] = flash_message("update.failure", title: "Warning!", message: "Please correct the errors below.")
98
- render "show", status: :unprocessable_entity
99
- end
99
+ flash.now[:error] = flash_message("update.failure", title: "Warning!", message: "Please correct the errors below.")
100
+
101
+ format.html { render "show", status: :unprocessable_entity }
102
+ format.turbo_stream { render "update", status: :unprocessable_entity }
100
103
  format.json { render json: instance.errors, status: :unprocessable_entity }
101
104
 
102
105
  yield format if block_given?
@@ -105,26 +108,34 @@ module Trestle
105
108
  end
106
109
 
107
110
  def destroy
108
- success = delete_instance
111
+ deleting_referer = URI(request.referer).path == admin.instance_path(instance)
109
112
 
110
- respond_to do |format|
111
- format.html do
112
- if success
113
- flash[:message] = flash_message("destroy.success", title: "Success!", message: "The %{lowercase_model_name} was successfully deleted.")
114
- redirect_to_return_location(:destroy, instance) { admin.path(:index) }
115
- else
116
- flash[:error] = flash_message("destroy.failure", title: "Warning!", message: "Could not delete %{lowercase_model_name}.")
113
+ if delete_instance
114
+ respond_to do |format|
115
+ flash[:message] = flash_message("destroy.success", title: "Success!", message: "The %{lowercase_model_name} was successfully deleted.")
116
+
117
+ format.html { redirect_to_return_location(:destroy, instance, status: :see_other) { admin.path(:index) } }
118
+ format.turbo_stream { flash.discard } unless deleting_referer
119
+ format.json { head :no_content }
120
+
121
+ yield format if block_given?
122
+ end
123
+ else
124
+ respond_to do |format|
125
+ flash[:error] = flash_message("destroy.failure", title: "Warning!", message: "Could not delete %{lowercase_model_name}.")
117
126
 
127
+ format.html do
118
128
  if load_instance
119
129
  redirect_to_return_location(:update, instance) { admin.instance_path(instance) }
120
130
  else
121
- redirect_to_return_location(:destroy, instance) { admin.path(:index) }
131
+ redirect_to_return_location(:destroy, instance, status: :see_other) { admin.path(:index) }
122
132
  end
123
133
  end
124
- end
125
- format.json { head :no_content }
134
+ format.turbo_stream { flash.discard }
135
+ format.json { head :no_content }
126
136
 
127
- yield format if block_given?
137
+ yield format if block_given?
138
+ end
128
139
  end
129
140
  end
130
141
  end
@@ -3,20 +3,20 @@ module Trestle
3
3
  module Controller
4
4
  module Redirection
5
5
  protected
6
- def redirect_to_return_location(action, instance, default: nil, &block)
6
+ def redirect_to_return_location(action, instance, status: :found, default: nil, &block)
7
7
  fallback_location = block_given? ? block : default
8
8
 
9
- if admin.return_locations[action] && !dialog_request?
9
+ if admin.return_locations[action] && !modal_request?
10
10
  location = instance_exec(instance, &admin.return_locations[action])
11
11
 
12
12
  case location
13
13
  when :back
14
- redirect_back fallback_location: fallback_location, turbolinks: false
14
+ redirect_back fallback_location: fallback_location, status: status
15
15
  else
16
- redirect_to location, turbolinks: false
16
+ redirect_to location, status: status
17
17
  end
18
18
  else
19
- redirect_to fallback_location, turbolinks: false
19
+ redirect_to fallback_location, status: status
20
20
  end
21
21
  end
22
22
  end
@@ -3,10 +3,11 @@ class Trestle::ApplicationController < ActionController::Base
3
3
 
4
4
  include Trestle::Controller::Breadcrumbs
5
5
  include Trestle::Controller::Callbacks
6
- include Trestle::Controller::Dialog
7
6
  include Trestle::Controller::Helpers
8
7
  include Trestle::Controller::Layout
9
8
  include Trestle::Controller::Location
9
+ include Trestle::Controller::Modal
10
10
  include Trestle::Controller::Title
11
11
  include Trestle::Controller::Toolbars
12
+ include Trestle::Controller::TurboStream
12
13
  end
@@ -11,5 +11,15 @@ module Trestle
11
11
  def instance_has_errors?
12
12
  instance.errors.any? rescue false
13
13
  end
14
+
15
+ def turbo_stream_update_flash
16
+ <<-EOF
17
+ <turbo-stream action="update" target="flash">
18
+ <template>
19
+ #{render_to_string(partial: "trestle/flash/flash", formats: [:html])}
20
+ </template>
21
+ </turbo-stream>
22
+ EOF
23
+ end
14
24
  end
15
25
  end
@@ -1,13 +1,14 @@
1
1
  module Trestle
2
2
  module FormHelper
3
3
  IDENTITY_FIELD_ERROR_PROC = Proc.new { |html_tag, instance| html_tag }
4
+ DEFAULT_FORM_CONTROLLERS = %w(keyboard-submit form-loading form-error)
4
5
 
5
6
  def trestle_form_for(instance, options={}, &block)
6
7
  options[:builder] ||= Form::Builder
7
8
  options[:as] ||= admin.parameter_name
8
9
 
9
10
  options[:data] ||= {}
10
- options[:data].reverse_merge!(remote: true, type: :html, behavior: "trestle-form", turbolinks: false)
11
+ options[:data][:controller] = (DEFAULT_FORM_CONTROLLERS + Array(options[:data][:controller])).join(" ")
11
12
 
12
13
  form_for(instance, options) do |f|
13
14
  with_identity_field_error_proc do
@@ -41,7 +42,7 @@ module Trestle
41
42
  end
42
43
 
43
44
  def render_sidebar_as_tab?
44
- dialog_request? && content_for?(:sidebar)
45
+ modal_request? && content_for?(:sidebar)
45
46
  end
46
47
  end
47
48
  end
@@ -13,7 +13,8 @@ module Trestle
13
13
  when :currency
14
14
  number_to_currency(value)
15
15
  when :tags
16
- safe_join(Array(value).map { |tag| content_tag(:span, tag, class: "tag") })
16
+ tags = Array(value).map { |tag| content_tag(:span, tag, class: "tag tag-primary") }
17
+ content_tag(:div, safe_join(tags), class: "tag-list")
17
18
  else
18
19
  value
19
20
  end
@@ -1,13 +1,52 @@
1
1
  module Trestle
2
2
  module I18nHelper
3
- def i18n_javascript_translations
4
- Trestle.config.javascript_i18n_keys.map { |key|
5
- begin
6
- [key, t(key, raise: true)]
7
- rescue I18n::MissingTranslationData
8
- nil
3
+ FLATPICKR_LOCALE_CONVERSIONS = { ca: "cat", el: "gr", nb: "no", vi: "vn" }.stringify_keys
4
+
5
+ # Returns the I18n fallbacks for the given locale.
6
+ #
7
+ # This is used to determine which locale files to include.
8
+ #
9
+ # Examples
10
+ #
11
+ # i18n_fallbacks("pt-BR") => ["pt-BR", "pt"]
12
+ # i18n_fallbacks("ca") => ["ca", "es-ES", "es"] %>
13
+ #
14
+ # Returns an array of locale Strings.
15
+ def i18n_fallbacks(locale=I18n.locale)
16
+ if I18n.respond_to?(:fallbacks)
17
+ I18n.fallbacks[locale].map(&:to_s)
18
+ elsif locale.to_s.include?("-")
19
+ fallback = locale.to_s.split("-").first
20
+ [locale, fallback]
21
+ else
22
+ [locale]
23
+ end
24
+ end
25
+
26
+ # Returns a nested hash of I18n key/value pairs for passing to JS.
27
+ def i18n_javascript_translations(keys=Trestle.config.javascript_i18n_keys)
28
+ result = {}
29
+
30
+ keys.each do |key|
31
+ if translation = I18n.t(key, default: nil)
32
+ *parts, last = key.split(".")
33
+
34
+ # Create nesting from period-separated i18n key
35
+ target = parts.inject(result) { |hash, part|
36
+ hash[part] ||= {}
37
+ }
38
+
39
+ target[last] = translation
9
40
  end
10
- }.compact
41
+ end
42
+
43
+ result
44
+ end
45
+
46
+ # Returns the Flatpickr locale code corresponding to the given locale,
47
+ # as some of their codes are different to the Rails' counterparts.
48
+ def flatpickr_locale(locale)
49
+ FLATPICKR_LOCALE_CONVERSIONS.fetch(locale.to_s) { locale }
11
50
  end
12
51
  end
13
52
  end
@@ -0,0 +1,29 @@
1
+ module Trestle
2
+ module ModalHelper
3
+ def modal_options!(options)
4
+ modal_options.merge!(options)
5
+ end
6
+
7
+ def modal_options
8
+ @_modal_options ||= {}
9
+ end
10
+
11
+ def modal_wrapper_attributes
12
+ {
13
+ class: ["modal", "fade", modal_options[:wrapper_class]],
14
+ tabindex: "-1",
15
+ role: "dialog",
16
+ data: {
17
+ controller: ["modal", modal_options[:controller]].compact.join(" ")
18
+ }
19
+ }.deep_merge(modal_options.except(:class, :wrapper_class, :controller))
20
+ end
21
+
22
+ def modal_dialog_attributes
23
+ {
24
+ class: ["modal-dialog", modal_options[:class]],
25
+ role: "document"
26
+ }
27
+ end
28
+ end
29
+ end
@@ -7,7 +7,7 @@ module Trestle
7
7
  def tab(name, options={})
8
8
  tabs[name] = tab = Tab.new(name, options)
9
9
 
10
- content_tag(:div, id: tab.id(("modal" if dialog_request?)), class: ["tab-pane", ('active' if name == tabs.keys.first)], role: "tabpanel") do
10
+ content_tag(:div, id: tab.id(("modal" if modal_request?)), class: ["tab-pane", ('active' if name == tabs.keys.first)], role: "tabpanel") do
11
11
  if block_given?
12
12
  yield
13
13
  elsif options[:partial]
@@ -0,0 +1,29 @@
1
+ module Trestle
2
+ module Turbo
3
+ module FrameHelper
4
+ def index_turbo_frame(options={}, &block)
5
+ defaults = {
6
+ id: "index",
7
+ data: {
8
+ controller: "reloadable",
9
+ turbo_action: "advance"
10
+ }
11
+ }
12
+
13
+ content_tag("turbo-frame", defaults.merge(options), &block)
14
+ end
15
+
16
+ def resource_turbo_frame(instance, options={}, &block)
17
+ defaults = {
18
+ id: dom_id(instance),
19
+ target: ("_top" unless modal_request?),
20
+ data: {
21
+ controller: ("deprecated--init" if modal_request? || request.post? || turbo_frame_request?)
22
+ }
23
+ }
24
+
25
+ content_tag("turbo-frame", defaults.merge(options), &block)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,9 @@
1
+ module Trestle
2
+ module Turbo
3
+ module StreamHelper
4
+ def turbo_stream
5
+ Trestle::Turbo::TagBuilder.new(self)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,21 @@
1
+ module Trestle
2
+ module Turbo
3
+ class TagBuilder < ::Turbo::Streams::TagBuilder
4
+ def modal(template=nil)
5
+ turbo_stream_action_tag :modal, template: @view_context.render(template: template || @view_context.action_name, layout: "layouts/trestle/modal", prefixes: @view_context.controller._prefixes, formats: :html)
6
+ end
7
+
8
+ def close_modal(target)
9
+ turbo_stream_action_tag :closeModal, targets: target
10
+ end
11
+
12
+ def flash
13
+ turbo_stream_action_tag :flash, template: @view_context.render(partial: "trestle/flash/flash", formats: :html)
14
+ end
15
+
16
+ def reload
17
+ turbo_stream_action_tag :reload
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,6 +1,6 @@
1
1
  module Trestle
2
2
  module UrlHelper
3
- DIALOG_ACTIONS = [:new, :show, :edit]
3
+ MODAL_ACTIONS = [:new, :show, :edit]
4
4
 
5
5
  def admin_link_to(content, instance_or_url=nil, options={}, &block)
6
6
  # Block given - ignore content parameter and capture content from block
@@ -45,9 +45,12 @@ module Trestle
45
45
  end
46
46
 
47
47
  # Determine link data options
48
- if DIALOG_ACTIONS.include?(action) && admin.form.dialog?
49
- options[:data] ||= {}
50
- options[:data][:behavior] ||= "dialog"
48
+ options[:data] ||= {}
49
+
50
+ if MODAL_ACTIONS.include?(action) && admin.respond_to?(:form) && admin.form.modal?
51
+ options[:data][:controller] ||= "modal-trigger"
52
+ else
53
+ options[:data][:turbo_frame] ||= (modal_request? ? "modal" : "_top")
51
54
  end
52
55
 
53
56
  link_to(content, path, options)
@@ -5,10 +5,9 @@
5
5
  <meta content='width=device-width, initial-scale=1' name='viewport'>
6
6
  <meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible'>
7
7
 
8
- <% if Trestle.config.turbolinks %>
9
- <meta name='turbolinks-cache-control' content='no-cache'>
10
- <meta name="turbolinks-root" content="<%= Trestle.config.path %>">
11
- <% end %>
8
+ <meta name='turbo-cache-control' content='no-cache'>
9
+ <meta name="turbo-prefetch" content="false" />
10
+ <meta name="turbo-root" content="<%= Trestle.config.path %>">
12
11
 
13
12
  <%= csrf_meta_tags %>
14
13
 
@@ -16,43 +15,42 @@
16
15
 
17
16
  <%= favicon_link_tag Trestle.config.favicon if Trestle.config.favicon %>
18
17
 
19
- <%= stylesheet_link_tag "trestle/admin", 'data-turbolinks-track': 'reload' %>
20
- <%= stylesheet_link_tag "trestle/theme", 'data-turbolinks-track': 'reload' if Trestle.config.theme %>
21
- <%= stylesheet_link_tag "trestle/custom", 'data-turbolinks-track': 'reload' %>
18
+ <%= stylesheet_link_tag "trestle/admin", 'data-turbo-track': 'reload' %>
19
+ <%= stylesheet_link_tag "trestle/icons/font-awesome", 'data-turbo-track': 'reload' if defined?(Sprockets) %>
22
20
 
23
- <%= hook :stylesheets %>
21
+ <%= stylesheet_link_tag "trestle/custom", 'data-turbo-track': 'reload' %>
24
22
 
25
- <%= javascript_include_tag "turbolinks" if Trestle.config.turbolinks rescue nil %>
26
- <%= javascript_include_tag "trestle/admin", 'data-turbolinks-track': 'reload' %>
23
+ <%= hook :stylesheets %>
27
24
 
28
- <%= javascript_tag nonce: true do %>
29
- <% i18n_javascript_translations.each do |key, value| %>
30
- Trestle.i18n['<%= key %>'] = "<%= escape_javascript(value) %>";
31
- <% end %>
25
+ <%= javascript_include_tag "trestle/admin", 'data-turbo-track': 'reload' %>
26
+ <%= javascript_include_tag "trestle/custom", 'data-turbo-track': 'reload' %>
32
27
 
33
- Trestle.localize(<%= Trestle.i18n_fallbacks.map { |l| "'#{l}'" }.join(", ").html_safe %>);
34
- <% end %>
28
+ <%= render "trestle/i18n" unless I18n.locale == :en %>
35
29
 
36
30
  <%= hook :javascripts %>
37
31
 
32
+ <%= render "trestle/theme" %>
33
+
38
34
  <%= content_for(:head) %>
39
35
 
40
36
  <%= hook :head %>
41
37
  </head>
42
38
 
43
39
  <%= content_tag :body, body_attributes do %>
44
- <div class="app-wrapper">
40
+ <div id="app-wrapper" class="app-wrapper" data-controller="wrapper" data-action="click->wrapper#hideMobileSidebar touchstart->wrapper#hideMobileSidebar" data-wrapper-mobile-sidebar-outlet=".app-sidebar">
45
41
  <%= render "trestle/shared/sidebar" %>
46
42
 
47
43
  <div class="app-container">
48
44
  <%= render "trestle/shared/header" %>
49
45
 
50
- <main class="app-main" data-context="<%= request.fullpath %>">
46
+ <main class="app-main">
51
47
  <%= yield %>
52
48
  </main>
53
49
 
54
50
  <%= render "trestle/shared/footer" %>
55
51
  </div>
56
52
  </div>
53
+
54
+ <turbo-frame id="modal" data-controller="modal-frame"></turbo-frame>
57
55
  <% end %>
58
56
  </html>
@@ -0,0 +1,4 @@
1
+ <%= yield %>
2
+
3
+ <%= turbo_stream.flash unless modal_request? %>
4
+ <%= turbo_stream.reload %>
@@ -0,0 +1,5 @@
1
+ <%= content_tag(:div, modal_wrapper_attributes) do %>
2
+ <%= content_tag(:div, modal_dialog_attributes) do %>
3
+ <%= yield %>
4
+ <% end %>
5
+ <% end %>
@@ -0,0 +1,12 @@
1
+ <% i18n_fallbacks.each do |locale| %>
2
+ <%= javascript_include_tag "trestle/locale/#{locale}", 'data-turbo-track': 'reload' rescue nil %>
3
+ <%= javascript_include_tag "trestle/locale/flatpickr/#{flatpickr_locale(locale)}", 'data-turbo-track': 'reload' rescue nil %>
4
+ <% end %>
5
+
6
+ <%= javascript_tag nonce: true do %>
7
+ <% if Trestle.config.javascript_i18n_keys.any? %>
8
+ Trestle.i18n.store(<%=raw JSON.pretty_generate(I18n.locale => i18n_javascript_translations) %>);
9
+ <% end %>
10
+
11
+ Trestle.localize(<%= i18n_fallbacks.map { |l| "'#{l}'" }.join(", ").html_safe %>);
12
+ <% end %>
@@ -0,0 +1,15 @@
1
+ <% if Trestle.config.theme.any? %>
2
+ <style type="text/css">
3
+ :root {
4
+ <% Trestle.config.theme.each do |name, color| %>
5
+ --<%= name %>: <%= color.hex %>;
6
+ --<%= name %>-rgb: <%= color.rgb.join(", ") %>;
7
+
8
+ <% h, s, l = color.hsl %>
9
+ --<%= name %>-h: <%= h %>;
10
+ --<%= name %>-s: <%= s %>%;
11
+ --<%= name %>-l: <%= l %>%;
12
+ <% end %>
13
+ }
14
+ </style>
15
+ <% end %>
@@ -1,16 +1,6 @@
1
1
  <header class="content-header">
2
2
  <div class="content-header-title">
3
3
  <h1><%= title %></h1>
4
-
5
- <% unless local_assigns.fetch(:hide_breadcrumbs, false) %>
6
- <ol class="breadcrumb">
7
- <% breadcrumbs.each do |breadcrumb| %>
8
- <li class="breadcrumb-item<% if breadcrumb == breadcrumbs.last %> active<% end %>">
9
- <%= link_to breadcrumb.label, breadcrumb.path %>
10
- </li>
11
- <% end %>
12
- </ol>
13
- <% end %>
14
4
  </div>
15
5
 
16
6
  <div class="content-header-toolbars">
@@ -24,4 +14,16 @@
24
14
  <%= deprecated_toolbar(:secondary) %>
25
15
  </div>
26
16
  </div>
17
+
18
+ <% unless local_assigns.fetch(:hide_breadcrumbs, false) %>
19
+ <div class="content-header-breadcrumbs">
20
+ <ol class="breadcrumb">
21
+ <% breadcrumbs.each do |breadcrumb| %>
22
+ <li class="breadcrumb-item<% if breadcrumb == breadcrumbs.last %> active<% end %>">
23
+ <%= link_to breadcrumb.label, breadcrumb.path, data: { turbo_frame: "_top" } %>
24
+ </li>
25
+ <% end %>
26
+ </ol>
27
+ </div>
28
+ <% end %>
27
29
  </header>
@@ -1,9 +1,12 @@
1
1
  <%= render "header", hide_breadcrumbs: local_assigns.fetch(:hide_breadcrumbs, false) if local_assigns.fetch(:header, true) %>
2
2
 
3
- <div class="main-content-area">
4
- <%= render "trestle/flash/flash" %>
3
+ <div class="main-content-area" data-scroll-target>
4
+ <turbo-frame id="flash">
5
+ <%= render "trestle/flash/flash" %>
6
+ </turbo-frame>
7
+
5
8
  <%= render "utilities" %>
6
- <%= render "tabs" %>
9
+ <%= render "tabs", data: { controller: "tabs tab-errors" } %>
7
10
 
8
11
  <% if local_assigns.fetch(:wrapper, true) %>
9
12
  <%= container do |c| %>
@@ -0,0 +1,36 @@
1
+ <div class="modal-content">
2
+ <div class="modal-header">
3
+ <h4 class="modal-title"><%= title %></h4>
4
+ <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
5
+ </div>
6
+
7
+ <div class="modal-flash">
8
+ <%= render "trestle/flash/flash" %>
9
+ </div>
10
+
11
+ <div class="modal-tabs">
12
+ <%= render "tabs", data: { controller: "tab-errors" } %>
13
+ </div>
14
+
15
+ <div class="modal-body">
16
+ <%= yield %>
17
+
18
+ <% if content_for?(:sidebar) %>
19
+ <div id="tab-sidebar" class="tab-pane" role="tabpanel">
20
+ <%= content_for(:sidebar) %>
21
+ </div>
22
+ <% end %>
23
+ </div>
24
+
25
+ <div class="modal-footer">
26
+ <div class="btn-toolbar secondary-toolbar" role="toolbar">
27
+ <%= render_toolbar(toolbar(:secondary)) %>
28
+ <%= deprecated_toolbar(:secondary) %>
29
+ </div>
30
+
31
+ <div class="btn-toolbar primary-toolbar" role="toolbar">
32
+ <%= render_toolbar(toolbar(:primary)) %>
33
+ <%= deprecated_toolbar(:primary) %>
34
+ </div>
35
+ </div>
36
+ </div>
@@ -1,15 +1,15 @@
1
1
  <% if tabs.any? || render_sidebar_as_tab? -%>
2
- <ul class="nav nav-tabs">
2
+ <%= content_tag :ul, class: "nav nav-tabs", data: local_assigns.fetch(:data, {}) do %>
3
3
  <% tabs.each do |name, tab| %>
4
4
  <li class="nav-item">
5
- <%= link_to tab.label, "##{tab.id(("modal" if dialog_request?))}", class: ["nav-link", ("active" if name == tabs.keys.first)], role: "tab", data: { toggle: "tab" } %>
5
+ <%= link_to tab.label, "##{tab.id(("modal" if modal_request?))}", class: ["nav-link", ("active" if name == tabs.keys.first)], role: "tab", data: { bs_toggle: "tab" } %>
6
6
  </li>
7
7
  <% end %>
8
8
 
9
9
  <% if render_sidebar_as_tab? %>
10
10
  <li class="nav-item align-right">
11
- <%= link_to icon("fa fa-list-alt"), "#tab-sidebar", class: "nav-link", role: "tab", data: { toggle: "tab" } %>
11
+ <%= link_to icon("fa fa-list-alt"), "#tab-sidebar", class: "nav-link", role: "tab", data: { bs_toggle: "tab" } %>
12
12
  </li>
13
13
  <% end %>
14
- </ul>
14
+ <% end %>
15
15
  <% end %>
@@ -1,5 +1,5 @@
1
1
  <div class="alert alert-dismissable <%= html_class %>" role="alert">
2
- <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
2
+ <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
3
3
 
4
4
  <%= icon %>
5
5
 
@@ -1,7 +1,7 @@
1
1
  <% errors = local_assigns.fetch(:errors, {}) %>
2
2
 
3
3
  <% if errors.any? %>
4
- <%= link_to "Debug errors", "#debug-errors", class: "toggle-debug-errors small", data: { toggle: "collapse" } %>
4
+ <%= link_to "Debug errors", "#debug-errors", class: "toggle-debug-errors small", data: { bs_toggle: "collapse" } %>
5
5
 
6
6
  <div id="debug-errors" class="debug-errors collapse">
7
7
  <ul>