avo 2.7.1.pre.1 → 2.8.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of avo might be problematic. Click here for more details.

Files changed (147) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -0
  3. data/Gemfile.lock +5 -5
  4. data/app/components/avo/alert_component.rb +6 -0
  5. data/app/components/avo/card_component.html.erb +2 -2
  6. data/app/components/avo/common_field_wrapper_component.html.erb +10 -3
  7. data/app/components/avo/common_field_wrapper_component.rb +27 -1
  8. data/app/components/avo/edit/field_wrapper_component.html.erb +1 -1
  9. data/app/components/avo/fields/badge_field/index_component.html.erb +1 -1
  10. data/app/components/avo/fields/badge_field/show_component.html.erb +1 -1
  11. data/app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb +21 -10
  12. data/app/components/avo/fields/belongs_to_field/autocomplete_component.rb +7 -1
  13. data/app/components/avo/fields/belongs_to_field/edit_component.html.erb +27 -15
  14. data/app/components/avo/fields/belongs_to_field/edit_component.rb +4 -0
  15. data/app/components/avo/fields/belongs_to_field/index_component.html.erb +1 -1
  16. data/app/components/avo/fields/belongs_to_field/show_component.html.erb +1 -1
  17. data/app/components/avo/fields/boolean_field/edit_component.html.erb +4 -2
  18. data/app/components/avo/fields/boolean_field/index_component.html.erb +1 -1
  19. data/app/components/avo/fields/boolean_field/show_component.html.erb +1 -1
  20. data/app/components/avo/fields/boolean_group_field/edit_component.html.erb +7 -1
  21. data/app/components/avo/fields/boolean_group_field/index_component.html.erb +1 -1
  22. data/app/components/avo/fields/boolean_group_field/show_component.html.erb +1 -1
  23. data/app/components/avo/fields/code_field/edit_component.html.erb +7 -5
  24. data/app/components/avo/fields/code_field/show_component.html.erb +2 -2
  25. data/app/components/avo/fields/common/key_value_component.html.erb +10 -4
  26. data/app/components/avo/fields/common/key_value_component.rb +2 -0
  27. data/app/components/avo/fields/country_field/edit_component.html.erb +4 -2
  28. data/app/components/avo/fields/country_field/index_component.html.erb +1 -1
  29. data/app/components/avo/fields/country_field/show_component.html.erb +1 -1
  30. data/app/components/avo/fields/date_field/edit_component.html.erb +6 -4
  31. data/app/components/avo/fields/date_field/index_component.html.erb +1 -1
  32. data/app/components/avo/fields/date_field/show_component.html.erb +1 -1
  33. data/app/components/avo/fields/date_time_field/edit_component.html.erb +6 -4
  34. data/app/components/avo/fields/date_time_field/index_component.html.erb +1 -1
  35. data/app/components/avo/fields/date_time_field/show_component.html.erb +1 -1
  36. data/app/components/avo/fields/edit_component.rb +7 -0
  37. data/app/components/avo/fields/external_image_field/edit_component.html.erb +5 -2
  38. data/app/components/avo/fields/external_image_field/index_component.html.erb +6 -4
  39. data/app/components/avo/fields/external_image_field/show_component.html.erb +1 -1
  40. data/app/components/avo/fields/file_field/edit_component.html.erb +6 -1
  41. data/app/components/avo/fields/file_field/index_component.html.erb +1 -1
  42. data/app/components/avo/fields/file_field/show_component.html.erb +1 -1
  43. data/app/components/avo/fields/files_field/edit_component.html.erb +7 -1
  44. data/app/components/avo/fields/files_field/index_component.html.erb +1 -1
  45. data/app/components/avo/fields/files_field/show_component.html.erb +1 -1
  46. data/app/components/avo/fields/gravatar_field/index_component.html.erb +1 -1
  47. data/app/components/avo/fields/gravatar_field/show_component.html.erb +1 -1
  48. data/app/components/avo/fields/has_one_field/index_component.html.erb +1 -1
  49. data/app/components/avo/fields/hidden_field/edit_component.html.erb +5 -1
  50. data/app/components/avo/fields/id_field/edit_component.html.erb +1 -1
  51. data/app/components/avo/fields/id_field/index_component.html.erb +1 -1
  52. data/app/components/avo/fields/id_field/show_component.html.erb +1 -1
  53. data/app/components/avo/fields/index_component.rb +3 -0
  54. data/app/components/avo/fields/key_value_field/edit_component.html.erb +1 -1
  55. data/app/components/avo/fields/key_value_field/show_component.html.erb +1 -1
  56. data/app/components/avo/fields/markdown_field/edit_component.html.erb +8 -5
  57. data/app/components/avo/fields/markdown_field/show_component.html.erb +1 -1
  58. data/app/components/avo/fields/number_field/edit_component.html.erb +7 -4
  59. data/app/components/avo/fields/number_field/index_component.html.erb +1 -1
  60. data/app/components/avo/fields/number_field/show_component.html.erb +1 -1
  61. data/app/components/avo/fields/password_field/edit_component.html.erb +4 -2
  62. data/app/components/avo/fields/progress_bar_field/edit_component.html.erb +7 -4
  63. data/app/components/avo/fields/progress_bar_field/index_component.html.erb +1 -1
  64. data/app/components/avo/fields/progress_bar_field/show_component.html.erb +1 -1
  65. data/app/components/avo/fields/select_field/edit_component.html.erb +9 -3
  66. data/app/components/avo/fields/select_field/index_component.html.erb +1 -1
  67. data/app/components/avo/fields/select_field/show_component.html.erb +1 -1
  68. data/app/components/avo/fields/show_component.rb +3 -0
  69. data/app/components/avo/fields/status_field/edit_component.html.erb +6 -3
  70. data/app/components/avo/fields/status_field/index_component.html.erb +1 -1
  71. data/app/components/avo/fields/status_field/show_component.html.erb +1 -1
  72. data/app/components/avo/fields/tags_field/edit_component.html.erb +19 -11
  73. data/app/components/avo/fields/tags_field/index_component.html.erb +1 -1
  74. data/app/components/avo/fields/tags_field/show_component.html.erb +1 -1
  75. data/app/components/avo/fields/text_field/edit_component.html.erb +5 -2
  76. data/app/components/avo/fields/text_field/index_component.html.erb +1 -1
  77. data/app/components/avo/fields/text_field/show_component.html.erb +1 -1
  78. data/app/components/avo/fields/textarea_field/edit_component.html.erb +6 -3
  79. data/app/components/avo/fields/textarea_field/show_component.html.erb +1 -1
  80. data/app/components/avo/fields/trix_field/edit_component.html.erb +13 -4
  81. data/app/components/avo/fields/trix_field/edit_component.rb +3 -0
  82. data/app/components/avo/fields/trix_field/show_component.html.erb +1 -1
  83. data/app/components/avo/index/field_wrapper_component.html.erb +12 -5
  84. data/app/components/avo/index/field_wrapper_component.rb +27 -3
  85. data/app/components/avo/panel_component.rb +4 -3
  86. data/app/components/avo/resource_component.rb +1 -0
  87. data/app/components/avo/show/field_wrapper_component.html.erb +1 -1
  88. data/app/components/avo/show/field_wrapper_component.rb +2 -1
  89. data/app/components/avo/views/resource_edit_component.html.erb +7 -4
  90. data/app/components/avo/views/resource_edit_component.rb +2 -1
  91. data/app/components/avo/views/resource_index_component.html.erb +6 -3
  92. data/app/components/avo/views/resource_index_component.rb +7 -1
  93. data/app/components/avo/views/resource_new_component.html.erb +7 -2
  94. data/app/components/avo/views/resource_new_component.rb +2 -1
  95. data/app/components/avo/views/resource_show_component.html.erb +9 -7
  96. data/app/components/avo/views/resource_show_component.rb +1 -0
  97. data/app/controllers/avo/actions_controller.rb +4 -1
  98. data/app/controllers/avo/base_controller.rb +14 -8
  99. data/app/controllers/avo/search_controller.rb +7 -1
  100. data/app/javascript/js/controllers/custom/course_resource_controller.js +102 -0
  101. data/app/javascript/js/controllers/fields/code_field_controller.js +7 -1
  102. data/app/javascript/js/controllers/fields/key_value_controller.js +1 -0
  103. data/app/javascript/js/controllers/fields/tags_field_controller.js +0 -1
  104. data/app/javascript/js/controllers/menu_controller.js +4 -3
  105. data/app/javascript/js/controllers/resource_edit_controller.js +72 -0
  106. data/app/javascript/js/controllers/resource_index_controller.js +4 -0
  107. data/app/javascript/js/controllers/resource_show_controller.js +4 -0
  108. data/app/javascript/js/controllers/search_controller.js +28 -5
  109. data/app/javascript/js/controllers.js +10 -0
  110. data/app/views/avo/associations/new.html.erb +2 -1
  111. data/app/views/avo/base/_select_filter.html.erb +1 -1
  112. data/app/views/avo/base/_text_filter.html.erb +1 -0
  113. data/app/views/avo/partials/_logo.html.erb +3 -2
  114. data/app/views/avo/partials/_navbar.html.erb +1 -1
  115. data/config/routes.rb +1 -1
  116. data/db/factories.rb +1 -0
  117. data/lib/avo/base_action.rb +9 -2
  118. data/lib/avo/base_card.rb +0 -23
  119. data/lib/avo/base_resource.rb +17 -15
  120. data/lib/avo/concerns/has_fields.rb +93 -0
  121. data/lib/avo/concerns/has_html_attributes.rb +110 -0
  122. data/lib/avo/concerns/has_stimulus_controllers.rb +42 -0
  123. data/lib/avo/fields/base_field.rb +23 -13
  124. data/lib/avo/fields/select_field.rb +1 -1
  125. data/lib/avo/grid_collector.rb +4 -4
  126. data/lib/avo/html/builder.rb +117 -0
  127. data/lib/avo/licensing/pro_license.rb +1 -0
  128. data/lib/avo/version.rb +1 -1
  129. data/lib/avo.rb +4 -0
  130. data/lib/generators/avo/templates/cards/chartkick_card_sample.tt +11 -1
  131. data/lib/generators/avo/templates/cards/metric_card_sample.tt +11 -1
  132. data/lib/generators/avo/templates/field/components/edit_component.html.erb.tt +1 -1
  133. data/lib/generators/avo/templates/field/components/index_component.html.erb.tt +1 -1
  134. data/lib/generators/avo/templates/field/components/show_component.html.erb.tt +1 -1
  135. data/lib/generators/avo/templates/initializer/avo.tt +1 -1
  136. data/lib/generators/avo/templates/locales/avo.en.yml +3 -3
  137. data/public/avo-assets/avo.css +28 -8
  138. data/public/avo-assets/avo.js +148 -148
  139. data/public/avo-assets/avo.js.map +3 -3
  140. data/public/avo-assets/logomark.png +0 -0
  141. metadata +13 -10
  142. data/app/assets/builds/action_cable.js +0 -2
  143. data/app/assets/builds/action_cable.js.map +0 -7
  144. data/app/assets/builds/avo.css +0 -9610
  145. data/app/assets/builds/avo.js +0 -512
  146. data/app/assets/builds/avo.js.map +0 -7
  147. data/lib/avo/fields_collector.rb +0 -70
@@ -4,7 +4,17 @@ class <%= class_name.camelize %> < Avo::Dashboards::MetricCard
4
4
  # self.description = "Some description"
5
5
  # self.cols = 1
6
6
  # self.initial_range = 30
7
- # self.ranges = [7, 30, 60, 365, "TODAY", "MTD", "QTD", "YTD", "ALL"]
7
+ # self.ranges = {
8
+ # "7 days": 7,
9
+ # "30 days": 30,
10
+ # "60 days": 60,
11
+ # "365 days": 365,
12
+ # Today: "TODAY",
13
+ # "Month to date": "MTD",
14
+ # "Quarter to date": "QTD",
15
+ # "Year to date": "YTD",
16
+ # All: "ALL",
17
+ # }
8
18
  # self.prefix = ""
9
19
  # self.suffix = ""
10
20
 
@@ -1,6 +1,6 @@
1
1
  <%%= edit_field_wrapper field: @field, index: @index, form: @form, resource: @resource, displayed_in_modal: @displayed_in_modal do %>
2
2
  <%%= @form.text_field @field.id,
3
- class: helpers.input_classes('w-full', has_error: @field.model_errors.include?(@field.id)),
3
+ class: classes("w-full"),
4
4
  placeholder: @field.placeholder,
5
5
  disabled: @field.readonly %>
6
6
  <%% end %>
@@ -1,3 +1,3 @@
1
- <%%= index_field_wrapper field: @field do %>
1
+ <%%= index_field_wrapper field: @field, resource: @resource do %>
2
2
  <%%= @field.value %>
3
3
  <%% end %>
@@ -1,3 +1,3 @@
1
- <%%= show_field_wrapper field: @field, index: @index do %>
1
+ <%%= show_field_wrapper field: @field, resource: @resource, index: @index do %>
2
2
  <%%= @field.value %>
3
3
  <%% end %>
@@ -3,7 +3,7 @@ Avo.configure do |config|
3
3
  ## == Routing ==
4
4
  config.root_path = '/<%= options[:path] %>'
5
5
 
6
- # Where should the user be redirected when he hits the `/<%= options[:path] %>` url
6
+ # Where should the user be redirected when visting the `/<%= options[:path] %>` url
7
7
  # config.home_path = nil
8
8
 
9
9
  ## == Licensing ==
@@ -13,9 +13,9 @@ en:
13
13
  unauthorized: 'Unauthorized'
14
14
  attachment_class_attached: '%{attachment_class} attached.'
15
15
  attachment_class_detached: '%{attachment_class} detached.'
16
- resource_updated: 'Resource updated'
17
- resource_created: 'Resource created'
18
- resource_destroyed: 'Resource destroyed'
16
+ resource_updated: 'Record updated'
17
+ resource_created: 'Record created'
18
+ resource_destroyed: 'Record destroyed'
19
19
  switch_to_view: "Switch to %{view_type} view"
20
20
  click_to_reveal_filters: "Click to reveal filters"
21
21
  attachment_destroyed: 'Attachment destroyed'
@@ -7181,10 +7181,6 @@ progress[value]::-moz-progress-bar{
7181
7181
  height:1.5rem
7182
7182
  }
7183
7183
 
7184
- .h-10{
7185
- height:2.5rem
7186
- }
7187
-
7188
7184
  .h-16{
7189
7185
  height:4rem
7190
7186
  }
@@ -7201,6 +7197,10 @@ progress[value]::-moz-progress-bar{
7201
7197
  height:calc(100vh - 4rem)
7202
7198
  }
7203
7199
 
7200
+ .h-10{
7201
+ height:2.5rem
7202
+ }
7203
+
7204
7204
  .max-h-\[42rem\]{
7205
7205
  max-height:42rem
7206
7206
  }
@@ -7241,8 +7241,8 @@ progress[value]::-moz-progress-bar{
7241
7241
  width:100%
7242
7242
  }
7243
7243
 
7244
- .w-32{
7245
- width:8rem
7244
+ .w-auto{
7245
+ width:auto
7246
7246
  }
7247
7247
 
7248
7248
  .w-24{
@@ -7581,6 +7581,10 @@ progress[value]::-moz-progress-bar{
7581
7581
  white-space:nowrap
7582
7582
  }
7583
7583
 
7584
+ .whitespace-pre-line{
7585
+ white-space:pre-line
7586
+ }
7587
+
7584
7588
  .break-words{
7585
7589
  overflow-wrap:break-word
7586
7590
  }
@@ -7958,6 +7962,10 @@ progress[value]::-moz-progress-bar{
7958
7962
  stroke:currentColor
7959
7963
  }
7960
7964
 
7965
+ .object-contain{
7966
+ object-fit:contain
7967
+ }
7968
+
7961
7969
  .object-cover{
7962
7970
  object-fit:cover
7963
7971
  }
@@ -8441,6 +8449,10 @@ progress[value]::-moz-progress-bar{
8441
8449
  opacity:0.5
8442
8450
  }
8443
8451
 
8452
+ .opacity-10{
8453
+ opacity:0.1
8454
+ }
8455
+
8444
8456
  .shadow-panel{
8445
8457
  --tw-shadow:0px 4px 8px rgba(0, 0, 0, 0.04), 0px 0px 2px rgba(0, 0, 0, 0.06), 0px 0px 1px rgba(0, 0, 0, 0.04);
8446
8458
  --tw-shadow-colored:0px 4px 8px var(--tw-shadow-color), 0px 0px 2px var(--tw-shadow-color), 0px 0px 1px var(--tw-shadow-color);
@@ -9323,6 +9335,10 @@ trix-editor {
9323
9335
  grid-column:span 6 / span 6
9324
9336
  }
9325
9337
 
9338
+ .sm\:block{
9339
+ display:block
9340
+ }
9341
+
9326
9342
  .sm\:flex{
9327
9343
  display:flex
9328
9344
  }
@@ -9331,8 +9347,8 @@ trix-editor {
9331
9347
  display:inline-flex
9332
9348
  }
9333
9349
 
9334
- .sm\:w-64{
9335
- width:16rem
9350
+ .sm\:hidden{
9351
+ display:none
9336
9352
  }
9337
9353
 
9338
9354
  .sm\:w-auto{
@@ -9479,6 +9495,10 @@ trix-editor {
9479
9495
  display:none
9480
9496
  }
9481
9497
 
9498
+ .lg\:w-64{
9499
+ width:16rem
9500
+ }
9501
+
9482
9502
  .lg\:w-1\/2{
9483
9503
  width:50%
9484
9504
  }