headmin 0.2.6 → 0.3.2

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 (237) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +29 -3
  3. data/Gemfile.lock +14 -3
  4. data/README.md +64 -57
  5. data/app/assets/config/headmin_manifest.js +2 -0
  6. data/app/assets/javascripts/headmin/config/i18n.js +11 -0
  7. data/{src/js → app/assets/javascripts}/headmin/controllers/blocks_controller.js +0 -1
  8. data/app/assets/javascripts/headmin/controllers/date_range_controller.js +32 -0
  9. data/app/assets/javascripts/headmin/controllers/dropzone_controller.js +33 -0
  10. data/app/assets/javascripts/headmin/controllers/file_preview_controller.js +244 -0
  11. data/{src/js → app/assets/javascripts}/headmin/controllers/filter_controller.js +12 -6
  12. data/{src/js → app/assets/javascripts}/headmin/controllers/filters_controller.js +0 -0
  13. data/app/assets/javascripts/headmin/controllers/flatpickr_controller.js +39 -0
  14. data/app/assets/javascripts/headmin/controllers/hello_controller.js +7 -0
  15. data/app/assets/javascripts/headmin/controllers/notification_controller.js +8 -0
  16. data/{src/js → app/assets/javascripts}/headmin/controllers/popup_controller.js +0 -1
  17. data/app/assets/javascripts/headmin/controllers/redactorx_controller.js +13 -0
  18. data/{src/js → app/assets/javascripts}/headmin/controllers/repeater_controller.js +0 -1
  19. data/app/assets/javascripts/headmin/controllers/select_controller.js +48 -0
  20. data/{src/js → app/assets/javascripts}/headmin/controllers/table_actions_controller.js +7 -37
  21. data/{src/js → app/assets/javascripts}/headmin/controllers/table_controller.js +23 -3
  22. data/app/assets/javascripts/headmin/index.js +41 -0
  23. data/app/assets/javascripts/headmin.js +15934 -0
  24. data/{src/scss → app/assets/stylesheets}/headmin/filter.scss +0 -0
  25. data/{src/scss → app/assets/stylesheets}/headmin/filters.scss +0 -0
  26. data/{src/scss → app/assets/stylesheets}/headmin/form.scss +55 -2
  27. data/{src/scss → app/assets/stylesheets}/headmin/general.scss +0 -0
  28. data/{src/scss → app/assets/stylesheets}/headmin/layout/body.scss +0 -0
  29. data/{src/scss → app/assets/stylesheets}/headmin/layout/sidebar.scss +0 -0
  30. data/{src/scss → app/assets/stylesheets}/headmin/layout.scss +0 -0
  31. data/{src/scss → app/assets/stylesheets}/headmin/login.scss +0 -0
  32. data/{src/scss/vendor/bootstrap/variables.scss → app/assets/stylesheets/headmin/overrides/bootstrap.scss} +0 -0
  33. data/{src/scss/vendor/redactorx/override.css → app/assets/stylesheets/headmin/overrides/redactorx.css} +0 -0
  34. data/{src/scss → app/assets/stylesheets}/headmin/popup.scss +0 -0
  35. data/app/assets/stylesheets/headmin/syntax.scss +349 -0
  36. data/{src/scss → app/assets/stylesheets}/headmin/table.scss +0 -0
  37. data/app/assets/stylesheets/headmin/thumbnail.scss +20 -0
  38. data/app/assets/stylesheets/headmin/utilities.scss +68 -0
  39. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_accordion.scss +118 -0
  40. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_alert.scss +57 -0
  41. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_badge.scss +29 -0
  42. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_breadcrumb.scss +28 -0
  43. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_button-group.scss +139 -0
  44. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_buttons.scss +111 -0
  45. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_card.scss +216 -0
  46. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_carousel.scss +229 -0
  47. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_close.scss +40 -0
  48. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_containers.scss +41 -0
  49. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_dropdown.scss +240 -0
  50. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_forms.scss +9 -0
  51. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_functions.scss +302 -0
  52. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_grid.scss +33 -0
  53. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_helpers.scss +9 -0
  54. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_images.scss +42 -0
  55. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_list-group.scss +174 -0
  56. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_mixins.scss +43 -0
  57. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_modal.scss +209 -0
  58. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_nav.scss +139 -0
  59. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_navbar.scss +335 -0
  60. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_offcanvas.scss +83 -0
  61. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_pagination.scss +64 -0
  62. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_placeholders.scss +51 -0
  63. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_popover.scss +158 -0
  64. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_progress.scss +48 -0
  65. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_reboot.scss +625 -0
  66. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_root.scss +54 -0
  67. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_spinners.scss +69 -0
  68. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_tables.scss +155 -0
  69. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_toasts.scss +51 -0
  70. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_tooltip.scss +115 -0
  71. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_transitions.scss +27 -0
  72. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_type.scss +104 -0
  73. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_utilities.scss +630 -0
  74. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_variables.scss +1641 -0
  75. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/bootstrap-grid.scss +67 -0
  76. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/bootstrap-reboot.scss +13 -0
  77. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/bootstrap-utilities.scss +18 -0
  78. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/bootstrap.scss +53 -0
  79. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_floating-labels.scss +63 -0
  80. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_form-check.scss +152 -0
  81. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_form-control.scss +219 -0
  82. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_form-range.scss +91 -0
  83. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_form-select.scss +72 -0
  84. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_form-text.scss +11 -0
  85. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_input-group.scss +121 -0
  86. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_labels.scss +36 -0
  87. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_validation.scss +12 -0
  88. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_clearfix.scss +3 -0
  89. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_colored-links.scss +12 -0
  90. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_position.scss +30 -0
  91. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_ratio.scss +26 -0
  92. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_stacks.scss +15 -0
  93. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_stretched-link.scss +15 -0
  94. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_text-truncation.scss +7 -0
  95. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_visually-hidden.scss +8 -0
  96. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_vr.scss +8 -0
  97. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_alert.scss +11 -0
  98. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_backdrop.scss +14 -0
  99. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_border-radius.scss +78 -0
  100. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_box-shadow.scss +18 -0
  101. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_breakpoints.scss +127 -0
  102. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_buttons.scss +133 -0
  103. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_caret.scss +64 -0
  104. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_clearfix.scss +9 -0
  105. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_color-scheme.scss +7 -0
  106. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_container.scss +9 -0
  107. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_deprecate.scss +10 -0
  108. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_forms.scss +144 -0
  109. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_gradients.scss +47 -0
  110. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_grid.scss +151 -0
  111. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_image.scss +16 -0
  112. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_list-group.scss +24 -0
  113. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_lists.scss +7 -0
  114. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_pagination.scss +31 -0
  115. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_reset-text.scss +17 -0
  116. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_resize.scss +6 -0
  117. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_table-variants.scss +21 -0
  118. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_text-truncate.scss +8 -0
  119. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_transition.scss +26 -0
  120. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_utilities.scss +89 -0
  121. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_visually-hidden.scss +29 -0
  122. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/utilities/_api.scss +47 -0
  123. data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/vendor/_rfs.scss +354 -0
  124. data/app/assets/stylesheets/headmin/vendor/flatpickr.css +903 -0
  125. data/{src/scss/vendor/redactorx → app/assets/stylesheets/headmin/vendor}/redactorx.css +0 -0
  126. data/app/assets/stylesheets/headmin/vendor/tom-select-bootstrap.css +537 -0
  127. data/app/assets/stylesheets/headmin.css +13454 -0
  128. data/app/assets/stylesheets/headmin.scss +65 -0
  129. data/app/helpers/headmin/admin_helper.rb +1 -0
  130. data/app/helpers/headmin/bootstrap_helper.rb +25 -3
  131. data/app/helpers/headmin/documentation_helper.rb +35 -0
  132. data/app/helpers/headmin/form_helper.rb +4 -0
  133. data/app/helpers/headmin/request_helper.rb +3 -8
  134. data/app/models/headmin/documentation_renderer.rb +32 -0
  135. data/app/models/headmin/form/base.rb +79 -0
  136. data/app/models/headmin/form/text.rb +53 -0
  137. data/app/services/block_service.rb +1 -1
  138. data/app/views/examples/admin.html.erb +1 -1
  139. data/app/views/headmin/_blocks.html.erb +2 -2
  140. data/app/views/headmin/_breadcrumbs.html.erb +1 -1
  141. data/app/views/headmin/_card.html.erb +10 -6
  142. data/app/views/headmin/_dropdown.html.erb +1 -1
  143. data/app/views/headmin/_filters.html.erb +22 -10
  144. data/app/views/headmin/_form.html.erb +14 -14
  145. data/app/views/headmin/_heading.html.erb +1 -1
  146. data/app/views/headmin/_notifications.html.erb +1 -1
  147. data/app/views/headmin/_pagination.html.erb +3 -5
  148. data/app/views/headmin/_popup.html.erb +10 -4
  149. data/app/views/headmin/_table.html.erb +10 -4
  150. data/app/views/headmin/_thumbnail.html.erb +45 -0
  151. data/app/views/headmin/dropdown/_devise.html.erb +2 -2
  152. data/app/views/headmin/dropdown/_list.html.erb +3 -6
  153. data/app/views/headmin/filters/_date.html.erb +9 -13
  154. data/app/views/headmin/filters/_flatpickr.html.erb +57 -0
  155. data/app/views/headmin/filters/_search.html.erb +5 -5
  156. data/app/views/headmin/filters/_select.html.erb +6 -6
  157. data/app/views/headmin/filters/filter/_button.html.erb +7 -7
  158. data/app/views/headmin/filters/filter/_template.html.erb +1 -1
  159. data/app/views/headmin/forms/_actions.html.erb +1 -1
  160. data/app/views/headmin/forms/_base.html.erb +100 -46
  161. data/app/views/headmin/forms/_blocks.html.erb +4 -4
  162. data/app/views/headmin/forms/_checkbox.html.erb +3 -3
  163. data/app/views/headmin/forms/_date.html.erb +30 -34
  164. data/app/views/headmin/forms/_date_range.html.erb +42 -0
  165. data/app/views/headmin/forms/_email.html.erb +35 -26
  166. data/app/views/headmin/forms/_file.html.erb +186 -34
  167. data/app/views/headmin/forms/_flatpickr.html.erb +34 -0
  168. data/app/views/headmin/forms/_flatpickr_range.html.erb +50 -0
  169. data/app/views/headmin/forms/_hidden.html.erb +24 -0
  170. data/app/views/headmin/forms/_image.html.erb +11 -45
  171. data/app/views/headmin/forms/_label.html.erb +18 -12
  172. data/app/views/headmin/forms/_number.html.erb +40 -37
  173. data/app/views/headmin/forms/_password.html.erb +37 -58
  174. data/app/views/headmin/forms/_redactorx.html.erb +8 -7
  175. data/app/views/headmin/forms/_repeater.html.erb +6 -6
  176. data/app/views/headmin/forms/_select.html.erb +43 -45
  177. data/app/views/headmin/forms/_text.html.erb +94 -59
  178. data/app/views/headmin/forms/_textarea.html.erb +37 -26
  179. data/app/views/headmin/forms/_url.html.erb +35 -26
  180. data/app/views/headmin/forms/_validation.html.erb +3 -3
  181. data/app/views/headmin/forms/_video.html.erb +21 -0
  182. data/app/views/headmin/forms/fields/_base.html.erb +3 -3
  183. data/app/views/headmin/forms/fields/_file.html.erb +2 -2
  184. data/app/views/headmin/forms/fields/_group.html.erb +3 -3
  185. data/app/views/headmin/forms/fields/_image.html.erb +2 -2
  186. data/app/views/headmin/forms/fields/_list.html.erb +3 -3
  187. data/app/views/headmin/forms/fields/_text.html.erb +2 -2
  188. data/app/views/headmin/forms/repeater/_row.html.erb +1 -1
  189. data/app/views/headmin/heading/_title.html.erb +1 -1
  190. data/app/views/headmin/layout/_body.html.erb +1 -1
  191. data/app/views/headmin/layout/_content.html.erb +1 -1
  192. data/app/views/headmin/layout/_footer.html.erb +1 -1
  193. data/app/views/headmin/layout/_header.html.erb +1 -1
  194. data/app/views/headmin/layout/_main.html.erb +12 -6
  195. data/app/views/headmin/layout/_sidebar.html.erb +3 -3
  196. data/app/views/headmin/layout/sidebar/_bottom.html.erb +1 -1
  197. data/app/views/headmin/layout/sidebar/_nav.html.erb +1 -1
  198. data/app/views/headmin/nav/_dropdown.html.erb +34 -0
  199. data/app/views/headmin/nav/_item.html.erb +22 -13
  200. data/app/views/headmin/table/_actions.html.erb +3 -5
  201. data/app/views/headmin/table/_body.html.erb +1 -1
  202. data/app/views/headmin/table/_foot.html.erb +1 -1
  203. data/app/views/headmin/table/_footer.html.erb +1 -1
  204. data/app/views/headmin/table/_head.html.erb +1 -1
  205. data/app/views/headmin/table/_header.html.erb +1 -1
  206. data/app/views/headmin/table/actions/_action.html.erb +4 -4
  207. data/app/views/headmin/table/actions/_delete.html.erb +1 -1
  208. data/app/views/headmin/table/actions/_export.html.erb +1 -1
  209. data/app/views/headmin/table/body/_row.html.erb +15 -7
  210. data/config/importmap.rb +2 -0
  211. data/config/locales/en.yml +0 -3
  212. data/config/locales/headmin/forms/en.yml +5 -0
  213. data/config/locales/headmin/forms/nl.yml +5 -0
  214. data/config/locales/headmin/popup/en.yml +4 -0
  215. data/config/locales/headmin/popup/nl.yml +4 -0
  216. data/config/locales/headmin/thumbnail/en.yml +4 -0
  217. data/config/locales/headmin/thumbnail/nl.yml +4 -0
  218. data/config/locales/nl.yml +0 -3
  219. data/esbuild-css.js +25 -0
  220. data/esbuild-js.js +11 -0
  221. data/headmin.gemspec +4 -1
  222. data/lib/headmin/engine.rb +15 -0
  223. data/lib/headmin/version.rb +1 -1
  224. data/lib/headmin.rb +1 -1
  225. data/package.json +18 -34
  226. data/src/js/headmin.js +1 -1
  227. data/src/scss/headmin.scss +1 -61
  228. data/yarn.lock +393 -5177
  229. metadata +191 -34
  230. data/.nvmrc +0 -1
  231. data/app/controllers/concerns/headmin/ckeditor.rb +0 -27
  232. data/app/views/headmin/forms/_ckeditor.html.erb +0 -42
  233. data/dist/css/headmin.css +0 -12354
  234. data/dist/js/headmin.js +0 -1080
  235. data/src/js/headmin/headmin.js +0 -141
  236. data/src/scss/headmin/utilities.scss +0 -19
  237. data/webpack.config.js +0 -30
@@ -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
@@ -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>
@@ -1,13 +1,19 @@
1
- <%#
2
- headmin/layout/main
3
- accepts block: yes
4
- parameters: none
1
+ <%
2
+ # headmin/layout/main
3
+ #
4
+ # ==== Examples
5
+ # Basic version
6
+ # <%= render 'headmin/layout/main' do %#>
7
+ # ...
8
+ # <% end %#>
9
+
10
+ class_names = local_assigns.has_key?(:class) ? local_assigns[:class] : false
5
11
  %>
6
12
 
7
- <div class="main" data-controller="popup">
13
+ <div class="main <%= class_names %>" data-controller="popup">
8
14
  <div class="container-fluid">
9
15
  <div class="row">
10
- <%= yield if block_given? %>
16
+ <%= yield %>
11
17
  </div>
12
18
  </div>
13
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>
@@ -9,12 +9,11 @@
9
9
  # <%= render 'headmin/table/actions/delete', url: destroy_admin_pages_path %#>
10
10
  # <% end %#>
11
11
 
12
- selection_count = content_for(:collection_total_count).to_i || 0
13
12
  %>
14
13
 
15
14
  <% content_for :table_actions do %>
16
15
  <th class="h-table-actions d-none" data-controller="table-actions" data-table-actions-target="wrapper" data-table-target="actions">
17
- <%= form_with data: { 'table-actions-target': 'form' } do |form| %>
16
+ <%= form_with url: '', data: { 'table-actions-target': 'form' } do |form| %>
18
17
  <%= form.hidden_field :authenticity_token, value: form_authenticity_token %>
19
18
  <%= form.hidden_field :_method, value: 'POST', 'data-table-actions-target': 'method' %>
20
19
  <%= query_parameter_fields(form) %>
@@ -28,16 +27,15 @@
28
27
  <div class="d-flex align-items-center gap-3">
29
28
  <label class="text-nowrap"
30
29
  data-table-actions-target="counter"
31
- data-total-count="<%= selection_count %>"
32
30
  data-items-zero="<%= t('.items_html', count: 0) %>"
33
31
  data-items-one="<%= t('.items_html', count: 1) %>"
34
32
  data-items-other="<%= t('.items_html', count: 2) %>"
35
33
  >
36
- <%= t('.items_html', count: selection_count) %>
34
+ <%= t('.items_html', count: 0) %>
37
35
  </label>
38
36
  <select class="form-select me-1" data-table-actions-target="select" data-action="change->table-actions#update">
39
37
  <option disabled selected="selected"><%= t('.selection') %></option>
40
- <%= yield if block_given? %>
38
+ <%= yield %>
41
39
  </select>
42
40
  </div>
43
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.
@@ -2,7 +2,7 @@
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.
@@ -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.
@@ -1,9 +1,17 @@
1
- <%#
2
- headmin/table/body/row
3
- accepts block: yes
4
- parameters: none
5
- %>
1
+ <%
2
+ # headmin/table/body/row
3
+ #
4
+ # ==== Options
5
+ # * +class</tt> - Custom class names to add to the table row
6
+ #
7
+ # ==== Examples
8
+ # <%= render 'headmin/table/body/row' do %#>
9
+ # <%= render 'headmin/table/body/id', value: page.id %#>
10
+ # <%= render 'headmin/table/body/string', value: page.title %#>
11
+ # <% end %#>
6
12
 
7
- <tr>
8
- <%= yield if block_given? %>
13
+ class_names = local_assigns.has_key?(:class) ? local_assigns[:class] : false
14
+ %>
15
+ <tr class="<%= class_names %>" data-table-target="row">
16
+ <%= yield %>
9
17
  </tr>
@@ -0,0 +1,2 @@
1
+ # Pin npm packages by running ./bin/importmap
2
+ pin "headmin"
@@ -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
@@ -3,10 +3,25 @@ module Headmin
3
3
  engine_name 'headmin'
4
4
 
5
5
  require 'closure_tree'
6
+ require 'redcarpet'
7
+ require 'rouge'
6
8
 
7
9
  # Add translations to main app
8
10
  config.before_configuration do
9
11
  config.i18n.load_path += Dir["#{config.root}/config/locales/**/*.yml"]
10
12
  end
13
+
14
+ # Add assets to precompilation list
15
+ initializer "headmin.assets" do |app|
16
+ next unless app.config.respond_to?(:assets)
17
+ app.config.assets.precompile += %w( headmin.js headmin.css headmin.scss)
18
+ end
19
+
20
+ # Add importmap to main app
21
+ initializer "headmin.importmap", before: "importmap" do |app|
22
+ next unless app.config.respond_to?(:importmap)
23
+ app.config.importmap.paths << Engine.root.join("config/importmap.rb")
24
+ app.config.importmap.cache_sweepers << Engine.root.join("app/assets/javascripts")
25
+ end
11
26
  end
12
27
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Headmin
4
- VERSION = "0.2.6"
4
+ VERSION = "0.3.2"
5
5
  end
data/lib/headmin.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "headmin/version"
4
- require_relative "headmin/engine"
4
+ require_relative "headmin/engine"