headmin 0.3.4 → 0.4.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 (162) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +27 -0
  3. data/.gitignore +14 -0
  4. data/.lock-487e157d270f3062a98b7b2a012753708-1272821827 +0 -0
  5. data/.nvmrc +1 -0
  6. data/CHANGELOG.md +31 -0
  7. data/Gemfile +7 -4
  8. data/Gemfile.lock +191 -25
  9. data/README.md +7 -0
  10. data/Rakefile +1 -7
  11. data/app/assets/javascripts/headmin/config/i18n.js +9 -9
  12. data/app/assets/javascripts/headmin/controllers/autocomplete_controller.js +318 -0
  13. data/app/assets/javascripts/headmin/controllers/blocks_controller.js +74 -79
  14. data/app/assets/javascripts/headmin/controllers/date_range_controller.js +24 -24
  15. data/app/assets/javascripts/headmin/controllers/dropzone_controller.js +23 -25
  16. data/app/assets/javascripts/headmin/controllers/file_preview_controller.js +237 -237
  17. data/app/assets/javascripts/headmin/controllers/filter_controller.js +44 -44
  18. data/app/assets/javascripts/headmin/controllers/filters_controller.js +57 -61
  19. data/app/assets/javascripts/headmin/controllers/flatpickr_controller.js +29 -29
  20. data/app/assets/javascripts/headmin/controllers/hello_controller.js +3 -3
  21. data/app/assets/javascripts/headmin/controllers/notification_controller.js +7 -6
  22. data/app/assets/javascripts/headmin/controllers/popup_controller.js +57 -51
  23. data/app/assets/javascripts/headmin/controllers/redactorx_controller.js +36 -9
  24. data/app/assets/javascripts/headmin/controllers/repeater_controller.js +122 -125
  25. data/app/assets/javascripts/headmin/controllers/select_controller.js +40 -39
  26. data/app/assets/javascripts/headmin/controllers/table_actions_controller.js +100 -101
  27. data/app/assets/javascripts/headmin/controllers/table_controller.js +115 -115
  28. data/app/assets/javascripts/headmin/index.js +38 -35
  29. data/app/assets/javascripts/headmin.js +295 -37
  30. data/app/assets/stylesheets/headmin/forms/autocomplete.scss +21 -0
  31. data/app/assets/stylesheets/headmin/forms/file.scss +46 -0
  32. data/app/assets/stylesheets/headmin/forms/repeater.scss +62 -0
  33. data/app/assets/stylesheets/headmin/forms/search.scss +12 -0
  34. data/app/assets/stylesheets/headmin/forms.scss +11 -0
  35. data/app/assets/stylesheets/headmin/general.scss +14 -0
  36. data/app/assets/stylesheets/headmin/overrides/bootstrap.scss +5 -3
  37. data/app/assets/stylesheets/headmin/overrides/redactorx.scss +74 -0
  38. data/app/assets/stylesheets/headmin/popup.scss +1 -0
  39. data/app/assets/stylesheets/headmin/syntax.scss +36 -349
  40. data/app/assets/stylesheets/headmin/table.scss +1 -1
  41. data/app/assets/stylesheets/headmin/utilities/buttons.scss +19 -0
  42. data/app/assets/stylesheets/headmin/utilities/dropzone.scss +72 -0
  43. data/app/assets/stylesheets/headmin/utilities.scss +2 -68
  44. data/app/assets/stylesheets/headmin.css +209 -205
  45. data/app/assets/stylesheets/headmin.scss +1 -1
  46. data/app/helpers/headmin/admin_helper.rb +0 -1
  47. data/app/helpers/headmin/form_helper.rb +2 -8
  48. data/app/models/concerns/headmin/blockable.rb +1 -1
  49. data/app/models/concerns/headmin/field.rb +4 -1
  50. data/app/models/concerns/headmin/fieldable.rb +138 -44
  51. data/app/models/concerns/headmin/form/autocompletable.rb +38 -0
  52. data/app/models/concerns/headmin/form/hintable.rb +19 -0
  53. data/app/models/concerns/headmin/form/input_groupable.rb +23 -0
  54. data/app/models/concerns/headmin/form/labelable.rb +33 -0
  55. data/app/models/concerns/headmin/form/listable.rb +28 -0
  56. data/app/models/concerns/headmin/form/placeholderable.rb +13 -0
  57. data/app/models/concerns/headmin/form/validatable.rb +40 -0
  58. data/app/models/concerns/headmin/form/wrappable.rb +21 -0
  59. data/app/models/headmin/.DS_Store +0 -0
  60. data/app/models/headmin/blocks_view.rb +15 -0
  61. data/app/models/headmin/form/blocks_view.rb +29 -0
  62. data/app/models/headmin/form/checkbox_view.rb +52 -0
  63. data/app/models/headmin/form/date_range_view.rb +25 -0
  64. data/app/models/headmin/form/date_view.rb +45 -0
  65. data/app/models/headmin/form/email_view.rb +48 -0
  66. data/app/models/headmin/form/file_view.rb +116 -0
  67. data/app/models/headmin/form/flatpickr_range_view.rb +102 -0
  68. data/app/models/headmin/form/flatpickr_view.rb +37 -0
  69. data/app/models/headmin/form/hidden_view.rb +10 -0
  70. data/app/models/headmin/form/hint_view.rb +6 -0
  71. data/app/models/headmin/form/input_group_view.rb +19 -0
  72. data/app/models/headmin/form/label_view.rb +24 -0
  73. data/app/models/headmin/form/number_view.rb +49 -0
  74. data/app/models/headmin/form/password_view.rb +44 -0
  75. data/app/models/headmin/form/redactorx_view.rb +59 -0
  76. data/app/models/headmin/form/search_view.rb +48 -0
  77. data/app/models/headmin/form/select_view.rb +62 -0
  78. data/app/models/headmin/form/switch_view.rb +23 -0
  79. data/app/models/headmin/form/text_view.rb +48 -0
  80. data/app/models/headmin/form/textarea_view.rb +44 -0
  81. data/app/models/headmin/form/url_view.rb +48 -0
  82. data/app/models/headmin/form/wrapper_view.rb +19 -0
  83. data/app/models/headmin/form/wysiwyg_view.rb +17 -0
  84. data/app/models/headmin/{thumbnail.rb → thumbnail_view.rb} +6 -1
  85. data/app/models/view_model.rb +58 -0
  86. data/app/views/headmin/_blocks.html.erb +13 -9
  87. data/app/views/headmin/_heading.html.erb +7 -1
  88. data/app/views/headmin/_thumbnail.html.erb +1 -37
  89. data/app/views/headmin/forms/_autocomplete.html.erb +11 -0
  90. data/app/views/headmin/forms/_blocks.html.erb +16 -17
  91. data/app/views/headmin/forms/_checkbox.html.erb +24 -29
  92. data/app/views/headmin/forms/_datalist.html.erb +3 -0
  93. data/app/views/headmin/forms/_date.html.erb +24 -24
  94. data/app/views/headmin/forms/_date_range.html.erb +19 -21
  95. data/app/views/headmin/forms/_email.html.erb +27 -32
  96. data/app/views/headmin/forms/_errors.html.erb +2 -3
  97. data/app/views/headmin/forms/_file.html.erb +84 -181
  98. data/app/views/headmin/forms/_flatpickr.html.erb +19 -20
  99. data/app/views/headmin/forms/_flatpickr_range.html.erb +28 -37
  100. data/app/views/headmin/forms/_hidden.html.erb +9 -10
  101. data/app/views/headmin/forms/_hint.html.erb +16 -0
  102. data/app/views/headmin/forms/_input_group.html.erb +21 -0
  103. data/app/views/headmin/forms/_label.html.erb +5 -13
  104. data/app/views/headmin/forms/_number.html.erb +23 -35
  105. data/app/views/headmin/forms/_password.html.erb +21 -30
  106. data/app/views/headmin/forms/_redactorx.html.erb +21 -40
  107. data/app/views/headmin/forms/_repeater.html.erb +55 -60
  108. data/app/views/headmin/forms/_search.html.erb +43 -0
  109. data/app/views/headmin/forms/_select.html.erb +24 -49
  110. data/app/views/headmin/forms/_switch.html.erb +29 -0
  111. data/app/views/headmin/forms/_text.html.erb +42 -96
  112. data/app/views/headmin/forms/_textarea.html.erb +21 -32
  113. data/app/views/headmin/forms/_url.html.erb +26 -31
  114. data/app/views/headmin/forms/_validation.html.erb +10 -13
  115. data/app/views/headmin/forms/_wrapper.html.erb +9 -0
  116. data/app/views/headmin/forms/_wysiwyg.html.erb +28 -0
  117. data/app/views/headmin/forms/autocomplete/_item.html.erb +3 -0
  118. data/app/views/headmin/forms/autocomplete/_list.html.erb +3 -0
  119. data/app/views/headmin/forms/fields/_file.html.erb +1 -1
  120. data/app/views/headmin/forms/fields/_files.html.erb +17 -0
  121. data/app/views/headmin/forms/fields/_group.html.erb +9 -2
  122. data/app/views/headmin/forms/repeater/_row.html.erb +4 -4
  123. data/bin/console +0 -1
  124. data/config/locales/headmin/forms/en.yml +1 -12
  125. data/config/locales/headmin/forms/nl.yml +1 -12
  126. data/esbuild-css.js +18 -18
  127. data/esbuild-js.js +8 -8
  128. data/headmin.gemspec +1 -3
  129. data/lib/generators/templates/controllers/auth/confirmations_controller.rb +0 -2
  130. data/lib/generators/templates/controllers/auth/omniauth_callbacks_controller.rb +0 -2
  131. data/lib/generators/templates/controllers/auth/passwords_controller.rb +0 -2
  132. data/lib/generators/templates/controllers/auth/registrations_controller.rb +0 -2
  133. data/lib/generators/templates/controllers/auth/sessions_controller.rb +0 -2
  134. data/lib/generators/templates/controllers/auth/unlocks_controller.rb +0 -2
  135. data/lib/headmin/version.rb +1 -3
  136. data/lib/headmin.rb +0 -2
  137. data/package-lock.json +5359 -0
  138. data/package.json +12 -4
  139. data/view_model_benchmark.rb +74 -0
  140. data/yarn-error.log +17 -12
  141. data/yarn.lock +1575 -31
  142. metadata +64 -25
  143. data/app/assets/stylesheets/headmin/form.scss +0 -132
  144. data/app/assets/stylesheets/headmin/overrides/redactorx.css +0 -3
  145. data/app/helpers/headmin/documentation_helper.rb +0 -35
  146. data/app/models/headmin/documentation_renderer.rb +0 -32
  147. data/app/models/headmin/form/base.rb +0 -78
  148. data/app/models/headmin/form/text.rb +0 -51
  149. data/app/services/block_service.rb +0 -72
  150. data/app/views/headmin/_card.html.erb +0 -52
  151. data/app/views/headmin/forms/_actions.html.erb +0 -28
  152. data/app/views/headmin/forms/_base.html.erb +0 -114
  153. data/app/views/headmin/forms/_image.html.erb +0 -21
  154. data/app/views/headmin/forms/_video.html.erb +0 -21
  155. data/app/views/headmin/forms/actions/_destroy.html.erb +0 -13
  156. data/app/views/headmin/forms/actions/_save.html.erb +0 -12
  157. data/app/views/headmin/forms/actions/_view.html.erb +0 -15
  158. data/app/views/headmin/forms/fields/_image.html.erb +0 -17
  159. data/docs/blocks-and-fields.md +0 -54
  160. data/docs/blocks.md +0 -48
  161. data/docs/devise.md +0 -41
  162. data/docs/fields.md +0 -79
@@ -1,7 +1,7 @@
1
1
  @charset "UTF-8";
2
2
  @import "https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css";
3
3
 
4
- /* sass-plugin-0:/usr/local/var/www/headmin/src/scss/headmin.scss */
4
+ /* sass-plugin-0:/opt/homebrew/var/www/headmin/src/scss/headmin.scss */
5
5
  :root {
6
6
  --bs-blue: #0d6efd;
7
7
  --bs-indigo: #6610f2;
@@ -260,7 +260,7 @@ small,
260
260
  mark,
261
261
  .mark {
262
262
  padding: 0.2em;
263
- background-color: #fcf8e3;
263
+ background-color: #ffec89;
264
264
  }
265
265
  sub,
266
266
  sup {
@@ -12913,23 +12913,134 @@ span.flatpickr-weekday {
12913
12913
  top: 3px;
12914
12914
  }
12915
12915
  .rx-container {
12916
+ padding: 0 !important;
12917
+ border: 1px solid #ced4da;
12918
+ border-radius: 0.25rem;
12919
+ }
12920
+ .rx-container.rx-in-focus {
12921
+ color: #212529;
12922
+ background-color: #fff;
12923
+ border-color: #86b7fe;
12924
+ outline: 0;
12925
+ box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.075), 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
12926
+ }
12927
+ .rx-container.rx-in-focus.is-valid {
12928
+ border-color: #198754;
12929
+ box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.25);
12930
+ }
12931
+ .rx-container.rx-in-focus.is-invalid {
12932
+ border-color: #dc3545;
12933
+ box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
12934
+ }
12935
+ .rx-container.is-valid,
12936
+ .rx-container.is-invalid {
12937
+ background-position: top calc(0.375em + 0.1875rem) right calc(0.375em + 0.1875rem);
12938
+ }
12939
+ .rx-toolbar-container.is-rx-toolbar {
12940
+ background: transparent;
12941
+ border-bottom: 1px solid #ced4da;
12942
+ }
12943
+ .rx-content {
12944
+ padding: 0.375rem 0.75rem !important;
12945
+ position: relative;
12946
+ }
12947
+ .rx-content p {
12948
+ font-size: 0.9rem;
12949
+ line-height: 1.5;
12950
+ color: #212529;
12951
+ }
12952
+ .rx-placeholder:before {
12953
+ font-size: 0.9rem;
12954
+ color: #6c757d;
12955
+ opacity: 1;
12956
+ }
12957
+ .rx-control {
12958
+ margin-left: -0.75rem;
12959
+ }
12960
+ .rx-toolbar .rx-button-icon {
12961
+ background: #fff;
12962
+ }
12963
+ .rx-toolbar .rx-button-icon span {
12964
+ color: #6c757d;
12965
+ }
12966
+ .rx-toolbar .rx-button-icon:hover span {
12967
+ color: #212529;
12968
+ }
12969
+ .form-label[required=required]:after,
12970
+ .form-check-label[required=required]:after {
12971
+ content: " *";
12972
+ color: #dc3545;
12973
+ }
12974
+ .h-autocomplete {
12975
+ position: absolute;
12976
+ top: calc(100% + 2px);
12977
+ left: 0;
12978
+ z-index: 1000;
12916
12979
  width: 100%;
12980
+ font-family: var(--bs-font-sans-serif);
12981
+ font-style: normal;
12982
+ font-weight: 400;
12983
+ line-height: 1.5;
12984
+ text-align: left;
12985
+ text-align: start;
12986
+ text-decoration: none;
12987
+ text-shadow: none;
12988
+ text-transform: none;
12989
+ letter-spacing: normal;
12990
+ word-break: normal;
12991
+ word-spacing: normal;
12992
+ white-space: normal;
12993
+ line-break: auto;
12994
+ font-size: 1rem;
12995
+ word-wrap: break-word;
12996
+ background-color: #fff;
12997
+ background-clip: padding-box;
12998
+ border-radius: 0.25rem !important;
12999
+ box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
13000
+ border: 1px solid rgba(0, 0, 0, 0.15);
13001
+ overflow: hidden;
12917
13002
  }
12918
- input[type=search] {
12919
- 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");
12920
- background-repeat: no-repeat;
12921
- background-position: 10px center;
12922
- padding-left: 35px;
13003
+ .h-autocomplete .list-group-flush {
13004
+ margin: 0;
13005
+ padding: 0;
12923
13006
  }
12924
- .form-control[readonly] {
12925
- background-color: transparent;
13007
+ .h-form-file .h-form-file-thumbnails {
13008
+ margin-bottom: 0.5rem;
12926
13009
  }
12927
- .form-label[required=required]:after {
12928
- content: "*";
12929
- margin-left: 1px;
13010
+ .h-form-file.h-dropzone {
13011
+ padding: 0.5rem;
12930
13012
  }
12931
- .forms-group .card-footer {
12932
- border-top: none;
13013
+ .h-form-file.h-dropzone .h-form-file-thumbnails {
13014
+ margin-bottom: 0;
13015
+ }
13016
+ .h-form-file-thumbnails {
13017
+ position: relative;
13018
+ display: flex;
13019
+ flex-wrap: wrap;
13020
+ gap: 0.5rem;
13021
+ }
13022
+ .h-form-file-thumbnail {
13023
+ position: relative;
13024
+ pointer-events: initial !important;
13025
+ display: flex;
13026
+ }
13027
+ .h-form-file-thumbnail-remove {
13028
+ position: absolute;
13029
+ top: 0;
13030
+ right: 0;
13031
+ background: #dc3545;
13032
+ width: 20px;
13033
+ height: 20px;
13034
+ display: flex;
13035
+ align-items: center;
13036
+ justify-content: center;
13037
+ color: white;
13038
+ border-radius: 0.25rem;
13039
+ z-index: 3;
13040
+ cursor: pointer;
13041
+ }
13042
+ .h-form-file-thumbnail-remove:hover {
13043
+ background: #e15361;
12933
13044
  }
12934
13045
  .repeater {
12935
13046
  position: relative;
@@ -12981,49 +13092,26 @@ input[type=search] {
12981
13092
  visibility: hidden;
12982
13093
  cursor: move;
12983
13094
  }
12984
- .h-form-file {
12985
- position: relative;
12986
- }
12987
- .h-form-file .h-form-file-thumbnails {
12988
- margin-bottom: 0.5rem;
12989
- }
12990
- .h-form-file.h-dropzone {
12991
- padding: 0.5rem;
12992
- }
12993
- .h-form-file.h-dropzone .h-form-file-thumbnails {
12994
- margin-bottom: 0;
12995
- }
12996
- .h-form-file-thumbnails {
12997
- position: relative;
12998
- display: flex;
12999
- flex-wrap: wrap;
13000
- gap: 0.5rem;
13001
- }
13002
- .h-form-file-thumbnail {
13003
- position: relative;
13004
- pointer-events: initial !important;
13005
- display: flex;
13006
- }
13007
- .h-form-file-thumbnail-remove {
13008
- position: absolute;
13009
- top: 0;
13010
- right: 0;
13011
- background: #dc3545;
13012
- width: 20px;
13013
- height: 20px;
13014
- display: flex;
13015
- align-items: center;
13016
- justify-content: center;
13017
- color: white;
13018
- border-radius: 0.25rem;
13019
- z-index: 3;
13020
- cursor: pointer;
13095
+ input[type=search] {
13096
+ 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");
13097
+ background-repeat: no-repeat;
13098
+ background-position: 10px center;
13099
+ padding-left: 35px !important;
13021
13100
  }
13022
- .h-form-file-thumbnail-remove:hover {
13023
- background: #e15361;
13101
+ .form-floating input[type=search] ~ label {
13102
+ padding-left: 35px;
13024
13103
  }
13025
13104
  html {
13026
13105
  height: 100%;
13106
+ background: red;
13107
+ }
13108
+ .list-group-item.active .text-muted {
13109
+ color: #fff !important;
13110
+ }
13111
+ mark,
13112
+ .mark {
13113
+ padding: 0;
13114
+ box-shadow: 0 0.2em 0 #ffec89, 0 -0.2em 0 #ffec89;
13027
13115
  }
13028
13116
  .body {
13029
13117
  background: rgba(0, 0, 0, 0.03);
@@ -13129,10 +13217,12 @@ body.empty {
13129
13217
  border: 1px solid #ced4da;
13130
13218
  }
13131
13219
  .h-dropzone {
13220
+ position: relative;
13132
13221
  border: 2px dashed #ced4da;
13133
13222
  border-radius: 0.25rem;
13134
13223
  }
13135
- .h-dropzone > *:not(input[type=file]) {
13224
+ .h-dropzone > *:not(.form-control) {
13225
+ margin: 0.5rem;
13136
13226
  pointer-events: none;
13137
13227
  z-index: 2;
13138
13228
  }
@@ -13143,19 +13233,40 @@ body.empty {
13143
13233
  .h-dropzone.dragover input[type=file] {
13144
13234
  z-index: 3;
13145
13235
  }
13146
- .h-dropzone.active {
13236
+ .h-dropzone.focus,
13237
+ .h-dropzone.dragover {
13147
13238
  border-color: #86b7fe;
13148
13239
  outline: 0;
13149
13240
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.075), 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
13150
13241
  }
13151
- .h-dropzone input[type=file] {
13242
+ .h-dropzone.focus.is-valid,
13243
+ .h-dropzone.dragover.is-valid {
13244
+ border-color: #198754;
13245
+ box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.25);
13246
+ }
13247
+ .h-dropzone.focus.is-invalid,
13248
+ .h-dropzone.dragover.is-invalid {
13249
+ border-color: #dc3545;
13250
+ box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
13251
+ }
13252
+ .h-dropzone .form-control {
13152
13253
  position: absolute;
13153
13254
  top: 0;
13154
13255
  left: 0;
13155
13256
  width: 100%;
13156
13257
  height: 100%;
13157
- opacity: 0;
13158
13258
  z-index: 1;
13259
+ border: none;
13260
+ box-shadow: none;
13261
+ text-indent: -100vw;
13262
+ color: transparent;
13263
+ background: none;
13264
+ }
13265
+ .h-dropzone.is-invalid {
13266
+ border-color: #dc3545;
13267
+ }
13268
+ .h-dropzone.is-valid {
13269
+ border-color: #198754;
13159
13270
  }
13160
13271
  .h-dropzone-placeholder {
13161
13272
  color: #6c757d;
@@ -13232,6 +13343,7 @@ body.empty {
13232
13343
  background-clip: padding-box;
13233
13344
  border-radius: 0.3rem;
13234
13345
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
13346
+ border: 1px solid rgba(0, 0, 0, 0.2);
13235
13347
  }
13236
13348
  .h-popup.closed {
13237
13349
  display: none;
@@ -13254,201 +13366,93 @@ body.empty {
13254
13366
  left: calc(50% - 14px);
13255
13367
  font-size: 28px;
13256
13368
  }
13369
+ .h-syntax {
13370
+ background-color: #ffffcc;
13371
+ }
13372
+ .h-syntax .hll {
13373
+ background-color: #ffffcc;
13374
+ }
13375
+ .h-syntax {
13376
+ background: #f8f8f8;
13377
+ }
13257
13378
  .h-syntax .c {
13258
- color: #727272;
13379
+ color: #6a737d;
13380
+ }
13381
+ .h-syntax .k {
13382
+ color: #d73a49;
13259
13383
  }
13260
13384
  .h-syntax .ch {
13261
- font-style: italic;
13262
- color: #60a0b0;
13385
+ color: #6a737d;
13263
13386
  }
13264
13387
  .h-syntax .cm {
13265
- color: #727272;
13388
+ color: #6a737d;
13266
13389
  }
13267
13390
  .h-syntax .cp {
13268
- color: #008085;
13391
+ color: #d73a49;
13269
13392
  }
13270
13393
  .h-syntax .cpf {
13271
- color: #007020;
13394
+ color: #032f62;
13272
13395
  }
13273
13396
  .h-syntax .c1 {
13274
- color: #727272;
13397
+ color: #6a737d;
13275
13398
  }
13276
13399
  .h-syntax .cs {
13277
- color: #727272;
13400
+ color: #6a737d;
13278
13401
  }
13279
13402
  .h-syntax .gd {
13280
- background-color: #fcc;
13281
- border: 1px solid #c00;
13282
- }
13283
- .h-syntax .ge {
13284
- font-style: italic;
13285
- }
13286
- .h-syntax .gr {
13287
- color: #f00;
13403
+ color: #b31d28;
13404
+ background-color: #ffeef0;
13288
13405
  }
13289
13406
  .h-syntax .gh {
13290
- color: #030;
13407
+ color: #005cc5;
13291
13408
  }
13292
13409
  .h-syntax .gi {
13293
- background-color: #cfc;
13294
- border: 1px solid #0c0;
13295
- }
13296
- .h-syntax .go {
13297
- color: #aaa;
13298
- }
13299
- .h-syntax .gp {
13300
- color: #009;
13410
+ color: #22863a;
13411
+ background-color: #f0fff4;
13301
13412
  }
13302
13413
  .h-syntax .gs {
13303
- font-weight: 700;
13414
+ font-weight: bold;
13304
13415
  }
13305
13416
  .h-syntax .gu {
13306
- color: #030;
13417
+ color: #6f42c1;
13418
+ font-weight: bold;
13307
13419
  }
13308
13420
  .h-syntax .gt {
13309
- color: #9c6;
13310
- }
13311
- .h-syntax .gl {
13312
- text-decoration: underline;
13313
- }
13314
- .h-syntax .k {
13315
- color: #069;
13421
+ color: #0044DD;
13316
13422
  }
13317
13423
  .h-syntax .kc {
13318
- color: #069;
13424
+ color: #005cc5;
13319
13425
  }
13320
13426
  .h-syntax .kd {
13321
- color: #069;
13427
+ color: #d73a49;
13322
13428
  }
13323
13429
  .h-syntax .kn {
13324
- color: #069;
13430
+ color: #d73a49;
13325
13431
  }
13326
13432
  .h-syntax .kp {
13327
- color: #069;
13433
+ color: #d73a49;
13328
13434
  }
13329
13435
  .h-syntax .kr {
13330
- color: #069;
13436
+ color: #d73a49;
13331
13437
  }
13332
13438
  .h-syntax .kt {
13333
- color: #078;
13439
+ color: #d73a49;
13334
13440
  }
13335
13441
  .h-syntax .m {
13336
- color: #c24f19;
13337
- }
13338
- .h-syntax .mb {
13339
- color: #40a070;
13340
- }
13341
- .h-syntax .mf {
13342
- color: #c24f19;
13343
- }
13344
- .h-syntax .mh {
13345
- color: #c24f19;
13346
- }
13347
- .h-syntax .mi {
13348
- color: #c24f19;
13349
- }
13350
- .h-syntax .il {
13351
- color: #c24f19;
13352
- }
13353
- .h-syntax .mo {
13354
- color: #c24f19;
13442
+ color: #666666;
13355
13443
  }
13356
13444
  .h-syntax .s {
13357
- color: #d73038;
13358
- }
13359
- .h-syntax .sa {
13360
- color: #4070a0;
13361
- }
13362
- .h-syntax .sb {
13363
- color: #c30;
13364
- }
13365
- .h-syntax .sc {
13366
- color: #c30;
13367
- }
13368
- .h-syntax .dl {
13369
- color: #4070a0;
13370
- }
13371
- .h-syntax .sd {
13372
- font-style: italic;
13373
- color: #c30;
13374
- }
13375
- .h-syntax .s2 {
13376
- color: #c30;
13377
- }
13378
- .h-syntax .se {
13379
- color: #c30;
13380
- }
13381
- .h-syntax .sh {
13382
- color: #c30;
13383
- }
13384
- .h-syntax .si {
13385
- color: #a00;
13386
- }
13387
- .h-syntax .sx {
13388
- color: #c30;
13389
- }
13390
- .h-syntax .sr {
13391
- color: #337e7e;
13392
- }
13393
- .h-syntax .s1 {
13394
- color: #c30;
13395
- }
13396
- .h-syntax .ss {
13397
- color: #fc3;
13398
- }
13399
- .h-syntax .na {
13400
- color: #006ee0;
13445
+ color: #032f62;
13401
13446
  }
13402
13447
  .h-syntax .nb {
13403
- color: #366;
13448
+ color: #005cc5;
13404
13449
  }
13405
13450
  .h-syntax .nc {
13406
- color: #168174;
13451
+ color: #6f42c1;
13407
13452
  }
13408
13453
  .h-syntax .no {
13409
- color: #360;
13454
+ color: #005cc5;
13410
13455
  }
13411
13456
  .h-syntax .nd {
13412
- color: #6b62de;
13413
- }
13414
- .h-syntax .ni {
13415
- color: #727272;
13416
- }
13417
- .h-syntax .ne {
13418
- color: #c00;
13419
- }
13420
- .h-syntax .nf {
13421
- color: #b715f4;
13422
- }
13423
- .h-syntax .nl {
13424
- color: #6b62de;
13425
- }
13426
- .h-syntax .nn {
13427
- color: #007ca5;
13428
- }
13429
- .h-syntax .nt {
13430
- color: #2f6f9f;
13431
- }
13432
- .h-syntax .nv {
13433
- color: #033;
13434
- }
13435
- .h-syntax .o {
13436
- color: #555;
13437
- }
13438
- .h-syntax .ow {
13439
- color: #000;
13440
- }
13441
- .h-syntax .w {
13442
- color: #bbb;
13443
- }
13444
- .h-syntax .language-bash::before,
13445
- .h-syntax .language-sh::before {
13446
- color: #009;
13447
- content: "$ ";
13448
- user-select: none;
13449
- }
13450
- .h-syntax .language-powershell::before {
13451
- color: #009;
13452
- content: "PM> ";
13453
- user-select: none;
13457
+ color: #6f42c1;
13454
13458
  }
@@ -53,7 +53,7 @@
53
53
 
54
54
  // Headmin
55
55
  @import "headmin/filters";
56
- @import "headmin/form";
56
+ @import "headmin/forms";
57
57
  @import "headmin/general";
58
58
  @import "headmin/layout";
59
59
  @import "headmin/login";
@@ -5,6 +5,5 @@ module Headmin
5
5
  include Headmin::FormHelper
6
6
  include Headmin::NotificationHelper
7
7
  include Headmin::RequestHelper
8
- include Headmin::DocumentationHelper
9
8
  end
10
9
  end
@@ -1,22 +1,16 @@
1
1
  module Headmin
2
2
  module FormHelper
3
- def form_field_valid?(form, name)
4
- !form.object.errors.has_key?(name)
5
- end
6
-
3
+ # TODO: cleanup after input field refactoring
7
4
  def form_field_validation_id(form, name)
8
5
  [form.object_name, name.to_s, "validation"].join("_").parameterize.underscore
9
6
  end
10
7
 
8
+ # TODO: cleanup after input field refactoring
11
9
  def form_field_validation_class(form, name)
12
10
  return nil if request.get?
13
11
  form.object.errors.has_key?(name) ? "is-invalid" : "is-valid"
14
12
  end
15
13
 
16
- def human_attribute_name(attribute)
17
- attribute.to_s.humanize
18
- end
19
-
20
14
  # Outputs currently present query parameters as hidden fields for a given form
21
15
  #
22
16
  # https://example.com/products?amount=1&type[]=food&type[]=beverage
@@ -3,7 +3,7 @@ module Headmin
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  included do
6
- has_many :blocks, as: :blockable
6
+ has_many :blocks, as: :blockable, dependent: :destroy
7
7
  accepts_nested_attributes_for :blocks, allow_destroy: true
8
8
  end
9
9
  end
@@ -11,7 +11,10 @@ module Headmin
11
11
  belongs_to :field, optional: true, touch: true
12
12
  has_many :fields, foreign_key: "parent_id"
13
13
  accepts_nested_attributes_for :fields, allow_destroy: true
14
- has_one_attached :file
14
+
15
+ # field_type: :files, :file
16
+ has_many_attached :files
17
+ accepts_nested_attributes_for :files_attachments, allow_destroy: true
15
18
  end
16
19
  end
17
20
  end