trestle 0.9.9 → 0.10.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (328) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rspec.yml +31 -3
  3. data/.gitignore +3 -0
  4. data/Gemfile +5 -1
  5. data/README.md +2 -1
  6. data/app/assets/bundle/trestle/admin.css +23 -0
  7. data/app/assets/bundle/trestle/admin.js +83 -0
  8. data/app/assets/bundle/trestle/fa-brands-400.ttf +0 -0
  9. data/app/assets/bundle/trestle/fa-brands-400.woff2 +0 -0
  10. data/app/assets/bundle/trestle/fa-regular-400.ttf +0 -0
  11. data/app/assets/bundle/trestle/fa-regular-400.woff2 +0 -0
  12. data/app/assets/bundle/trestle/fa-solid-900.ttf +0 -0
  13. data/app/assets/bundle/trestle/fa-solid-900.woff2 +0 -0
  14. data/app/assets/bundle/trestle/locale/cs.js +110 -0
  15. data/app/assets/bundle/trestle/locale/de.js +116 -0
  16. data/app/assets/bundle/trestle/locale/en.js +329 -0
  17. data/app/assets/bundle/trestle/locale/es-MX.js +109 -0
  18. data/app/assets/bundle/trestle/locale/es.js +109 -0
  19. data/app/assets/bundle/trestle/locale/fr.js +111 -0
  20. data/app/assets/bundle/trestle/locale/ko.js +111 -0
  21. data/app/assets/bundle/trestle/locale/lv.js +109 -0
  22. data/app/assets/bundle/trestle/locale/nl.js +96 -0
  23. data/app/assets/bundle/trestle/locale/pl.js +99 -0
  24. data/app/assets/bundle/trestle/locale/pt-BR.js +98 -0
  25. data/app/assets/bundle/trestle/locale/vi.js +116 -0
  26. data/app/assets/bundle/trestle/locale/zh-CN.js +109 -0
  27. data/app/assets/bundle/trestle/photoswipe-7aa1aec9c3c1fd65c382.digested.js +6 -0
  28. data/app/assets/sprockets/trestle/custom.css +1 -0
  29. data/app/assets/sprockets/trestle/icons/font-awesome.css.erb +32 -0
  30. data/app/assets/sprockets/trestle/manifest.js +4 -0
  31. data/app/assets/stylesheets/trestle/custom.css +6 -1
  32. data/app/controllers/concerns/trestle/controller/helpers.rb +2 -0
  33. data/app/controllers/concerns/trestle/controller/location.rb +1 -6
  34. data/app/controllers/concerns/trestle/controller/modal.rb +23 -0
  35. data/app/controllers/concerns/trestle/controller/turbo.rb +21 -0
  36. data/app/controllers/concerns/trestle/resource/controller/actions.rb +39 -28
  37. data/app/controllers/concerns/trestle/resource/controller/redirection.rb +5 -5
  38. data/app/controllers/trestle/application_controller.rb +2 -1
  39. data/app/helpers/trestle/flash_helper.rb +10 -0
  40. data/app/helpers/trestle/form_helper.rb +3 -2
  41. data/app/helpers/trestle/format_helper.rb +2 -1
  42. data/app/helpers/trestle/i18n_helper.rb +46 -7
  43. data/app/helpers/trestle/modal_helper.rb +34 -0
  44. data/app/helpers/trestle/tab_helper.rb +1 -1
  45. data/app/helpers/trestle/turbo_frame_helper.rb +34 -0
  46. data/app/helpers/trestle/url_helper.rb +7 -4
  47. data/app/views/layouts/trestle/admin.html.erb +16 -18
  48. data/app/views/layouts/trestle/admin.turbo_stream.erb +11 -0
  49. data/app/views/layouts/trestle/modal.html.erb +5 -0
  50. data/app/views/trestle/_i18n.html.erb +12 -0
  51. data/app/views/trestle/_theme.html.erb +15 -0
  52. data/app/views/trestle/application/_header.html.erb +1 -1
  53. data/app/views/trestle/application/_layout.html.erb +6 -3
  54. data/app/views/trestle/application/_modal.html.erb +36 -0
  55. data/app/views/trestle/application/_tabs.html.erb +4 -4
  56. data/app/views/trestle/flash/_alert.html.erb +1 -1
  57. data/app/views/trestle/flash/_debug.html.erb +1 -1
  58. data/app/views/trestle/resource/_form.html.erb +5 -0
  59. data/app/views/trestle/resource/create.turbo_stream.erb +5 -0
  60. data/app/views/trestle/resource/destroy.turbo_stream.erb +1 -0
  61. data/app/views/trestle/resource/edit.html.erb +4 -2
  62. data/app/views/trestle/resource/index.html.erb +12 -10
  63. data/app/views/trestle/resource/new.html.erb +4 -2
  64. data/app/views/trestle/resource/show.html.erb +4 -2
  65. data/app/views/trestle/resource/update.turbo_stream.erb +5 -0
  66. data/app/views/trestle/shared/_sidebar.html.erb +9 -9
  67. data/frontend/css/components/_alerts.scss +19 -17
  68. data/frontend/css/components/_background.scss +7 -35
  69. data/frontend/css/components/_badges.scss +31 -0
  70. data/frontend/css/components/_breadcrumbs.scss +4 -4
  71. data/frontend/css/components/_buttons.scss +5 -4
  72. data/frontend/css/components/_datepicker.scss +12 -8
  73. data/frontend/css/components/_dropdown.scss +23 -3
  74. data/frontend/css/components/{_fields.scss → _forms.scss} +16 -3
  75. data/frontend/css/components/_media-grid.scss +52 -44
  76. data/frontend/css/components/_modal.scss +33 -4
  77. data/frontend/css/components/_pagination.scss +1 -1
  78. data/frontend/css/components/_photoswipe.scss +8 -0
  79. data/frontend/css/components/_popover.scss +1 -0
  80. data/frontend/css/components/_scopes.scss +1 -1
  81. data/frontend/css/components/_select.scss +161 -31
  82. data/frontend/css/components/_table.scss +60 -65
  83. data/frontend/css/components/_tabs.scss +10 -3
  84. data/frontend/css/components/_tags.scss +71 -16
  85. data/frontend/css/components/_toolbars.scss +16 -11
  86. data/frontend/css/components/_turbo.scss +3 -0
  87. data/frontend/css/core/_bootstrap.scss +46 -0
  88. data/frontend/css/core/_dependencies.scss +4 -3
  89. data/frontend/css/core/_functions.scss +39 -0
  90. data/frontend/css/core/_mixins.scss +2 -36
  91. data/frontend/css/core/_theme.scss +258 -0
  92. data/frontend/css/core/_typography.scss +10 -1
  93. data/frontend/css/icons/_fontawesome.scss +3 -15
  94. data/frontend/css/index.scss +12 -6
  95. data/frontend/css/layout/_base.scss +3 -3
  96. data/frontend/css/layout/_content.scss +10 -6
  97. data/frontend/css/layout/_footer.scss +1 -1
  98. data/frontend/css/layout/_header.scss +5 -3
  99. data/frontend/css/layout/_navigation.scss +2 -2
  100. data/frontend/css/layout/_sidebar.scss +19 -9
  101. data/frontend/css/support/_sprockets.scss +2 -0
  102. data/frontend/css/support/_webpack.scss +2 -0
  103. data/frontend/css/variables/_bootstrap.scss +134 -40
  104. data/frontend/css/variables/_maps.scss +15 -0
  105. data/frontend/css/variables/_trestle.scss +55 -26
  106. data/frontend/js/controllers/application_controller.js +17 -0
  107. data/frontend/js/controllers/checkbox_select_controller.js +43 -0
  108. data/frontend/js/controllers/confirm_controller.js +115 -0
  109. data/frontend/js/controllers/confirm_delete_controller.js +11 -0
  110. data/frontend/js/controllers/datepicker_controller.js +12 -0
  111. data/frontend/js/controllers/datetimepicker_controller.js +13 -0
  112. data/frontend/js/controllers/deprecated/init_controller.js +9 -0
  113. data/frontend/js/controllers/flatpickr_controller.js +50 -0
  114. data/frontend/js/controllers/follow_url_controller.js +36 -0
  115. data/frontend/js/controllers/form_error_controller.js +24 -0
  116. data/frontend/js/controllers/form_loading_controller.js +50 -0
  117. data/frontend/js/controllers/gallery_controller.js +10 -0
  118. data/frontend/js/controllers/index.js +19 -0
  119. data/frontend/js/controllers/keyboard_submit_controller.js +25 -0
  120. data/frontend/js/controllers/lightbox_controller.js +160 -0
  121. data/frontend/js/controllers/mobile_sidebar_controller.js +30 -0
  122. data/frontend/js/controllers/modal_controller.js +36 -0
  123. data/frontend/js/controllers/modal_frame_controller.js +11 -0
  124. data/frontend/js/controllers/modal_trigger_controller.js +74 -0
  125. data/frontend/js/{components/navigation.js → controllers/navigation_controller.js} +14 -10
  126. data/frontend/js/controllers/navigation_tooltip_controller.js +32 -0
  127. data/frontend/js/controllers/popover_controller.js +87 -0
  128. data/frontend/js/controllers/reloadable_controller.js +34 -0
  129. data/frontend/js/controllers/select_controller.js +49 -0
  130. data/frontend/js/controllers/sidebar_controller.js +33 -0
  131. data/frontend/js/controllers/tab_errors_controller.js +45 -0
  132. data/frontend/js/controllers/tabs_controller.js +45 -0
  133. data/frontend/js/controllers/timepicker_controller.js +14 -0
  134. data/frontend/js/controllers/toggle_attr_controller.js +27 -0
  135. data/frontend/js/controllers/toggle_class_controller.js +27 -0
  136. data/frontend/js/controllers/tooltip_controller.js +13 -0
  137. data/frontend/js/controllers/wrapper_controller.js +43 -0
  138. data/frontend/js/core/backdrop.js +100 -0
  139. data/frontend/js/core/error_modal.js +65 -0
  140. data/frontend/js/core/fetch.js +32 -0
  141. data/frontend/js/core/i18n.js +24 -10
  142. data/frontend/js/core/modal.js +52 -0
  143. data/frontend/js/core/stream_actions.js +56 -0
  144. data/frontend/js/core/turbo_errors.js +9 -0
  145. data/frontend/js/{core → deprecated}/events.js +1 -8
  146. data/frontend/js/deprecated/tooltip.js +8 -0
  147. data/frontend/js/index.js +28 -40
  148. data/frontend/js/mixins/index.js +5 -0
  149. data/frontend/js/mixins/photoswipe.js +10 -0
  150. data/frontend/js/util/bootstrap.js +93 -0
  151. data/i18n/config.yml +14 -0
  152. data/i18n/environment.rb +8 -0
  153. data/i18n/export +3 -0
  154. data/i18n/template.erb +1 -0
  155. data/lib/generators/trestle/install/install_generator.rb +3 -8
  156. data/lib/generators/trestle/install/templates/trestle.rb.erb +5 -5
  157. data/lib/trestle/color.rb +113 -0
  158. data/lib/trestle/configuration.rb +16 -8
  159. data/lib/trestle/engine.rb +23 -17
  160. data/lib/trestle/form/fields/check_box_helpers.rb +7 -18
  161. data/lib/trestle/form/fields/collection_select.rb +1 -1
  162. data/lib/trestle/form/fields/color_field.rb +4 -0
  163. data/lib/trestle/form/fields/date_field.rb +4 -0
  164. data/lib/trestle/form/fields/date_picker.rb +10 -4
  165. data/lib/trestle/form/fields/date_select.rb +1 -1
  166. data/lib/trestle/form/fields/datetime_field.rb +4 -0
  167. data/lib/trestle/form/fields/datetime_select.rb +1 -1
  168. data/lib/trestle/form/fields/file_field.rb +3 -28
  169. data/lib/trestle/form/fields/form_control.rb +2 -2
  170. data/lib/trestle/form/fields/form_group.rb +1 -1
  171. data/lib/trestle/form/fields/grouped_collection_select.rb +1 -1
  172. data/lib/trestle/form/fields/radio_button_helpers.rb +5 -17
  173. data/lib/trestle/form/fields/range_field.rb +1 -5
  174. data/lib/trestle/form/fields/select.rb +17 -1
  175. data/lib/trestle/form/fields/time_field.rb +4 -0
  176. data/lib/trestle/form/fields/time_select.rb +1 -1
  177. data/lib/trestle/form/fields/time_zone_select.rb +1 -1
  178. data/lib/trestle/form/renderer.rb +3 -0
  179. data/lib/trestle/form.rb +16 -1
  180. data/lib/trestle/resource/toolbar.rb +2 -2
  181. data/lib/trestle/table/actions_column.rb +2 -2
  182. data/lib/trestle/table/row.rb +2 -1
  183. data/lib/trestle/table/select_column.rb +3 -6
  184. data/lib/trestle/table.rb +6 -1
  185. data/lib/trestle/toolbar/item.rb +1 -1
  186. data/lib/trestle/toolbar/menu.rb +3 -6
  187. data/lib/trestle/version.rb +1 -1
  188. data/lib/trestle.rb +2 -23
  189. data/package.json +31 -27
  190. data/trestle.gemspec +2 -3
  191. data/webpack.config.js +10 -10
  192. data/yarn.lock +1456 -1194
  193. metadata +166 -164
  194. data/app/assets/bundle/trestle/bundle.css +0 -12
  195. data/app/assets/bundle/trestle/bundle.js +0 -89
  196. data/app/assets/bundle/trestle/fa-brands-400.eot +0 -0
  197. data/app/assets/bundle/trestle/fa-brands-400.svg +0 -3717
  198. data/app/assets/bundle/trestle/fa-brands-400.woff +0 -0
  199. data/app/assets/bundle/trestle/fa-regular-400.eot +0 -0
  200. data/app/assets/bundle/trestle/fa-regular-400.svg +0 -801
  201. data/app/assets/bundle/trestle/fa-regular-400.woff +0 -0
  202. data/app/assets/bundle/trestle/fa-solid-900.eot +0 -0
  203. data/app/assets/bundle/trestle/fa-solid-900.svg +0 -5034
  204. data/app/assets/bundle/trestle/fa-solid-900.woff +0 -0
  205. data/app/assets/javascripts/trestle/admin.js +0 -3
  206. data/app/assets/javascripts/trestle/i18n.js.erb +0 -8
  207. data/app/assets/stylesheets/trestle/admin.css +0 -2
  208. data/app/assets/stylesheets/trestle/icons/_font-awesome.css.erb +0 -40
  209. data/app/controllers/concerns/trestle/controller/dialog.rb +0 -16
  210. data/app/views/trestle/application/_dialog.html.erb +0 -34
  211. data/frontend/css/components/_color-vars.scss +0 -10
  212. data/frontend/css/components/_custom-forms.scss +0 -35
  213. data/frontend/css/components/_magnific-popup.scss +0 -36
  214. data/frontend/css/components/_turbolinks.scss +0 -3
  215. data/frontend/js/components/confirmation.js +0 -32
  216. data/frontend/js/components/datepicker.js +0 -69
  217. data/frontend/js/components/dialog.js +0 -149
  218. data/frontend/js/components/file.js +0 -7
  219. data/frontend/js/components/form.js +0 -100
  220. data/frontend/js/components/gallery.js +0 -33
  221. data/frontend/js/components/pagination.js +0 -51
  222. data/frontend/js/components/select.js +0 -18
  223. data/frontend/js/components/sidebar.js +0 -75
  224. data/frontend/js/components/table.js +0 -61
  225. data/frontend/js/components/tabs.js +0 -59
  226. data/frontend/js/components/tooltips.js +0 -25
  227. data/frontend/js/core/contexts.js +0 -17
  228. data/frontend/js/core/turbolinks.js +0 -3
  229. data/frontend/js/core/visit.js +0 -16
  230. data/frontend/theme/trestle/_theme.scss +0 -4
  231. data/frontend/theme/trestle/_variables.scss +0 -4
  232. data/frontend/theme/trestle/theme/_defaults.scss +0 -152
  233. data/frontend/theme/trestle/theme/_functions.scss +0 -44
  234. data/frontend/theme/trestle/theme/_variables.scss +0 -15
  235. data/frontend/theme/trestle/theme/bootstrap/_alert.scss +0 -19
  236. data/frontend/theme/trestle/theme/bootstrap/_badge.scss +0 -25
  237. data/frontend/theme/trestle/theme/bootstrap/_buttons.scss +0 -93
  238. data/frontend/theme/trestle/theme/bootstrap/_color-vars.scss +0 -11
  239. data/frontend/theme/trestle/theme/bootstrap/_custom-forms.scss +0 -93
  240. data/frontend/theme/trestle/theme/bootstrap/_dropdown.scss +0 -6
  241. data/frontend/theme/trestle/theme/bootstrap/_forms.scss +0 -6
  242. data/frontend/theme/trestle/theme/bootstrap/_links.scss +0 -7
  243. data/frontend/theme/trestle/theme/bootstrap/_list-group.scss +0 -31
  244. data/frontend/theme/trestle/theme/bootstrap/_nav.scss +0 -6
  245. data/frontend/theme/trestle/theme/bootstrap/_pagination.scss +0 -18
  246. data/frontend/theme/trestle/theme/bootstrap/_progress.scss +0 -3
  247. data/frontend/theme/trestle/theme/bootstrap/_tables.scss +0 -41
  248. data/frontend/theme/trestle/theme/bootstrap/_utilities.scss +0 -3
  249. data/frontend/theme/trestle/theme/bootstrap/utilities/_background.scss +0 -17
  250. data/frontend/theme/trestle/theme/bootstrap/utilities/_borders.scss +0 -5
  251. data/frontend/theme/trestle/theme/bootstrap/utilities/_text.scss +0 -18
  252. data/frontend/theme/trestle/theme/trestle/_background.scss +0 -61
  253. data/frontend/theme/trestle/theme/trestle/_datepicker.scss +0 -58
  254. data/frontend/theme/trestle/theme/trestle/_headers.scss +0 -4
  255. data/frontend/theme/trestle/theme/trestle/_navbar.scss +0 -15
  256. data/frontend/theme/trestle/theme/trestle/_navigation.scss +0 -5
  257. data/frontend/theme/trestle/theme/trestle/_select2.scss +0 -22
  258. data/frontend/theme/trestle/theme/trestle/_tags.scss +0 -12
  259. data/frontend/theme/trestle/theme/trestle/_turbolinks.scss +0 -3
  260. data/frontend/theme/trestle/theme.scss +0 -29
  261. data/lib/generators/trestle/install/templates/_theme.scss +0 -13
  262. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ar-dz.js +0 -0
  263. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ar.js +0 -0
  264. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/at.js +0 -0
  265. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/az.js +0 -0
  266. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/be.js +0 -0
  267. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/bg.js +0 -0
  268. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/bn.js +0 -0
  269. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/bs.js +0 -0
  270. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/cat.js +0 -0
  271. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ckb.js +0 -0
  272. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/cs.js +0 -0
  273. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/cy.js +0 -0
  274. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/da.js +0 -0
  275. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/de.js +0 -0
  276. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/default.js +0 -0
  277. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/eo.js +0 -0
  278. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/es.js +0 -0
  279. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/et.js +0 -0
  280. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/fa.js +0 -0
  281. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/fi.js +0 -0
  282. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/fo.js +0 -0
  283. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/fr.js +0 -0
  284. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ga.js +0 -0
  285. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/gr.js +0 -0
  286. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/he.js +0 -0
  287. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/hi.js +0 -0
  288. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/hr.js +0 -0
  289. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/hu.js +0 -0
  290. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/hy.js +0 -0
  291. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/id.js +0 -0
  292. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/is.js +0 -0
  293. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/it.js +0 -0
  294. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ja.js +0 -0
  295. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ka.js +0 -0
  296. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/km.js +0 -0
  297. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ko.js +0 -0
  298. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/kz.js +0 -0
  299. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/lt.js +0 -0
  300. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/lv.js +0 -0
  301. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/mk.js +0 -0
  302. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/mn.js +0 -0
  303. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ms.js +0 -0
  304. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/my.js +0 -0
  305. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/nl.js +0 -0
  306. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/nn.js +0 -0
  307. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/no.js +0 -0
  308. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/pa.js +0 -0
  309. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/pl.js +0 -0
  310. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/pt.js +0 -0
  311. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ro.js +0 -0
  312. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ru.js +0 -0
  313. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/si.js +0 -0
  314. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/sk.js +0 -0
  315. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/sl.js +0 -0
  316. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/sq.js +0 -0
  317. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/sr-cyr.js +0 -0
  318. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/sr.js +0 -0
  319. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/sv.js +0 -0
  320. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/th.js +0 -0
  321. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/tr.js +0 -0
  322. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/uk.js +0 -0
  323. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/uz.js +0 -0
  324. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/uz_latn.js +0 -0
  325. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/vn.js +0 -0
  326. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/zh-tw.js +0 -0
  327. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/zh.js +0 -0
  328. /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::Turbo
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,34 @@
1
+ module Trestle
2
+ module ModalHelper
3
+ def turbo_stream_modal(template: action_name)
4
+ template = render_to_string template: action_name, prefixes: _prefixes, formats: [:html], layout: "trestle/modal"
5
+ %(<turbo-stream action="modal"><template>#{template}</template></turbo-stream>).html_safe
6
+ end
7
+
8
+ def modal_options!(options)
9
+ modal_options.merge!(options)
10
+ end
11
+
12
+ def modal_options
13
+ @_modal_options ||= {}
14
+ end
15
+
16
+ def modal_wrapper_attributes
17
+ {
18
+ class: ["modal", "fade", modal_options[:wrapper_class]],
19
+ tabindex: "-1",
20
+ role: "dialog",
21
+ data: {
22
+ controller: ["modal", modal_options[:controller]].compact.join(" ")
23
+ }
24
+ }.deep_merge(modal_options.except(:class, :wrapper_class, :controller))
25
+ end
26
+
27
+ def modal_dialog_attributes
28
+ {
29
+ class: ["modal-dialog", modal_options[:class]],
30
+ role: "document"
31
+ }
32
+ end
33
+ end
34
+ 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,34 @@
1
+ module Trestle
2
+ module TurboFrameHelper
3
+ def index_turbo_frame(options={}, &block)
4
+ defaults = {
5
+ id: "index",
6
+ data: {
7
+ controller: "reloadable",
8
+ turbo_action: "advance"
9
+ }
10
+ }
11
+
12
+ content_tag("turbo-frame", defaults.merge(options), &block)
13
+ end
14
+
15
+ def resource_turbo_frame(instance, options={}, &block)
16
+ defaults = {
17
+ id: dom_id(instance),
18
+ target: ("_top" unless modal_request?),
19
+ data: {
20
+ controller: resource_turbo_frame_controllers.join(" ").presence
21
+ }
22
+ }
23
+
24
+ content_tag("turbo-frame", defaults.merge(options), &block)
25
+ end
26
+
27
+ def resource_turbo_frame_controllers
28
+ controllers = []
29
+ controllers << "modal-frame" if modal_request?
30
+ controllers << "deprecated--init" if modal_request? || request.post? || turbo_frame_request?
31
+ controllers
32
+ end
33
+ end
34
+ 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.form.modal?
51
+ options[:data][:controller] ||= "modal-trigger"
52
+ else
53
+ options[:data][:turbo_frame] = "_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"></turbo-frame>
57
55
  <% end %>
58
56
  </html>
@@ -0,0 +1,11 @@
1
+ <%= yield %>
2
+
3
+ <% unless modal_request? %>
4
+ <turbo-stream action="flash">
5
+ <template>
6
+ <%= render partial: "trestle/flash/flash", formats: [:html] %>
7
+ </template>
8
+ </turbo-stream>
9
+ <% end %>
10
+
11
+ <turbo-stream action="reload"></turbo-stream>
@@ -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 %>
@@ -6,7 +6,7 @@
6
6
  <ol class="breadcrumb">
7
7
  <% breadcrumbs.each do |breadcrumb| %>
8
8
  <li class="breadcrumb-item<% if breadcrumb == breadcrumbs.last %> active<% end %>">
9
- <%= link_to breadcrumb.label, breadcrumb.path %>
9
+ <%= link_to breadcrumb.label, breadcrumb.path, data: { turbo_frame: "_top" } %>
10
10
  </li>
11
11
  <% end %>
12
12
  </ol>
@@ -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>
@@ -1,4 +1,9 @@
1
1
  <% if admin.form -%>
2
+ <% if admin.form.modal? && modal_options = admin.form.options[:modal] %>
3
+ <% modal_options!(class: modal_options[:class]) %>
4
+ <% modal_options!(controller: modal_options[:controller]) %>
5
+ <% end %>
6
+
2
7
  <%= admin.form.render(self, instance) %>
3
8
  <% else %>
4
9
  <p><%= t("trestle.onboarding.no_form", default: "Please define a form block or create a <code>_form.html</code> partial.").html_safe %></p>
@@ -0,0 +1,5 @@
1
+ <turbo-stream action="replace" target="<%= dom_id(admin.build_instance({}, params)) %>">
2
+ <template>
3
+ <%= render template: instance.persisted? ? "trestle/resource/show" : "trestle/resource/new", formats: [:html] %>
4
+ </template>
5
+ </turbo-stream>
@@ -0,0 +1 @@
1
+ <turbo-stream action="closeModal" target="<%= dom_id(instance) %>"></turbo-stream>
@@ -11,6 +11,8 @@
11
11
  <%= t.delete %>
12
12
  <% end %>
13
13
 
14
- <%= trestle_form_for instance, url: admin.actions.include?(:update) ? admin.instance_path(instance, action: :update) : "#", method: :patch do |f| %>
15
- <%= render partial: "form", layout: dialog_request? ? "dialog" : "layout" %>
14
+ <%= resource_turbo_frame(instance) do %>
15
+ <%= trestle_form_for instance, url: admin.actions.include?(:update) ? admin.instance_path(instance, action: :update) : "#", method: :patch do |f| %>
16
+ <%= render partial: "form", layout: modal_request? ? "modal" : "layout" %>
17
+ <% end %>
16
18
  <% end %>