headmin 0.2.8 → 0.3.4

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 (271) 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 +65 -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/{src/js → app/assets/javascripts}/headmin/controllers/date_range_controller.js +0 -2
  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/{src/js → app/assets/javascripts}/headmin/controllers/flatpickr_controller.js +2 -1
  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 -0
  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 +18 -6
  28. data/{src/js → app/assets/javascripts}/headmin/controllers/table_controller.js +28 -14
  29. data/app/assets/javascripts/headmin/index.js +37 -0
  30. data/app/assets/javascripts/headmin.js +15280 -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 +53 -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 +8 -6
  159. data/app/views/headmin/_dropdown.html.erb +1 -1
  160. data/app/views/headmin/_filters.html.erb +20 -8
  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 +1 -1
  165. data/app/views/headmin/_popup.html.erb +10 -4
  166. data/app/views/headmin/_table.html.erb +2 -2
  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 +4 -10
  172. data/app/views/headmin/filters/_flatpickr.html.erb +5 -5
  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 +98 -45
  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 +29 -45
  182. data/app/views/headmin/forms/_date_range.html.erb +24 -66
  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 +18 -39
  186. data/app/views/headmin/forms/_flatpickr_range.html.erb +34 -45
  187. data/app/views/headmin/forms/_hidden.html.erb +13 -12
  188. data/app/views/headmin/forms/_image.html.erb +11 -45
  189. data/app/views/headmin/forms/_label.html.erb +18 -14
  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 -48
  195. data/app/views/headmin/forms/_text.html.erb +95 -58
  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 +1 -1
  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 +2 -2
  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 +6 -5
  227. data/app/views/headmin/table/actions/_delete.html.erb +2 -2
  228. data/app/views/headmin/table/actions/_export.html.erb +1 -1
  229. data/app/views/headmin/table/body/_row.html.erb +2 -2
  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 +16 -34
  258. data/src/js/headmin.js +1 -1
  259. data/src/scss/headmin.scss +1 -61
  260. data/yarn-error.log +362 -0
  261. data/yarn.lock +234 -5275
  262. metadata +194 -38
  263. data/.nvmrc +0 -1
  264. data/.rubocop.yml +0 -13
  265. data/app/controllers/concerns/headmin/ckeditor.rb +0 -27
  266. data/app/views/headmin/forms/_ckeditor.html.erb +0 -42
  267. data/dist/css/headmin.css +0 -12357
  268. data/dist/js/headmin.js +0 -1115
  269. data/src/js/headmin/headmin.js +0 -158
  270. data/src/scss/headmin/utilities.scss +0 -19
  271. data/webpack.config.js +0 -30
@@ -0,0 +1,21 @@
1
+ <%
2
+ # name: headmin/forms/video
3
+ #
4
+ # ==== Required parameters
5
+ # * +form+ - Form object
6
+ # * +attribute+ - Name of the attribute of the form model
7
+ #
8
+ # ==== Extra parameters
9
+ # Listed in 'headmin/forms/file'
10
+ # Listed in 'headmin/forms/base'
11
+ #
12
+ # ==== Examples
13
+ # Basic version
14
+ # <%= render 'headmin/forms/video', form: form, attribute: :video %#>
15
+
16
+ options = local_assigns.merge(
17
+ accept: 'video/*'
18
+ )
19
+ %>
20
+
21
+ <%= render 'headmin/forms/file', options %>
@@ -6,8 +6,8 @@
6
6
  %>
7
7
 
8
8
  <div class="d-grid">
9
- <%= link_to([:admin, form.object], class: 'btn btn-outline-danger', method: :delete, data: {confirm: t('.confirm')}) do %>
10
- <%= bootstrap_icon('trash') %>
11
- <%= t('.title') %>
9
+ <%= link_to([:admin, form.object], class: "btn btn-outline-danger", "data-turbo-method": "delete", "data-turbo-confirm": t(".confirm")) do %>
10
+ <%= bootstrap_icon("trash") %>
11
+ <%= t(".title") %>
12
12
  <% end %>
13
13
  </div>
@@ -2,9 +2,9 @@
2
2
  # name: headmin/forms/fields/base
3
3
  #
4
4
  # ==== Options
5
- # * <tt>form<tt> - Form object
6
- # * <tt>name<tt> - Name for the field
7
- # * <tt>field_type<tt> - Type of the field. Options: [:text, :image, :file, :list, :group]
5
+ # * +form+ - Form object
6
+ # * +name+ - Name for the field
7
+ # * +field_type+ - Type of the field. Options: [:text, :image, :file, :list, :group]
8
8
  #
9
9
  # ==== Examples
10
10
  # Basic version
@@ -2,8 +2,8 @@
2
2
  # name: headmin/forms/fields/file
3
3
  #
4
4
  # ==== Options
5
- # * <tt>form<tt> - Form object
6
- # * <tt>name<tt> - Name for the field
5
+ # * +form+ - Form object
6
+ # * +name+ - Name for the field
7
7
  #
8
8
  # ==== Examples
9
9
  # Basic version
@@ -2,9 +2,9 @@
2
2
  # name: headmin/forms/fields/group
3
3
  #
4
4
  # ==== Options
5
- # * <tt>form<tt> - Form object
6
- # * <tt>name<tt> - Name for the field
7
- # * <tt>label<tt> - Text to show as label. Label will be hidden if value is false
5
+ # * +form+ - Form object
6
+ # * +name+ - Name for the field
7
+ # * +label+ - Text to show as label. Label will be hidden if value is false
8
8
  #
9
9
  # ==== Examples
10
10
  # Basic version
@@ -29,7 +29,7 @@
29
29
 
30
30
  <%= render 'headmin/forms/fields/base', form: form, name: name, field_type: :group do |group, field_label| %>
31
31
  <% if show_label %>
32
- <%= render 'headmin/forms/label', form: form, attribute: :value, name: label || field_label %>
32
+ <%= render 'headmin/forms/label', form: form, attribute: :value, text: label || field_label %>
33
33
  <% end %>
34
34
 
35
35
  <li class="list-group-item mb-3">
@@ -2,8 +2,8 @@
2
2
  # name: headmin/forms/fields/image
3
3
  #
4
4
  # ==== Options
5
- # * <tt>form<tt> - Form object
6
- # * <tt>name<tt> - Name for the field
5
+ # * +form+ - Form object
6
+ # * +name+ - Name for the field
7
7
  #
8
8
  # ==== Examples
9
9
  # Basic version
@@ -2,9 +2,9 @@
2
2
  # name: headmin/forms/fields/list
3
3
  #
4
4
  # ==== Options
5
- # * <tt>form<tt> - Form object
6
- # * <tt>name<tt> - Name for the field
7
- # * <tt>label<tt> - Text to show as label. Label will be hidden if value is false
5
+ # * +form+ - Form object
6
+ # * +name+ - Name for the field
7
+ # * +label+ - Text to show as label. Label will be hidden if value is false
8
8
  #
9
9
  # ==== Examples
10
10
  # Basic version
@@ -2,8 +2,8 @@
2
2
  # name: headmin/forms/fields/text
3
3
  #
4
4
  # ==== Options
5
- # * <tt>form<tt> - Form object
6
- # * <tt>name<tt> - Name for the field
5
+ # * +form+ - Form object
6
+ # * +name+ - Name for the field
7
7
  #
8
8
  # ==== Examples
9
9
  # Basic version
@@ -18,7 +18,7 @@
18
18
  <%= form.hidden_field :id %>
19
19
  <%= form.hidden_field :_destroy if destroyable %>
20
20
  <%= form.hidden_field :position if draggable %>
21
- <%= yield if block_given? %>
21
+ <%= yield %>
22
22
 
23
23
  <!-- Drag handle -->
24
24
  <% if draggable %>
@@ -21,4 +21,4 @@
21
21
  </a>
22
22
  <% end %>
23
23
  </div>
24
- </div>
24
+ </div>
@@ -5,5 +5,5 @@
5
5
  %>
6
6
 
7
7
  <div class="body col-sm-12 col-md-11 col-lg-10 p-0">
8
- <%= yield if block_given? %>
8
+ <%= yield %>
9
9
  </div>
@@ -5,5 +5,5 @@
5
5
  %>
6
6
 
7
7
  <div class="content py-4">
8
- <%= yield if block_given? %>
8
+ <%= yield %>
9
9
  </div>
@@ -10,7 +10,7 @@
10
10
  <div class="text-secondary">
11
11
  Headmin v.<%= Headmin::VERSION %>
12
12
  <span class="float-end">
13
- <%= yield if block_given? %>
13
+ <%= yield %>
14
14
  </span>
15
15
  </div>
16
16
  </div>
@@ -7,7 +7,7 @@
7
7
  <header class="border-bottom d-print-none d-none d-md-block">
8
8
  <nav class="navbar navbar-light bg-white">
9
9
  <div class="container-fluid">
10
- <%= yield if block_given? %>
10
+ <%= yield %>
11
11
  </div>
12
12
  </nav>
13
13
  </header>
@@ -13,7 +13,7 @@
13
13
  <div class="main <%= class_names %>" data-controller="popup">
14
14
  <div class="container-fluid">
15
15
  <div class="row">
16
- <%= yield if block_given? %>
16
+ <%= yield %>
17
17
  </div>
18
18
  </div>
19
19
  </div>
@@ -7,14 +7,14 @@
7
7
 
8
8
  <div class="sidebar col-sm-12 col-md-1 col-lg-2 bg-dark overflow-y d-print-none">
9
9
  <nav class="navbar navbar-expand-md navbar-dark bg-dark w-100 h-100 flex-md-column">
10
- <a href="<%= admin_root_path %>" class="nav-brand mb-lg-4 ms-lg-3 me-lg-auto">
11
- <%= logo %>
10
+ <a href="<%= local_assigns[:url] %>" class="nav-brand mb-lg-4 ms-lg-3 me-lg-auto">
11
+ <%= local_assigns[:logo] %>
12
12
  </a>
13
13
  <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#sidebar-nav" aria-controls="sidebar-nav" aria-expanded="false" aria-label="Toggle navigation">
14
14
  <span class="navbar-toggler-icon"></span>
15
15
  </button>
16
16
  <div class="navbar-nav navbar-collapse collapse flex-column align-items-start justify-content-start w-100 h-100" id="sidebar-nav">
17
- <%= yield if block_given? %>
17
+ <%= yield %>
18
18
  </div>
19
19
  </nav>
20
20
  </div>
@@ -1,4 +1,4 @@
1
1
  <div class="mt-auto w-100">
2
2
  <hr class="bg-light">
3
- <%= yield if block_given? %>
3
+ <%= yield %>
4
4
  </div>
@@ -5,5 +5,5 @@
5
5
  %>
6
6
 
7
7
  <ul class="nav nav-pills flex-column mb-auto w-100">
8
- <%= yield if block_given? %>
8
+ <%= yield %>
9
9
  </ul>
@@ -0,0 +1,34 @@
1
+ <%
2
+ # headmin/nav/dropdown
3
+ #
4
+ # ==== Options
5
+ # * +name</tt> - Name of the nav item
6
+ # * +url</tt> - URL for this nav item
7
+ # * +icon</tt> - Optional Bootstrap icon name
8
+ # * +active</tt> - Set to true if this nav dropdown needs to be highlighted
9
+ #
10
+ # ==== Examples
11
+ # Basic version.
12
+ # <%= render 'headmin/nav/dropdown', name: 'My Account', url: admin_user_path, icon: 'person-circle' do %#>
13
+ # <%= render 'headmin/nav/item', name: 'Edit info', url: edit_admin_user_path(current_user) %#>
14
+ # <%= render 'headmin/nav/item', name: 'Log out', url: destroy_user_session_path(current_user) %#>
15
+ # <% end %#>
16
+
17
+ name = local_assigns.has_key?(:name) ? name : ''
18
+ icon = local_assigns.has_key?(:icon) ? icon : nil
19
+ collapse_id = "nav-dropdown-#{name.parameterize}"
20
+ url = local_assigns.has_key?(:url) ? url : request.url
21
+ active = local_assigns.has_key?(:active) ? active : current_url?(url)
22
+ %>
23
+
24
+ <li class="nav-item">
25
+ <a class="nav-link d-flex align-items-center dropdown-toggle <%= 'active' if active %>" href="#<%= collapse_id %>" role="button" data-bs-toggle="collapse" aria-expanded="<%= active.to_s %>" aria-controls="<%= collapse_id %>">
26
+ <%= bootstrap_icon(icon, class: 'me-2') if icon %>
27
+ <span class="d-block d-md-none d-lg-block">
28
+ <%= name %>
29
+ </span>
30
+ </a>
31
+ <ul class="collapse <%= 'show' if active %>" id="<%= collapse_id %>">
32
+ <%= yield %>
33
+ </ul>
34
+ </li>
@@ -1,21 +1,30 @@
1
- <%#
2
- headmin/nav/item
3
- accepts block: yes
4
- parameters:
5
- url: (string) Url to be used as anchor in link tag
6
- name: (string) Name to be displayed inside link
7
- active: (boolean) Whether to highlight the item or not
1
+ <%
2
+ # headmin/nav/item
3
+ #
4
+ # ==== Options
5
+ # * +name</tt> - Name of the nav item
6
+ # * +url</tt> - URL for this nav item
7
+ # * +icon</tt> - Optional Bootstrap icon name
8
+ # * +active</tt> - Set to true if this nav item needs to be highlighted
9
+ #
10
+ # ==== Examples
11
+ # Basic version.
12
+ # <%= render 'headmin/nav/item', name: 'Dashboard', url: admin_root_path %#>
13
+ #
14
+ # With icon
15
+ # <%= render 'headmin/nav/item', name: 'Dashboard', url: admin_root_path, icon: 'speedometer' %#>
16
+
17
+ name = local_assigns.has_key?(:name) ? name : ''
18
+ icon = local_assigns.has_key?(:icon) ? icon : nil
19
+ url = local_assigns.has_key?(:url) ? url : request.url
20
+ active = local_assigns.has_key?(:active) ? active : current_url?(url)
8
21
  %>
9
- <% name = local_assigns.has_key?(:name) ? name : '' %>
10
- <% icon = local_assigns.has_key?(:icon) ? icon : nil %>
11
- <% url = local_assigns.has_key?(:url) ? url : '' %>
12
- <% active = local_assigns.has_key?(:active) ? current_url?(url) : false %>
13
22
 
14
23
  <li class="nav-item">
15
24
  <a class="nav-link d-flex align-items-center <%= 'active' if active %>" aria-current="page" href="<%= url %>">
16
25
  <%= bootstrap_icon(icon, class: 'me-2') if icon %>
17
26
  <span class="d-block d-md-none d-lg-block">
18
- <%= name %>
19
- </span>
27
+ <%= name %>
28
+ </span>
20
29
  </a>
21
30
  </li>
@@ -16,6 +16,6 @@
16
16
  <%= render 'headmin/dropdown/list', id: 'nav-item-devise' do %>
17
17
  <%= render 'headmin/dropdown/item', name: t('.edit_profile'), url: polymorphic_path([:edit, singular, :registration]) %>
18
18
  <%= render 'headmin/dropdown/divider' %>
19
- <%= render 'headmin/dropdown/item', name: t('.log_out'), url: polymorphic_path([:destroy, singular, :session]), method: :delete %>
19
+ <%= render 'headmin/dropdown/item', name: t('.log_out'), url: polymorphic_path([:destroy, singular, :session]), data: { "turbo-method": "delete" } %>
20
20
  <% end %>
21
21
  <% end %>
@@ -13,7 +13,7 @@
13
13
 
14
14
  <% content_for :table_actions do %>
15
15
  <th class="h-table-actions d-none" data-controller="table-actions" data-table-actions-target="wrapper" data-table-target="actions">
16
- <%= form_with url: '', data: { 'table-actions-target': 'form' } do |form| %>
16
+ <%= form_with url: '', data: { "table-actions-target": 'form' } do |form| %>
17
17
  <%= form.hidden_field :authenticity_token, value: form_authenticity_token %>
18
18
  <%= form.hidden_field :_method, value: 'POST', 'data-table-actions-target': 'method' %>
19
19
  <%= query_parameter_fields(form) %>
@@ -35,7 +35,7 @@
35
35
  </label>
36
36
  <select class="form-select me-1" data-table-actions-target="select" data-action="change->table-actions#update">
37
37
  <option disabled selected="selected"><%= t('.selection') %></option>
38
- <%= yield if block_given? %>
38
+ <%= yield %>
39
39
  </select>
40
40
  </div>
41
41
  </div>
@@ -5,7 +5,7 @@
5
5
  %>
6
6
 
7
7
  <% content_for :table_body do %>
8
- <%= yield if block_given? %>
8
+ <%= yield %>
9
9
  <% end %>
10
10
 
11
11
  <tbody data-table-target="body">
@@ -5,7 +5,7 @@
5
5
  %>
6
6
 
7
7
  <% content_for :table_foot do %>
8
- <%= yield if block_given? %>
8
+ <%= yield %>
9
9
  <% end %>
10
10
 
11
11
  <tfoot class="table-light">
@@ -5,5 +5,5 @@
5
5
  %>
6
6
 
7
7
  <div class="d-flex flex-column flex-md-row align-content-start align-items-md-center justify-content-md-between">
8
- <%= yield if block_given? %>
8
+ <%= yield %>
9
9
  </div>
@@ -7,7 +7,7 @@
7
7
  <thead class="table-light fw-light">
8
8
  <tr>
9
9
  <% content_for :table_head do %>
10
- <%= yield if block_given? %>
10
+ <%= yield %>
11
11
  <% end %>
12
12
 
13
13
  <%= yield :table_head %>
@@ -5,5 +5,5 @@
5
5
  %>
6
6
 
7
7
  <div class="d-flex flex-column flex-md-row align-content-start align-items-md-center justify-content-md-between">
8
- <%= yield if block_given? %>
8
+ <%= yield %>
9
9
  </div>
@@ -2,10 +2,10 @@
2
2
  # headmin/table/actions/action
3
3
  #
4
4
  # ==== Options
5
- # * <tt>name</tt> - Name of the bulk action
6
- # * <tt>url</tt> - URL to send the request to
7
- # * <tt>method</tt> - HTTP method for the request (defaults to GET)
8
- # * <tt>confirm</tt> - Message to show in a confirm dialog. Leave blank if no confirm dialog needs to be shown
5
+ # * +name</tt> - Name of the bulk action
6
+ # * +url</tt> - URL to send the request to
7
+ # * +method</tt> - HTTP method for the request (defaults to GET)
8
+ # * +confirm</tt> - Message to show in a confirm dialog. Leave blank if no confirm dialog needs to be shown
9
9
  #
10
10
  # ==== Examples
11
11
  # Basic version.
@@ -20,8 +20,9 @@
20
20
  url = local_assigns.has_key?(:url) ? local_assigns[:url] : request.path
21
21
  method = local_assigns.has_key?(:method) ? local_assigns[:method] : 'GET'
22
22
  confirm = local_assigns.has_key?(:confirm) ? local_assigns[:confirm] : nil
23
+ turbo = confirm ? true : false
23
24
  %>
24
25
 
25
- <option value="<%= url %>" data-method="<%= method %>" <% if confirm %>data-confirm="<%= confirm %>"<%end %>>
26
+ <option value="<%= url %>" data-method="<%= method %>" <% if confirm %>data-turbo-confirm="<%= confirm %>"<% end %> <% unless turbo %>data-turbo="false"<%end %>>
26
27
  <%= name %>
27
28
  </option>
@@ -2,11 +2,11 @@
2
2
  # headmin/table/actions/delete
3
3
  #
4
4
  # ==== Options
5
- # * <tt>url</tt> - URL to send the request to
5
+ # * +url</tt> - URL to send the request to
6
6
  #
7
7
  # ==== Examples
8
8
  # Basic version.
9
9
  # <%= render "headmin/table/actions/delete", url: delete_admin_products_path %#>
10
10
  %>
11
11
 
12
- <%= render 'headmin/table/actions/action', name: t('.button'), url: url, method: :delete, confirm: t('.confirm') %>
12
+ <%= render "headmin/table/actions/action", name: t(".button"), url: url, method: "DELETE", confirm: t(".confirm") %>
@@ -2,7 +2,7 @@
2
2
  # headmin/table/actions/export
3
3
  #
4
4
  # ==== Options
5
- # * <tt>url</tt> - URL to send the request to
5
+ # * +url</tt> - URL to send the request to
6
6
  #
7
7
  # ==== Examples
8
8
  # Basic version.
@@ -2,7 +2,7 @@
2
2
  # headmin/table/body/row
3
3
  #
4
4
  # ==== Options
5
- # * <tt>class</tt> - Custom class names to add to the table row
5
+ # * +class</tt> - Custom class names to add to the table row
6
6
  #
7
7
  # ==== Examples
8
8
  # <%= render 'headmin/table/body/row' do %#>
@@ -13,5 +13,5 @@
13
13
  class_names = local_assigns.has_key?(:class) ? local_assigns[:class] : false
14
14
  %>
15
15
  <tr class="<%= class_names %>" data-table-target="row">
16
- <%= yield if block_given? %>
16
+ <%= yield %>
17
17
  </tr>
@@ -1,5 +1,5 @@
1
1
  <div>
2
- <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: {method: :put}) do |f| %>
2
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
3
3
  <%= render "headmin/views/devise/shared/error_messages", resource: resource %>
4
4
 
5
5
  <%= render 'headmin/forms/email', form: f, attribute: :email, required: true, float: true %>
@@ -19,6 +19,6 @@
19
19
  <h4><%= t('.cancel') %></h4>
20
20
 
21
21
  <p><%= t('.unhappy') %></p>
22
- <%= button_to t('.cancel'), registration_path(resource_name), class: 'btn btn-lg btn-danger w-100', data: {confirm: "Are you sure?"}, method: :delete %>
22
+ <%= button_to t('.cancel'), registration_path(resource_name), class: 'btn btn-lg btn-danger w-100', "data-turbo-confirm": "Are you sure?", "data-turbo-method": "delete" %>
23
23
  </div>
24
24
  </div>
@@ -0,0 +1,2 @@
1
+ # Pin npm packages by running ./bin/importmap
2
+ pin "headmin"
@@ -1,9 +1,9 @@
1
- ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
1
+ ActionView::Base.field_error_proc = proc do |html_tag, instance|
2
2
  class_attr_index = html_tag.index 'class="'
3
3
 
4
4
  if class_attr_index
5
- html_tag.insert class_attr_index+7, 'error '
5
+ html_tag.insert class_attr_index + 7, "error "
6
6
  else
7
- html_tag.insert html_tag.index('>'), ' class="error"'
7
+ html_tag.insert html_tag.index(">"), ' class="error"'
8
8
  end
9
- end
9
+ end
@@ -1,5 +1,2 @@
1
1
  en:
2
2
  language_name: English
3
- headmin:
4
- popup:
5
- add: 'Add %{name}'
@@ -12,6 +12,11 @@ en:
12
12
  title: Status
13
13
  view:
14
14
  title: View
15
+ file:
16
+ not_found: Not available
17
+ placeholder:
18
+ one: Browse file or drag & drop it here
19
+ other: Browse files or drag & drop them here
15
20
  group:
16
21
  save: Save
17
22
  blocks:
@@ -12,6 +12,11 @@ nl:
12
12
  title: Status
13
13
  view:
14
14
  title: Bekijken
15
+ file:
16
+ not_found: Niet beschikbaar
17
+ placeholder:
18
+ one: Kies bestand of sleep het hierheen
19
+ other: Kies bestanden of sleep ze hierheen
15
20
  group:
16
21
  save: Opslaan
17
22
  blocks:
@@ -0,0 +1,4 @@
1
+ en:
2
+ headmin:
3
+ popup:
4
+ add: 'Add %{name}'
@@ -0,0 +1,4 @@
1
+ nl:
2
+ headmin:
3
+ popup:
4
+ add: '%{name} toevoegen'
@@ -0,0 +1,4 @@
1
+ en:
2
+ headmin:
3
+ thumbnail:
4
+ title: Title
@@ -0,0 +1,4 @@
1
+ nl:
2
+ headmin:
3
+ thumbnail:
4
+ title: Titel
@@ -1,5 +1,2 @@
1
1
  nl:
2
2
  language_name: Nederlands
3
- headmin:
4
- popup:
5
- add: '%{name} toevoegen'
data/esbuild-css.js ADDED
@@ -0,0 +1,25 @@
1
+ const esbuild = require("esbuild");
2
+ const sassPlugin = require("esbuild-sass-plugin").sassPlugin;
3
+ const watch = process.argv.includes('-w')
4
+
5
+ // Used to skip external URLs in scss files
6
+ const externalUrlPlugin = {
7
+ name: "custom-resolver",
8
+ setup(build) {
9
+ build.onResolve({filter: /^https?:\/\//}, ({path}) => {
10
+ return {path, external: true, namespace: "provided"};
11
+ });
12
+ }
13
+ }
14
+
15
+ esbuild.build({
16
+ entryPoints: ['src/scss/headmin.scss'],
17
+ outfile: 'app/assets/stylesheets/headmin.css',
18
+ bundle: true,
19
+ watch: watch,
20
+ allowOverwrite: true,
21
+ plugins: [
22
+ externalUrlPlugin,
23
+ sassPlugin()
24
+ ]
25
+ }).catch((e) => console.error(e.message));
data/esbuild-js.js ADDED
@@ -0,0 +1,11 @@
1
+ const esbuild = require("esbuild");
2
+ const watch = process.argv.includes('-w')
3
+
4
+ esbuild.build({
5
+ entryPoints: ['src/js/headmin.js'],
6
+ outfile: 'app/assets/javascripts/headmin.js',
7
+ bundle: true,
8
+ allowOverwrite: true,
9
+ format: 'esm',
10
+ watch: watch
11
+ }).catch((e) => console.error(e.message));
data/headmin.gemspec CHANGED
@@ -29,7 +29,10 @@ Gem::Specification.new do |spec|
29
29
 
30
30
  # Uncomment to register a new dependency of your gem
31
31
  # spec.add_dependency "example-gem", "~> 1.0"
32
- spec.add_runtime_dependency 'closure_tree'
32
+ spec.add_runtime_dependency "closure_tree", "~> 7.4"
33
+ spec.add_runtime_dependency "inline_svg", "~> 1.7"
34
+ spec.add_runtime_dependency "redcarpet", "~> 3.5"
35
+ spec.add_runtime_dependency "rouge", "~> 3.27"
33
36
 
34
37
  # For more information and examples about making a new gem, checkout our
35
38
  # guide at: https://bundler.io/guides/creating_gem.html
@@ -2,21 +2,21 @@ module Headmin
2
2
  class BlocksGenerator < Rails::Generators::Base
3
3
  include Rails::Generators::Migration
4
4
 
5
- source_root File.expand_path('../../templates', __FILE__)
5
+ source_root File.expand_path("../../templates", __FILE__)
6
6
 
7
7
  def copy_models
8
- template 'models/block.rb', 'app/models/block.rb'
8
+ template "models/block.rb", "app/models/block.rb"
9
9
  end
10
10
 
11
11
  def copy_migrations
12
- migration_template 'migrations/create_blocks.rb', 'db/migrate/create_blocks.rb'
12
+ migration_template "migrations/create_blocks.rb", "db/migrate/create_blocks.rb"
13
13
  end
14
14
 
15
- private
16
-
17
- def self.next_migration_number(dirname)
18
- next_migration_number = current_migration_number(dirname) + 1
19
- ActiveRecord::Migration.next_migration_number(next_migration_number)
15
+ class << self
16
+ def next_migration_number(dirname)
17
+ next_migration_number = current_migration_number(dirname) + 1
18
+ ActiveRecord::Migration.next_migration_number(next_migration_number)
19
+ end
20
20
  end
21
21
  end
22
22
  end