avo 1.20.2.pre.2 → 1.22.0.pre.1

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 (85) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +57 -57
  3. data/README.md +1 -1
  4. data/app/assets/builds/avo.css +405 -224
  5. data/app/assets/builds/avo.js +16 -6
  6. data/app/assets/builds/avo.js.map +2 -2
  7. data/app/assets/stylesheets/avo.css +1 -1
  8. data/app/assets/stylesheets/css/fonts.css +53 -0
  9. data/app/assets/stylesheets/css/pagination.css +9 -9
  10. data/app/assets/stylesheets/css/search.css +3 -2
  11. data/app/assets/svgs/dashboards-icon.svg +6 -0
  12. data/app/assets/svgs/resources-icon.svg +13 -0
  13. data/app/assets/svgs/three-dots.svg +5 -0
  14. data/app/assets/svgs/tools-icon.svg +3 -0
  15. data/app/components/avo/button_component.html.erb +1 -0
  16. data/app/components/avo/button_component.rb +111 -0
  17. data/app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb +14 -7
  18. data/app/components/avo/fields/belongs_to_field/autocomplete_component.rb +47 -3
  19. data/app/components/avo/fields/belongs_to_field/edit_component.html.erb +59 -38
  20. data/app/components/avo/fields/belongs_to_field/edit_component.rb +37 -0
  21. data/app/components/avo/fields/boolean_field/index_component.html.erb +1 -1
  22. data/app/components/avo/index/field_wrapper_component.html.erb +8 -2
  23. data/app/components/avo/index/field_wrapper_component.rb +2 -1
  24. data/app/components/avo/index/resource_table_component.html.erb +3 -3
  25. data/app/components/avo/index/table_row_component.html.erb +1 -1
  26. data/app/components/avo/navigation_heading_component.html.erb +2 -2
  27. data/app/components/avo/navigation_heading_component.rb +5 -1
  28. data/app/components/avo/navigation_link_component.html.erb +2 -2
  29. data/app/components/avo/navigation_link_component.rb +5 -0
  30. data/app/components/avo/panel_component.html.erb +5 -3
  31. data/app/components/avo/sidebar_profile_component.html.erb +28 -0
  32. data/app/components/avo/sidebar_profile_component.rb +43 -0
  33. data/app/components/avo/views/resource_index_component.html.erb +8 -7
  34. data/app/components/avo/views/resource_show_component.html.erb +10 -0
  35. data/app/controllers/avo/application_controller.rb +14 -12
  36. data/app/controllers/avo/base_controller.rb +4 -1
  37. data/app/helpers/avo/application_helper.rb +7 -5
  38. data/app/helpers/avo/resources_helper.rb +2 -2
  39. data/app/javascript/js/controllers/fields/date_field_controller.js +10 -2
  40. data/app/javascript/js/controllers/item_selector_controller.js +29 -19
  41. data/app/javascript/js/controllers/search_controller.js +8 -3
  42. data/app/views/avo/base/_actions.html.erb +4 -3
  43. data/app/views/avo/base/_filters.html.erb +3 -1
  44. data/app/views/avo/partials/_global_search.html.erb +2 -2
  45. data/app/views/avo/partials/_logo.html.erb +3 -1
  46. data/app/views/avo/partials/_navbar.html.erb +11 -0
  47. data/app/views/avo/partials/_paginator.html.erb +4 -3
  48. data/app/views/avo/partials/_resource_search.html.erb +1 -1
  49. data/app/views/avo/partials/_sidebar.html.erb +35 -0
  50. data/app/views/avo/partials/_table_header.html.erb +3 -3
  51. data/app/views/avo/partials/_turbo_frame_wrap.html.erb +7 -1
  52. data/app/views/avo/partials/_view_toggle_button.html.erb +22 -16
  53. data/app/views/layouts/avo/application.html.erb +3 -13
  54. data/db/factories.rb +7 -3
  55. data/lib/avo/app.rb +4 -3
  56. data/lib/avo/base_resource.rb +16 -14
  57. data/lib/avo/version.rb +1 -1
  58. data/public/avo-assets/avo.css +405 -224
  59. data/public/avo-assets/avo.js +16 -6
  60. data/public/avo-assets/avo.js.map +2 -2
  61. data/public/avo-assets/fonts/inter-v7-latin-500.eot +0 -0
  62. data/public/avo-assets/fonts/inter-v7-latin-500.svg +351 -0
  63. data/public/avo-assets/fonts/inter-v7-latin-500.ttf +0 -0
  64. data/public/avo-assets/fonts/inter-v7-latin-500.woff +0 -0
  65. data/public/avo-assets/fonts/inter-v7-latin-500.woff2 +0 -0
  66. data/public/avo-assets/fonts/inter-v7-latin-600.eot +0 -0
  67. data/public/avo-assets/fonts/inter-v7-latin-600.svg +351 -0
  68. data/public/avo-assets/fonts/inter-v7-latin-600.ttf +0 -0
  69. data/public/avo-assets/fonts/inter-v7-latin-600.woff +0 -0
  70. data/public/avo-assets/fonts/inter-v7-latin-600.woff2 +0 -0
  71. data/public/avo-assets/fonts/inter-v7-latin-700.eot +0 -0
  72. data/public/avo-assets/fonts/inter-v7-latin-700.svg +352 -0
  73. data/public/avo-assets/fonts/inter-v7-latin-700.ttf +0 -0
  74. data/public/avo-assets/fonts/inter-v7-latin-700.woff +0 -0
  75. data/public/avo-assets/fonts/inter-v7-latin-700.woff2 +0 -0
  76. data/public/avo-assets/fonts/inter-v7-latin-regular.eot +0 -0
  77. data/public/avo-assets/fonts/inter-v7-latin-regular.svg +351 -0
  78. data/public/avo-assets/fonts/inter-v7-latin-regular.ttf +0 -0
  79. data/public/avo-assets/fonts/inter-v7-latin-regular.woff +0 -0
  80. data/public/avo-assets/fonts/inter-v7-latin-regular.woff2 +0 -0
  81. data/public/avo-assets/logo.png +0 -0
  82. metadata +32 -5
  83. data/app/assets/images/avo/logo.png +0 -0
  84. data/app/views/avo/partials/_profile_dropdown.html.erb +0 -25
  85. data/app/views/avo/sidebar/_sidebar.html.erb +0 -33
@@ -1,17 +1,23 @@
1
- <%
2
- if available_view_types.count > 1
3
- case view_type.to_sym
4
- when :table
5
- new_view_type = 'grid'
6
- new_icon = 'view-grid'
7
- translation_key = 'avo.grid_view'
8
- when :grid
9
- new_view_type = 'table'
10
- new_icon = 'view-list'
11
- translation_key = 'avo.table_view'
12
- end
13
- %>
14
- <%= a_link params.permit!.merge(view_type: new_view_type), color: :blue, 'data-turbo-frame': turbo_frame, title: t('avo.switch_to_view', view_type: new_view_type), 'data-tippy': 'tooltip' do %>
15
- <%= svg new_icon %> <%= t translation_key, item: @resource.model_class.model_name.human.downcase %>
16
- <% end %>
1
+ <% if available_view_types.count > 1 %>
2
+ <%
3
+ info = {
4
+ table: {
5
+ new_view_type: 'grid',
6
+ new_icon: 'view-grid',
7
+ translation_key: 'avo.grid_view',
8
+ },
9
+ grid: {
10
+ new_view_type: 'table',
11
+ new_icon: 'view-list',
12
+ translation_key: 'avo.table_view',
13
+ },
14
+ }
15
+ %>
16
+ <div class="flex">
17
+ <% available_view_types.each do |type| %>
18
+ <%= a_link params.permit!.merge(view_type: type), color: :secondary, variant: :outlined, class: view_type.to_s == type.to_s ? 'bg-gray-200' : '', 'data-turbo-frame': turbo_frame, title: t('avo.switch_to_view', view_type: type), 'data-tippy': 'tooltip' do %>
19
+ <%= svg info[type][:new_icon] %>
20
+ <% end %>
21
+ <% end %>
22
+ </div>
17
23
  <% end %>
@@ -17,24 +17,14 @@
17
17
  <%= stylesheet_link_tag "avo", "data-turbo-track": "reload", defer: true %>
18
18
  <% end %>
19
19
  </head>
20
- <body class="bg-slate-200 os-mac">
20
+ <body class="bg-gray-100 os-mac">
21
21
 
22
22
  <div id="app" class="flex min-h-screen flex-row h-full">
23
23
  <div class="flex flex-1 w-full">
24
- <%= render partial: 'avo/sidebar/sidebar' %>
24
+ <%= render partial: 'avo/partials/sidebar' %>
25
25
 
26
26
  <div class="flex-1 flex flex-col h-full overflow-auto">
27
- <div class="relative bg-white p-2 shadow-md h-16 w-full flex flex-shrink-0 items-center z-50 px-6" v-if="layout !== 'blank'">
28
- <div>
29
- <%= render partial: "avo/partials/header" %>
30
- </div>
31
- <div class="flex-1 flex ml-4 pl-4">
32
- <%= render partial: "avo/partials/global_search" if ::Avo::App.license.has_with_trial(:global_search) && ::Avo.configuration.feature_enabled?(:global_search) %>
33
- </div>
34
- <div class="align-end">
35
- <%= render partial: "avo/partials/profile_dropdown" %>
36
- </div>
37
- </div>
27
+ <%= render partial: "avo/partials/navbar" %>
38
28
 
39
29
  <div class="content p-8 flex-1 flex flex-col justify-between items-stretch <%= @container_classes %>">
40
30
  <%= render partial: "avo/partials/custom_tools_alert" if @custom_tools_alert_visible %>
data/db/factories.rb CHANGED
@@ -58,11 +58,15 @@ FactoryBot.define do
58
58
  type { "Spouse" }
59
59
  end
60
60
 
61
+ factory :fish do
62
+ name { %w[Tilapia Salmon Trout Catfish Pangasius Carp].sample }
63
+ end
64
+
61
65
  factory :course do
62
- name { Faker::Company.name }
66
+ name { Faker::Educator.unique.course_name }
63
67
  end
64
68
 
65
- factory :link do
66
- name { Faker::Internet.url }
69
+ factory :course_link, class: "Course::Link" do
70
+ link { Faker::Internet.url }
67
71
  end
68
72
  end
data/lib/avo/app.rb CHANGED
@@ -133,9 +133,10 @@ module Avo
133
133
  end
134
134
 
135
135
  def resources_navigation(user = nil)
136
- get_available_resources(user).select do |resource|
137
- resource.model_class.present?
138
- end
136
+ get_available_resources(user)
137
+ .select do |resource|
138
+ resource.model_class.present?
139
+ end
139
140
  .select do |resource|
140
141
  resource.visible_on_sidebar
141
142
  end
@@ -6,7 +6,7 @@ module Avo
6
6
 
7
7
  include ActionView::Helpers::UrlHelper
8
8
 
9
- delegate :view_context, to: 'Avo::App'
9
+ delegate :view_context, to: "Avo::App"
10
10
  delegate :main_app, to: :view_context
11
11
  delegate :avo, to: :view_context
12
12
  delegate :resource_path, to: :view_context
@@ -21,7 +21,7 @@ module Avo
21
21
  class_attribute :title, default: :id
22
22
  class_attribute :description, default: :id
23
23
  class_attribute :search_query, default: nil
24
- class_attribute :search_query_help, default: ''
24
+ class_attribute :search_query_help, default: ""
25
25
  class_attribute :includes, default: []
26
26
  class_attribute :model_class
27
27
  class_attribute :translation_key
@@ -60,7 +60,7 @@ module Avo
60
60
  # This is the search_query scope
61
61
  # This should be removed and passed to the search block
62
62
  def scope
63
- self.query_scope
63
+ query_scope
64
64
  end
65
65
 
66
66
  # This resolves the scope when doing "where" queries (not find queries)
@@ -128,17 +128,19 @@ module Avo
128
128
  end
129
129
  .select do |field|
130
130
  # Strip out the reflection field in index queries with a parent association.
131
- if reflection.present? &&
132
- reflection.options.present? &&
133
- field.respond_to?(:polymorphic_as) &&
134
- field.polymorphic_as.to_s == reflection.options[:as].to_s
135
- next
136
- end
137
- if field.respond_to?(:foreign_key) &&
138
- reflection.present? &&
139
- reflection.respond_to?(:foreign_key) &&
140
- reflection.foreign_key != field.foreign_key
141
- next
131
+ if reflection.present?
132
+ if reflection.options.present? &&
133
+ field.respond_to?(:polymorphic_as) &&
134
+ field.polymorphic_as.to_s == reflection.options[:as].to_s
135
+ next
136
+ end
137
+
138
+ if field.respond_to?(:foreign_key) &&
139
+ reflection.respond_to?(:foreign_key) &&
140
+ reflection.foreign_key != field.foreign_key &&
141
+ @params[:resource_name] == field.resource.model_key
142
+ next
143
+ end
142
144
  end
143
145
 
144
146
  true
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "1.20.2.pre.2"
2
+ VERSION = "1.22.0.pre.1"
3
3
  end