avo 1.15.0 → 1.16.3

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 (34) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/app/components/avo/views/resource_show_component.html.erb +5 -0
  4. data/app/packs/js/controllers/text_filter_controller.js +23 -0
  5. data/app/views/avo/base/_text_filter.html.erb +23 -0
  6. data/app/views/avo/partials/_profile_dropdown.html.erb +1 -1
  7. data/app/views/avo/sidebar/_sidebar.html.erb +2 -2
  8. data/lib/avo/app.rb +1 -3
  9. data/lib/avo/base_resource.rb +4 -0
  10. data/lib/avo/fields/base_field.rb +1 -1
  11. data/lib/avo/filters/text_filter.rb +9 -0
  12. data/lib/avo/version.rb +1 -1
  13. data/lib/generators/avo/templates/locales/avo.en.yml +1 -0
  14. data/lib/generators/avo/templates/locales/avo.nb-NO.yml +1 -0
  15. data/lib/generators/avo/templates/locales/avo.pt-BR.yml +1 -0
  16. data/lib/generators/avo/templates/locales/avo.ro.yml +1 -0
  17. data/public/avo-packs/css/application-2b4685ca.css.map +1 -1
  18. data/public/avo-packs/css/application-2b4685ca.css.map.br +0 -0
  19. data/public/avo-packs/css/application-2b4685ca.css.map.gz +0 -0
  20. data/public/avo-packs/js/application-124d087ff9491dbf3511.js +26 -0
  21. data/public/avo-packs/js/{application-6dbb940fca2e811fb7d5.js.LICENSE.txt → application-124d087ff9491dbf3511.js.LICENSE.txt} +0 -0
  22. data/public/avo-packs/js/application-124d087ff9491dbf3511.js.br +0 -0
  23. data/public/avo-packs/js/application-124d087ff9491dbf3511.js.gz +0 -0
  24. data/public/avo-packs/js/application-124d087ff9491dbf3511.js.map +1 -0
  25. data/public/avo-packs/js/application-124d087ff9491dbf3511.js.map.br +0 -0
  26. data/public/avo-packs/js/application-124d087ff9491dbf3511.js.map.gz +0 -0
  27. data/public/avo-packs/manifest.json +8 -8
  28. metadata +12 -9
  29. data/public/avo-packs/js/application-6dbb940fca2e811fb7d5.js +0 -26
  30. data/public/avo-packs/js/application-6dbb940fca2e811fb7d5.js.br +0 -0
  31. data/public/avo-packs/js/application-6dbb940fca2e811fb7d5.js.gz +0 -0
  32. data/public/avo-packs/js/application-6dbb940fca2e811fb7d5.js.map +0 -1
  33. data/public/avo-packs/js/application-6dbb940fca2e811fb7d5.js.map.br +0 -0
  34. data/public/avo-packs/js/application-6dbb940fca2e811fb7d5.js.map.gz +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce1c9ffa6fde59af4b61d77ff981b439a369323c9d50c7775e8c505e23a48b4f
4
- data.tar.gz: 3f56bed982b298e60c4ea007f9946584810d9d5c1a6ab304a670dfd12f7312c2
3
+ metadata.gz: 24fb847d8c6ebd7ba3c45926bc5431d7d100b3baf56391e316d4f30cebbae4f7
4
+ data.tar.gz: 7eb97752916fd9159f0210e5f500a9b4c563c9d250ffa53b59dd1ad54b5ff770
5
5
  SHA512:
6
- metadata.gz: 56131c0af786bab270cc590048c25587efbc31d0614e8faafc10ea4fac9c6c5c0e5155b23f978a4bd8da7c4faf3c30befc87585ca8c2b61873d135ef28c6515d
7
- data.tar.gz: 504322330fb7d8b75e860614c00c5c3c8972476f7475b01bd4a0a2b0fa1589682138156666b97ecf950dbfddf33a9f47349cfafa74b9afe72f93141c16e032b8
6
+ metadata.gz: 99780816253684b5de953532a0da805fecf38ab55115475438d94553ebe24989912e45172f7028d4c468482427f3da1686ea78d5c698ad3f24ff771fc0be72dc
7
+ data.tar.gz: 54104ca33a97fb1508133b6f1db18772cf94db9404d2c4dde5b507bc64b2c80fba54c00501bad998f6998a83f533902c18dd6425b541c451c9d55c917b11699f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (1.15.0)
4
+ avo (1.16.3)
5
5
  active_link_to
6
6
  addressable
7
7
  breadcrumbs_on_rails
@@ -14,6 +14,11 @@
14
14
  <%= svg 'trash' %> <%= t('avo.detach_item', item: @reflection.name.to_s).capitalize %>
15
15
  <% end %>
16
16
  <% end %>
17
+ <% if @resource.authorization.authorize_action(:edit, raise_exception: false) %>
18
+ <%= a_link edit_path, color: 'indigo' do %>
19
+ <%= svg 'edit' %> <%= t('avo.edit').capitalize %>
20
+ <% end %>
21
+ <% end %>
17
22
  <% else %>
18
23
  <%= a_link back_path do %>
19
24
  <%= svg 'arrow-left' %> <%= t('avo.go_back') %>
@@ -0,0 +1,23 @@
1
+ import BaseFilterController from './filter_controller'
2
+
3
+ export default class extends BaseFilterController {
4
+ static targets = ['text']
5
+
6
+ getFilterValue() {
7
+ return this.textTarget.value
8
+ }
9
+
10
+ tryToSubmit(e) {
11
+ if (e.keyCode === 13) {
12
+ return this.changeFilter()
13
+ }
14
+
15
+ return undefined
16
+ }
17
+
18
+ getFilterClass() {
19
+ const { filterClass } = this.textTarget.dataset
20
+
21
+ return filterClass
22
+ }
23
+ }
@@ -0,0 +1,23 @@
1
+ <%
2
+ begin
3
+ decoded_filters_param = JSON.parse(Base64.decode64(params[:filters]))
4
+ set_value = decoded_filters_param[filter.class.to_s]
5
+ rescue => exception
6
+ set_value = filter.default
7
+ end
8
+ %>
9
+ <div data-controller="text-filter">
10
+ <%= filter_wrapper name: filter.name do %>
11
+ <%= text_field_tag filter.id, set_value,
12
+ class: input_classes('w-full mb-0'),
13
+ id: "avo_filters_#{filter.id.parameterize.underscore}",
14
+ 'data-filter-class': filter.class.to_s,
15
+ 'data-text-filter-target': 'text',
16
+ 'data-action': 'keypress->text-filter#tryToSubmit'
17
+ %>
18
+ <div class="flex justify-end">
19
+ <%= a_button filter.button_label || "Filter by #{filter.name}", class: 'mt-4', color: 'blue', data: { action: "text-filter#changeFilter" }, size: :sm %>
20
+ </div>
21
+ <%= link_to 'url_redirect', request.url, data: { 'text-filter-target': 'urlRedirect', 'turbo-frame': params[:turbo_frame] }, style: 'hidden', class: 'hidden' %>
22
+ <% end %>
23
+ </div>
@@ -17,7 +17,7 @@
17
17
 
18
18
  <% if main_app.respond_to?(:destroy_user_session_path) %>
19
19
  <div class="hidden absolute inset-auto inset-auto right-0 mr-6 mt-0 py-4 bg-white rounded-xl min-w-[200px] shadow-context" data-toggle-panel-target="panel">
20
- <%= button_to "Sign out", main_app.destroy_user_session_path, method: :delete, form: { "data-turbo" => "false" }, class: "appearance-none bg-white text-left cursor-pointer text-green-600 font-semibold hover:text-white hover:bg-green-500 block px-4 py-1 w-full" %>
20
+ <%= button_to t('avo.sign_out'), main_app.destroy_user_session_path, method: :delete, form: { "data-turbo" => "false" }, class: "appearance-none bg-white text-left cursor-pointer text-green-600 font-semibold hover:text-white hover:bg-green-500 block px-4 py-1 w-full" %>
21
21
  </div>
22
22
  <% end %>
23
23
  </div>
@@ -11,8 +11,8 @@
11
11
  <%= render Avo::NavigationHeadingComponent.new label: t('avo.resources') %>
12
12
 
13
13
  <div class="w-full">
14
- <% Avo::App.resources_navigation(_current_user).each do |resource| %>
15
- <%= render Avo::NavigationLinkComponent.new label: resource.plural_name.humanize, path: resources_path(resource.model_class) %>
14
+ <% Avo::App.resources_navigation(_current_user).sort_by { |r| r.navigation_label }.each do |resource| %>
15
+ <%= render Avo::NavigationLinkComponent.new label: resource.navigation_label, path: resources_path(resource.model_class) %>
16
16
  <% end %>
17
17
 
18
18
  <% sidebar_partials = Avo::App.get_sidebar_partials %>
data/lib/avo/app.rb CHANGED
@@ -164,13 +164,11 @@ module Avo
164
164
  end
165
165
  .map do |resource|
166
166
  route_key = if resource.model_class.present?
167
- resource.model_class.model_name.route_key
167
+ resource.model_class.model_name.plural.to_sym
168
168
  else
169
169
  resource.to_s.underscore.gsub("_resource", "").downcase.pluralize.to_sym
170
170
  end
171
171
 
172
- # Handle uncountable routes
173
- route_key = route_key.to_sym
174
172
  resources route_key
175
173
  end
176
174
  end
@@ -230,6 +230,10 @@ module Avo
230
230
  self.class.name.demodulize.underscore
231
231
  end
232
232
 
233
+ def navigation_label
234
+ plural_name.humanize
235
+ end
236
+
233
237
  def available_view_types
234
238
  view_types = [:table]
235
239
 
@@ -85,7 +85,7 @@ module Avo
85
85
 
86
86
  def visible?
87
87
  if visible.present? && visible.respond_to?(:call)
88
- visible.call resource: resource
88
+ visible.call resource: @resource
89
89
  else
90
90
  visible
91
91
  end
@@ -0,0 +1,9 @@
1
+ module Avo
2
+ module Filters
3
+ class TextFilter < BaseFilter
4
+ class_attribute :button_label
5
+
6
+ self.template = "avo/base/text_filter"
7
+ end
8
+ end
9
+ end
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "1.15.0"
2
+ VERSION = "1.16.3"
3
3
  end
@@ -83,3 +83,4 @@ en:
83
83
  search:
84
84
  placeholder: 'Search'
85
85
  cancel_button: 'Cancel'
86
+ sign_out: 'Sign out'
@@ -80,3 +80,4 @@ nb-NO:
80
80
  not_authorized: 'Du er ikke autorisert til å gjøre denne handlingen.'
81
81
  search_placeholder: 'Søk'
82
82
  search_cancel_button: 'Avbryt'
83
+ sign_out: 'Logg ut'
@@ -82,3 +82,4 @@ pt-BR:
82
82
  search:
83
83
  placeholder: 'Procurar'
84
84
  cancel_button: 'Cancelar'
85
+ sign_out: 'sair'
@@ -70,3 +70,4 @@ ro:
70
70
  search:
71
71
  placeholder: 'Cauta'
72
72
  cancel_button: 'Anulare'
73
+ sign_out: 'Delogare'