headmin 0.3.2 → 0.4.0

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 (186) 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/.ruby-version +1 -1
  6. data/CHANGELOG.md +24 -0
  7. data/Gemfile +8 -5
  8. data/Gemfile.lock +197 -25
  9. data/README.md +9 -1
  10. data/Rakefile +1 -7
  11. data/app/assets/images/document.docx +0 -0
  12. data/app/assets/images/document.pdf +0 -0
  13. data/app/assets/images/image.jpg +0 -0
  14. data/app/assets/images/spreadsheet.xls +0 -0
  15. data/app/assets/images/video.mp4 +0 -0
  16. data/app/assets/javascripts/headmin/config/i18n.js +9 -9
  17. data/app/assets/javascripts/headmin/controllers/autocomplete_controller.js +255 -0
  18. data/app/assets/javascripts/headmin/controllers/blocks_controller.js +74 -79
  19. data/app/assets/javascripts/headmin/controllers/date_range_controller.js +24 -24
  20. data/app/assets/javascripts/headmin/controllers/dropzone_controller.js +23 -25
  21. data/app/assets/javascripts/headmin/controllers/file_preview_controller.js +237 -237
  22. data/app/assets/javascripts/headmin/controllers/filter_controller.js +44 -44
  23. data/app/assets/javascripts/headmin/controllers/filters_controller.js +57 -61
  24. data/app/assets/javascripts/headmin/controllers/flatpickr_controller.js +29 -29
  25. data/app/assets/javascripts/headmin/controllers/hello_controller.js +3 -3
  26. data/app/assets/javascripts/headmin/controllers/notification_controller.js +7 -6
  27. data/app/assets/javascripts/headmin/controllers/popup_controller.js +51 -52
  28. data/app/assets/javascripts/headmin/controllers/redactorx_controller.js +36 -9
  29. data/app/assets/javascripts/headmin/controllers/repeater_controller.js +122 -125
  30. data/app/assets/javascripts/headmin/controllers/select_controller.js +40 -39
  31. data/app/assets/javascripts/headmin/controllers/table_actions_controller.js +88 -77
  32. data/app/assets/javascripts/headmin/controllers/table_controller.js +103 -89
  33. data/app/assets/javascripts/headmin/index.js +38 -39
  34. data/app/assets/javascripts/headmin.js +287 -732
  35. data/app/assets/stylesheets/headmin/forms/autocomplete.scss +21 -0
  36. data/app/assets/stylesheets/headmin/forms/file.scss +46 -0
  37. data/app/assets/stylesheets/headmin/forms/repeater.scss +62 -0
  38. data/app/assets/stylesheets/headmin/forms/search.scss +12 -0
  39. data/app/assets/stylesheets/headmin/forms.scss +11 -0
  40. data/app/assets/stylesheets/headmin/general.scss +5 -0
  41. data/app/assets/stylesheets/headmin/overrides/bootstrap.scss +5 -3
  42. data/app/assets/stylesheets/headmin/overrides/redactorx.scss +74 -0
  43. data/app/assets/stylesheets/headmin/popup.scss +1 -0
  44. data/app/assets/stylesheets/headmin/syntax.scss +36 -349
  45. data/app/assets/stylesheets/headmin/table.scss +1 -1
  46. data/app/assets/stylesheets/headmin/utilities/buttons.scss +19 -0
  47. data/app/assets/stylesheets/headmin/utilities/dropzone.scss +72 -0
  48. data/app/assets/stylesheets/headmin/utilities.scss +2 -68
  49. data/app/assets/stylesheets/headmin/vendor/tom-select-bootstrap.css +1 -2
  50. data/app/assets/stylesheets/headmin.css +206 -206
  51. data/app/assets/stylesheets/headmin.scss +1 -1
  52. data/app/controllers/concerns/headmin/authentication.rb +1 -1
  53. data/app/controllers/concerns/headmin/searchable.rb +1 -1
  54. data/app/controllers/concerns/headmin/sortable.rb +7 -7
  55. data/app/helpers/headmin/admin_helper.rb +1 -2
  56. data/app/helpers/headmin/bootstrap_helper.rb +2 -24
  57. data/app/helpers/headmin/filter_helper.rb +1 -1
  58. data/app/helpers/headmin/form_helper.rb +5 -11
  59. data/app/helpers/headmin/notification_helper.rb +21 -21
  60. data/app/helpers/headmin/request_helper.rb +3 -3
  61. data/app/models/concerns/headmin/block.rb +1 -2
  62. data/app/models/concerns/headmin/blockable.rb +2 -2
  63. data/app/models/concerns/headmin/field.rb +2 -1
  64. data/app/models/concerns/headmin/fieldable.rb +8 -8
  65. data/app/models/concerns/headmin/form/autocompletable.rb +38 -0
  66. data/app/models/concerns/headmin/form/hintable.rb +19 -0
  67. data/app/models/concerns/headmin/form/input_groupable.rb +23 -0
  68. data/app/models/concerns/headmin/form/labelable.rb +33 -0
  69. data/app/models/concerns/headmin/form/listable.rb +28 -0
  70. data/app/models/concerns/headmin/form/placeholderable.rb +13 -0
  71. data/app/models/concerns/headmin/form/validatable.rb +40 -0
  72. data/app/models/concerns/headmin/form/wrappable.rb +21 -0
  73. data/app/models/headmin/.DS_Store +0 -0
  74. data/app/models/headmin/blocks_view.rb +15 -0
  75. data/app/models/headmin/form/blocks_view.rb +29 -0
  76. data/app/models/headmin/form/checkbox_view.rb +52 -0
  77. data/app/models/headmin/form/date_range_view.rb +25 -0
  78. data/app/models/headmin/form/date_view.rb +45 -0
  79. data/app/models/headmin/form/email_view.rb +48 -0
  80. data/app/models/headmin/form/file_view.rb +116 -0
  81. data/app/models/headmin/form/flatpickr_range_view.rb +102 -0
  82. data/app/models/headmin/form/flatpickr_view.rb +37 -0
  83. data/app/models/headmin/form/hidden_view.rb +10 -0
  84. data/app/models/headmin/form/hint_view.rb +6 -0
  85. data/app/models/headmin/form/input_group_view.rb +19 -0
  86. data/app/models/headmin/form/label_view.rb +24 -0
  87. data/app/models/headmin/form/number_view.rb +49 -0
  88. data/app/models/headmin/form/password_view.rb +44 -0
  89. data/app/models/headmin/form/redactorx_view.rb +59 -0
  90. data/app/models/headmin/form/search_view.rb +48 -0
  91. data/app/models/headmin/form/select_view.rb +62 -0
  92. data/app/models/headmin/form/switch_view.rb +23 -0
  93. data/app/models/headmin/form/text_view.rb +48 -0
  94. data/app/models/headmin/form/textarea_view.rb +44 -0
  95. data/app/models/headmin/form/url_view.rb +48 -0
  96. data/app/models/headmin/form/wrapper_view.rb +19 -0
  97. data/app/models/headmin/form/wysiwyg_view.rb +17 -0
  98. data/app/models/headmin/thumbnail_view.rb +66 -0
  99. data/app/models/view_model.rb +58 -0
  100. data/app/views/headmin/_blocks.html.erb +13 -9
  101. data/app/views/headmin/_heading.html.erb +7 -1
  102. data/app/views/headmin/_thumbnail.html.erb +5 -39
  103. data/app/views/headmin/dropdown/_item.html.erb +1 -1
  104. data/app/views/headmin/forms/_autocomplete.html.erb +11 -0
  105. data/app/views/headmin/forms/_blocks.html.erb +16 -17
  106. data/app/views/headmin/forms/_checkbox.html.erb +24 -29
  107. data/app/views/headmin/forms/_datalist.html.erb +3 -0
  108. data/app/views/headmin/forms/_date.html.erb +24 -24
  109. data/app/views/headmin/forms/_date_range.html.erb +19 -21
  110. data/app/views/headmin/forms/_email.html.erb +27 -32
  111. data/app/views/headmin/forms/_errors.html.erb +2 -3
  112. data/app/views/headmin/forms/_file.html.erb +84 -181
  113. data/app/views/headmin/forms/_flatpickr.html.erb +19 -20
  114. data/app/views/headmin/forms/_flatpickr_range.html.erb +28 -37
  115. data/app/views/headmin/forms/_hidden.html.erb +9 -10
  116. data/app/views/headmin/forms/_hint.html.erb +16 -0
  117. data/app/views/headmin/forms/_input_group.html.erb +21 -0
  118. data/app/views/headmin/forms/_label.html.erb +5 -13
  119. data/app/views/headmin/forms/_number.html.erb +23 -35
  120. data/app/views/headmin/forms/_password.html.erb +21 -30
  121. data/app/views/headmin/forms/_redactorx.html.erb +21 -40
  122. data/app/views/headmin/forms/_repeater.html.erb +55 -60
  123. data/app/views/headmin/forms/_search.html.erb +43 -0
  124. data/app/views/headmin/forms/_select.html.erb +24 -49
  125. data/app/views/headmin/forms/_switch.html.erb +29 -0
  126. data/app/views/headmin/forms/_text.html.erb +42 -96
  127. data/app/views/headmin/forms/_textarea.html.erb +21 -32
  128. data/app/views/headmin/forms/_url.html.erb +26 -31
  129. data/app/views/headmin/forms/_validation.html.erb +10 -13
  130. data/app/views/headmin/forms/_wrapper.html.erb +9 -0
  131. data/app/views/headmin/forms/_wysiwyg.html.erb +28 -0
  132. data/app/views/headmin/forms/autocomplete/_item.html.erb +3 -0
  133. data/app/views/headmin/forms/autocomplete/_list.html.erb +3 -0
  134. data/app/views/headmin/forms/fields/_group.html.erb +6 -4
  135. data/app/views/headmin/forms/repeater/_row.html.erb +4 -4
  136. data/app/views/headmin/nav/item/_devise.html.erb +1 -1
  137. data/app/views/headmin/table/_actions.html.erb +1 -1
  138. data/app/views/headmin/table/actions/_action.html.erb +2 -1
  139. data/app/views/headmin/table/actions/_delete.html.erb +1 -1
  140. data/app/views/headmin/views/devise/registrations/_edit.html.erb +2 -2
  141. data/bin/console +0 -1
  142. data/config/initializers/customize_input_error.rb +4 -4
  143. data/config/locales/headmin/forms/en.yml +0 -11
  144. data/config/locales/headmin/forms/nl.yml +0 -11
  145. data/esbuild-css.js +18 -18
  146. data/esbuild-js.js +8 -8
  147. data/headmin.gemspec +1 -3
  148. data/lib/generators/headmin/blocks_generator.rb +8 -8
  149. data/lib/generators/headmin/devise_generator.rb +4 -4
  150. data/lib/generators/headmin/fields_generator.rb +9 -9
  151. data/lib/generators/templates/controllers/auth/confirmations_controller.rb +1 -3
  152. data/lib/generators/templates/controllers/auth/omniauth_callbacks_controller.rb +1 -3
  153. data/lib/generators/templates/controllers/auth/passwords_controller.rb +1 -3
  154. data/lib/generators/templates/controllers/auth/registrations_controller.rb +1 -3
  155. data/lib/generators/templates/controllers/auth/sessions_controller.rb +1 -3
  156. data/lib/generators/templates/controllers/auth/unlocks_controller.rb +1 -3
  157. data/lib/generators/templates/models/block.rb +1 -1
  158. data/lib/headmin/engine.rb +6 -6
  159. data/lib/headmin/version.rb +1 -3
  160. data/lib/headmin.rb +0 -2
  161. data/package-lock.json +5359 -0
  162. data/package.json +13 -7
  163. data/view_model_benchmark.rb +74 -0
  164. data/yarn-error.log +367 -0
  165. data/yarn.lock +1448 -161
  166. metadata +69 -25
  167. data/.rubocop.yml +0 -13
  168. data/app/assets/stylesheets/headmin/form.scss +0 -132
  169. data/app/assets/stylesheets/headmin/overrides/redactorx.css +0 -3
  170. data/app/helpers/headmin/documentation_helper.rb +0 -35
  171. data/app/models/headmin/documentation_renderer.rb +0 -32
  172. data/app/models/headmin/form/base.rb +0 -79
  173. data/app/models/headmin/form/text.rb +0 -53
  174. data/app/services/block_service.rb +0 -72
  175. data/app/views/headmin/_card.html.erb +0 -52
  176. data/app/views/headmin/forms/_actions.html.erb +0 -28
  177. data/app/views/headmin/forms/_base.html.erb +0 -114
  178. data/app/views/headmin/forms/_image.html.erb +0 -21
  179. data/app/views/headmin/forms/_video.html.erb +0 -21
  180. data/app/views/headmin/forms/actions/_destroy.html.erb +0 -13
  181. data/app/views/headmin/forms/actions/_save.html.erb +0 -12
  182. data/app/views/headmin/forms/actions/_view.html.erb +0 -15
  183. data/docs/blocks-and-fields.md +0 -54
  184. data/docs/blocks.md +0 -48
  185. data/docs/devise.md +0 -41
  186. 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.2
4
+ version: 0.4.0
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-20 00:00:00.000000000 Z
11
+ date: 2022-04-14 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,8 +74,9 @@ executables: []
74
74
  extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
+ - ".github/workflows/ci.yml"
77
78
  - ".gitignore"
78
- - ".rubocop.yml"
79
+ - ".nvmrc"
79
80
  - ".ruby-version"
80
81
  - CHANGELOG.md
81
82
  - CODE_OF_CONDUCT.md
@@ -86,8 +87,14 @@ files:
86
87
  - Rakefile
87
88
  - app/assets/config/headmin_manifest.js
88
89
  - app/assets/images/avatar.jpg
90
+ - app/assets/images/document.docx
91
+ - app/assets/images/document.pdf
92
+ - app/assets/images/image.jpg
93
+ - app/assets/images/spreadsheet.xls
94
+ - app/assets/images/video.mp4
89
95
  - app/assets/javascripts/headmin.js
90
96
  - app/assets/javascripts/headmin/config/i18n.js
97
+ - app/assets/javascripts/headmin/controllers/autocomplete_controller.js
91
98
  - app/assets/javascripts/headmin/controllers/blocks_controller.js
92
99
  - app/assets/javascripts/headmin/controllers/date_range_controller.js
93
100
  - app/assets/javascripts/headmin/controllers/dropzone_controller.js
@@ -108,19 +115,25 @@ files:
108
115
  - app/assets/stylesheets/headmin.scss
109
116
  - app/assets/stylesheets/headmin/filter.scss
110
117
  - app/assets/stylesheets/headmin/filters.scss
111
- - 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
112
123
  - app/assets/stylesheets/headmin/general.scss
113
124
  - app/assets/stylesheets/headmin/layout.scss
114
125
  - app/assets/stylesheets/headmin/layout/body.scss
115
126
  - app/assets/stylesheets/headmin/layout/sidebar.scss
116
127
  - app/assets/stylesheets/headmin/login.scss
117
128
  - app/assets/stylesheets/headmin/overrides/bootstrap.scss
118
- - app/assets/stylesheets/headmin/overrides/redactorx.css
129
+ - app/assets/stylesheets/headmin/overrides/redactorx.scss
119
130
  - app/assets/stylesheets/headmin/popup.scss
120
131
  - app/assets/stylesheets/headmin/syntax.scss
121
132
  - app/assets/stylesheets/headmin/table.scss
122
133
  - app/assets/stylesheets/headmin/thumbnail.scss
123
134
  - app/assets/stylesheets/headmin/utilities.scss
135
+ - app/assets/stylesheets/headmin/utilities/buttons.scss
136
+ - app/assets/stylesheets/headmin/utilities/dropzone.scss
124
137
  - app/assets/stylesheets/headmin/vendor/bootstrap/scss/_accordion.scss
125
138
  - app/assets/stylesheets/headmin/vendor/bootstrap/scss/_alert.scss
126
139
  - app/assets/stylesheets/headmin/vendor/bootstrap/scss/_badge.scss
@@ -217,7 +230,6 @@ files:
217
230
  - app/controllers/concerns/headmin/sortable.rb
218
231
  - app/helpers/headmin/admin_helper.rb
219
232
  - app/helpers/headmin/bootstrap_helper.rb
220
- - app/helpers/headmin/documentation_helper.rb
221
233
  - app/helpers/headmin/filter_helper.rb
222
234
  - app/helpers/headmin/form_helper.rb
223
235
  - app/helpers/headmin/notification_helper.rb
@@ -226,15 +238,45 @@ files:
226
238
  - app/models/concerns/headmin/blockable.rb
227
239
  - app/models/concerns/headmin/field.rb
228
240
  - app/models/concerns/headmin/fieldable.rb
229
- - app/models/headmin/documentation_renderer.rb
230
- - app/models/headmin/form/base.rb
231
- - app/models/headmin/form/text.rb
232
- - 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
233
276
  - app/views/examples/admin.html.erb
234
277
  - app/views/examples/auth.html.erb
235
278
  - app/views/headmin/_blocks.html.erb
236
279
  - app/views/headmin/_breadcrumbs.html.erb
237
- - app/views/headmin/_card.html.erb
238
280
  - app/views/headmin/_dropdown.html.erb
239
281
  - app/views/headmin/_filters.html.erb
240
282
  - app/views/headmin/_form.html.erb
@@ -258,10 +300,10 @@ files:
258
300
  - app/views/headmin/filters/filter/_button.html.erb
259
301
  - app/views/headmin/filters/filter/_menu_item.html.erb
260
302
  - app/views/headmin/filters/filter/_template.html.erb
261
- - app/views/headmin/forms/_actions.html.erb
262
- - app/views/headmin/forms/_base.html.erb
303
+ - app/views/headmin/forms/_autocomplete.html.erb
263
304
  - app/views/headmin/forms/_blocks.html.erb
264
305
  - app/views/headmin/forms/_checkbox.html.erb
306
+ - app/views/headmin/forms/_datalist.html.erb
265
307
  - app/views/headmin/forms/_date.html.erb
266
308
  - app/views/headmin/forms/_date_range.html.erb
267
309
  - app/views/headmin/forms/_email.html.erb
@@ -270,21 +312,24 @@ files:
270
312
  - app/views/headmin/forms/_flatpickr.html.erb
271
313
  - app/views/headmin/forms/_flatpickr_range.html.erb
272
314
  - app/views/headmin/forms/_hidden.html.erb
273
- - app/views/headmin/forms/_image.html.erb
315
+ - app/views/headmin/forms/_hint.html.erb
316
+ - app/views/headmin/forms/_input_group.html.erb
274
317
  - app/views/headmin/forms/_label.html.erb
275
318
  - app/views/headmin/forms/_number.html.erb
276
319
  - app/views/headmin/forms/_password.html.erb
277
320
  - app/views/headmin/forms/_redactorx.html.erb
278
321
  - app/views/headmin/forms/_repeater.html.erb
322
+ - app/views/headmin/forms/_search.html.erb
279
323
  - app/views/headmin/forms/_select.html.erb
324
+ - app/views/headmin/forms/_switch.html.erb
280
325
  - app/views/headmin/forms/_text.html.erb
281
326
  - app/views/headmin/forms/_textarea.html.erb
282
327
  - app/views/headmin/forms/_url.html.erb
283
328
  - app/views/headmin/forms/_validation.html.erb
284
- - app/views/headmin/forms/_video.html.erb
285
- - app/views/headmin/forms/actions/_destroy.html.erb
286
- - app/views/headmin/forms/actions/_save.html.erb
287
- - 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
288
333
  - app/views/headmin/forms/fields/_base.html.erb
289
334
  - app/views/headmin/forms/fields/_file.html.erb
290
335
  - app/views/headmin/forms/fields/_group.html.erb
@@ -379,10 +424,6 @@ files:
379
424
  - config/locales/headmin/views/en.yml
380
425
  - config/locales/headmin/views/nl.yml
381
426
  - config/locales/nl.yml
382
- - docs/blocks-and-fields.md
383
- - docs/blocks.md
384
- - docs/devise.md
385
- - docs/fields.md
386
427
  - esbuild-css.js
387
428
  - esbuild-js.js
388
429
  - headmin.gemspec
@@ -416,9 +457,12 @@ files:
416
457
  - lib/headmin.rb
417
458
  - lib/headmin/engine.rb
418
459
  - lib/headmin/version.rb
460
+ - package-lock.json
419
461
  - package.json
420
462
  - src/js/headmin.js
421
463
  - src/scss/headmin.scss
464
+ - view_model_benchmark.rb
465
+ - yarn-error.log
422
466
  - yarn.lock
423
467
  homepage: https://github.com/insiting/headmin
424
468
  licenses:
@@ -442,7 +486,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
442
486
  - !ruby/object:Gem::Version
443
487
  version: '0'
444
488
  requirements: []
445
- rubygems_version: 3.2.3
489
+ rubygems_version: 3.3.3
446
490
  signing_key:
447
491
  specification_version: 4
448
492
  summary: Admin component library
data/.rubocop.yml DELETED
@@ -1,13 +0,0 @@
1
- AllCops:
2
- TargetRubyVersion: 2.4
3
-
4
- Style/StringLiterals:
5
- Enabled: true
6
- EnforcedStyle: double_quotes
7
-
8
- Style/StringLiteralsInInterpolation:
9
- Enabled: true
10
- EnforcedStyle: double_quotes
11
-
12
- Layout/LineLength:
13
- Max: 120
@@ -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,79 +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
-
64
- end
65
-
66
- def prepend
67
- @local_assigns[:prepend]
68
- end
69
-
70
- def float
71
- @local_assigns[:float] || false
72
- end
73
-
74
- def label
75
- @local_assigns[:label]
76
- end
77
- end
78
- end
79
- end
@@ -1,53 +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
- def local_assigns
32
- @local_assigns
33
- end
34
-
35
- def form_field_valid?(form, name)
36
- return unless form.object
37
-
38
- !form.object.errors.has_key?(name)
39
- end
40
-
41
- def form_field_validation_id(form, name)
42
- return unless form.object
43
-
44
- [form.object_name, name.to_s, "validation"].join("_").parameterize.underscore
45
- end
46
-
47
- def form_field_validation_class(form, name)
48
- return nil if @request.get?
49
- form.object.errors.has_key?(name) ? 'is-invalid' : 'is-valid'
50
- end
51
- end
52
- end
53
- end
@@ -1,72 +0,0 @@
1
- class BlockService
2
- def self.block_names(path:)
3
- form_views(path: path).map do |view|
4
- view_name(view)
5
- end
6
- end
7
-
8
- def self.form_view(name, path:)
9
- view_by_name(name, form_view_paths(path))
10
- end
11
-
12
- def self.frontend_view(name, path:)
13
- view_by_name(name, frontend_view_paths(path))
14
- end
15
-
16
- def self.frontend_views(path:)
17
- views(frontend_view_paths(path))
18
- end
19
-
20
- def self.form_views(path:)
21
- views(form_view_paths(path))
22
- end
23
-
24
- def self.view_name(view)
25
- filename = File.basename(view.split('.')[0])
26
-
27
- # Removes leading _ if exists
28
- filename.sub(/^_/, '')
29
- end
30
-
31
- private
32
-
33
- # Looks for a block view by its name.
34
- #
35
- # It will first search in a specified path and will fallback to the default path
36
- # An exception will be raised if the view is nowhere to be found
37
- def self.view_by_name(name, paths)
38
- views = views(paths)
39
- view = views.find { |view| view.include?("/_#{name}.html.erb") }
40
-
41
- unless view
42
- prefixes = paths.map { |path| path.split('app/views/').last }
43
- raise ActionView::MissingTemplate.new(paths, name, prefixes, true, "headmin") unless view
44
- end
45
-
46
- view
47
- end
48
-
49
- def self.form_view_paths(path)
50
- [app_view_path(path), app_view_path('admin/blocks')].uniq
51
- end
52
-
53
- def self.frontend_view_paths(path)
54
- [app_view_path(path), app_view_path('website/blocks')].uniq
55
- end
56
-
57
- def self.app_view_path(path)
58
- base_path = 'app/views'
59
- [base_path, path].join('/')
60
- end
61
-
62
- def self.views(paths)
63
- paths.map { |path| views_in_path(path) }.flatten
64
- end
65
-
66
- def self.views_in_path(path)
67
- files = Dir.glob("#{path}/*")
68
- files.map do |file|
69
- file.split('app/views/').last
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>