headmin 0.3.3 → 0.4.1

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 (160) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +27 -0
  3. data/.gitignore +14 -0
  4. data/.nvmrc +1 -0
  5. data/CHANGELOG.md +24 -0
  6. data/Gemfile +7 -4
  7. data/Gemfile.lock +171 -3
  8. data/README.md +9 -1
  9. data/Rakefile +1 -7
  10. data/app/assets/javascripts/headmin/config/i18n.js +9 -9
  11. data/app/assets/javascripts/headmin/controllers/autocomplete_controller.js +318 -0
  12. data/app/assets/javascripts/headmin/controllers/blocks_controller.js +74 -79
  13. data/app/assets/javascripts/headmin/controllers/date_range_controller.js +24 -24
  14. data/app/assets/javascripts/headmin/controllers/dropzone_controller.js +23 -25
  15. data/app/assets/javascripts/headmin/controllers/file_preview_controller.js +237 -237
  16. data/app/assets/javascripts/headmin/controllers/filter_controller.js +44 -44
  17. data/app/assets/javascripts/headmin/controllers/filters_controller.js +57 -61
  18. data/app/assets/javascripts/headmin/controllers/flatpickr_controller.js +29 -29
  19. data/app/assets/javascripts/headmin/controllers/hello_controller.js +3 -3
  20. data/app/assets/javascripts/headmin/controllers/notification_controller.js +7 -6
  21. data/app/assets/javascripts/headmin/controllers/popup_controller.js +57 -51
  22. data/app/assets/javascripts/headmin/controllers/redactorx_controller.js +36 -9
  23. data/app/assets/javascripts/headmin/controllers/repeater_controller.js +122 -125
  24. data/app/assets/javascripts/headmin/controllers/select_controller.js +40 -39
  25. data/app/assets/javascripts/headmin/controllers/table_actions_controller.js +88 -77
  26. data/app/assets/javascripts/headmin/controllers/table_controller.js +115 -116
  27. data/app/assets/javascripts/headmin/index.js +38 -35
  28. data/app/assets/javascripts/headmin.js +309 -42
  29. data/app/assets/stylesheets/headmin/forms/autocomplete.scss +21 -0
  30. data/app/assets/stylesheets/headmin/forms/file.scss +46 -0
  31. data/app/assets/stylesheets/headmin/forms/repeater.scss +62 -0
  32. data/app/assets/stylesheets/headmin/forms/search.scss +12 -0
  33. data/app/assets/stylesheets/headmin/forms.scss +11 -0
  34. data/app/assets/stylesheets/headmin/general.scss +14 -0
  35. data/app/assets/stylesheets/headmin/overrides/bootstrap.scss +5 -3
  36. data/app/assets/stylesheets/headmin/overrides/redactorx.scss +74 -0
  37. data/app/assets/stylesheets/headmin/popup.scss +1 -0
  38. data/app/assets/stylesheets/headmin/syntax.scss +36 -349
  39. data/app/assets/stylesheets/headmin/table.scss +1 -1
  40. data/app/assets/stylesheets/headmin/utilities/buttons.scss +19 -0
  41. data/app/assets/stylesheets/headmin/utilities/dropzone.scss +72 -0
  42. data/app/assets/stylesheets/headmin/utilities.scss +2 -68
  43. data/app/assets/stylesheets/headmin.css +209 -205
  44. data/app/assets/stylesheets/headmin.scss +1 -1
  45. data/app/helpers/headmin/admin_helper.rb +0 -1
  46. data/app/helpers/headmin/form_helper.rb +2 -8
  47. data/app/models/concerns/headmin/blockable.rb +1 -1
  48. data/app/models/concerns/headmin/field.rb +1 -0
  49. data/app/models/concerns/headmin/form/autocompletable.rb +38 -0
  50. data/app/models/concerns/headmin/form/hintable.rb +19 -0
  51. data/app/models/concerns/headmin/form/input_groupable.rb +23 -0
  52. data/app/models/concerns/headmin/form/labelable.rb +33 -0
  53. data/app/models/concerns/headmin/form/listable.rb +28 -0
  54. data/app/models/concerns/headmin/form/placeholderable.rb +13 -0
  55. data/app/models/concerns/headmin/form/validatable.rb +40 -0
  56. data/app/models/concerns/headmin/form/wrappable.rb +21 -0
  57. data/app/models/headmin/.DS_Store +0 -0
  58. data/app/models/headmin/blocks_view.rb +15 -0
  59. data/app/models/headmin/form/blocks_view.rb +29 -0
  60. data/app/models/headmin/form/checkbox_view.rb +52 -0
  61. data/app/models/headmin/form/date_range_view.rb +25 -0
  62. data/app/models/headmin/form/date_view.rb +45 -0
  63. data/app/models/headmin/form/email_view.rb +48 -0
  64. data/app/models/headmin/form/file_view.rb +116 -0
  65. data/app/models/headmin/form/flatpickr_range_view.rb +102 -0
  66. data/app/models/headmin/form/flatpickr_view.rb +37 -0
  67. data/app/models/headmin/form/hidden_view.rb +10 -0
  68. data/app/models/headmin/form/hint_view.rb +6 -0
  69. data/app/models/headmin/form/input_group_view.rb +19 -0
  70. data/app/models/headmin/form/label_view.rb +24 -0
  71. data/app/models/headmin/form/number_view.rb +49 -0
  72. data/app/models/headmin/form/password_view.rb +44 -0
  73. data/app/models/headmin/form/redactorx_view.rb +59 -0
  74. data/app/models/headmin/form/search_view.rb +48 -0
  75. data/app/models/headmin/form/select_view.rb +62 -0
  76. data/app/models/headmin/form/switch_view.rb +23 -0
  77. data/app/models/headmin/form/text_view.rb +48 -0
  78. data/app/models/headmin/form/textarea_view.rb +44 -0
  79. data/app/models/headmin/form/url_view.rb +48 -0
  80. data/app/models/headmin/form/wrapper_view.rb +19 -0
  81. data/app/models/headmin/form/wysiwyg_view.rb +17 -0
  82. data/app/models/headmin/{thumbnail.rb → thumbnail_view.rb} +6 -1
  83. data/app/models/view_model.rb +58 -0
  84. data/app/views/headmin/_blocks.html.erb +13 -9
  85. data/app/views/headmin/_heading.html.erb +7 -1
  86. data/app/views/headmin/_thumbnail.html.erb +1 -37
  87. data/app/views/headmin/forms/_autocomplete.html.erb +11 -0
  88. data/app/views/headmin/forms/_blocks.html.erb +16 -17
  89. data/app/views/headmin/forms/_checkbox.html.erb +24 -29
  90. data/app/views/headmin/forms/_datalist.html.erb +3 -0
  91. data/app/views/headmin/forms/_date.html.erb +24 -24
  92. data/app/views/headmin/forms/_date_range.html.erb +19 -21
  93. data/app/views/headmin/forms/_email.html.erb +27 -32
  94. data/app/views/headmin/forms/_errors.html.erb +2 -3
  95. data/app/views/headmin/forms/_file.html.erb +84 -181
  96. data/app/views/headmin/forms/_flatpickr.html.erb +19 -20
  97. data/app/views/headmin/forms/_flatpickr_range.html.erb +28 -37
  98. data/app/views/headmin/forms/_hidden.html.erb +9 -10
  99. data/app/views/headmin/forms/_hint.html.erb +16 -0
  100. data/app/views/headmin/forms/_input_group.html.erb +21 -0
  101. data/app/views/headmin/forms/_label.html.erb +5 -13
  102. data/app/views/headmin/forms/_number.html.erb +23 -35
  103. data/app/views/headmin/forms/_password.html.erb +21 -30
  104. data/app/views/headmin/forms/_redactorx.html.erb +21 -40
  105. data/app/views/headmin/forms/_repeater.html.erb +55 -60
  106. data/app/views/headmin/forms/_search.html.erb +43 -0
  107. data/app/views/headmin/forms/_select.html.erb +24 -49
  108. data/app/views/headmin/forms/_switch.html.erb +29 -0
  109. data/app/views/headmin/forms/_text.html.erb +42 -96
  110. data/app/views/headmin/forms/_textarea.html.erb +21 -32
  111. data/app/views/headmin/forms/_url.html.erb +26 -31
  112. data/app/views/headmin/forms/_validation.html.erb +10 -13
  113. data/app/views/headmin/forms/_wrapper.html.erb +9 -0
  114. data/app/views/headmin/forms/_wysiwyg.html.erb +28 -0
  115. data/app/views/headmin/forms/autocomplete/_item.html.erb +3 -0
  116. data/app/views/headmin/forms/autocomplete/_list.html.erb +3 -0
  117. data/app/views/headmin/forms/fields/_group.html.erb +9 -2
  118. data/app/views/headmin/forms/repeater/_row.html.erb +4 -4
  119. data/app/views/headmin/table/_actions.html.erb +1 -1
  120. data/app/views/headmin/table/actions/_action.html.erb +2 -1
  121. data/app/views/headmin/table/actions/_delete.html.erb +1 -1
  122. data/bin/console +0 -1
  123. data/config/locales/headmin/forms/en.yml +1 -12
  124. data/config/locales/headmin/forms/nl.yml +1 -12
  125. data/esbuild-css.js +18 -18
  126. data/esbuild-js.js +8 -8
  127. data/headmin.gemspec +1 -3
  128. data/lib/generators/templates/controllers/auth/confirmations_controller.rb +0 -2
  129. data/lib/generators/templates/controllers/auth/omniauth_callbacks_controller.rb +0 -2
  130. data/lib/generators/templates/controllers/auth/passwords_controller.rb +0 -2
  131. data/lib/generators/templates/controllers/auth/registrations_controller.rb +0 -2
  132. data/lib/generators/templates/controllers/auth/sessions_controller.rb +0 -2
  133. data/lib/generators/templates/controllers/auth/unlocks_controller.rb +0 -2
  134. data/lib/headmin/version.rb +1 -3
  135. data/lib/headmin.rb +0 -2
  136. data/package-lock.json +5359 -0
  137. data/package.json +13 -6
  138. data/view_model_benchmark.rb +74 -0
  139. data/yarn-error.log +367 -0
  140. data/yarn.lock +1575 -31
  141. metadata +63 -24
  142. data/app/assets/stylesheets/headmin/form.scss +0 -132
  143. data/app/assets/stylesheets/headmin/overrides/redactorx.css +0 -3
  144. data/app/helpers/headmin/documentation_helper.rb +0 -35
  145. data/app/models/headmin/documentation_renderer.rb +0 -32
  146. data/app/models/headmin/form/base.rb +0 -78
  147. data/app/models/headmin/form/text.rb +0 -51
  148. data/app/services/block_service.rb +0 -72
  149. data/app/views/headmin/_card.html.erb +0 -52
  150. data/app/views/headmin/forms/_actions.html.erb +0 -28
  151. data/app/views/headmin/forms/_base.html.erb +0 -114
  152. data/app/views/headmin/forms/_image.html.erb +0 -21
  153. data/app/views/headmin/forms/_video.html.erb +0 -21
  154. data/app/views/headmin/forms/actions/_destroy.html.erb +0 -13
  155. data/app/views/headmin/forms/actions/_save.html.erb +0 -12
  156. data/app/views/headmin/forms/actions/_view.html.erb +0 -15
  157. data/docs/blocks-and-fields.md +0 -54
  158. data/docs/blocks.md +0 -48
  159. data/docs/devise.md +0 -41
  160. data/docs/fields.md +0 -79
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: headmin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jef Vlamings
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-31 00:00:00.000000000 Z
11
+ date: 2022-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: closure_tree
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '3.27'
61
+ version: '3.28'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '3.27'
68
+ version: '3.28'
69
69
  description: A complete library of commonly used components to build an admin interface
70
70
  in your Ruby on Rails project.
71
71
  email:
@@ -74,7 +74,9 @@ executables: []
74
74
  extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
+ - ".github/workflows/ci.yml"
77
78
  - ".gitignore"
79
+ - ".nvmrc"
78
80
  - ".ruby-version"
79
81
  - CHANGELOG.md
80
82
  - CODE_OF_CONDUCT.md
@@ -92,6 +94,7 @@ files:
92
94
  - app/assets/images/video.mp4
93
95
  - app/assets/javascripts/headmin.js
94
96
  - app/assets/javascripts/headmin/config/i18n.js
97
+ - app/assets/javascripts/headmin/controllers/autocomplete_controller.js
95
98
  - app/assets/javascripts/headmin/controllers/blocks_controller.js
96
99
  - app/assets/javascripts/headmin/controllers/date_range_controller.js
97
100
  - app/assets/javascripts/headmin/controllers/dropzone_controller.js
@@ -112,19 +115,25 @@ files:
112
115
  - app/assets/stylesheets/headmin.scss
113
116
  - app/assets/stylesheets/headmin/filter.scss
114
117
  - app/assets/stylesheets/headmin/filters.scss
115
- - app/assets/stylesheets/headmin/form.scss
118
+ - app/assets/stylesheets/headmin/forms.scss
119
+ - app/assets/stylesheets/headmin/forms/autocomplete.scss
120
+ - app/assets/stylesheets/headmin/forms/file.scss
121
+ - app/assets/stylesheets/headmin/forms/repeater.scss
122
+ - app/assets/stylesheets/headmin/forms/search.scss
116
123
  - app/assets/stylesheets/headmin/general.scss
117
124
  - app/assets/stylesheets/headmin/layout.scss
118
125
  - app/assets/stylesheets/headmin/layout/body.scss
119
126
  - app/assets/stylesheets/headmin/layout/sidebar.scss
120
127
  - app/assets/stylesheets/headmin/login.scss
121
128
  - app/assets/stylesheets/headmin/overrides/bootstrap.scss
122
- - app/assets/stylesheets/headmin/overrides/redactorx.css
129
+ - app/assets/stylesheets/headmin/overrides/redactorx.scss
123
130
  - app/assets/stylesheets/headmin/popup.scss
124
131
  - app/assets/stylesheets/headmin/syntax.scss
125
132
  - app/assets/stylesheets/headmin/table.scss
126
133
  - app/assets/stylesheets/headmin/thumbnail.scss
127
134
  - app/assets/stylesheets/headmin/utilities.scss
135
+ - app/assets/stylesheets/headmin/utilities/buttons.scss
136
+ - app/assets/stylesheets/headmin/utilities/dropzone.scss
128
137
  - app/assets/stylesheets/headmin/vendor/bootstrap/scss/_accordion.scss
129
138
  - app/assets/stylesheets/headmin/vendor/bootstrap/scss/_alert.scss
130
139
  - app/assets/stylesheets/headmin/vendor/bootstrap/scss/_badge.scss
@@ -221,7 +230,6 @@ files:
221
230
  - app/controllers/concerns/headmin/sortable.rb
222
231
  - app/helpers/headmin/admin_helper.rb
223
232
  - app/helpers/headmin/bootstrap_helper.rb
224
- - app/helpers/headmin/documentation_helper.rb
225
233
  - app/helpers/headmin/filter_helper.rb
226
234
  - app/helpers/headmin/form_helper.rb
227
235
  - app/helpers/headmin/notification_helper.rb
@@ -230,16 +238,45 @@ files:
230
238
  - app/models/concerns/headmin/blockable.rb
231
239
  - app/models/concerns/headmin/field.rb
232
240
  - app/models/concerns/headmin/fieldable.rb
233
- - app/models/headmin/documentation_renderer.rb
234
- - app/models/headmin/form/base.rb
235
- - app/models/headmin/form/text.rb
236
- - app/models/headmin/thumbnail.rb
237
- - app/services/block_service.rb
241
+ - app/models/concerns/headmin/form/autocompletable.rb
242
+ - app/models/concerns/headmin/form/hintable.rb
243
+ - app/models/concerns/headmin/form/input_groupable.rb
244
+ - app/models/concerns/headmin/form/labelable.rb
245
+ - app/models/concerns/headmin/form/listable.rb
246
+ - app/models/concerns/headmin/form/placeholderable.rb
247
+ - app/models/concerns/headmin/form/validatable.rb
248
+ - app/models/concerns/headmin/form/wrappable.rb
249
+ - app/models/headmin/.DS_Store
250
+ - app/models/headmin/blocks_view.rb
251
+ - app/models/headmin/form/blocks_view.rb
252
+ - app/models/headmin/form/checkbox_view.rb
253
+ - app/models/headmin/form/date_range_view.rb
254
+ - app/models/headmin/form/date_view.rb
255
+ - app/models/headmin/form/email_view.rb
256
+ - app/models/headmin/form/file_view.rb
257
+ - app/models/headmin/form/flatpickr_range_view.rb
258
+ - app/models/headmin/form/flatpickr_view.rb
259
+ - app/models/headmin/form/hidden_view.rb
260
+ - app/models/headmin/form/hint_view.rb
261
+ - app/models/headmin/form/input_group_view.rb
262
+ - app/models/headmin/form/label_view.rb
263
+ - app/models/headmin/form/number_view.rb
264
+ - app/models/headmin/form/password_view.rb
265
+ - app/models/headmin/form/redactorx_view.rb
266
+ - app/models/headmin/form/search_view.rb
267
+ - app/models/headmin/form/select_view.rb
268
+ - app/models/headmin/form/switch_view.rb
269
+ - app/models/headmin/form/text_view.rb
270
+ - app/models/headmin/form/textarea_view.rb
271
+ - app/models/headmin/form/url_view.rb
272
+ - app/models/headmin/form/wrapper_view.rb
273
+ - app/models/headmin/form/wysiwyg_view.rb
274
+ - app/models/headmin/thumbnail_view.rb
275
+ - app/models/view_model.rb
238
276
  - app/views/examples/admin.html.erb
239
277
  - app/views/examples/auth.html.erb
240
278
  - app/views/headmin/_blocks.html.erb
241
279
  - app/views/headmin/_breadcrumbs.html.erb
242
- - app/views/headmin/_card.html.erb
243
280
  - app/views/headmin/_dropdown.html.erb
244
281
  - app/views/headmin/_filters.html.erb
245
282
  - app/views/headmin/_form.html.erb
@@ -263,10 +300,10 @@ files:
263
300
  - app/views/headmin/filters/filter/_button.html.erb
264
301
  - app/views/headmin/filters/filter/_menu_item.html.erb
265
302
  - app/views/headmin/filters/filter/_template.html.erb
266
- - app/views/headmin/forms/_actions.html.erb
267
- - app/views/headmin/forms/_base.html.erb
303
+ - app/views/headmin/forms/_autocomplete.html.erb
268
304
  - app/views/headmin/forms/_blocks.html.erb
269
305
  - app/views/headmin/forms/_checkbox.html.erb
306
+ - app/views/headmin/forms/_datalist.html.erb
270
307
  - app/views/headmin/forms/_date.html.erb
271
308
  - app/views/headmin/forms/_date_range.html.erb
272
309
  - app/views/headmin/forms/_email.html.erb
@@ -275,21 +312,24 @@ files:
275
312
  - app/views/headmin/forms/_flatpickr.html.erb
276
313
  - app/views/headmin/forms/_flatpickr_range.html.erb
277
314
  - app/views/headmin/forms/_hidden.html.erb
278
- - app/views/headmin/forms/_image.html.erb
315
+ - app/views/headmin/forms/_hint.html.erb
316
+ - app/views/headmin/forms/_input_group.html.erb
279
317
  - app/views/headmin/forms/_label.html.erb
280
318
  - app/views/headmin/forms/_number.html.erb
281
319
  - app/views/headmin/forms/_password.html.erb
282
320
  - app/views/headmin/forms/_redactorx.html.erb
283
321
  - app/views/headmin/forms/_repeater.html.erb
322
+ - app/views/headmin/forms/_search.html.erb
284
323
  - app/views/headmin/forms/_select.html.erb
324
+ - app/views/headmin/forms/_switch.html.erb
285
325
  - app/views/headmin/forms/_text.html.erb
286
326
  - app/views/headmin/forms/_textarea.html.erb
287
327
  - app/views/headmin/forms/_url.html.erb
288
328
  - app/views/headmin/forms/_validation.html.erb
289
- - app/views/headmin/forms/_video.html.erb
290
- - app/views/headmin/forms/actions/_destroy.html.erb
291
- - app/views/headmin/forms/actions/_save.html.erb
292
- - app/views/headmin/forms/actions/_view.html.erb
329
+ - app/views/headmin/forms/_wrapper.html.erb
330
+ - app/views/headmin/forms/_wysiwyg.html.erb
331
+ - app/views/headmin/forms/autocomplete/_item.html.erb
332
+ - app/views/headmin/forms/autocomplete/_list.html.erb
293
333
  - app/views/headmin/forms/fields/_base.html.erb
294
334
  - app/views/headmin/forms/fields/_file.html.erb
295
335
  - app/views/headmin/forms/fields/_group.html.erb
@@ -384,10 +424,6 @@ files:
384
424
  - config/locales/headmin/views/en.yml
385
425
  - config/locales/headmin/views/nl.yml
386
426
  - config/locales/nl.yml
387
- - docs/blocks-and-fields.md
388
- - docs/blocks.md
389
- - docs/devise.md
390
- - docs/fields.md
391
427
  - esbuild-css.js
392
428
  - esbuild-js.js
393
429
  - headmin.gemspec
@@ -421,9 +457,12 @@ files:
421
457
  - lib/headmin.rb
422
458
  - lib/headmin/engine.rb
423
459
  - lib/headmin/version.rb
460
+ - package-lock.json
424
461
  - package.json
425
462
  - src/js/headmin.js
426
463
  - src/scss/headmin.scss
464
+ - view_model_benchmark.rb
465
+ - yarn-error.log
427
466
  - yarn.lock
428
467
  homepage: https://github.com/insiting/headmin
429
468
  licenses:
@@ -1,132 +0,0 @@
1
- input[type="search"] {
2
- background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%236c757d' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E%0A");
3
- background-repeat: no-repeat;
4
- background-position: 10px center;
5
- padding-left: 35px
6
- }
7
-
8
- .form-control[readonly] {
9
- background-color: transparent;
10
- }
11
-
12
- .form-label[required="required"]:after {
13
- content: '*';
14
- margin-left: 1px;
15
- }
16
-
17
- .forms-group {
18
- .card-footer {
19
- border-top: none;
20
- }
21
- }
22
-
23
- .repeater {
24
- position: relative;
25
- }
26
-
27
- .repeater-row {
28
- position: relative;
29
-
30
- &:hover {
31
- .repeater-row-remove {
32
- visibility: visible;
33
- }
34
-
35
- .repeater-row-add {
36
- visibility: visible;
37
- }
38
-
39
- .repeater-row-handle {
40
- visibility: visible;
41
- }
42
- }
43
- }
44
-
45
- .repeater-row-remove {
46
- position: absolute;
47
- top: calc(50% - 17px);
48
- right: -22px;
49
- z-index: 2;
50
- visibility: hidden;
51
-
52
- i.bi {
53
- background: white;
54
- border-radius: 50%;
55
- }
56
- }
57
-
58
- .repeater-row-add {
59
- position: absolute;
60
- top: calc(100% - 18px);
61
- right: calc(50% - 17px);
62
- z-index: 2;
63
- visibility: hidden;
64
-
65
- i.bi {
66
- background: white;
67
- border-radius: 50%;
68
- }
69
- }
70
-
71
- .repeater-row-handle {
72
- position: absolute;
73
- top: 0;
74
- left: 0;
75
- height: 100%;
76
- width: 18px;
77
- display: flex;
78
- align-items: center;
79
- justify-content: center;
80
- z-index: 2;
81
- visibility: hidden;
82
- cursor: move;
83
- }
84
-
85
- .h-form-file {
86
- position: relative;
87
-
88
- .h-form-file-thumbnails {
89
- margin-bottom: map-get($spacers, 2);
90
- }
91
-
92
- &.h-dropzone {
93
- padding: map-get($spacers, 2);
94
-
95
- .h-form-file-thumbnails {
96
- margin-bottom: 0;
97
- }
98
- }
99
- }
100
-
101
- .h-form-file-thumbnails {
102
- position: relative;
103
- display: flex;
104
- flex-wrap: wrap;
105
- gap: map-get($spacers, 2);
106
- }
107
-
108
- .h-form-file-thumbnail {
109
- position: relative;
110
- pointer-events: initial !important;
111
- display: flex;
112
- }
113
-
114
- .h-form-file-thumbnail-remove {
115
- position: absolute;
116
- top: 0;
117
- right: 0;
118
- background: $danger;
119
- width: 20px;
120
- height: 20px;
121
- display: flex;
122
- align-items: center;
123
- justify-content: center;
124
- color: white;
125
- border-radius: $border-radius;
126
- z-index: 3;
127
- cursor: pointer;
128
-
129
- &:hover {
130
- background: tint-color($danger, $btn-hover-bg-tint-amount)
131
- }
132
- }
@@ -1,3 +0,0 @@
1
- .rx-container {
2
- width: 100%;
3
- }
@@ -1,35 +0,0 @@
1
- module Headmin
2
- module DocumentationHelper
3
- def extract_documentation(text)
4
- # Get content inside documentation block
5
- starts_with = '<% documentation do %>\n'
6
- ends_with = '\n<% end %>'
7
- between = text[/#{starts_with}(.*?)#{ends_with}/m, 1]
8
-
9
- # Remove leading whitespaces from each line
10
- between.lines.map { |line| line.sub(" ", "") }.join
11
- end
12
-
13
- def markdown_to_html(text)
14
- renderer = Headmin::DocumentationRenderer.new(escape_html: true)
15
- markdown = Redcarpet::Markdown.new(renderer, tables: true, fenced_code_blocks: true)
16
- markdown.render(text)
17
- end
18
-
19
- def documentation(template = nil)
20
- # Disable rendering inside block
21
- return if block_given?
22
-
23
- # Read contents of template
24
- content = @lookup_context.find_template(template, nil, true).encode!
25
-
26
- # Extract documentation
27
- content = extract_documentation(content)
28
-
29
- # Convert markdown into HTML
30
- html = markdown_to_html(content)
31
-
32
- raw html
33
- end
34
- end
35
- end
@@ -1,32 +0,0 @@
1
- module Headmin
2
- class DocumentationRenderer < Redcarpet::Render::HTML
3
- def block_code(code, language)
4
- if language == "erbx"
5
- "<div class=\"card mb-3\"><div class=\"card-body\">#{render_code(code)}</div><div class=\"card-footer\"><pre><code class=\"h-syntax\">#{highlight_syntax(code, "erb")}</code></pre></div></div>"
6
- else
7
- "<pre><code class=\"h-syntax\">#{highlight_syntax(code, language)}</code></pre></div>"
8
- end
9
- end
10
-
11
- def table(header, body)
12
- "<table class=\"table table-sm\">#{header}#{body}</table>"
13
- end
14
-
15
- private
16
-
17
- def highlight_syntax(code, language)
18
- formatter = Rouge::Formatters::HTML.new
19
- lexer = Rouge::Lexer.find(language)
20
- formatter.format(lexer.lex(code))
21
- end
22
-
23
- def render_code(code)
24
- ApplicationController.renderer.new(
25
- "action_dispatch.request.path_parameters" => {
26
- controller: "main",
27
- action: "index"
28
- }
29
- ).render(inline: code)
30
- end
31
- end
32
- end
@@ -1,78 +0,0 @@
1
- module Headmin
2
- module Form
3
- class Base
4
- def initialize(local_assigns)
5
- @local_assigns = local_assigns
6
- end
7
-
8
- def class_names
9
- class_names = [@local_assigns[:class]]
10
- class_names << "form-floating" if float
11
- class_names << "mb-3 text-start"
12
- class_names.join(" ")
13
- end
14
-
15
- def data
16
- @local_assigns[:data]
17
- end
18
-
19
- def label_options
20
- {
21
- attribute: attribute,
22
- class: "d-block",
23
- for: id,
24
- form: form,
25
- required: required,
26
- text: label
27
- }
28
- end
29
-
30
- def required
31
- @local_assigns[:required]
32
- end
33
-
34
- def form
35
- @local_assigns[:form]
36
- end
37
-
38
- def id
39
- @local_assigns[:id]
40
- end
41
-
42
- def validation_options
43
- {
44
- attribute: attribute,
45
- form: form
46
- }
47
- end
48
-
49
- def attribute
50
- @local_assigns[:attribute]
51
- end
52
-
53
- def list
54
- @local_assigns[:list]
55
- end
56
-
57
- def list_id
58
- list ? "#{attribute}_list" : nil
59
- end
60
-
61
- def append
62
- @local_assigns[:append]
63
- end
64
-
65
- def prepend
66
- @local_assigns[:prepend]
67
- end
68
-
69
- def float
70
- @local_assigns[:float] || false
71
- end
72
-
73
- def label
74
- @local_assigns[:label]
75
- end
76
- end
77
- end
78
- end
@@ -1,51 +0,0 @@
1
- module Headmin
2
- module Form
3
- class Text
4
- def initialize(local_assigns, request)
5
- @local_assigns = local_assigns
6
- @request = request
7
- end
8
-
9
- def placeholder
10
- @local_assigns[:float] ? @local_assigns[:placeholder] || attribute : @local_assigns[:placeholder]
11
- end
12
-
13
- def attribute
14
- @local_assigns[:attribute]
15
- end
16
-
17
- def form
18
- @local_assigns[:form]
19
- end
20
-
21
- def options
22
- option_keys = %i[aria autocomplete autofocus data disabled id maxlength minlength list pattern placeholder readonly required spellcheck size value]
23
- @local_assigns.slice(*option_keys).merge(
24
- aria: {describedby: form_field_validation_id(form, attribute)},
25
- class: ["form-control", form_field_validation_class(form, attribute)].join(" "),
26
- list: @local_assigns[:list] ? "#{attribute}_list" : nil,
27
- placeholder: placeholder
28
- )
29
- end
30
-
31
- attr_reader :local_assigns
32
-
33
- def form_field_valid?(form, name)
34
- return unless form.object
35
-
36
- !form.object.errors.has_key?(name)
37
- end
38
-
39
- def form_field_validation_id(form, name)
40
- return unless form.object
41
-
42
- [form.object_name, name.to_s, "validation"].join("_").parameterize.underscore
43
- end
44
-
45
- def form_field_validation_class(form, name)
46
- return nil if @request.get?
47
- form.object.errors.has_key?(name) ? "is-invalid" : "is-valid"
48
- end
49
- end
50
- end
51
- end
@@ -1,72 +0,0 @@
1
- class BlockService
2
- class << self
3
- def block_names(path:)
4
- form_views(path: path).map do |view|
5
- view_name(view)
6
- end
7
- end
8
-
9
- def form_view(name, path:)
10
- view_by_name(name, form_view_paths(path))
11
- end
12
-
13
- def frontend_view(name, path:)
14
- view_by_name(name, frontend_view_paths(path))
15
- end
16
-
17
- def frontend_views(path:)
18
- views(frontend_view_paths(path))
19
- end
20
-
21
- def form_views(path:)
22
- views(form_view_paths(path))
23
- end
24
-
25
- def view_name(view)
26
- filename = File.basename(view.split(".")[0])
27
-
28
- # Removes leading _ if exists
29
- filename.sub(/^_/, "")
30
- end
31
-
32
- # Looks for a block view by its name.
33
- #
34
- # It will first search in a specified path and will fallback to the default path
35
- # An exception will be raised if the view is nowhere to be found
36
- def view_by_name(name, paths)
37
- views = views(paths)
38
- view = views.find { |view| view.include?("/_#{name}.html.erb") }
39
-
40
- unless view
41
- prefixes = paths.map { |path| path.split("app/views/").last }
42
- raise ActionView::MissingTemplate.new(paths, name, prefixes, true, "headmin") unless view
43
- end
44
-
45
- view
46
- end
47
-
48
- def form_view_paths(path)
49
- [app_view_path(path), app_view_path("admin/blocks")].uniq
50
- end
51
-
52
- def frontend_view_paths(path)
53
- [app_view_path(path), app_view_path("website/blocks")].uniq
54
- end
55
-
56
- def app_view_path(path)
57
- base_path = "app/views"
58
- [base_path, path].join("/")
59
- end
60
-
61
- def views(paths)
62
- paths.map { |path| views_in_path(path) }.flatten
63
- end
64
-
65
- def views_in_path(path)
66
- files = Dir.glob("#{path}/*")
67
- files.map do |file|
68
- file.split("app/views/").last
69
- end
70
- end
71
- end
72
- end
@@ -1,52 +0,0 @@
1
- <% warn "[DEPRECATION] `headmin/card` is deprecated. Please use plain Bootstrap markup." %>
2
- <%
3
- # DEPRECATED in 0.3
4
- # headmin/card
5
- #
6
- # ==== Options
7
- # * +title</tt> - Title for card
8
- # * +description</tt> - Description for card
9
- # * +id</tt> - HTML Id Attribute
10
- # * +padded</tt> - Set to true if you want to render the block content inside the card-body element
11
- #
12
- # ==== Examples
13
- # Basic version.
14
- # <%= render 'headmin/card' do %#>
15
- # Your content
16
- # <% end %#>
17
- #
18
- # Title and description
19
- # <%= render 'headmin/card', title: 'Title', description: 'Description' do %#>
20
- # Your content
21
- # <% end %#>
22
-
23
- id = local_assigns.has_key?(:id) ? id : nil
24
- title = local_assigns.has_key?(:title) ? title : nil
25
- description = local_assigns.has_key?(:description) ? description : nil
26
- padded = local_assigns.has_key?(:padded) ? padded : true
27
- %>
28
-
29
- <div class="card mb-3 shadow-sm" id="<%= id %>">
30
-
31
- <% if padded || title || description %>
32
- <div class="card-body">
33
- <% if title.present? %>
34
- <h5 class="card-title"><%= title %></h5>
35
- <% end %>
36
-
37
- <% if description.present? %>
38
- <p class="card-text text-secondary"><%= description %></p>
39
- <% end %>
40
-
41
- <!-- Render inside body-->
42
- <% if padded %>
43
- <%= yield %>
44
- <% end %>
45
- </div>
46
- <% end %>
47
-
48
- <!-- Render outside body-->
49
- <% unless padded %>
50
- <%= yield %>
51
- <% end %>
52
- </div>
@@ -1,28 +0,0 @@
1
- <%#
2
- headmin/forms/actions
3
- accepts block: true
4
- parameters:
5
- form: (object) Form object
6
- %>
7
-
8
- <div class="card forms-actions shadow-sm mb-3">
9
- <div class="card-body">
10
- <h5 class="card-title"><%= t('.title') %></h5>
11
- <p class="card-text"><%= t('.description') %></p>
12
-
13
- <% if form.object.persisted? %>
14
- <dl>
15
- <dt><%= form.object.class.human_attribute_name(:created_at) %></dt>
16
- <dd><%= form.object.created_at.strftime(t('.format')) %></dd>
17
- <dt><%= form.object.class.human_attribute_name(:updated_at) %></dt>
18
- <dd><%= form.object.updated_at.strftime(t('.format')) %></dd>
19
- </dl>
20
- <% end %>
21
-
22
- <%= yield %>
23
-
24
- <%= render 'headmin/forms/actions/destroy', form: form %>
25
- <hr>
26
- <%= render 'headmin/forms/actions/save', form: form %>
27
- </div>
28
- </div>