trestle 0.9.8 → 0.10.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (347) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rspec.yml +34 -4
  3. data/.gitignore +7 -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/toolbars.rb +1 -1
  36. data/app/controllers/concerns/trestle/controller/turbo.rb +21 -0
  37. data/app/controllers/concerns/trestle/resource/controller/actions.rb +40 -29
  38. data/app/controllers/concerns/trestle/resource/controller/redirection.rb +7 -5
  39. data/app/controllers/trestle/admin_controller.rb +4 -0
  40. data/app/controllers/trestle/application_controller.rb +2 -1
  41. data/app/helpers/trestle/card_helper.rb +2 -2
  42. data/app/helpers/trestle/flash_helper.rb +10 -0
  43. data/app/helpers/trestle/form_helper.rb +3 -2
  44. data/app/helpers/trestle/format_helper.rb +2 -1
  45. data/app/helpers/trestle/i18n_helper.rb +46 -7
  46. data/app/helpers/trestle/modal_helper.rb +34 -0
  47. data/app/helpers/trestle/navigation_helper.rb +3 -1
  48. data/app/helpers/trestle/tab_helper.rb +1 -1
  49. data/app/helpers/trestle/toolbars_helper.rb +1 -1
  50. data/app/helpers/trestle/turbo_frame_helper.rb +34 -0
  51. data/app/helpers/trestle/url_helper.rb +7 -4
  52. data/app/views/layouts/trestle/admin.html.erb +16 -18
  53. data/app/views/layouts/trestle/admin.turbo_stream.erb +11 -0
  54. data/app/views/layouts/trestle/modal.html.erb +5 -0
  55. data/app/views/trestle/_i18n.html.erb +12 -0
  56. data/app/views/trestle/_theme.html.erb +15 -0
  57. data/app/views/trestle/application/_header.html.erb +1 -1
  58. data/app/views/trestle/application/_layout.html.erb +6 -3
  59. data/app/views/trestle/application/_modal.html.erb +36 -0
  60. data/app/views/trestle/application/_tabs.html.erb +4 -4
  61. data/app/views/trestle/flash/_alert.html.erb +1 -1
  62. data/app/views/trestle/flash/_debug.html.erb +1 -1
  63. data/app/views/trestle/resource/_form.html.erb +5 -0
  64. data/app/views/trestle/resource/_scopes.html.erb +1 -1
  65. data/app/views/trestle/resource/create.turbo_stream.erb +5 -0
  66. data/app/views/trestle/resource/destroy.turbo_stream.erb +1 -0
  67. data/app/views/trestle/resource/edit.html.erb +4 -2
  68. data/app/views/trestle/resource/index.html.erb +12 -10
  69. data/app/views/trestle/resource/new.html.erb +4 -2
  70. data/app/views/trestle/resource/show.html.erb +4 -2
  71. data/app/views/trestle/resource/update.turbo_stream.erb +5 -0
  72. data/app/views/trestle/shared/_sidebar.html.erb +9 -9
  73. data/config/locales/vi.yml +1 -1
  74. data/frontend/css/components/_alerts.scss +19 -17
  75. data/frontend/css/components/_background.scss +7 -35
  76. data/frontend/css/components/_badges.scss +31 -0
  77. data/frontend/css/components/_breadcrumbs.scss +4 -4
  78. data/frontend/css/components/_buttons.scss +5 -4
  79. data/frontend/css/components/_datepicker.scss +12 -8
  80. data/frontend/css/components/_dropdown.scss +23 -3
  81. data/frontend/css/components/{_fields.scss → _forms.scss} +16 -3
  82. data/frontend/css/components/_media-grid.scss +52 -44
  83. data/frontend/css/components/_modal.scss +33 -4
  84. data/frontend/css/components/_pagination.scss +1 -1
  85. data/frontend/css/components/_photoswipe.scss +8 -0
  86. data/frontend/css/components/_popover.scss +1 -0
  87. data/frontend/css/components/_scopes.scss +1 -1
  88. data/frontend/css/components/_select.scss +161 -31
  89. data/frontend/css/components/_table.scss +60 -65
  90. data/frontend/css/components/_tabs.scss +10 -3
  91. data/frontend/css/components/_tags.scss +71 -16
  92. data/frontend/css/components/_toolbars.scss +18 -31
  93. data/frontend/css/components/_turbo.scss +3 -0
  94. data/frontend/css/core/_bootstrap.scss +46 -0
  95. data/frontend/css/core/_dependencies.scss +4 -3
  96. data/frontend/css/core/_functions.scss +39 -0
  97. data/frontend/css/core/_mixins.scss +3 -40
  98. data/frontend/css/core/_theme.scss +258 -0
  99. data/frontend/css/core/_typography.scss +10 -1
  100. data/frontend/css/icons/_fontawesome.scss +3 -15
  101. data/frontend/css/index.scss +12 -6
  102. data/frontend/css/layout/_base.scss +3 -3
  103. data/frontend/css/layout/_content.scss +11 -7
  104. data/frontend/css/layout/_footer.scss +1 -1
  105. data/frontend/css/layout/_header.scss +5 -3
  106. data/frontend/css/layout/_navigation.scss +2 -2
  107. data/frontend/css/layout/_sidebar.scss +19 -9
  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 +134 -40
  111. data/frontend/css/variables/_maps.scss +15 -0
  112. data/frontend/css/variables/_trestle.scss +55 -26
  113. data/frontend/js/controllers/application_controller.js +17 -0
  114. data/frontend/js/controllers/checkbox_select_controller.js +43 -0
  115. data/frontend/js/controllers/confirm_controller.js +115 -0
  116. data/frontend/js/controllers/confirm_delete_controller.js +11 -0
  117. data/frontend/js/controllers/datepicker_controller.js +12 -0
  118. data/frontend/js/controllers/datetimepicker_controller.js +13 -0
  119. data/frontend/js/controllers/deprecated/init_controller.js +9 -0
  120. data/frontend/js/controllers/flatpickr_controller.js +50 -0
  121. data/frontend/js/controllers/follow_url_controller.js +36 -0
  122. data/frontend/js/controllers/form_error_controller.js +24 -0
  123. data/frontend/js/controllers/form_loading_controller.js +50 -0
  124. data/frontend/js/controllers/gallery_controller.js +10 -0
  125. data/frontend/js/controllers/index.js +19 -0
  126. data/frontend/js/controllers/keyboard_submit_controller.js +25 -0
  127. data/frontend/js/controllers/lightbox_controller.js +160 -0
  128. data/frontend/js/controllers/mobile_sidebar_controller.js +30 -0
  129. data/frontend/js/controllers/modal_controller.js +36 -0
  130. data/frontend/js/controllers/modal_frame_controller.js +11 -0
  131. data/frontend/js/controllers/modal_trigger_controller.js +74 -0
  132. data/frontend/js/{components/navigation.js → controllers/navigation_controller.js} +14 -10
  133. data/frontend/js/controllers/navigation_tooltip_controller.js +32 -0
  134. data/frontend/js/controllers/popover_controller.js +87 -0
  135. data/frontend/js/controllers/reloadable_controller.js +34 -0
  136. data/frontend/js/controllers/select_controller.js +49 -0
  137. data/frontend/js/controllers/sidebar_controller.js +33 -0
  138. data/frontend/js/controllers/tab_errors_controller.js +45 -0
  139. data/frontend/js/controllers/tabs_controller.js +45 -0
  140. data/frontend/js/controllers/timepicker_controller.js +14 -0
  141. data/frontend/js/controllers/toggle_attr_controller.js +27 -0
  142. data/frontend/js/controllers/toggle_class_controller.js +27 -0
  143. data/frontend/js/controllers/tooltip_controller.js +13 -0
  144. data/frontend/js/controllers/wrapper_controller.js +43 -0
  145. data/frontend/js/core/backdrop.js +100 -0
  146. data/frontend/js/core/error_modal.js +65 -0
  147. data/frontend/js/core/fetch.js +32 -0
  148. data/frontend/js/core/i18n.js +24 -10
  149. data/frontend/js/core/modal.js +52 -0
  150. data/frontend/js/core/stream_actions.js +56 -0
  151. data/frontend/js/core/turbo_errors.js +9 -0
  152. data/frontend/js/{core → deprecated}/events.js +1 -8
  153. data/frontend/js/deprecated/tooltip.js +8 -0
  154. data/frontend/js/index.js +28 -40
  155. data/frontend/js/mixins/index.js +5 -0
  156. data/frontend/js/mixins/photoswipe.js +10 -0
  157. data/frontend/js/util/bootstrap.js +93 -0
  158. data/i18n/config.yml +14 -0
  159. data/i18n/environment.rb +8 -0
  160. data/i18n/export +3 -0
  161. data/i18n/template.erb +1 -0
  162. data/lib/generators/trestle/install/install_generator.rb +3 -8
  163. data/lib/generators/trestle/install/templates/trestle.rb.erb +5 -5
  164. data/lib/trestle/adapters/active_record_adapter.rb +1 -1
  165. data/lib/trestle/admin/builder.rb +7 -0
  166. data/lib/trestle/admin.rb +12 -6
  167. data/lib/trestle/color.rb +113 -0
  168. data/lib/trestle/configurable.rb +2 -2
  169. data/lib/trestle/configuration.rb +16 -8
  170. data/lib/trestle/engine.rb +23 -17
  171. data/lib/trestle/form/automatic.rb +3 -1
  172. data/lib/trestle/form/fields/check_box_helpers.rb +7 -18
  173. data/lib/trestle/form/fields/collection_select.rb +1 -1
  174. data/lib/trestle/form/fields/color_field.rb +4 -0
  175. data/lib/trestle/form/fields/date_field.rb +4 -0
  176. data/lib/trestle/form/fields/date_picker.rb +10 -4
  177. data/lib/trestle/form/fields/date_select.rb +1 -1
  178. data/lib/trestle/form/fields/datetime_field.rb +4 -0
  179. data/lib/trestle/form/fields/datetime_select.rb +1 -1
  180. data/lib/trestle/form/fields/file_field.rb +3 -28
  181. data/lib/trestle/form/fields/form_control.rb +2 -2
  182. data/lib/trestle/form/fields/form_group.rb +1 -1
  183. data/lib/trestle/form/fields/grouped_collection_select.rb +1 -1
  184. data/lib/trestle/form/fields/radio_button_helpers.rb +5 -17
  185. data/lib/trestle/form/fields/range_field.rb +1 -5
  186. data/lib/trestle/form/fields/select.rb +17 -1
  187. data/lib/trestle/form/fields/time_field.rb +4 -0
  188. data/lib/trestle/form/fields/time_select.rb +1 -1
  189. data/lib/trestle/form/fields/time_zone_select.rb +1 -1
  190. data/lib/trestle/form/renderer.rb +3 -0
  191. data/lib/trestle/form.rb +16 -1
  192. data/lib/trestle/hook/helpers.rb +1 -1
  193. data/lib/trestle/reloader.rb +2 -11
  194. data/lib/trestle/resource/builder.rb +1 -8
  195. data/lib/trestle/resource/toolbar.rb +2 -2
  196. data/lib/trestle/resource.rb +2 -2
  197. data/lib/trestle/scopes/block.rb +7 -7
  198. data/lib/trestle/scopes/definition.rb +2 -2
  199. data/lib/trestle/scopes/scope.rb +4 -0
  200. data/lib/trestle/table/actions_column.rb +2 -2
  201. data/lib/trestle/table/row.rb +2 -1
  202. data/lib/trestle/table/select_column.rb +3 -6
  203. data/lib/trestle/table.rb +6 -1
  204. data/lib/trestle/toolbar/item.rb +1 -1
  205. data/lib/trestle/toolbar/menu.rb +3 -6
  206. data/lib/trestle/version.rb +1 -1
  207. data/lib/trestle.rb +3 -20
  208. data/package.json +31 -27
  209. data/trestle.gemspec +9 -10
  210. data/webpack.config.js +18 -11
  211. data/yarn.lock +1934 -2819
  212. metadata +181 -179
  213. data/app/assets/bundle/trestle/bundle.css +0 -12
  214. data/app/assets/bundle/trestle/bundle.js +0 -103
  215. data/app/assets/bundle/trestle/fa-brands-400.eot +0 -0
  216. data/app/assets/bundle/trestle/fa-brands-400.svg +0 -3717
  217. data/app/assets/bundle/trestle/fa-brands-400.woff +0 -0
  218. data/app/assets/bundle/trestle/fa-regular-400.eot +0 -0
  219. data/app/assets/bundle/trestle/fa-regular-400.svg +0 -801
  220. data/app/assets/bundle/trestle/fa-regular-400.woff +0 -0
  221. data/app/assets/bundle/trestle/fa-solid-900.eot +0 -0
  222. data/app/assets/bundle/trestle/fa-solid-900.svg +0 -5034
  223. data/app/assets/bundle/trestle/fa-solid-900.woff +0 -0
  224. data/app/assets/javascripts/trestle/admin.js +0 -3
  225. data/app/assets/javascripts/trestle/i18n.js.erb +0 -8
  226. data/app/assets/stylesheets/trestle/admin.css +0 -2
  227. data/app/assets/stylesheets/trestle/icons/_font-awesome.css.erb +0 -40
  228. data/app/controllers/concerns/trestle/controller/dialog.rb +0 -16
  229. data/app/views/trestle/application/_dialog.html.erb +0 -34
  230. data/frontend/css/components/_color-vars.scss +0 -10
  231. data/frontend/css/components/_custom-forms.scss +0 -35
  232. data/frontend/css/components/_magnific-popup.scss +0 -36
  233. data/frontend/css/components/_turbolinks.scss +0 -3
  234. data/frontend/js/components/confirmation.js +0 -32
  235. data/frontend/js/components/datepicker.js +0 -69
  236. data/frontend/js/components/dialog.js +0 -149
  237. data/frontend/js/components/file.js +0 -7
  238. data/frontend/js/components/form.js +0 -100
  239. data/frontend/js/components/gallery.js +0 -33
  240. data/frontend/js/components/pagination.js +0 -51
  241. data/frontend/js/components/select.js +0 -18
  242. data/frontend/js/components/sidebar.js +0 -75
  243. data/frontend/js/components/table.js +0 -61
  244. data/frontend/js/components/tabs.js +0 -59
  245. data/frontend/js/components/tooltips.js +0 -25
  246. data/frontend/js/core/contexts.js +0 -17
  247. data/frontend/js/core/turbolinks.js +0 -3
  248. data/frontend/js/core/visit.js +0 -16
  249. data/frontend/theme/trestle/_theme.scss +0 -4
  250. data/frontend/theme/trestle/_variables.scss +0 -4
  251. data/frontend/theme/trestle/theme/_defaults.scss +0 -152
  252. data/frontend/theme/trestle/theme/_functions.scss +0 -44
  253. data/frontend/theme/trestle/theme/_variables.scss +0 -15
  254. data/frontend/theme/trestle/theme/bootstrap/_alert.scss +0 -19
  255. data/frontend/theme/trestle/theme/bootstrap/_badge.scss +0 -25
  256. data/frontend/theme/trestle/theme/bootstrap/_buttons.scss +0 -93
  257. data/frontend/theme/trestle/theme/bootstrap/_color-vars.scss +0 -11
  258. data/frontend/theme/trestle/theme/bootstrap/_custom-forms.scss +0 -93
  259. data/frontend/theme/trestle/theme/bootstrap/_dropdown.scss +0 -6
  260. data/frontend/theme/trestle/theme/bootstrap/_forms.scss +0 -6
  261. data/frontend/theme/trestle/theme/bootstrap/_links.scss +0 -7
  262. data/frontend/theme/trestle/theme/bootstrap/_list-group.scss +0 -31
  263. data/frontend/theme/trestle/theme/bootstrap/_nav.scss +0 -6
  264. data/frontend/theme/trestle/theme/bootstrap/_pagination.scss +0 -18
  265. data/frontend/theme/trestle/theme/bootstrap/_progress.scss +0 -3
  266. data/frontend/theme/trestle/theme/bootstrap/_tables.scss +0 -41
  267. data/frontend/theme/trestle/theme/bootstrap/_utilities.scss +0 -3
  268. data/frontend/theme/trestle/theme/bootstrap/utilities/_background.scss +0 -17
  269. data/frontend/theme/trestle/theme/bootstrap/utilities/_borders.scss +0 -5
  270. data/frontend/theme/trestle/theme/bootstrap/utilities/_text.scss +0 -18
  271. data/frontend/theme/trestle/theme/trestle/_background.scss +0 -61
  272. data/frontend/theme/trestle/theme/trestle/_datepicker.scss +0 -58
  273. data/frontend/theme/trestle/theme/trestle/_headers.scss +0 -4
  274. data/frontend/theme/trestle/theme/trestle/_navbar.scss +0 -15
  275. data/frontend/theme/trestle/theme/trestle/_navigation.scss +0 -5
  276. data/frontend/theme/trestle/theme/trestle/_select2.scss +0 -22
  277. data/frontend/theme/trestle/theme/trestle/_tags.scss +0 -12
  278. data/frontend/theme/trestle/theme/trestle/_turbolinks.scss +0 -3
  279. data/frontend/theme/trestle/theme.scss +0 -29
  280. data/lib/generators/trestle/install/templates/_theme.scss +0 -13
  281. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ar-dz.js +0 -0
  282. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ar.js +0 -0
  283. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/at.js +0 -0
  284. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/az.js +0 -0
  285. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/be.js +0 -0
  286. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/bg.js +0 -0
  287. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/bn.js +0 -0
  288. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/bs.js +0 -0
  289. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/cat.js +0 -0
  290. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ckb.js +0 -0
  291. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/cs.js +0 -0
  292. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/cy.js +0 -0
  293. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/da.js +0 -0
  294. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/de.js +0 -0
  295. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/default.js +0 -0
  296. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/eo.js +0 -0
  297. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/es.js +0 -0
  298. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/et.js +0 -0
  299. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/fa.js +0 -0
  300. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/fi.js +0 -0
  301. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/fo.js +0 -0
  302. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/fr.js +0 -0
  303. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ga.js +0 -0
  304. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/gr.js +0 -0
  305. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/he.js +0 -0
  306. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/hi.js +0 -0
  307. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/hr.js +0 -0
  308. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/hu.js +0 -0
  309. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/hy.js +0 -0
  310. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/id.js +0 -0
  311. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/is.js +0 -0
  312. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/it.js +0 -0
  313. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ja.js +0 -0
  314. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ka.js +0 -0
  315. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/km.js +0 -0
  316. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ko.js +0 -0
  317. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/kz.js +0 -0
  318. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/lt.js +0 -0
  319. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/lv.js +0 -0
  320. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/mk.js +0 -0
  321. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/mn.js +0 -0
  322. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ms.js +0 -0
  323. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/my.js +0 -0
  324. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/nl.js +0 -0
  325. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/nn.js +0 -0
  326. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/no.js +0 -0
  327. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/pa.js +0 -0
  328. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/pl.js +0 -0
  329. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/pt.js +0 -0
  330. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ro.js +0 -0
  331. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ru.js +0 -0
  332. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/si.js +0 -0
  333. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/sk.js +0 -0
  334. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/sl.js +0 -0
  335. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/sq.js +0 -0
  336. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/sr-cyr.js +0 -0
  337. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/sr.js +0 -0
  338. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/sv.js +0 -0
  339. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/th.js +0 -0
  340. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/tr.js +0 -0
  341. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/uk.js +0 -0
  342. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/uz.js +0 -0
  343. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/uz_latn.js +0 -0
  344. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/vn.js +0 -0
  345. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/zh-tw.js +0 -0
  346. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/zh.js +0 -0
  347. /data/app/assets/{stylesheets → sprockets}/trestle/_custom.css +0 -0
@@ -14,11 +14,11 @@ module Trestle
14
14
  end
15
15
 
16
16
  def delete
17
- link(t("buttons.delete", default: "Delete %{model_name}"), instance, action: :destroy, method: :delete, style: :danger, icon: "fa fa-trash", data: { toggle: "confirm-delete", placement: "bottom" }) if action?(:destroy)
17
+ link(t("buttons.delete", default: "Delete %{model_name}"), instance, action: :destroy, style: :danger, icon: "fa fa-trash", data: { turbo_method: "delete", controller: "confirm-delete", confirm_delete_placement_value: "bottom" }) if action?(:destroy)
18
18
  end
19
19
 
20
20
  def dismiss
21
- button(t("buttons.ok", default: "OK"), style: :light, data: { dismiss: "modal" }) if @template.dialog_request?
21
+ button(t("buttons.ok", default: "OK"), style: :light, data: { bs_dismiss: "modal" }) if @template.modal_request?
22
22
  end
23
23
  alias ok dismiss
24
24
 
@@ -88,8 +88,8 @@ module Trestle
88
88
  model_name.plural
89
89
  end
90
90
 
91
- def actions
92
- @actions ||= (readonly? ? READONLY_ACTIONS : RESOURCE_ACTIONS).dup
91
+ def default_actions
92
+ readonly? ? READONLY_ACTIONS : RESOURCE_ACTIONS
93
93
  end
94
94
 
95
95
  def root_action
@@ -1,16 +1,16 @@
1
1
  module Trestle
2
2
  class Scopes
3
3
  class Block
4
- attr_reader :block
4
+ attr_reader :block, :options
5
5
 
6
- def initialize(&block)
7
- @block = block
6
+ def initialize(options={}, &block)
7
+ @options, @block = options, block
8
8
  end
9
9
 
10
10
  # Evaluates the scope block within the given admin context
11
11
  # and returns an array of the scopes that were defined.
12
12
  def scopes(context)
13
- context = Evaluator.new(context)
13
+ context = Evaluator.new(context, options)
14
14
  context.instance_exec(context, &block)
15
15
  context.scopes
16
16
  end
@@ -20,8 +20,8 @@ module Trestle
20
20
 
21
21
  attr_reader :scopes
22
22
 
23
- def initialize(context=nil)
24
- @context = context
23
+ def initialize(context=nil, defaults={})
24
+ @context, @defaults = context, defaults
25
25
  @scopes = []
26
26
  end
27
27
 
@@ -31,7 +31,7 @@ module Trestle
31
31
  scope = nil
32
32
  end
33
33
 
34
- scopes << Scope.new(@context, name, options, &(scope || block))
34
+ scopes << Scope.new(@context, name, @defaults.merge(options), &(scope || block))
35
35
  end
36
36
  end
37
37
  end
@@ -8,8 +8,8 @@ module Trestle
8
8
  @options = {}
9
9
  end
10
10
 
11
- def append(&block)
12
- @blocks << Block.new(&block)
11
+ def append(options={}, &block)
12
+ @blocks << Block.new(options, &block)
13
13
  end
14
14
 
15
15
  # Evaluates each of the scope blocks within the given admin context
@@ -23,6 +23,10 @@ module Trestle
23
23
  @options[:default] == true
24
24
  end
25
25
 
26
+ def count?
27
+ @options[:count] != false
28
+ end
29
+
26
30
  def apply(collection)
27
31
  if @block
28
32
  if @block.arity == 1
@@ -42,7 +42,7 @@ module Trestle
42
42
  end
43
43
 
44
44
  def delete
45
- link(t("buttons.delete", default: "Delete"), instance, admin: admin, action: :destroy, method: :delete, icon: "fa fa-trash", style: :danger, data: { toggle: "confirm-delete", placement: "left" })
45
+ link(t("buttons.delete", default: "Delete"), instance, admin: admin, action: :destroy, icon: "fa fa-trash", style: :danger, data: { turbo_method: "delete", controller: "confirm-delete", confirm_delete_placement_value: "left" })
46
46
  end
47
47
 
48
48
  builder_method :show, :edit, :delete
@@ -67,7 +67,7 @@ module Trestle
67
67
  end
68
68
 
69
69
  def classes
70
- super + ["actions"]
70
+ super + ["table-actions"]
71
71
  end
72
72
 
73
73
  def content(instance)
@@ -33,8 +33,9 @@ module Trestle
33
33
  options = Trestle::Options.new
34
34
 
35
35
  if @table.admin && @table.autolink? && @table.admin.actions.include?(:show)
36
+ options.merge!(data: { controller: "follow-url", action: "click->follow-url#follow" })
36
37
  options.merge!(data: { url: admin_url_for(instance) })
37
- options.merge!(data: { behavior: "dialog" }) if @table.admin.form.dialog?
38
+ options.merge!(data: { modal: true }) if @table.admin.form.modal?
38
39
  end
39
40
 
40
41
  options.merge!(@row.options)
@@ -13,11 +13,11 @@ module Trestle
13
13
 
14
14
  class Renderer < Column::Renderer
15
15
  def header
16
- checkbox "", nil, id: checkbox_id("all")
16
+ checkbox "", nil, id: checkbox_id("all"), data: { checkbox_select_target: "selectAll", action: "change->checkbox-select#toggleAll" }
17
17
  end
18
18
 
19
19
  def content(instance)
20
- checkbox "selected[]", instance.to_param, id: checkbox_id(instance.to_param)
20
+ checkbox "selected[]", instance.to_param, id: checkbox_id(instance.to_param), data: { checkbox_select_target: "checkbox", action: "change->checkbox-select#toggle" }
21
21
  end
22
22
 
23
23
  def classes
@@ -34,10 +34,7 @@ module Trestle
34
34
  end
35
35
 
36
36
  def checkbox(name, value="1", options={})
37
- @template.content_tag(:div, class: "custom-control custom-checkbox") do
38
- @template.check_box_tag(name, value, false, options.merge(class: "custom-control-input")) +
39
- @template.tag(:label, for: options.fetch(:id), class: "custom-control-label")
40
- end
37
+ @template.check_box_tag(name, value, false, options.merge(class: "form-check-input"))
41
38
  end
42
39
  end
43
40
  end
data/lib/trestle/table.rb CHANGED
@@ -70,7 +70,12 @@ module Trestle
70
70
  end
71
71
 
72
72
  def data
73
- options[:data]
73
+ data = options[:data] || {}
74
+
75
+ controllers = Array(data[:controller])
76
+ controllers << "checkbox-select"
77
+
78
+ data.merge(controller: controllers.join(" "))
74
79
  end
75
80
  end
76
81
  end
@@ -97,7 +97,7 @@ module Trestle
97
97
 
98
98
  class Dropdown < Button
99
99
  def options
100
- super.merge(type: "button", data: { toggle: "dropdown" })
100
+ super.merge(type: "button", data: { bs_toggle: "dropdown" })
101
101
  end
102
102
 
103
103
  def label
@@ -18,16 +18,13 @@ module Trestle
18
18
  end
19
19
 
20
20
  def render_toggle(options={})
21
- content_tag(:button, type: "button", class: Array(options[:class]) + ["dropdown-toggle"], data: { toggle: "dropdown" }) do
22
- safe_join([
23
- content_tag(:span, "", class: "caret"),
24
- content_tag(:span, I18n.t("trestle.ui.toggle_dropdown", default: "Toggle dropdown"), class: "sr-only")
25
- ])
21
+ content_tag(:button, type: "button", class: Array(options[:class]) + ["dropdown-toggle dropdown-toggle-split"], data: { bs_toggle: "dropdown" }, aria: { expanded: false }) do
22
+ content_tag(:span, I18n.t("trestle.ui.toggle_dropdown", default: "Toggle dropdown"), class: "visually-hidden")
26
23
  end
27
24
  end
28
25
 
29
26
  def render_items
30
- content_tag(:ul, safe_join(items, "\n"), class: "dropdown-menu dropdown-menu-right", role: "menu")
27
+ content_tag(:ul, safe_join(items, "\n"), class: "dropdown-menu dropdown-menu-end", role: "menu")
31
28
  end
32
29
 
33
30
  class Builder
@@ -1,3 +1,3 @@
1
1
  module Trestle
2
- VERSION = "0.9.8"
2
+ VERSION = "0.10.0.pre"
3
3
  end
data/lib/trestle.rb CHANGED
@@ -6,6 +6,7 @@ require "kaminari"
6
6
  module Trestle
7
7
  require_relative "trestle/evaluation_context"
8
8
  require_relative "trestle/builder"
9
+ require_relative "trestle/color"
9
10
  require_relative "trestle/hook"
10
11
  require_relative "trestle/toolbar"
11
12
  require_relative "trestle/adapters"
@@ -64,26 +65,8 @@ module Trestle
64
65
  Navigation.build(blocks, context)
65
66
  end
66
67
 
67
- # Returns the I18n fallbacks for the given locale.
68
- #
69
- # This is used from within a Sprockets asset (JavaScript)
70
- # to determine which locale files to include.
71
- #
72
- # Examples
73
- #
74
- # Trestle.i18n_fallbacks("pt-BR") => ["pt-BR", "pt"]
75
- # Trestle.i18n_fallbacks("ca") => ["ca", "es-ES", "es"] %>
76
- #
77
- # Returns an array of locale Strings.
78
- def self.i18n_fallbacks(locale=I18n.locale)
79
- if I18n.respond_to?(:fallbacks)
80
- I18n.fallbacks[locale].map(&:to_s)
81
- elsif locale.to_s.include?("-")
82
- fallback = locale.to_s.split("-").first
83
- [locale, fallback]
84
- else
85
- [locale]
86
- end
68
+ def self.deprecator
69
+ @deprecator ||= ActiveSupport::Deprecation.new('1.0', 'Trestle')
87
70
  end
88
71
  end
89
72
 
data/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "trestle",
3
- "version": "0.9.7",
3
+ "version": "0.10.0.pre",
4
4
  "description": "A modern, responsive admin framework for Ruby on Rails",
5
5
  "homepage": "https://trestle.io",
6
6
  "repository": "https://github.com/TrestleAdmin/trestle.git",
7
7
  "author": "Sam Pohlenz <sam@sampohlenz.com>",
8
- "license": "LGPL-3.0",
8
+ "license": "LGPL-3.0-only",
9
9
  "private": true,
10
10
  "scripts": {
11
11
  "dev": "webpack --mode development",
@@ -13,33 +13,37 @@
13
13
  "watch": "webpack --mode development --watch"
14
14
  },
15
15
  "devDependencies": {
16
- "@babel/core": "^7.14.6",
17
- "@babel/preset-env": "^7.14.7",
18
- "autoprefixer": "^10.2.6",
19
- "babel-loader": "^8.0.6",
20
- "copy-webpack-plugin": "^9.0.1",
21
- "css-loader": "^5.2.6",
22
- "css-minimizer-webpack-plugin": "^3.0.2",
23
- "expose-loader": "^3.0.0",
24
- "mini-css-extract-plugin": "^2.0.0",
25
- "node-sass": "^7.0.1",
26
- "postcss": "^8.3.5",
27
- "postcss-loader": "^6.1.1",
28
- "sass-loader": "^12.1.0",
29
- "webpack": "^5.42.0",
30
- "webpack-cli": "^4.7.2"
16
+ "@babel/core": "^7.20.12",
17
+ "@babel/helper-explode-assignable-expression": "^7.18.6",
18
+ "@babel/preset-env": "^7.20.2",
19
+ "autoprefixer": "^10.4.13",
20
+ "babel-loader": "^9.1.2",
21
+ "copy-webpack-plugin": "^11.0.0",
22
+ "css-loader": "^6.7.3",
23
+ "css-minimizer-webpack-plugin": "^5.0.0",
24
+ "expose-loader": "^4.0.0",
25
+ "mini-css-extract-plugin": "^2.7.2",
26
+ "postcss": "^8.4.21",
27
+ "postcss-loader": "^7.0.2",
28
+ "sass": "^1.57.1",
29
+ "sass-loader": "^13.2.0",
30
+ "webpack": "^5.75.0",
31
+ "webpack-bundle-analyzer": "^4.7.0",
32
+ "webpack-cli": "^5.0.1"
31
33
  },
32
34
  "dependencies": {
33
- "@fortawesome/fontawesome-free": "^5.15.3",
34
- "@rails/ujs": "^6.1.3-1",
35
- "bootstrap": "^4.5.0",
36
- "bootstrap-confirmation2": "^4.2.1",
37
- "bs-custom-file-input": "^1.3.2",
38
- "flatpickr": "^4.6.2",
35
+ "@fortawesome/fontawesome-free": "^6.2.1",
36
+ "@hotwired/stimulus": "^3.2.2",
37
+ "@hotwired/stimulus-webpack-helpers": "^1.0.1",
38
+ "@hotwired/turbo": "^8.0.2",
39
+ "@popperjs/core": "^2.11.8",
40
+ "bootstrap": "~5.3.1",
41
+ "flatpickr": "^4.6.13",
42
+ "get-video-id": "^4.1.7",
43
+ "i18n-js": "^4.4.3",
39
44
  "jquery": "^3.6.0",
40
- "magnific-popup": "^1.1.0",
41
- "popper.js": "^1.15.0",
42
- "select2": "^4.0.10",
43
- "select2-theme-bootstrap4": "^1.0.0"
45
+ "photoswipe": "^5.4.4",
46
+ "select2": "^4.0.13",
47
+ "select2-bootstrap-5-theme": "~1.3.0"
44
48
  }
45
49
  }
data/trestle.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.summary = "A modern, responsive admin framework for Ruby on Rails"
13
13
  spec.description = "Trestle is a modern, responsive admin framework for Ruby on Rails."
14
14
  spec.homepage = "https://www.trestle.io"
15
- spec.license = "LGPL-3.0"
15
+ spec.license = "LGPL-3.0-only"
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(bin|coverage|gemfiles|node_modules|spec|sandbox)/}) }
18
18
 
@@ -20,18 +20,17 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.required_ruby_version = ">= 2.2.2"
22
22
 
23
- spec.add_dependency "railties", ">= 4.2.0"
24
- spec.add_dependency "activemodel", ">= 4.2.0"
25
- spec.add_dependency "sprockets-rails", ">= 2.0.0"
23
+ spec.add_dependency "railties", ">= 5.2.0"
24
+ spec.add_dependency "activemodel", ">= 5.2.0"
26
25
  spec.add_dependency "kaminari", ">= 1.1.0"
27
26
 
28
- spec.add_development_dependency "rspec-rails", "~> 3.5"
29
- spec.add_development_dependency "rspec-html-matchers", "~> 0.9.2"
30
- spec.add_development_dependency "database_cleaner", "~> 1.8.3"
31
- spec.add_development_dependency "ammeter", "~> 1.1.4"
27
+ spec.add_development_dependency "rspec-rails", ">= 5.1.2"
28
+ spec.add_development_dependency "rspec-html-matchers", "~> 0.10.0"
29
+ spec.add_development_dependency "database_cleaner", "~> 2.0.2"
30
+ spec.add_development_dependency "ammeter", "~> 1.1.5"
31
+ spec.add_development_dependency "i18n-js", "~> 4.2.3"
32
32
 
33
33
  spec.add_development_dependency "bundler"
34
34
  spec.add_development_dependency "rake"
35
- spec.add_development_dependency "sqlite3", "~> 1.3.6"
36
- spec.add_development_dependency "turbolinks"
35
+ spec.add_development_dependency "sqlite3"
37
36
  end
data/webpack.config.js CHANGED
@@ -4,6 +4,7 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
4
4
  const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
5
5
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
6
6
  const TerserPlugin = require('terser-webpack-plugin');
7
+ // const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
7
8
 
8
9
  module.exports = {
9
10
  mode: 'production',
@@ -11,8 +12,10 @@ module.exports = {
11
12
  output: {
12
13
  library: 'Trestle',
13
14
  libraryExport: 'Trestle',
14
- filename: 'bundle.js',
15
- path: path.resolve(__dirname, 'app/assets/bundle/trestle')
15
+ filename: 'admin.js',
16
+ path: path.resolve(__dirname, 'app/assets/bundle/trestle'),
17
+ chunkFilename: '[name]-[contenthash].digested.js',
18
+ assetModuleFilename: '[name][ext]'
16
19
  },
17
20
  optimization: {
18
21
  minimizer: [
@@ -32,7 +35,7 @@ module.exports = {
32
35
  ]
33
36
  },
34
37
  {
35
- test: /\.(ttf|eot|svg|woff2?)(\?[\s\S]+)?$/,
38
+ test: /\.(ttf|woff2?)(\?[\s\S]+)?$/,
36
39
  type: 'asset/resource'
37
40
  },
38
41
  {
@@ -54,7 +57,14 @@ module.exports = {
54
57
  }
55
58
  }
56
59
  },
57
- { loader: 'sass-loader' }
60
+ {
61
+ loader: 'sass-loader',
62
+ options: {
63
+ sassOptions: {
64
+ quietDeps: true
65
+ }
66
+ }
67
+ }
58
68
  ]
59
69
  },
60
70
  {
@@ -71,13 +81,9 @@ module.exports = {
71
81
  plugins: [
72
82
  new CopyWebpackPlugin({
73
83
  patterns: [
74
- {
75
- from: 'node_modules/@fortawesome/fontawesome-free/webfonts/*',
76
- to: '[name][ext]'
77
- },
78
84
  {
79
85
  from: 'node_modules/flatpickr/dist/l10n/*.js',
80
- to: 'flatpickr/[name][ext]',
86
+ to: 'locale/flatpickr/[name][ext]',
81
87
  globOptions: {
82
88
  ignore: ['**/index.js']
83
89
  }
@@ -85,8 +91,9 @@ module.exports = {
85
91
  ]
86
92
  }),
87
93
  new MiniCssExtractPlugin({
88
- filename: 'bundle.css'
89
- })
94
+ filename: 'admin.css'
95
+ }),
96
+ // new BundleAnalyzerPlugin()
90
97
  ],
91
98
  resolve: {
92
99
  mainFields: ['main']