trestle 0.9.9 → 0.10.0.pre2

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 +2 -1
  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-7aa1aec9c3c1fd65c382.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 +23 -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 +70 -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 +68 -39
  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 +10 -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 +160 -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 +3 -0
  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 +1480 -1233
  203. metadata +175 -208
  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
@@ -1,17 +1,13 @@
1
1
  // Color system
2
2
 
3
- $theme-colors: (
4
- "primary": #4d6bb2,
5
- "success": #7dc67d,
6
- "info": #7ccde5,
7
- "warning": #f3bd71,
8
- "danger": #e17572,
9
- "light": #bbbbbb,
10
- "dark": #444444,
11
-
12
- // Backwards compatibility
13
- "default": #bbbbbb
14
- );
3
+ $primary: #4d6bb2;
4
+ $secondary: #6c757d;
5
+ $success: #7dc67d;
6
+ $info: #7ccde5;
7
+ $warning: #f3bd71;
8
+ $danger: #e17572;
9
+ $light: #bbbbbb;
10
+ $dark: #444444;
15
11
 
16
12
 
17
13
  // Body
@@ -20,78 +16,121 @@ $body-bg: #f3f3f3;
20
16
  $body-color: #333333;
21
17
 
22
18
 
23
- // Set a specific jump point for requesting color jumps
24
- $theme-color-interval: 5% !default;
25
-
26
- // Increase default color threshold for light vs dark
27
- $yiq-contrasted-threshold: 200;
19
+ // The contrast ratio to reach against white, to determine if color changes from "light" to "dark".
20
+ $min-contrast-ratio: 1.7;
28
21
 
29
22
  // Enable box shadows
30
23
  $enable-shadows: true;
31
24
 
32
25
  // Decrease default grid spacing
33
- $grid-gutter-width: 10px * 2;
26
+ $grid-gutter-width: 1.25rem;
27
+
28
+
29
+ // Characters which are escaped by the escape-svg function
30
+ $escaped-characters: (
31
+ ("<", "%3c"),
32
+ (">", "%3e"),
33
+ ("#", "%23"),
34
+ ("(", "%28"),
35
+ (")", "%29"),
36
+ ) !default;
37
+
38
+
39
+ // Components
40
+
41
+ $box-shadow: soft-shadow(1rem, 1.5em, rgba(black, 0.25));
42
+ $box-shadow-sm: soft-shadow(0.5rem, 0.75em, rgba(black, 0.075), $layers: 4);
34
43
 
35
44
 
36
45
  // Typography
37
46
 
47
+ $link-decoration: none;
48
+
38
49
  $headings-font-weight: 400;
39
50
  $headings-margin-bottom: 1rem;
40
51
 
41
- $h1-font-size: 2rem;
42
- $h2-font-size: 1.75rem;
43
- $h3-font-size: 1.5rem;
44
- $h4-font-size: 1.25rem;
45
- $h5-font-size: 1.1rem;
46
- $h6-font-size: 1rem;
52
+ $font-size-base: 0.875rem;
53
+
54
+ $h1-font-size: 1.75rem;
55
+ $h2-font-size: 1.5rem;
56
+ $h3-font-size: 1.25rem;
57
+ $h4-font-size: 1.125rem;
58
+ $h5-font-size: 0.95rem;
59
+ $h6-font-size: 0.875rem;
47
60
 
48
- $hr-margin-y: 1.5rem;
61
+ $hr-color: rgba(black, 0.375);
62
+ $hr-margin-y: 1.25rem;
49
63
 
50
64
 
51
65
  // Navs
52
66
 
67
+ $nav-pills-link-active-bg: var(--primary);
68
+
53
69
  $nav-tabs-border-radius: 0;
54
70
  $nav-tabs-border-width: 0;
55
71
 
56
- $nav-tabs-link-bg: #eeeeee;
57
- $nav-tabs-link-color: #555555;
72
+ // (non-Bootstrap variables)
73
+ $nav-tabs-link-bg: #eeeeee;
74
+ $nav-tabs-link-color: #555555;
75
+ $nav-tabs-link-hover-bg: #eaeaea;
76
+ $nav-tabs-link-hover-color: #505050;
77
+ $nav-tabs-link-transition: color .1s ease-in-out, background-color .1s ease-in-out;
58
78
 
59
- $nav-tabs-link-active-bg: white;
79
+ $nav-tabs-link-active-bg: white;
60
80
  $nav-tabs-link-active-color: $body-color;
61
81
 
62
82
 
63
83
  // Navbar
64
84
 
65
- $navbar-toggler-padding-x: 0.4rem;
66
- $navbar-dark-color: rgba(white, 0.75);
85
+ $navbar-light-color: rgba(white, 0.75);
86
+ $navbar-dark-color: rgba(white, 0.75);
87
+
88
+ $navbar-toggler-padding-x: 0.375rem;
89
+ $navbar-toggler-focus-width: 0.25rem;
67
90
 
68
91
 
69
92
  // Breadcrumbs
70
93
 
71
94
  $breadcrumb-padding-y: 0;
72
95
  $breadcrumb-padding-x: 0;
73
- $breadcrumb-bg: transparent;
74
96
  $breadcrumb-active-color: #777777;
75
97
  $breadcrumb-divider-color: #cccccc;
76
98
 
77
99
 
78
100
  // Tables
79
101
 
80
- $table-cell-padding: 6px 8px;
81
- $table-accent-bg: rgba(black, 0.02);
102
+ $table-cell-padding-x: 0.5rem;
103
+ $table-cell-padding-y: 0.375rem;
104
+
105
+ $table-bg: transparent;
106
+ $table-striped-bg: rgba(black, 0.02);
82
107
  $table-hover-bg: rgba(black, 0.04);
83
108
  $table-border-color: rgba(black, 0.13);
84
109
 
85
- $table-bg-level: -11;
86
- $table-border-level: -7;
87
-
88
110
 
89
111
  // Alerts
90
112
 
91
- $alert-padding-y: 1.5rem;
113
+ $alert-padding-y: 1.25rem;
92
114
  $alert-border-radius: 0.1rem;
93
115
 
94
116
 
117
+ // Progress bars
118
+
119
+ $progress-bar-bg: var(--primary);
120
+
121
+
122
+ // List group
123
+
124
+ $list-group-bg: white;
125
+ $list-group-active-bg: var(--primary);
126
+
127
+
128
+ // Close
129
+
130
+ $btn-close-color: white;
131
+ $btn-close-bg: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='#{$btn-close-color}'><path d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/></svg>");
132
+
133
+
95
134
  // Badges
96
135
 
97
136
  $badge-padding-y: 0.35em;
@@ -100,44 +139,60 @@ $badge-padding-x: 0.6em;
100
139
 
101
140
  // Buttons
102
141
 
103
- $btn-padding-x-sm: 0.65rem;
142
+ $btn-padding-x-sm: 0.625rem;
143
+ $btn-padding-y-sm: 0.25rem;
104
144
 
105
145
 
106
146
  // Forms
107
147
 
108
- $input-border-color: #cccccc;
148
+ $input-bg: white;
109
149
  $input-disabled-bg: #fafafa;
110
150
 
111
- $input-box-shadow: none;
151
+ $input-border-color: #cccccc;
112
152
 
113
153
  $input-placeholder-color: #999999;
114
154
 
115
155
  $input-group-addon-bg: #eeeeee;
116
156
 
117
- $form-feedback-invalid-color: darken(theme-color("danger"), 20%);
157
+ $form-feedback-invalid-color: shade-color($danger, 10%);
118
158
 
119
159
  $form-feedback-margin-top: 0.5rem;
120
160
  $form-feedback-font-size: 90%;
121
161
 
162
+ $form-label-font-weight: bold;
163
+
122
164
  $form-text-color: #666666;
123
165
 
124
- $custom-control-indicator-size: 1.15rem;
125
- $custom-control-indicator-border-width: 1px;
166
+ $form-check-input-width: 1.25em;
167
+ $form-check-padding-start: $form-check-input-width + 0.6em;
126
168
 
127
- $custom-control-gutter: 0.6rem;
169
+ $form-switch-width: 2.25em;
170
+ $form-switch-focus-color: #aaaaaa;
128
171
 
129
- $custom-switch-width: 2.25rem;
130
- $custom-switch-indicator-size: calc(#{em($custom-control-indicator-size)} - #{$custom-control-indicator-border-width * 4}) !default;
172
+ $form-select-padding-x-sm: 0.625rem;
173
+ $form-select-padding-x-lg: 0.75rem;
131
174
 
132
175
 
133
176
  // Dropdowns
134
177
 
178
+ $dropdown-bg: white;
135
179
  $dropdown-spacer: 0.5rem;
136
- $dropdown-box-shadow: 0 3px 6px rgba(black, 0.175);
180
+ $dropdown-box-shadow: $box-shadow-sm;
137
181
  $dropdown-arrow-width: 7px;
138
182
  $dropdown-arrow-outer-width: $dropdown-arrow-width + 1px;
139
183
  $dropdown-header-color: #111111;
140
- $dropdown-font-size: 0.9rem;
184
+ $dropdown-font-size: 0.8125rem;
185
+
186
+ $dropdown-link-active-bg: var(--primary);
187
+
188
+ $dropdown-dark-bg: #222222;
189
+ $dropdown-dark-divider-bg: rgba(white, 0.15);
190
+
191
+
192
+ // Pagination
193
+
194
+ $pagination-bg: white;
195
+ $pagination-disabled-bg: white;
141
196
 
142
197
 
143
198
  // Cards
@@ -146,20 +201,42 @@ $card-bg: rgba(white, 0.5);
146
201
  $card-border-radius: 0;
147
202
 
148
203
 
204
+ // Accordion
205
+
206
+ $accordion-bg: white;
207
+ $accordion-icon-active-color: #111111;
208
+
209
+
210
+ // Tooltips
211
+
212
+ $tooltip-color: white;
213
+
214
+
149
215
  // Popovers
150
216
 
151
- $popover-box-shadow: $dropdown-box-shadow;
152
- $popover-arrow-width: $dropdown-arrow-width;
153
- $popover-font-size: 0.9rem;
217
+ $popover-font-size: 0.75rem;
218
+ $popover-box-shadow: $dropdown-box-shadow;
219
+
220
+ $popover-header-bg: #f7f7f7;
221
+ $popover-header-border: #ebebeb;
222
+
223
+ $popover-header-padding-x: 0.625rem;
224
+ $popover-header-padding-y: 0.375rem;
225
+
226
+ $popover-body-padding-x: 0.625rem;
227
+ $popover-body-padding-y: 0.5rem;
228
+
229
+ $popover-arrow-width: $dropdown-arrow-width;
154
230
 
155
231
 
156
232
  // Modals
157
233
 
158
- $modal-inner-padding: 1.5rem;
234
+ $modal-inner-padding: 1.25rem;
159
235
 
160
- $modal-header-padding-x: 1.5rem;
161
- $modal-header-padding-y: 1.05rem;
236
+ $modal-header-padding-x: 1.25rem;
237
+ $modal-header-padding-y: 1rem;
162
238
 
239
+ $modal-content-bg: white;
163
240
  $modal-content-border-radius: 0;
164
241
  $modal-content-border-width: 0;
165
242
 
@@ -172,4 +249,30 @@ $modal-lg: 900px;
172
249
 
173
250
  // Select2 Bootstrap Theme
174
251
 
175
- $s2bs-btn-default-border: #cccccc;
252
+ $s2bs5-border-color: #ced4da;
253
+
254
+ $s2bs5-item-active-bg: tint-color($primary, 90%);
255
+
256
+ $s2b25-clear-width: 0.5rem;
257
+ $s2b25-clear-height: 0.5rem;
258
+ $s2b25-clear-height-sm: 0.5rem;
259
+ $s2b25-clear-height-lg: 1rem;
260
+
261
+ $s2bs5-clear-icon: str-replace($btn-close-bg, #{$btn-close-color}, #{shade-color($s2bs5-border-color, 50%)});
262
+ $s2bs5-clear-bg: transparent escape-svg($s2bs5-clear-icon) center / $s2b25-clear-height auto no-repeat;
263
+ $s2bs5-clear-hover-bg: $s2bs5-clear-bg;
264
+
265
+ $s2bs5-clear-bg-sm: transparent escape-svg($s2bs5-clear-icon) center / $s2b25-clear-height-sm auto no-repeat;
266
+ $s2bs5-clear-hover-bg-sm: $s2bs5-clear-bg-sm;
267
+
268
+ $s2bs5-clear-bg-lg: transparent escape-svg($s2bs5-clear-icon) center / $s2b25-clear-height-lg auto no-repeat;
269
+ $s2bs5-clear-hover-bg-lg: $s2bs5-clear-bg-lg;
270
+
271
+ $s2bs5-clear-tag-icon: $btn-close-bg;
272
+ $s2bs5-clear-tag-bg: transparent escape-svg($s2bs5-clear-tag-icon) center / $s2b25-clear-height-sm auto no-repeat;
273
+
274
+ $s2bs5-padding-x: 0.625rem;
275
+ $s2bs5-padding-y: 0.375rem;
276
+
277
+ $s2bs5-multi-item-padding-x: 0.375rem;
278
+ $s2bs5-multi-item-padding-y: 0;
@@ -0,0 +1,15 @@
1
+ // Update color maps
2
+
3
+ $custom-colors: (
4
+ // Backwards compatibility
5
+ "default": #bbbbbb
6
+ );
7
+
8
+ $theme-colors: map-merge($theme-colors, $custom-colors);
9
+
10
+
11
+ // Disable box shadows on form controls.
12
+ // This is done after importing the default Bootstrap variables as a null value would be overwritten.
13
+
14
+ $input-box-shadow: null;
15
+ $form-select-box-shadow: null;
@@ -1,7 +1,19 @@
1
1
  // Default theme
2
2
 
3
- $theme-bg: theme-color("primary");
4
- $error-bg: theme-color("danger");
3
+ $theme-bg: $primary;
4
+ $error-bg: $danger;
5
+
6
+ $theme-bg-variations: (
7
+ default: -20%,
8
+
9
+ dark: -35%,
10
+ darker: -50%,
11
+ darkest: -65%,
12
+
13
+ light: 0,
14
+ lighter: 15%,
15
+ lightest: 30%
16
+ );
5
17
 
6
18
 
7
19
  // Header
@@ -9,7 +21,7 @@ $error-bg: theme-color("danger");
9
21
  $header-bg: white;
10
22
  $header-color: #333333;
11
23
 
12
- $header-height: 50px;
24
+ $header-height: 3.125rem;
13
25
 
14
26
 
15
27
  // Footer
@@ -17,13 +29,15 @@ $header-height: 50px;
17
29
  $footer-bg: #f9f9f9;
18
30
  $footer-color: #888888;
19
31
 
32
+ $footer-padding: 0.375rem 1.25rem;
33
+
20
34
 
21
35
  // Sidebar
22
36
 
23
37
  $sidebar-bg: #222222;
24
38
  $sidebar-hover-bg: #1a1a1a;
25
39
  $sidebar-active-bg: #393939;
26
- $sidebar-active-border: 4px;
40
+ $sidebar-active-border: 0.25rem;
27
41
 
28
42
  $sidebar-link-color: #919191;
29
43
  $sidebar-group-color: #595959;
@@ -31,21 +45,23 @@ $sidebar-group-color: #595959;
31
45
  $sidebar-toggle-bg: rgba(black, 0.25);
32
46
  $sidebar-toggle-color: rgba(white, 0.5);
33
47
 
34
- $sidebar-mobile-toggle-bg: transparent;
35
- $sidebar-mobile-toggle-color: white;
36
- $sidebar-mobile-toggle-border: 1px solid rgba($sidebar-mobile-toggle-color, 0.15);
37
-
38
- $sidebar-mobile-toggle-active-bg: rgba($sidebar-mobile-toggle-color, 0.1);
39
- $sidebar-mobile-toggle-active-border: $sidebar-mobile-toggle-border;
40
-
48
+ $sidebar-mobile-toggle-color: white;
41
49
  $sidebar-mobile-toggle-icon-bg: str-replace(url("data:image/svg+xml,%3csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3e%3cpath stroke='#{$sidebar-mobile-toggle-color}' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e"), "#", "%23");
42
50
 
43
- $sidebar-width: 250px;
44
- $sidebar-width-collapsed: 54px;
51
+ $sidebar-mobile-toggle-bg: transparent;
52
+ $sidebar-mobile-toggle-border-width: 1px;
53
+ $sidebar-mobile-toggle-border-color: rgba($sidebar-mobile-toggle-color, 0.15);
54
+ $sidebar-mobile-toggle-border: $sidebar-mobile-toggle-border-width solid $sidebar-mobile-toggle-border-color;
55
+
56
+ $sidebar-mobile-toggle-active-bg: rgba($sidebar-mobile-toggle-color, 0.1);
57
+ $sidebar-mobile-toggle-active-border-width: $sidebar-mobile-toggle-border-width;
58
+ $sidebar-mobile-toggle-active-border-color: $sidebar-mobile-toggle-border-color;
59
+ $sidebar-mobile-toggle-active-border: $sidebar-mobile-toggle-border-width solid $sidebar-mobile-toggle-active-border-color;
45
60
 
46
- $sidebar-transition-duration: 250ms;
61
+ $sidebar-width: 15.625rem;
62
+ $sidebar-width-collapsed: 3.5rem;
47
63
 
48
- $sidebar-font-size-scale: 0.925;
64
+ $sidebar-transition-duration: 200ms;
49
65
 
50
66
 
51
67
  // Content
@@ -53,31 +69,40 @@ $sidebar-font-size-scale: 0.925;
53
69
  $content-header-bg: #fafafa;
54
70
  $content-sidebar-bg: #f9f9f9;
55
71
 
56
- $content-sidebar-width: 285px;
72
+ $content-sidebar-width: 17.5rem;
57
73
 
58
- $main-content-header-bg: $content-sidebar-bg;
59
- $main-content-header-padding: 12px 20px;
60
- $main-content-header-border: 1px solid rgba(black, 0.1);
74
+ $main-content-header-bg: $content-sidebar-bg;
75
+ $main-content-header-border: 1px solid rgba(black, 0.1);
61
76
 
62
- $main-content-footer-bg: $content-sidebar-bg;
63
- $main-content-footer-padding: 12px 20px;
64
- $main-content-footer-border: 1px solid rgba(black, 0.1);
77
+ $main-content-footer-bg: $content-sidebar-bg;
78
+ $main-content-footer-border: 1px solid rgba(black, 0.1);
79
+
80
+
81
+ // Typography
82
+
83
+ $headings-border: 1px solid rgba(black, 0.1);
84
+
85
+ $header-font-size-scale: 0.8125;
86
+ $sidebar-font-size-scale: 0.8125;
87
+
88
+ $badge-hover-scale: -15%;
65
89
 
66
90
 
67
91
  // Tags
68
92
 
69
- $tag-color: white;
70
- $tag-bg: lighten(theme-color("primary"), 10%);
71
- $tag-border: theme-color("primary");
93
+ $tag-bg-scale: -30%;
94
+ $tag-border-scale: 0;
95
+
96
+ $tag-hover-bg-scale: -15%;
97
+ $tag-hover-border-scale: 15%;
72
98
 
73
- $tag-hover-color: white;
74
- $tag-hover-bg: theme-color("primary");
75
- $tag-hover-border: darken(theme-color("primary"), 10%);
99
+ $tag-spacing-x: 0.25rem;
100
+ $tag-spacing-y: 0.2rem;
76
101
 
77
102
 
78
103
  // Scopes
79
104
 
80
- $scope-padding: 0.25rem 0.675rem;
105
+ $scope-padding: 0.2rem 0.625rem;
81
106
 
82
107
  $scope-color: rgba(black, 0.4);
83
108
  $scope-bg: rgba(black, 0.035);
@@ -101,25 +126,29 @@ $alert-danger-bg: #de7471;
101
126
  $alert-danger-color: white;
102
127
  $alert-danger-border: #d85956;
103
128
 
104
- $alert-info-bg: darken(theme-color("info"), 10%);
129
+ $alert-info-bg: shade-color($info, 10%);
105
130
  $alert-info-color: white;
106
- $alert-info-border: darken($alert-info-bg, 10%);
131
+ $alert-info-border: shade-color($alert-info-bg, 5%);
107
132
 
108
- $alert-warning-bg: darken(theme-color("warning"), 5%);
133
+ $alert-warning-bg: shade-color($warning, 5%);
109
134
  $alert-warning-color: white;
110
- $alert-warning-border: darken($alert-warning-bg, 5%);
135
+ $alert-warning-border: shade-color($alert-warning-bg, 5%);
111
136
 
112
- $alert-light-bg: theme-color("light");
137
+ $alert-light-bg: $light;
113
138
  $alert-light-color: $body-color;
114
- $alert-light-border: darken($alert-light-bg, 5%);
139
+ $alert-light-border: shade-color($alert-light-bg, 5%);
115
140
 
116
- $alert-dark-bg: theme-color("dark");
141
+ $alert-dark-bg: $dark;
117
142
  $alert-dark-color: white;
118
- $alert-dark-border: darken($alert-dark-bg, 10%);
143
+ $alert-dark-border: shade-color($alert-dark-bg, 20%);
119
144
 
120
- $alert-primary-bg: darken(theme-color("primary"), 5%);
145
+ $alert-primary-bg: shade-color($primary, 10%);
121
146
  $alert-primary-color: white;
122
- $alert-primary-border: darken($alert-primary-bg, 10%);
147
+ $alert-primary-border: shade-color($alert-primary-bg, 10%);
148
+
149
+ $alert-secondary-bg: shade-color($secondary, 10%);
150
+ $alert-secondary-color: white;
151
+ $alert-secondary-border: shade-color($alert-secondary-bg, 10%);
123
152
 
124
153
 
125
154
  // Modals
@@ -0,0 +1,17 @@
1
+ import { Controller } from '@hotwired/stimulus'
2
+
3
+ import { fetchWithErrorHandling, fetchTurboStream } from '../core/fetch'
4
+
5
+ export default class extends Controller {
6
+ fetch (url, options = {}) {
7
+ return fetchWithErrorHandling(url, options)
8
+ }
9
+
10
+ fetchTurboStream (url, options = {}) {
11
+ return fetchTurboStream(url, options)
12
+ }
13
+
14
+ get csrfToken () {
15
+ return document.querySelector("[name='csrf-token']").content
16
+ }
17
+ }
@@ -0,0 +1,59 @@
1
+ import ApplicationController from './application_controller'
2
+
3
+ export default class extends ApplicationController {
4
+ static outlets = ['checkbox-select']
5
+
6
+ connect () {
7
+ if (!this.hasCheckboxSelectOutlet) {
8
+ // Set default outlet if none specified
9
+ this.element.setAttribute(`data-${this.identifier}-checkbox-select-outlet`, '.trestle-table')
10
+ }
11
+
12
+ this.baseHref = this.element.href
13
+
14
+ this.update()
15
+ }
16
+
17
+ update () {
18
+ this.toggleEnabled()
19
+ this.updateHref()
20
+ }
21
+
22
+ toggleEnabled () {
23
+ this.element.classList.toggle('disabled', this.checkboxes.length === 0)
24
+ }
25
+
26
+ updateHref () {
27
+ this.element.href = this.hrefWithSelectedIds
28
+ }
29
+
30
+ get checkboxes () {
31
+ if (this.hasCheckboxSelectOutlet) {
32
+ return this.checkboxSelectOutlet.checked
33
+ } else {
34
+ return []
35
+ }
36
+ }
37
+
38
+ get selectedIds () {
39
+ return this.checkboxes.map(c => c.value)
40
+ }
41
+
42
+ get hrefWithSelectedIds () {
43
+ const ids = this.selectedIds
44
+
45
+ if (ids.length) {
46
+ return `${this.baseHref}?ids=${ids.join(',')}`
47
+ } else {
48
+ return this.baseHref
49
+ }
50
+ }
51
+
52
+ checkboxSelectOutletConnected (outlet, element) {
53
+ element.addEventListener('checkbox-select:change', this.update.bind(this))
54
+ }
55
+
56
+ checkboxSelectOutletDisconnected (outlet, element) {
57
+ element.removeEventListener('checkbox-select:change', this.update.bind(this))
58
+ }
59
+ }
@@ -0,0 +1,46 @@
1
+ import ApplicationController from './application_controller'
2
+
3
+ export default class extends ApplicationController {
4
+ static targets = ['checkbox', 'selectAll']
5
+
6
+ toggle () {
7
+ this.updateSelectAllState()
8
+ this.dispatch('change')
9
+ }
10
+
11
+ toggleAll () {
12
+ const isChecked = this.selectAllTarget.checked
13
+
14
+ this.checkboxTargets.forEach((checkbox) => {
15
+ checkbox.checked = isChecked
16
+ })
17
+
18
+ this.dispatch('change')
19
+ }
20
+
21
+ updateSelectAllState () {
22
+ const checked = this.checked
23
+ const checkboxes = this.checkboxTargets
24
+
25
+ if (checked.length === checkboxes.length) {
26
+ // All checked
27
+ this.selectAllTarget.indeterminate = false
28
+ this.selectAllTarget.checked = true
29
+ } else if (checked.length == 0) {
30
+ // None checked
31
+ this.selectAllTarget.indeterminate = false
32
+ this.selectAllTarget.checked = false
33
+ } else {
34
+ // Some checked
35
+ this.selectAllTarget.indeterminate = true
36
+ }
37
+ }
38
+
39
+ get checked () {
40
+ return this.checkboxTargets.filter((checkbox) => checkbox.checked)
41
+ }
42
+
43
+ get unchecked () {
44
+ return this.checkboxTargets.filter((checkbox) => !checkbox.checked)
45
+ }
46
+ }