avo 3.10.6 → 3.10.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/README.md +4 -9
  4. data/app/components/avo/fields/boolean_field/index_component.html.erb +1 -1
  5. data/app/components/avo/fields/boolean_field/show_component.html.erb +1 -1
  6. data/app/components/avo/fields/boolean_group_field/edit_component.rb +1 -1
  7. data/app/components/avo/fields/common/boolean_group_component.html.erb +3 -6
  8. data/app/components/avo/resource_component.rb +0 -2
  9. data/app/components/avo/turbo_frame_wrapper_component.html.erb +1 -1
  10. data/app/controllers/avo/base_controller.rb +9 -2
  11. data/lib/avo/asset_manager.rb +8 -3
  12. data/lib/avo/base_resource.rb +2 -601
  13. data/lib/avo/fields/boolean_group_field.rb +1 -1
  14. data/lib/avo/licensing/request.rb +3 -1
  15. data/lib/avo/resources/base.rb +607 -0
  16. data/lib/avo/resources/items/item_group.rb +2 -0
  17. data/lib/avo/resources/items/tab.rb +2 -0
  18. data/lib/avo/version.rb +1 -1
  19. data/lib/avo.rb +1 -0
  20. data/lib/generators/avo/eject_generator.rb +1 -1
  21. data/lib/generators/avo/templates/locales/avo.de.yml +120 -0
  22. data/lib/generators/avo/templates/locales/avo.it.yml +120 -0
  23. data/lib/generators/avo/templates/locales/avo.nl.yml +120 -0
  24. data/lib/generators/avo/templates/locales/avo.pl.yml +120 -0
  25. data/lib/generators/avo/templates/locales/avo.ru.yml +120 -0
  26. data/lib/generators/avo/templates/locales/avo.uk.yml +120 -0
  27. data/lib/generators/avo/templates/locales/avo.zh.yml +120 -0
  28. data/public/avo-assets/avo.base.css +3 -71
  29. data/public/avo-assets/avo.base.js +230 -227
  30. data/public/avo-assets/avo.base.js.map +4 -4
  31. data/public/avo-assets/logo-on-white.png +0 -0
  32. metadata +10 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c13c4b4bb35ac2adf3418f41602032955893eaf9c7f5575857d5f61808651608
4
- data.tar.gz: e76a9aa45330312abf5d0847023a5a143e24871bdad72a42397fbb8775f3eb5f
3
+ metadata.gz: b6522100491a3502db0cd2f730a0a8135cf567cf17a6d38084d00122b9f4683a
4
+ data.tar.gz: b878fcd1ad6fb33182ab27b9c16d180fc6324f268f419bf8033f5b41fa7e36f8
5
5
  SHA512:
6
- metadata.gz: cbf8a7e0c935ab671b5d0cc2ed210ea1495137ee30f3b7aa95aa11721bcc5bfdfc1f854730cd840d39a395e9f3ee6540b17c4bdb81259b4bd439241745ee3cdb
7
- data.tar.gz: 25284219c36fe5b9469e8ca0e75fb999d3bdb4cd9dc7fbd986c67f880fbbbf90b785eedee368f856032960e649f76345737c8d7f85dd24c6601e80bd8d871ffa
6
+ metadata.gz: 5feea15d9c0607c974f687346630fd69109b69fbf874c41d1885c5402f356bbcfdf426c1f25d565f5c103d15ee5fe596f5fe7343468abcc2b6ebf78008f70c41
7
+ data.tar.gz: c0e12f8faa5c48e9da89f1f5e24fb89db4e9ae9978533ae9e6abda17280f94e41a9da981dfb5a8f663662b02bf307686b683be7043a423e51a03039a64f2195a
data/Gemfile.lock CHANGED
@@ -115,7 +115,7 @@ GIT
115
115
  PATH
116
116
  remote: .
117
117
  specs:
118
- avo (3.10.6)
118
+ avo (3.10.7)
119
119
  actionview (>= 6.1)
120
120
  active_link_to
121
121
  activerecord (>= 6.1)
@@ -484,7 +484,7 @@ GEM
484
484
  railties (>= 5.2)
485
485
  reverse_markdown (2.1.1)
486
486
  nokogiri
487
- rexml (3.3.1)
487
+ rexml (3.3.2)
488
488
  strscan
489
489
  ripper-tags (1.0.2)
490
490
  rspec-core (3.13.0)
data/README.md CHANGED
@@ -14,9 +14,6 @@
14
14
  <a href="https://github.com/testdouble/standard">
15
15
  <img alt="Ruby Style" src="https://img.shields.io/badge/style-standard-168AFE?logo=ruby&logoColor=FE1616" />
16
16
  </a>
17
- <a href="https://discord.com/invite/vuuwFe4Km3">
18
- <img alt="Avo Rails Admin Discord Community" src="https://img.shields.io/discord/740892036978442260?color=8892F6&label=discord&logo=discord&logoColor=8892F6">
19
- </a>
20
17
  [![codecov](https://codecov.io/gh/avo-hq/avo/branch/master/graph/badge.svg?token=Q2LMFE4989)](https://codecov.io/gh/avo-hq/avo)
21
18
  [![Maintainability](https://api.codeclimate.com/v1/badges/676a0afa2cc79f03aa29/maintainability)](https://codeclimate.com/github/avo-hq/avo/maintainability)
22
19
 
@@ -36,15 +33,13 @@ Avo is a very custom Admin Panel Framework, Content Management System, and Inter
36
33
  <br>
37
34
  🗺 **Roadmap**: [GitHub Roadmap](https://github.com/orgs/avo-hq/projects/14)
38
35
  <br>
39
- 🎸 **Demo app**: [Avodemo](https://main.avodemo.com/)
40
- <br>
41
- 🐤 **Twitter**: [avo_hq](https://twitter.com/avo_hq)
36
+ 🎸 **Demo App**: [Avodemo](https://main.avodemo.com/)
42
37
  <br>
43
- 💬 **Community chat**: [discord](https://discord.gg/pkTF6y8)
38
+ 🐤 **Twitter**: [`avo_hq`](https://twitter.com/avo_hq)
44
39
  <br>
45
- 🔧 **Issue tracker**: [GitHub issues](http://github.com/avo-hq/avo/issues)
40
+ 🔧 **Issue Tracker**: [GitHub Issues](http://github.com/avo-hq/avo/issues)
46
41
  <br>
47
- 🎙 **Discussions and feature requests**: [GitHub issues](http://github.com/avo-hq/avo/discussions)
42
+ 🎙 **Discussions and Feature Requests**: [GitHub Discussions](http://github.com/avo-hq/avo/discussions)
48
43
 
49
44
  ## Features
50
45
 
@@ -1,3 +1,3 @@
1
- <%= index_field_wrapper **field_wrapper_args, dash_if_blank: false, flush: true do %>
1
+ <%= index_field_wrapper **field_wrapper_args, flush: true do %>
2
2
  <%= render Avo::Fields::Common::BooleanCheckComponent.new checked: @field.value %>
3
3
  <% end %>
@@ -1,3 +1,3 @@
1
- <%= field_wrapper **field_wrapper_args, dash_if_blank: false do %>
1
+ <%= field_wrapper **field_wrapper_args do %>
2
2
  <%= render Avo::Fields::Common::BooleanCheckComponent.new checked: @field.value %>
3
3
  <% end %>
@@ -17,7 +17,7 @@ class Avo::Fields::BooleanGroupField::EditComponent < Avo::Fields::EditComponent
17
17
  if params[@form_scope].present? && params[@form_scope][@field.id.to_s].present?
18
18
  params[@form_scope][@field.id.to_s].include?(id.to_s)
19
19
  elsif @field.value.present?
20
- @field.value[id.to_s]
20
+ @field.value.with_indifferent_access[id]
21
21
  end
22
22
  end
23
23
  end
@@ -1,13 +1,10 @@
1
1
  <div data-controller="tippy">
2
- <%= link_to t('avo.view').humanize, 'javascript:void(0);', data: { 'tippy-target': 'source' } %>
2
+ <%= link_to t("avo.view").humanize, "javascript:void(0);", data: {"tippy-target": :source} %>
3
3
  <div class="hidden" data-tippy-target="content">
4
4
  <div class="p-2 space-y-2">
5
- <%
6
- @options.each do |id, label|
7
- checked = @value.present? && @value[id.to_s].present?
8
- %>
5
+ <% @options.each do |id, label| %>
9
6
  <div class="flex flex-nowrap">
10
- <%= render Avo::Fields::Common::BooleanCheckComponent.new checked: checked %>
7
+ <%= render Avo::Fields::Common::BooleanCheckComponent.new checked: @value.present? && @value&.with_indifferent_access[id].present? %>
11
8
  <div class="ml-px text-left py-px"><%= label %></div>
12
9
  </div>
13
10
  <% end %>
@@ -50,8 +50,6 @@ class Avo::ResourceComponent < Avo::BaseComponent
50
50
  end
51
51
 
52
52
  def can_see_the_actions_button?
53
- return false if @actions.blank?
54
-
55
53
  return authorize_association_for(:act_on) if @reflection.present?
56
54
 
57
55
  @resource.authorization.authorize_action(:act_on, raise_exception: false) && !has_reflection_and_is_read_only
@@ -4,7 +4,7 @@
4
4
  # We're appending it back if it's a turbo_frame_request.
5
5
  %>
6
6
  <% if helpers.turbo_frame_request? %>
7
- <%= helpers.turbo_stream_action_tag :append, target: 'alerts', template: render(Avo::FlashAlertsComponent.new(flashes: helpers.flash)) %>
7
+ <%= helpers.turbo_stream_action_tag :append, target: "alerts", template: render(Avo::FlashAlertsComponent.new(flashes: helpers.flash)) %>
8
8
  <% end %>
9
9
  <%= content %>
10
10
  <% if name.present? %></turbo-frame><% end %>
@@ -305,8 +305,15 @@ module Avo
305
305
  # Sorting
306
306
  if params[:sort_by].present?
307
307
  @index_params[:sort_by] = params[:sort_by]
308
- elsif @resource.model_class.present? && @resource.model_class.column_names.include?("created_at")
309
- @index_params[:sort_by] = :created_at
308
+ elsif @resource.model_class.present?
309
+ available_columns = @resource.model_class.column_names
310
+ default_sort_column = @resource.default_sort_column
311
+
312
+ if available_columns.include?(default_sort_column.to_s)
313
+ @index_params[:sort_by] = default_sort_column
314
+ elsif available_columns.include?("created_at")
315
+ @index_params[:sort_by] = :created_at
316
+ end
310
317
  end
311
318
 
312
319
  @index_params[:sort_direction] = params[:sort_direction] || :desc
@@ -2,9 +2,6 @@ module Avo
2
2
  class AssetManager
3
3
  include ActionView::Helpers::AssetTagHelper
4
4
 
5
- attr_reader :stylesheets
6
- attr_reader :javascripts
7
-
8
5
  def initialize
9
6
  @stylesheets = []
10
7
  @javascripts = []
@@ -22,6 +19,14 @@ module Avo
22
19
  def add_javascript(path)
23
20
  @javascripts.push path
24
21
  end
22
+
23
+ def stylesheets
24
+ @stylesheets.uniq
25
+ end
26
+
27
+ def javascripts
28
+ @javascripts.uniq
29
+ end
25
30
  end
26
31
 
27
32
  def self.asset_manager