avo 3.0.1.beta20 → 3.0.1.beta21

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.

@@ -39,8 +39,7 @@
39
39
  <% end %>
40
40
  </div>
41
41
  <% end %>
42
- <%# Example link below %>
43
- <%#= render Avo::ProfileItemComponent.new label: 'Profile', path: '/profile', icon: 'user-circle' %>
42
+ <%= render "avo/partials/profile_menu_extra" %>
44
43
  <% if can_destroy_user? %>
45
44
  <%= button_to helpers.main_app.send(destroy_user_session_path),
46
45
  form: { "data-turbo" => "false" },
@@ -264,15 +264,17 @@ module Avo
264
264
  self
265
265
  end
266
266
 
267
+ VIEW_METHODS_MAPPING = {
268
+ index: [:index_fields, :display_fields],
269
+ show: [:show_fields, :display_fields],
270
+ edit: [:edit_fields, :form_fields],
271
+ update: [:edit_fields, :form_fields],
272
+ new: [:new_fields, :form_fields],
273
+ create: [:new_fields, :form_fields]
274
+ } unless defined? VIEW_METHODS_MAPPING
275
+
267
276
  def fetch_fields
268
- possible_methods_for_view = {
269
- index: [:index_fields, :display_fields],
270
- show: [:show_fields, :display_fields],
271
- edit: [:edit_fields, :form_fields],
272
- update: [:edit_fields, :form_fields],
273
- new: [:new_fields, :form_fields],
274
- create: [:new_fields, :form_fields]
275
- }[view.to_sym]
277
+ possible_methods_for_view = VIEW_METHODS_MAPPING[view.to_sym]
276
278
 
277
279
  # Safe navigation operator is used because the view can be "destroy" or "preview"
278
280
  possible_methods_for_view&.each do |method_for_view|
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "3.0.1.beta20" unless const_defined?(:VERSION)
2
+ VERSION = "3.0.1.beta21" unless const_defined?(:VERSION)
3
3
  end
@@ -2,11 +2,14 @@
2
2
  # It also allows to check if the view is a form or a display view by using `view.form?` or `view.display?`
3
3
  module Avo
4
4
  class ViewInquirer < ActiveSupport::StringInquirer
5
+ DISPLAY_VIEWS = %w[index show].freeze unless defined? DISPLAY_VIEWS
6
+ FORM_VIEWS = %w[new edit].freeze unless defined? FORM_VIEWS
7
+
5
8
  def initialize(view)
6
9
  super(view.to_s)
7
10
 
8
- @display = in? %w[index show]
9
- @form = in? %w[new edit]
11
+ @display = in? DISPLAY_VIEWS
12
+ @form = in? FORM_VIEWS
10
13
  end
11
14
 
12
15
  def display?
data/lib/avo.rb CHANGED
@@ -147,7 +147,7 @@ module Avo
147
147
  def get_cache_store
148
148
  if Rails.env.production?
149
149
  case Rails.cache.class.to_s
150
- when "ActiveSupport::Cache::MemCacheStore", "ActiveSupport::Cache::RedisCacheStore"
150
+ when "ActiveSupport::Cache::MemCacheStore", "ActiveSupport::Cache::RedisCacheStore", "SolidCache::Store"
151
151
  Rails.cache
152
152
  else
153
153
  ActiveSupport::Cache.lookup_store(:file_store, Rails.root.join("tmp", "cache"))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avo
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1.beta20
4
+ version: 3.0.1.beta21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Marin
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-10-10 00:00:00.000000000 Z
12
+ date: 2023-10-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord