headmin 0.2.7 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (270) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/CHANGELOG.md +29 -3
  4. data/Gemfile +1 -1
  5. data/Gemfile.lock +39 -24
  6. data/README.md +64 -57
  7. data/app/assets/config/headmin_manifest.js +2 -0
  8. data/app/assets/images/document.docx +0 -0
  9. data/{src/scss/headmin/filters.scss → app/assets/images/document.pdf} +0 -0
  10. data/app/assets/images/image.jpg +0 -0
  11. data/app/assets/images/spreadsheet.xls +0 -0
  12. data/app/assets/images/video.mp4 +0 -0
  13. data/app/assets/javascripts/headmin/config/i18n.js +11 -0
  14. data/{src/js → app/assets/javascripts}/headmin/controllers/blocks_controller.js +0 -1
  15. data/app/assets/javascripts/headmin/controllers/date_range_controller.js +32 -0
  16. data/app/assets/javascripts/headmin/controllers/dropzone_controller.js +33 -0
  17. data/app/assets/javascripts/headmin/controllers/file_preview_controller.js +244 -0
  18. data/{src/js → app/assets/javascripts}/headmin/controllers/filter_controller.js +12 -6
  19. data/{src/js → app/assets/javascripts}/headmin/controllers/filters_controller.js +0 -0
  20. data/app/assets/javascripts/headmin/controllers/flatpickr_controller.js +39 -0
  21. data/app/assets/javascripts/headmin/controllers/hello_controller.js +7 -0
  22. data/app/assets/javascripts/headmin/controllers/notification_controller.js +8 -0
  23. data/{src/js → app/assets/javascripts}/headmin/controllers/popup_controller.js +0 -1
  24. data/app/assets/javascripts/headmin/controllers/redactorx_controller.js +13 -0
  25. data/{src/js → app/assets/javascripts}/headmin/controllers/repeater_controller.js +0 -1
  26. data/app/assets/javascripts/headmin/controllers/select_controller.js +48 -0
  27. data/{src/js → app/assets/javascripts}/headmin/controllers/table_actions_controller.js +9 -39
  28. data/{src/js → app/assets/javascripts}/headmin/controllers/table_controller.js +51 -16
  29. data/app/assets/javascripts/headmin/index.js +37 -0
  30. data/app/assets/javascripts/headmin.js +15271 -0
  31. data/{src/scss → app/assets/stylesheets}/headmin/filter.scss +0 -0
  32. data/app/assets/stylesheets/headmin/filters.scss +0 -0
  33. data/{src/scss → app/assets/stylesheets}/headmin/form.scss +57 -4
  34. data/{src/scss → app/assets/stylesheets}/headmin/general.scss +0 -0
  35. data/{src/scss → app/assets/stylesheets}/headmin/layout/body.scss +0 -0
  36. data/{src/scss → app/assets/stylesheets}/headmin/layout/sidebar.scss +0 -0
  37. data/{src/scss → app/assets/stylesheets}/headmin/layout.scss +0 -0
  38. data/{src/scss → app/assets/stylesheets}/headmin/login.scss +0 -0
  39. data/{src/scss/vendor/bootstrap/variables.scss → app/assets/stylesheets/headmin/overrides/bootstrap.scss} +0 -0
  40. data/{src/scss/vendor/redactorx/override.css → app/assets/stylesheets/headmin/overrides/redactorx.css} +0 -0
  41. data/{src/scss → app/assets/stylesheets}/headmin/popup.scss +0 -0
  42. data/app/assets/stylesheets/headmin/syntax.scss +349 -0
  43. data/{src/scss → app/assets/stylesheets}/headmin/table.scss +0 -0
  44. data/app/assets/stylesheets/headmin/thumbnail.scss +20 -0
  45. data/app/assets/stylesheets/headmin/utilities.scss +68 -0
  46. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_accordion.scss +118 -0
  47. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_alert.scss +57 -0
  48. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_badge.scss +29 -0
  49. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_breadcrumb.scss +28 -0
  50. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_button-group.scss +139 -0
  51. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_buttons.scss +111 -0
  52. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_card.scss +216 -0
  53. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_carousel.scss +229 -0
  54. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_close.scss +40 -0
  55. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_containers.scss +41 -0
  56. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_dropdown.scss +240 -0
  57. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_forms.scss +9 -0
  58. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_functions.scss +302 -0
  59. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_grid.scss +33 -0
  60. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_helpers.scss +9 -0
  61. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_images.scss +42 -0
  62. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_list-group.scss +174 -0
  63. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_mixins.scss +43 -0
  64. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_modal.scss +209 -0
  65. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_nav.scss +139 -0
  66. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_navbar.scss +335 -0
  67. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_offcanvas.scss +83 -0
  68. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_pagination.scss +64 -0
  69. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_placeholders.scss +51 -0
  70. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_popover.scss +158 -0
  71. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_progress.scss +48 -0
  72. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_reboot.scss +625 -0
  73. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_root.scss +54 -0
  74. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_spinners.scss +69 -0
  75. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_tables.scss +155 -0
  76. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_toasts.scss +51 -0
  77. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_tooltip.scss +115 -0
  78. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_transitions.scss +27 -0
  79. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_type.scss +104 -0
  80. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_utilities.scss +630 -0
  81. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_variables.scss +1641 -0
  82. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/bootstrap-grid.scss +67 -0
  83. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/bootstrap-reboot.scss +13 -0
  84. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/bootstrap-utilities.scss +18 -0
  85. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/bootstrap.scss +53 -0
  86. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_floating-labels.scss +63 -0
  87. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_form-check.scss +152 -0
  88. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_form-control.scss +219 -0
  89. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_form-range.scss +91 -0
  90. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_form-select.scss +72 -0
  91. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_form-text.scss +11 -0
  92. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_input-group.scss +121 -0
  93. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_labels.scss +36 -0
  94. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_validation.scss +12 -0
  95. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_clearfix.scss +3 -0
  96. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_colored-links.scss +12 -0
  97. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_position.scss +30 -0
  98. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_ratio.scss +26 -0
  99. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_stacks.scss +15 -0
  100. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_stretched-link.scss +15 -0
  101. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_text-truncation.scss +7 -0
  102. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_visually-hidden.scss +8 -0
  103. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_vr.scss +8 -0
  104. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_alert.scss +11 -0
  105. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_backdrop.scss +14 -0
  106. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_border-radius.scss +78 -0
  107. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_box-shadow.scss +18 -0
  108. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_breakpoints.scss +127 -0
  109. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_buttons.scss +133 -0
  110. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_caret.scss +64 -0
  111. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_clearfix.scss +9 -0
  112. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_color-scheme.scss +7 -0
  113. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_container.scss +9 -0
  114. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_deprecate.scss +10 -0
  115. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_forms.scss +144 -0
  116. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_gradients.scss +47 -0
  117. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_grid.scss +151 -0
  118. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_image.scss +16 -0
  119. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_list-group.scss +24 -0
  120. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_lists.scss +7 -0
  121. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_pagination.scss +31 -0
  122. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_reset-text.scss +17 -0
  123. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_resize.scss +6 -0
  124. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_table-variants.scss +21 -0
  125. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_text-truncate.scss +8 -0
  126. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_transition.scss +26 -0
  127. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_utilities.scss +89 -0
  128. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_visually-hidden.scss +29 -0
  129. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/utilities/_api.scss +47 -0
  130. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/vendor/_rfs.scss +354 -0
  131. data/app/assets/stylesheets/headmin/vendor/flatpickr.css +903 -0
  132. data/{src/scss/vendor/redactorx → app/assets/stylesheets/headmin/vendor}/redactorx.css +0 -0
  133. data/app/assets/stylesheets/headmin/vendor/tom-select-bootstrap.css +536 -0
  134. data/app/assets/stylesheets/headmin.css +13454 -0
  135. data/app/assets/stylesheets/headmin.scss +65 -0
  136. data/app/controllers/concerns/headmin/authentication.rb +1 -1
  137. data/app/controllers/concerns/headmin/searchable.rb +1 -1
  138. data/app/controllers/concerns/headmin/sortable.rb +7 -7
  139. data/app/helpers/headmin/admin_helper.rb +2 -1
  140. data/app/helpers/headmin/bootstrap_helper.rb +4 -4
  141. data/app/helpers/headmin/documentation_helper.rb +35 -0
  142. data/app/helpers/headmin/filter_helper.rb +1 -1
  143. data/app/helpers/headmin/form_helper.rb +7 -3
  144. data/app/helpers/headmin/notification_helper.rb +21 -21
  145. data/app/helpers/headmin/request_helper.rb +5 -10
  146. data/app/models/concerns/headmin/block.rb +1 -2
  147. data/app/models/concerns/headmin/blockable.rb +1 -1
  148. data/app/models/concerns/headmin/field.rb +1 -1
  149. data/app/models/concerns/headmin/fieldable.rb +8 -8
  150. data/app/models/headmin/documentation_renderer.rb +32 -0
  151. data/app/models/headmin/form/base.rb +78 -0
  152. data/app/models/headmin/form/text.rb +51 -0
  153. data/app/models/headmin/thumbnail.rb +61 -0
  154. data/app/services/block_service.rb +53 -53
  155. data/app/views/examples/admin.html.erb +1 -1
  156. data/app/views/headmin/_blocks.html.erb +2 -2
  157. data/app/views/headmin/_breadcrumbs.html.erb +1 -1
  158. data/app/views/headmin/_card.html.erb +10 -6
  159. data/app/views/headmin/_dropdown.html.erb +1 -1
  160. data/app/views/headmin/_filters.html.erb +22 -10
  161. data/app/views/headmin/_form.html.erb +14 -14
  162. data/app/views/headmin/_heading.html.erb +1 -1
  163. data/app/views/headmin/_notifications.html.erb +1 -1
  164. data/app/views/headmin/_pagination.html.erb +3 -5
  165. data/app/views/headmin/_popup.html.erb +10 -4
  166. data/app/views/headmin/_table.html.erb +10 -4
  167. data/app/views/headmin/_thumbnail.html.erb +47 -0
  168. data/app/views/headmin/dropdown/_devise.html.erb +2 -2
  169. data/app/views/headmin/dropdown/_item.html.erb +1 -1
  170. data/app/views/headmin/dropdown/_list.html.erb +3 -6
  171. data/app/views/headmin/filters/_date.html.erb +9 -13
  172. data/app/views/headmin/filters/_flatpickr.html.erb +57 -0
  173. data/app/views/headmin/filters/_search.html.erb +5 -5
  174. data/app/views/headmin/filters/_select.html.erb +6 -6
  175. data/app/views/headmin/filters/filter/_button.html.erb +7 -7
  176. data/app/views/headmin/filters/filter/_template.html.erb +1 -1
  177. data/app/views/headmin/forms/_actions.html.erb +1 -1
  178. data/app/views/headmin/forms/_base.html.erb +100 -46
  179. data/app/views/headmin/forms/_blocks.html.erb +4 -4
  180. data/app/views/headmin/forms/_checkbox.html.erb +4 -4
  181. data/app/views/headmin/forms/_date.html.erb +30 -34
  182. data/app/views/headmin/forms/_date_range.html.erb +42 -0
  183. data/app/views/headmin/forms/_email.html.erb +35 -26
  184. data/app/views/headmin/forms/_file.html.erb +186 -34
  185. data/app/views/headmin/forms/_flatpickr.html.erb +34 -0
  186. data/app/views/headmin/forms/_flatpickr_range.html.erb +50 -0
  187. data/app/views/headmin/forms/_hidden.html.erb +24 -0
  188. data/app/views/headmin/forms/_image.html.erb +11 -45
  189. data/app/views/headmin/forms/_label.html.erb +18 -12
  190. data/app/views/headmin/forms/_number.html.erb +40 -37
  191. data/app/views/headmin/forms/_password.html.erb +37 -58
  192. data/app/views/headmin/forms/_redactorx.html.erb +8 -7
  193. data/app/views/headmin/forms/_repeater.html.erb +7 -7
  194. data/app/views/headmin/forms/_select.html.erb +43 -45
  195. data/app/views/headmin/forms/_text.html.erb +94 -59
  196. data/app/views/headmin/forms/_textarea.html.erb +37 -26
  197. data/app/views/headmin/forms/_url.html.erb +35 -26
  198. data/app/views/headmin/forms/_validation.html.erb +3 -3
  199. data/app/views/headmin/forms/_video.html.erb +21 -0
  200. data/app/views/headmin/forms/actions/_destroy.html.erb +3 -3
  201. data/app/views/headmin/forms/fields/_base.html.erb +3 -3
  202. data/app/views/headmin/forms/fields/_file.html.erb +2 -2
  203. data/app/views/headmin/forms/fields/_group.html.erb +4 -4
  204. data/app/views/headmin/forms/fields/_image.html.erb +2 -2
  205. data/app/views/headmin/forms/fields/_list.html.erb +3 -3
  206. data/app/views/headmin/forms/fields/_text.html.erb +2 -2
  207. data/app/views/headmin/forms/repeater/_row.html.erb +1 -1
  208. data/app/views/headmin/heading/_title.html.erb +1 -1
  209. data/app/views/headmin/layout/_body.html.erb +1 -1
  210. data/app/views/headmin/layout/_content.html.erb +1 -1
  211. data/app/views/headmin/layout/_footer.html.erb +1 -1
  212. data/app/views/headmin/layout/_header.html.erb +1 -1
  213. data/app/views/headmin/layout/_main.html.erb +12 -6
  214. data/app/views/headmin/layout/_sidebar.html.erb +3 -3
  215. data/app/views/headmin/layout/sidebar/_bottom.html.erb +1 -1
  216. data/app/views/headmin/layout/sidebar/_nav.html.erb +1 -1
  217. data/app/views/headmin/nav/_dropdown.html.erb +34 -0
  218. data/app/views/headmin/nav/_item.html.erb +22 -13
  219. data/app/views/headmin/nav/item/_devise.html.erb +1 -1
  220. data/app/views/headmin/table/_actions.html.erb +3 -5
  221. data/app/views/headmin/table/_body.html.erb +1 -1
  222. data/app/views/headmin/table/_foot.html.erb +1 -1
  223. data/app/views/headmin/table/_footer.html.erb +1 -1
  224. data/app/views/headmin/table/_head.html.erb +1 -1
  225. data/app/views/headmin/table/_header.html.erb +1 -1
  226. data/app/views/headmin/table/actions/_action.html.erb +4 -4
  227. data/app/views/headmin/table/actions/_delete.html.erb +1 -1
  228. data/app/views/headmin/table/actions/_export.html.erb +1 -1
  229. data/app/views/headmin/table/body/_row.html.erb +15 -7
  230. data/app/views/headmin/views/devise/registrations/_edit.html.erb +2 -2
  231. data/config/importmap.rb +2 -0
  232. data/config/initializers/customize_input_error.rb +4 -4
  233. data/config/locales/en.yml +0 -3
  234. data/config/locales/headmin/forms/en.yml +5 -0
  235. data/config/locales/headmin/forms/nl.yml +5 -0
  236. data/config/locales/headmin/popup/en.yml +4 -0
  237. data/config/locales/headmin/popup/nl.yml +4 -0
  238. data/config/locales/headmin/thumbnail/en.yml +4 -0
  239. data/config/locales/headmin/thumbnail/nl.yml +4 -0
  240. data/config/locales/nl.yml +0 -3
  241. data/esbuild-css.js +25 -0
  242. data/esbuild-js.js +11 -0
  243. data/headmin.gemspec +4 -1
  244. data/lib/generators/headmin/blocks_generator.rb +8 -8
  245. data/lib/generators/headmin/devise_generator.rb +4 -4
  246. data/lib/generators/headmin/fields_generator.rb +9 -9
  247. data/lib/generators/templates/controllers/auth/confirmations_controller.rb +1 -1
  248. data/lib/generators/templates/controllers/auth/omniauth_callbacks_controller.rb +1 -1
  249. data/lib/generators/templates/controllers/auth/passwords_controller.rb +1 -1
  250. data/lib/generators/templates/controllers/auth/registrations_controller.rb +1 -1
  251. data/lib/generators/templates/controllers/auth/sessions_controller.rb +1 -1
  252. data/lib/generators/templates/controllers/auth/unlocks_controller.rb +1 -1
  253. data/lib/generators/templates/models/block.rb +1 -1
  254. data/lib/headmin/engine.rb +18 -3
  255. data/lib/headmin/version.rb +1 -1
  256. data/lib/headmin.rb +1 -1
  257. data/package.json +17 -34
  258. data/src/js/headmin.js +1 -1
  259. data/src/scss/headmin.scss +1 -61
  260. data/yarn.lock +234 -5275
  261. metadata +198 -36
  262. data/.nvmrc +0 -1
  263. data/.rubocop.yml +0 -13
  264. data/app/controllers/concerns/headmin/ckeditor.rb +0 -27
  265. data/app/views/headmin/forms/_ckeditor.html.erb +0 -42
  266. data/dist/css/headmin.css +0 -12354
  267. data/dist/js/headmin.js +0 -1080
  268. data/src/js/headmin/headmin.js +0 -141
  269. data/src/scss/headmin/utilities.scss +0 -19
  270. data/webpack.config.js +0 -30
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 75079b879cee8f51cc97f715f1714d29554519f30ad046aa5c391ae663fb5ea0
4
- data.tar.gz: b7e38afe69ddfb236653170172d8bfa74ddb972071cfb6644d460a89a0581b48
3
+ metadata.gz: 9030a5fb86be00d17cc66832c36991fe2af18d745c94737a548695ff572b1b6f
4
+ data.tar.gz: 786656902c0252efd3a2ea7b29df56f0c31b006dbdc1ee7bab4e2573711b617d
5
5
  SHA512:
6
- metadata.gz: 052d363086709d82b0f526dec7a9a80fb05845d3da62b8aee65f35d3b5e5c7e6a4431c3a9f079491d12eca8387fabf06338cc6a14c950728db910605409195dd
7
- data.tar.gz: b83c34883e5ca7719e14a1282412b836e8bbf706071283c07d2ec6dcd0a2317737c43044f5e0fe138d406fd14b930b6d72a1b9cac11d9ed6237477d3b4220083
6
+ metadata.gz: 599ca9728a88c3a9cd210429d5864660eef92831602f3f4c1370d0b40a58640e288fc3682caff76463e43e43df86cf56844cc414e53ec260e12308e7be6ea76b
7
+ data.tar.gz: 8647e86331483620394e4ae0c0cf38c4ccac1ae89843de242a590af2bdb819104ffd0afd89bd77f5e6fb1264a9ead16dc8915c7ecf3dc7b740d52b65b73518a6
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-3.0.0
1
+ ruby-3.1.0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
- ## [Unreleased]
1
+ # Headmin Changelog
2
2
 
3
- ## [0.0.1] - 2021-03-14
3
+ ## 0.3
4
4
 
5
- - Initial release
5
+ - Support for import maps added
6
+ - Headmin is now works with Rails 7
7
+ - All JS is moved to Stimulus controllers thus deprecating the need for a custom initialization process
8
+ - Makeover of `headmin/forms/file`
9
+ - added attribute `dropzone` to enable drag&drop
10
+ - added attribute `preview` to enable previews
11
+ - Image previews for `headmin/forms/image` are not enabled by default anymore. To enable you can add `preview: true`. To
12
+ render previews for attachments add them as nested_attributes to your model
13
+
14
+ ```rb
15
+ has_one_attached :image
16
+ accepts_nested_attributes_for :image_attachment
17
+ ```
18
+
19
+ - **BREAK**: CKEditor has been removed in favor of RedactorX.
20
+ Download a purchased copy of RedactorX and add it to your `<head>` like this:
21
+
22
+ ```html
23
+
24
+ <head>
25
+ <script src="<%= asset_path('redactorx') %>" type="module"></script>
26
+ </head>
27
+ ```
28
+
29
+ ## 0.2.8
30
+
31
+ - ...
data/Gemfile CHANGED
@@ -8,4 +8,4 @@ gemspec
8
8
  gem "rake", "~> 13.0"
9
9
 
10
10
  gem "minitest", "~> 5.0"
11
- gem "rubocop", "~> 1.7"
11
+ gem "standard", "~> 1.7"
data/Gemfile.lock CHANGED
@@ -1,56 +1,71 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- headmin (0.2.6)
5
- closure_tree
4
+ headmin (0.3.3)
5
+ closure_tree (~> 7.4)
6
+ inline_svg (~> 1.7)
7
+ redcarpet (~> 3.5)
8
+ rouge (~> 3.27)
6
9
 
7
10
  GEM
8
11
  remote: https://rubygems.org/
9
12
  specs:
10
- activemodel (6.1.4.1)
11
- activesupport (= 6.1.4.1)
12
- activerecord (6.1.4.1)
13
- activemodel (= 6.1.4.1)
14
- activesupport (= 6.1.4.1)
15
- activesupport (6.1.4.1)
13
+ activemodel (7.0.1)
14
+ activesupport (= 7.0.1)
15
+ activerecord (7.0.1)
16
+ activemodel (= 7.0.1)
17
+ activesupport (= 7.0.1)
18
+ activesupport (7.0.1)
16
19
  concurrent-ruby (~> 1.0, >= 1.0.2)
17
20
  i18n (>= 1.6, < 2)
18
21
  minitest (>= 5.1)
19
22
  tzinfo (~> 2.0)
20
- zeitwerk (~> 2.3)
21
23
  ast (2.4.2)
22
24
  closure_tree (7.4.0)
23
25
  activerecord (>= 4.2.10)
24
26
  with_advisory_lock (>= 4.0.0)
25
27
  concurrent-ruby (1.1.9)
26
- i18n (1.8.11)
28
+ i18n (1.9.1)
27
29
  concurrent-ruby (~> 1.0)
30
+ inline_svg (1.8.0)
31
+ activesupport (>= 3.0)
32
+ nokogiri (>= 1.6)
28
33
  minitest (5.14.4)
29
- parallel (1.20.1)
30
- parser (3.0.0.0)
34
+ nokogiri (1.13.1-x86_64-darwin)
35
+ racc (~> 1.4)
36
+ parallel (1.21.0)
37
+ parser (3.1.0.0)
31
38
  ast (~> 2.4.1)
32
- rainbow (3.0.0)
39
+ racc (1.6.0)
40
+ rainbow (3.1.1)
33
41
  rake (13.0.3)
34
- regexp_parser (2.1.1)
35
- rexml (3.2.4)
36
- rubocop (1.11.0)
42
+ redcarpet (3.5.1)
43
+ regexp_parser (2.2.0)
44
+ rexml (3.2.5)
45
+ rouge (3.27.0)
46
+ rubocop (1.25.0)
37
47
  parallel (~> 1.10)
38
- parser (>= 3.0.0.0)
48
+ parser (>= 3.1.0.0)
39
49
  rainbow (>= 2.2.2, < 4.0)
40
50
  regexp_parser (>= 1.8, < 3.0)
41
51
  rexml
42
- rubocop-ast (>= 1.2.0, < 2.0)
52
+ rubocop-ast (>= 1.15.1, < 2.0)
43
53
  ruby-progressbar (~> 1.7)
44
54
  unicode-display_width (>= 1.4.0, < 3.0)
45
- rubocop-ast (1.4.1)
46
- parser (>= 2.7.1.5)
55
+ rubocop-ast (1.15.1)
56
+ parser (>= 3.0.1.1)
57
+ rubocop-performance (1.13.2)
58
+ rubocop (>= 1.7.0, < 2.0)
59
+ rubocop-ast (>= 0.4.0)
47
60
  ruby-progressbar (1.11.0)
61
+ standard (1.7.0)
62
+ rubocop (= 1.25.0)
63
+ rubocop-performance (= 1.13.2)
48
64
  tzinfo (2.0.4)
49
65
  concurrent-ruby (~> 1.0)
50
- unicode-display_width (2.0.0)
66
+ unicode-display_width (2.1.0)
51
67
  with_advisory_lock (4.6.0)
52
68
  activerecord (>= 4.2)
53
- zeitwerk (2.5.1)
54
69
 
55
70
  PLATFORMS
56
71
  x86_64-darwin-19
@@ -59,7 +74,7 @@ DEPENDENCIES
59
74
  headmin!
60
75
  minitest (~> 5.0)
61
76
  rake (~> 13.0)
62
- rubocop (~> 1.7)
77
+ standard (~> 1.7)
63
78
 
64
79
  BUNDLED WITH
65
- 2.2.14
80
+ 2.3.3
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # Headmin
2
+
2
3
  A complete library of commonly used components to build an admin interface in your Ruby on Rails project.
3
4
 
4
5
  [![Gem Version](https://badge.fury.io/rb/headmin.svg)](https://rubygems.org/gems/headmin)
@@ -6,77 +7,98 @@ A complete library of commonly used components to build an admin interface in yo
6
7
 
7
8
  ## Installation
8
9
 
9
- Add this line to your application's Gemfile:
10
+ To install Headmin into your current Rails application use bundler:
10
11
 
11
- ```ruby
12
- gem 'headmin'
12
+ ```shell
13
+ $ bundle add 'headmin'
13
14
  ```
14
15
 
15
- And then execute:
16
+ ## Usage
17
+ All assets are available via the asset pipeline and can be called as if it was available in your application.
16
18
 
17
- ```shell
18
- $ bundle install
19
+ ### Stylesheets
20
+ Import all SCSS stylesheets like this:
21
+
22
+ ```scss
23
+ @import "headmin";
24
+ ```
25
+
26
+ - Asset Pipeline: `Sprockets` & `sassc-rails` will pickup the correct file automatically
27
+ - Node: Use a build tool like `ESBuild`, `Webpack` or `Rollup` to find the right file via Headmins' package.json
28
+
29
+ ### Javascript
30
+ Import the `Headmin` class into your script and initialize it. This will append its Stimulus controllers to
31
+ the `window.Stimulus object` if it's available.
32
+
33
+ ```js
34
+ import {Headmin} from 'headmin'
35
+ Headmin.start()
19
36
  ```
20
37
 
21
- Add headmin to list of node modules
38
+ ### Node or not to Node
39
+ With the introduction of importmap in Rails 7, you're no longer required to use node for your frontend assets.
40
+ By default all assets are available via the asset pipeline and added to the default importmap.rb.
41
+
42
+ If you want to use node because you're tied to a specific build tool, you can add Headmin as a dependency to your package.json.
22
43
 
23
44
  ```shell
24
45
  $ yarn add headmin
25
46
  ```
26
- ## Usage
27
- Add the Headmin helpers to the Admin helper file
47
+
48
+ ## Helpers
49
+
50
+ Add the Headmin helpers to your helper file. We recommend using namespaces.
51
+
28
52
  ```ruby
53
+ # In a, preferably namespaced, view helper
29
54
  module AdminHelper
30
55
  include Headmin::AdminHelper
31
56
  end
32
57
  ```
33
58
 
34
- Import the Headmin class into your script.
35
- ```js
36
- import {Headmin} from 'headmin'
37
-
38
- document.addEventListener("DOMContentLoaded", function () {
39
- Headmin.start()
40
- })
41
- ```
42
-
43
- Finally import Headmin in your stylesheet.
44
- ```scss
45
- @import '~headmin/src/scss/headmin.scss';
46
- ```
47
-
48
- ### Integrations
49
- - [Blocks](docs/blocks.md)
50
- - [Fields](docs/fields.md)
51
- - [Blocks + Fields = Magic](docs/blocks-and-fields.md)
52
- - [Devise](docs/devise.md)
53
-
54
59
  ## Development
60
+
55
61
  For development purposes it's helpful to have both the test project and Headmin located in the same directory.
56
62
 
57
63
  In Gemfile
64
+
58
65
  ```ruby
59
66
  gem "headmin", path: "../headmin"
60
67
  ```
61
68
 
62
69
  In package.json
70
+
63
71
  ```json
64
72
  {
65
73
  "dependencies": {
66
- "bar": "file:../headmin"
74
+ "headmin": "link:../headmin"
67
75
  }
68
76
  }
69
77
  ```
70
78
 
79
+ To see frontend changes update live in development run
80
+ ```shell
81
+ # Watches changes and builds them on-the-fly
82
+ yarn dev
83
+ ```
84
+
85
+ ### Javascript
86
+
87
+ When adding new dependencies, make sure you add them to the `package.json` file as well as the `importmap.rb` file.
88
+
71
89
  ## Testing
72
- If you want to test a specific feature in a staging environment without releasing the gem, you can refer to the remote repo in your Gemfile and package.json.
90
+
91
+ If you want to test a specific feature in a staging environment without releasing the gem, you can refer to the remote
92
+ repo in your Gemfile and package.json.
73
93
 
74
94
  In Gemfile
95
+
75
96
  ```ruby
76
97
  gem 'headmin', git: 'git@github.com:insiting/headmin.git', branch: 'feature/test'
77
98
  ```
78
99
 
79
100
  In package.json
101
+
80
102
  ```json
81
103
  {
82
104
  "dependencies": {
@@ -87,50 +109,34 @@ In package.json
87
109
  ```
88
110
 
89
111
  ## Releasing
90
- After integration a new feature of fixing a bug, first commit and push your changes.
91
112
 
92
- Build the assets for production
93
- ```shell
94
- $ nvm use
95
- $ yarn build
96
- ```
113
+ After integration a new feature of fixing a bug, first commit and push your changes.
97
114
 
98
- Update the version number of the gem
115
+ Update the gem
99
116
 
100
117
  ```shell
101
118
  # First bundle if new runtime dependencies were added
102
119
  $ bundle
103
- $ git push
104
120
 
105
- # Update the version number and tag the release
121
+ # Update the version number, push commits and tag the release
106
122
  $ gem bump -v {patch,minor,major,...} --push --tag
107
123
 
108
124
  # Release to Rubygems
109
125
  $ gem release
110
126
  ```
111
127
 
112
- Update the node module
113
- ```
114
- # Manually update the version number in package.json
115
- $ npm publish
116
- ```
117
-
118
- ## Deployment
119
- Update the Headmin gem to the latest version
120
- ```shell
121
- $ bundle update headmin
122
- ```
128
+ Update the node package
123
129
 
124
- Update the Headmin node module ot the latest version
125
130
  ```shell
126
- $ yarn upgrade headmin
131
+ # Manually update the version number in package.json
132
+ $ yarn release
127
133
  ```
128
134
 
129
- Deploy your app as usual
130
-
131
135
  ## Contributing
132
136
 
133
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/headmin. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/headmin/blob/master/CODE_OF_CONDUCT.md).
137
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/headmin. This project is intended
138
+ to be a safe, welcoming space for collaboration, and contributors are expected to adhere to
139
+ the [code of conduct](https://github.com/[USERNAME]/headmin/blob/master/CODE_OF_CONDUCT.md).
134
140
 
135
141
  ## License
136
142
 
@@ -138,4 +144,5 @@ The gem is available as open source under the terms of the [MIT License](https:/
138
144
 
139
145
  ## Code of Conduct
140
146
 
141
- Everyone interacting in the Headmin project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/headmin/blob/master/CODE_OF_CONDUCT.md).
147
+ Everyone interacting in the Headmin project's codebases, issue trackers, chat rooms and mailing lists is expected to
148
+ follow the [code of conduct](https://github.com/[USERNAME]/headmin/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,2 @@
1
+ //= link_tree ../images
2
+ //= link_tree ../javascripts
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,11 @@
1
+ export default class {
2
+ static get locale() {
3
+ if (window.I18n === undefined) {
4
+ const locale = document.querySelector('html').getAttribute('lang')
5
+ window.I18n = {
6
+ locale: locale || 'en'
7
+ }
8
+ }
9
+ return window.I18n.locale
10
+ }
11
+ }
@@ -1,6 +1,5 @@
1
1
  import {Controller} from "@hotwired/stimulus"
2
2
  import Sortable from "sortablejs";
3
- import { createPopper } from '@popperjs/core';
4
3
 
5
4
  export default class extends Controller {
6
5
  static get targets() {
@@ -0,0 +1,32 @@
1
+ import {Controller} from "@hotwired/stimulus"
2
+
3
+ export default class extends Controller {
4
+ static get targets() {
5
+ return ["dateInput", "startDateInput", "endDateInput"]
6
+ }
7
+
8
+ update(event) {
9
+ const flatpickr = event.target._flatpickr
10
+ const startDate = flatpickr.selectedDates[0]
11
+ const endDate = flatpickr.selectedDates[1]
12
+
13
+ this.setStartDateInputValue(this.formatDate(startDate))
14
+ this.setEndDateInputValue(this.formatDate(endDate))
15
+ }
16
+
17
+ setStartDateInputValue(value) {
18
+ this.startDateInputTarget.value = value
19
+ }
20
+
21
+ setEndDateInputValue(value) {
22
+ this.endDateInputTarget.value = value
23
+ }
24
+
25
+ formatDate(date) {
26
+ if(date instanceof Date) {
27
+ return date.toLocaleDateString('nl-BE', {day: '2-digit', month: '2-digit', year: 'numeric'})
28
+ } else {
29
+ return null;
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,33 @@
1
+ import {Controller} from "@hotwired/stimulus"
2
+
3
+ // References:
4
+ // https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API
5
+
6
+ export default class extends Controller {
7
+ static get targets() {
8
+ return ["input"]
9
+ }
10
+
11
+ connect() {
12
+ this.element.classList.add('h-dropzone')
13
+
14
+ // Drag
15
+ this.inputTarget.addEventListener('dragover', (event) => {
16
+ this.element.classList.add('dragover')
17
+ })
18
+ this.inputTarget.addEventListener('dragleave', (event) => {
19
+ this.element.classList.remove('dragover')
20
+ })
21
+ this.inputTarget.addEventListener('drop', (event) => {
22
+ this.element.classList.remove('dragover')
23
+ })
24
+
25
+ // Focus
26
+ this.inputTarget.addEventListener('focusin', (event) => {
27
+ this.element.classList.add('active')
28
+ })
29
+ this.inputTarget.addEventListener('focusout', (event) => {
30
+ this.element.classList.remove('active')
31
+ })
32
+ }
33
+ }