avo 3.13.0 → 3.13.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 16115bffdc8f969e07e1d01706cbcd76e6df1cdf5e1f8ce11e98dad69eb873b1
4
- data.tar.gz: 8bd21a31f10463840231e58046eb13e22623321aca8a72ca0fd057ad5cd1b41f
3
+ metadata.gz: 661b7efdb938f2b72205c0fd4d62dcfaaf778af38c3ffe15e7a13b070d11db88
4
+ data.tar.gz: 0ce3b4ff38787188323dcde5a287daa8780637a21c99ab66c9bfe6509258d3d3
5
5
  SHA512:
6
- metadata.gz: 88932b6f5343c7d4fc6d61a6f53aedeed56b9a67ac0b1ad79ab5aa3d76a6f9e25839139ada620fe9fbe6c79be486d934f0dbee4a9624bfdb29b5110025e36faa
7
- data.tar.gz: 28f672c943abe0f0d2ec0562fc7e1d20ddd210d551f849f276eb9d113a3c3ec276d28626f0d0e05e76c6e19514264e177886bfdd6a951435c69f82feff19d127
6
+ metadata.gz: 45fcf56fea15a88f5bf24a7e973ee570c6dd26f43d233467611ae504d6c40f436bfe0e94839e342203942e1e185144cbebe7e7ec45810233b3c2f2b809a3ef7b
7
+ data.tar.gz: 8d16dee5688f0853a3b46f451413ed47ecaded7efb047678393f390177c9989cb3d7ca73b9c01e8bee998b3b44e4eb60c056cea03e8282a36d5b1d5a8182295b
data/Gemfile.lock CHANGED
@@ -107,7 +107,7 @@ GIT
107
107
  PATH
108
108
  remote: .
109
109
  specs:
110
- avo (3.13.0)
110
+ avo (3.13.2)
111
111
  actionview (>= 6.1)
112
112
  active_link_to
113
113
  activerecord (>= 6.1)
@@ -642,7 +642,7 @@ GEM
642
642
  unicode-display_width (2.6.0)
643
643
  uri (0.13.1)
644
644
  useragent (0.16.10)
645
- view_component (3.14.0)
645
+ view_component (3.15.1)
646
646
  activesupport (>= 5.2.0, < 8.0)
647
647
  concurrent-ruby (~> 1.0)
648
648
  method_source (~> 1.0)
@@ -14,7 +14,7 @@ class Avo::Index::ResourceTableComponent < Avo::BaseComponent
14
14
  prop :parent_record, _Nilable(_Any)
15
15
  prop :parent_resource, _Nilable(Avo::BaseResource)
16
16
  prop :pagy, _Nilable(Pagy)
17
- prop :query, _Nilable(ActiveRecord::Relation)
17
+ prop :query, _Nilable(_Any)
18
18
  prop :actions, _Nilable(_Array(Avo::BaseAction))
19
19
 
20
20
  def encrypted_query
@@ -6,7 +6,7 @@ class Avo::Index::TableRowComponent < Avo::BaseComponent
6
6
 
7
7
  attr_writer :header_fields
8
8
 
9
- prop :resource, _Nilable(Avo::BaseResource)
9
+ prop :resource, _Nilable(Avo::BaseResource), reader: :public
10
10
  prop :reflection, _Nilable(ActiveRecord::Reflection::AbstractReflection)
11
11
  prop :parent_record, _Nilable(_Any)
12
12
  prop :parent_resource, _Nilable(Avo::BaseResource)
@@ -6,7 +6,7 @@ class Avo::ModalComponent < Avo::BaseComponent
6
6
 
7
7
  prop :width, Symbol, default: :md
8
8
  prop :body_class, _Nilable(String)
9
- prop :overflow, Symbol, default: :auto
9
+ prop :overflow, _Nilable(Symbol), default: :auto
10
10
 
11
11
  def width_classes
12
12
  case @width.to_sym
@@ -17,7 +17,7 @@ class Avo::Views::ResourceIndexComponent < Avo::ResourceComponent
17
17
  prop :parent_record, _Nilable(_Any)
18
18
  prop :parent_resource, _Nilable(Avo::BaseResource)
19
19
  prop :applied_filters, Hash, default: {}.freeze
20
- prop :query, _Nilable(ActiveRecord::Relation), reader: :public
20
+ prop :query, _Nilable(_Any), reader: :public
21
21
  # This should be
22
22
  # prop :scopes, _Nilable(_Array(Avo::Advanced::Scopes::BaseScope)), reader: :public
23
23
  # However, Avo::Advanced::Scopes::BaseScope raises an error because
@@ -328,5 +328,13 @@ module Avo
328
328
  "avo/application"
329
329
  end
330
330
  end
331
+
332
+ def authenticate_developer_or_admin!
333
+ raise_404 unless Avo::Current.user_is_developer? || Avo::Current.user_is_admin?
334
+ end
335
+
336
+ def raise_404
337
+ raise ActionController::RoutingError.new "No route matches"
338
+ end
331
339
  end
332
340
  end
@@ -2,7 +2,13 @@ require_dependency "avo/application_controller"
2
2
 
3
3
  module Avo
4
4
  class DebugController < ApplicationController
5
+ before_action :authenticate_developer_or_admin!
6
+
5
7
  def status
8
+ respond_to do |format|
9
+ format.html { render :status }
10
+ format.text { render :status }
11
+ end
6
12
  end
7
13
 
8
14
  def send_to_hq
@@ -2,6 +2,8 @@ require_dependency "avo/application_controller"
2
2
 
3
3
  module Avo
4
4
  class PrivateController < ApplicationController
5
+ before_action :authenticate_developer_or_admin!
6
+
5
7
  def design
6
8
  @page_title = "Design [Private]"
7
9
  end
@@ -76,7 +76,7 @@
76
76
  <ul>
77
77
  <li>Avo <%= Avo::VERSION %></li>
78
78
  <% Avo.plugin_manager.plugins.each do |plugin| %>
79
- <li><%= plugin.klass.name %> - <%= plugin.klass.version %></li>
79
+ <li><%= plugin.name %> - <%= plugin.version %></li>
80
80
  <% end %>
81
81
  </ul>
82
82
  </div>
@@ -0,0 +1,6 @@
1
+ <!-- Avo version: <%= Avo::VERSION %> -->
2
+ <!-- Rails version: <%= Rails::VERSION::STRING %> -->
3
+ <!-- Environment: <%= Rails.env %> -->
4
+ <!-- License ID: <%= Avo.license.id %> -->
5
+ <!-- License valid?: <%= Avo.license.valid ? "valid" : "invalid" %> -->
6
+ <!-- Plugins: <%= Avo.plugin_manager.to_s %> -->
@@ -53,12 +53,6 @@
53
53
  <%= render partial: "avo/partials/alerts" %>
54
54
  <%= render partial: "avo/partials/scripts" %>
55
55
  <%= render partial: "avo/partials/confirm_dialog" %>
56
- <!-- Avo version: <%= Avo::VERSION %> -->
57
- <!-- Rails version: <%= Rails::VERSION::STRING %> -->
58
- <!-- Environment: <%= Rails.env %> -->
59
- <!-- License ID: <%= Avo.license.id %> -->
60
- <!-- License valid?: <%= Avo.license.valid ? "valid" : "invalid" %> -->
61
- <!-- Plugins: <%= Avo.plugin_manager.to_s %> -->
62
56
  </body>
63
57
  </html>
64
58
  <!-- ✨ Built with Avo • https://www.avohq.io/ -->
data/lib/avo/plugin.rb CHANGED
@@ -3,11 +3,17 @@ module Avo
3
3
  attr_reader :name
4
4
  attr_reader :priority
5
5
 
6
+ delegate :version, :namespace, :engine, to: :class
7
+
6
8
  def initialize(*, name:, priority:, **, &block)
7
9
  @name = name
8
10
  @priority = priority
9
11
  end
10
12
 
13
+ def to_s
14
+ "#{name}-#{version}"
15
+ end
16
+
11
17
  class << self
12
18
  def name
13
19
  return gemspec.name if gemspec.present?
@@ -12,18 +12,6 @@ module Avo
12
12
  @plugins << Plugin.new(name:, priority: priority)
13
13
  end
14
14
 
15
- def boot_plugins
16
- Avo.plugin_manager.all.sort_by(&:priority).each do |plugin|
17
- plugin.klass.boot
18
- end
19
- end
20
-
21
- def init_plugins
22
- Avo.plugin_manager.all.sort_by(&:priority).each do |plugin|
23
- plugin.klass.init
24
- end
25
- end
26
-
27
15
  def register_field(method_name, klass)
28
16
  Avo.field_manager.load_field method_name, klass
29
17
  end
@@ -37,7 +25,7 @@ module Avo
37
25
  def as_json(*arg)
38
26
  plugins.map do |plugin|
39
27
  {
40
- klass: plugin.klass.to_s,
28
+ klass: plugin.to_s,
41
29
  priority: plugin.priority,
42
30
  }
43
31
  end
@@ -45,7 +33,7 @@ module Avo
45
33
 
46
34
  def to_s
47
35
  plugins.map do |plugin|
48
- plugin.klass.to_s
36
+ plugin.to_s
49
37
  end.join(",")
50
38
  rescue
51
39
  "Failed to fetch plugins."
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "3.13.0" unless const_defined?(:VERSION)
2
+ VERSION = "3.13.2" unless const_defined?(:VERSION)
3
3
  end
@@ -101,6 +101,7 @@ Avo.configure do |config|
101
101
  # }
102
102
 
103
103
  ## == Customization ==
104
+ config.click_row_to_view_record = true
104
105
  # config.app_name = 'Avocadelicious'
105
106
  # config.timezone = 'UTC'
106
107
  # config.currency = 'USD'
@@ -114,7 +115,6 @@ Avo.configure do |config|
114
115
  # config.buttons_on_form_footers = true
115
116
  # config.field_wrapper_layout = true
116
117
  # config.resource_parent_controller = "Avo::ResourcesController"
117
- # config.click_row_to_view_record = false
118
118
 
119
119
  ## == Branding ==
120
120
  # config.branding = {
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.13.0
4
+ version: 3.13.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Marin
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-10-01 00:00:00.000000000 Z
13
+ date: 2024-10-02 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord
@@ -2234,6 +2234,7 @@ files:
2234
2234
  - app/views/avo/debug/_valid_indicator.html.erb
2235
2235
  - app/views/avo/debug/report.html.erb
2236
2236
  - app/views/avo/debug/status.html.erb
2237
+ - app/views/avo/debug/status.text.erb
2237
2238
  - app/views/avo/home/_actions.html.erb
2238
2239
  - app/views/avo/home/_dashboards.html.erb
2239
2240
  - app/views/avo/home/_docs.html.erb