avo 1.3.0.pre.1 → 1.3.4

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 (88) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -0
  3. data/Gemfile.lock +12 -8
  4. data/README.md +3 -2
  5. data/app/components/avo/edit/fields/markdown_field_component.html.erb +1 -0
  6. data/app/components/avo/edit/fields/trix_field_component.html.erb +1 -1
  7. data/app/components/avo/panel_component.html.erb +5 -3
  8. data/app/components/avo/panel_component.rb +6 -1
  9. data/app/components/avo/show/fields/markdown_field_component.html.erb +1 -0
  10. data/app/components/avo/views/resource_index_component.html.erb +1 -1
  11. data/app/components/avo/views/resource_show_component.html.erb +1 -1
  12. data/app/controllers/avo/application_controller.rb +27 -0
  13. data/app/controllers/avo/home_controller.rb +4 -3
  14. data/app/helpers/avo/application_helper.rb +8 -2
  15. data/app/packs/entrypoints/application.js +10 -14
  16. data/app/packs/js/controllers/fields/code_field_controller.js +4 -1
  17. data/app/packs/js/controllers/fields/simple_mde_controller.js +9 -0
  18. data/app/packs/stylesheets/components/code.css +5 -0
  19. data/app/views/avo/home/_actions.html.erb +5 -5
  20. data/app/views/avo/home/_docs.html.erb +1 -1
  21. data/app/views/avo/home/_filters.html.erb +4 -4
  22. data/app/views/avo/home/_resources.html.erb +15 -2
  23. data/app/views/avo/home/index.html.erb +1 -1
  24. data/app/views/avo/partials/_custom_tools_alert.html.erb +6 -0
  25. data/app/views/avo/partials/_head.html.erb +0 -0
  26. data/app/views/avo/partials/_logo.html.erb +1 -1
  27. data/app/views/avo/sidebar/_license_warning.html.erb +3 -7
  28. data/app/views/avo/sidebar/_sidebar.html.erb +2 -1
  29. data/app/views/layouts/avo/application.html.erb +9 -4
  30. data/avo.gemspec +1 -1
  31. data/bin/helpers.rb +1 -1
  32. data/bin/spring +5 -5
  33. data/config/webpacker.yml +1 -1
  34. data/lib/avo.rb +13 -0
  35. data/lib/avo/app.rb +7 -3
  36. data/lib/avo/configuration.rb +6 -0
  37. data/lib/avo/fields/base_field.rb +3 -1
  38. data/lib/avo/fields/key_value_field.rb +1 -24
  39. data/lib/avo/fields/markdown_field.rb +3 -4
  40. data/lib/avo/licensing/h_q.rb +3 -3
  41. data/lib/avo/licensing/license.rb +2 -0
  42. data/lib/avo/licensing/pro_license.rb +2 -1
  43. data/lib/avo/version.rb +1 -1
  44. data/lib/generators/avo/action_generator.rb +1 -1
  45. data/lib/generators/avo/eject_generator.rb +5 -4
  46. data/lib/generators/avo/filter_generator.rb +1 -1
  47. data/lib/generators/avo/locales_generator.rb +2 -2
  48. data/lib/generators/avo/resource_generator.rb +1 -4
  49. data/lib/generators/avo/templates/action.tt +5 -9
  50. data/lib/generators/avo/templates/initializer/avo.tt +10 -1
  51. data/lib/generators/avo/templates/locales/avo.en.yml +1 -0
  52. data/lib/generators/avo/templates/locales/avo.nb-NO.yml +81 -0
  53. data/lib/generators/avo/templates/locales/avo.pt-BR.yml +82 -0
  54. data/lib/generators/avo/templates/locales/avo.ro.yml +70 -0
  55. data/lib/generators/avo/tool_generator.rb +2 -2
  56. data/public/avo-packs/css/{application-5af67922.css → application-af3e670d.css} +40 -103
  57. data/public/avo-packs/css/application-af3e670d.css.br +0 -0
  58. data/public/avo-packs/css/application-af3e670d.css.gz +0 -0
  59. data/public/avo-packs/css/application-af3e670d.css.map +1 -0
  60. data/public/avo-packs/css/application-af3e670d.css.map.br +0 -0
  61. data/public/avo-packs/css/application-af3e670d.css.map.gz +0 -0
  62. data/public/avo-packs/js/application-801f1297670a4c6df1b6.js +26 -0
  63. data/public/avo-packs/js/{application-a48a99244065c8d7a1d1.js.LICENSE.txt → application-801f1297670a4c6df1b6.js.LICENSE.txt} +0 -0
  64. data/public/avo-packs/js/application-801f1297670a4c6df1b6.js.br +0 -0
  65. data/public/avo-packs/js/application-801f1297670a4c6df1b6.js.gz +0 -0
  66. data/public/avo-packs/js/application-801f1297670a4c6df1b6.js.map +1 -0
  67. data/public/avo-packs/js/application-801f1297670a4c6df1b6.js.map.br +0 -0
  68. data/public/avo-packs/js/application-801f1297670a4c6df1b6.js.map.gz +0 -0
  69. data/public/avo-packs/manifest.json +15 -15
  70. metadata +33 -35
  71. data/app/components/avo/common/key_value_component.html.erb +0 -53
  72. data/app/components/avo/common/key_value_component.rb +0 -11
  73. data/app/components/avo/edit/fields/key_value_field_component.html.erb +0 -3
  74. data/app/components/avo/edit/fields/key_value_field_component.rb +0 -4
  75. data/app/components/avo/show/fields/key_value_field_component.html.erb +0 -3
  76. data/app/components/avo/show/fields/key_value_field_component.rb +0 -4
  77. data/app/packs/js/controllers/fields/key_value_controller.js +0 -132
  78. data/public/avo-packs/css/application-5af67922.css.br +0 -0
  79. data/public/avo-packs/css/application-5af67922.css.gz +0 -0
  80. data/public/avo-packs/css/application-5af67922.css.map +0 -1
  81. data/public/avo-packs/css/application-5af67922.css.map.br +0 -0
  82. data/public/avo-packs/css/application-5af67922.css.map.gz +0 -0
  83. data/public/avo-packs/js/application-a48a99244065c8d7a1d1.js +0 -26
  84. data/public/avo-packs/js/application-a48a99244065c8d7a1d1.js.br +0 -0
  85. data/public/avo-packs/js/application-a48a99244065c8d7a1d1.js.gz +0 -0
  86. data/public/avo-packs/js/application-a48a99244065c8d7a1d1.js.map +0 -1
  87. data/public/avo-packs/js/application-a48a99244065c8d7a1d1.js.map.br +0 -0
  88. data/public/avo-packs/js/application-a48a99244065c8d7a1d1.js.map.gz +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a62f55a2092f0dd2716cdaacc87e2eea086745d164d032ff8024757748830e54
4
- data.tar.gz: a104302aecf8c7f57ac9915fe61eaf26866d3ac25678f40eee2b2244de5d3664
3
+ metadata.gz: f07bd27219373943d20e34298f27988df5b44c40e2fd9747952e41ee9d3595b7
4
+ data.tar.gz: e2526041e2318832a501f6862fb045e39332f6ea21c2762354898be7ee715bf6
5
5
  SHA512:
6
- metadata.gz: 88e0ca48ccbc7ff735cbf14178e8bfce1085b34996ed3cad80238e3a625adc0eeab918092b5fee304a3fc31ab9d2465a5f0b5580aac6b5efd308b09218f340cd
7
- data.tar.gz: 8b1847c9083ef9998ee2e6a49202addcb9e670c2b5fa1904672287bfa902dd886df4ed5a6ba21de1f5db9020a3a1bc1e5e868765d672677928840d9c14ad83e1
6
+ metadata.gz: af5fb87c665732d3a23aab6129ab55724b5c3c7ad55e61fe0526d4715762f6375aaf71c602905481127a0631d1f39a3cd4f6d14630ac5cc3ca48a43bb43e32a9
7
+ data.tar.gz: abe7cdf77c7cb9afbdcb1f6f0c2fa5a89d7fe100170d80b33b7454631fae2e502da13990a1bd52265bc7b9561591db2d03795c3affbea661937e45c9f3415be3
data/Gemfile CHANGED
@@ -123,3 +123,5 @@ gem "appraisal"
123
123
  gem 'meta-tags'
124
124
 
125
125
  gem 'breadcrumbs_on_rails'
126
+
127
+ gem 'manifester'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (1.3.0.pre.1)
4
+ avo (1.3.4)
5
5
  active_link_to
6
6
  addressable
7
7
  breadcrumbs_on_rails
@@ -9,12 +9,12 @@ PATH
9
9
  hotwire-rails
10
10
  httparty
11
11
  image_processing
12
+ manifester
12
13
  meta-tags
13
14
  pagy
14
15
  pundit
15
16
  rails (>= 6.0)
16
17
  view_component
17
- webpacker
18
18
  zeitwerk
19
19
 
20
20
  GEM
@@ -159,12 +159,15 @@ GEM
159
159
  listen (3.5.1)
160
160
  rb-fsevent (~> 0.10, >= 0.10.3)
161
161
  rb-inotify (~> 0.9, >= 0.9.10)
162
- loofah (2.9.0)
162
+ loofah (2.9.1)
163
163
  crass (~> 1.0.2)
164
164
  nokogiri (>= 1.5.9)
165
165
  mail (2.7.1)
166
166
  mini_mime (>= 0.1.1)
167
- marcel (1.0.0)
167
+ manifester (0.1.7)
168
+ rails (>= 6.0)
169
+ zeitwerk
170
+ marcel (1.0.1)
168
171
  meta-tags (2.14.0)
169
172
  actionpack (>= 3.2.0, < 6.2)
170
173
  method_source (1.0.0)
@@ -172,16 +175,16 @@ GEM
172
175
  mime-types-data (~> 3.2015)
173
176
  mime-types-data (3.2021.0225)
174
177
  mini_magick (4.11.0)
175
- mini_mime (1.0.3)
178
+ mini_mime (1.1.0)
176
179
  mini_portile2 (2.5.0)
177
180
  minitest (5.14.4)
178
181
  msgpack (1.3.3)
179
182
  multi_xml (0.6.0)
180
183
  nio4r (2.5.7)
181
- nokogiri (1.11.2)
184
+ nokogiri (1.11.3)
182
185
  mini_portile2 (~> 2.5.0)
183
186
  racc (~> 1.4)
184
- nokogiri (1.11.2-x86_64-linux)
187
+ nokogiri (1.11.3-x86_64-linux)
185
188
  racc (~> 1.4)
186
189
  orm_adapter (0.5.0)
187
190
  pagy (3.12.0)
@@ -380,6 +383,7 @@ DEPENDENCIES
380
383
  iso
381
384
  jbuilder (~> 2.7)
382
385
  listen (>= 3.5.1)
386
+ manifester
383
387
  meta-tags
384
388
  pg (>= 0.18, < 2.0)
385
389
  puma (~> 4.3.5)
@@ -405,4 +409,4 @@ DEPENDENCIES
405
409
  zeitwerk (~> 2.3)
406
410
 
407
411
  BUNDLED WITH
408
- 2.2.5
412
+ 2.2.11
data/README.md CHANGED
@@ -30,12 +30,13 @@ Avo is a beautiful next-generation framework that empowers you, the developer, t
30
30
  - **Keeps your app clean** - You don't need to change your app to use Avo. Drop it in your existing app or add it to a new one and you're done 🙌
31
31
  - **Custom fields***- No worries if we missed a field you need. Generate a custom field in a jiffy.
32
32
  - **Dashboard widgets and metrics*** - Customize your dashboard with the tools and analytics you need.
33
- - **Custom tools*** - You need to add a page with something completely new, you've got it!
33
+ - **Custom tools** - You need to add a page with something completely new, you've got it!
34
34
  - **Authorization** - Leverage Pundit policies to build a robust and scalable authorization system.
35
35
  - **Themable*** - Dress it up into your own colors.
36
36
  - **Localization*** - Have it available in any language you need.
37
+ - **No asset pipeline pollution** - Bring your own asset pipeline.
37
38
 
38
- *Some features are still under development
39
+ *Features still under development
39
40
 
40
41
  # Installation
41
42
  Add this line to your application's `Gemfile`:
@@ -5,6 +5,7 @@
5
5
  placeholder: @field.placeholder,
6
6
  disabled: @field.readonly,
7
7
  'data-simple-mde-target': 'element',
8
+ 'data-component-options': @field.options.to_json,
8
9
  'data-view': :edit
9
10
  %>
10
11
  </div>
@@ -1,6 +1,6 @@
1
1
  <%= edit_field_wrapper field: @field, index: @index, form: @form, resource: @resource, displayed_in_modal: @displayed_in_modal do %>
2
2
  <% trix_id = "trix_#{@resource.name.underscore}_#{@field.id}" %>
3
- <trix-editor input="<%= trix_id %>" value="<%= @field.value %>" placeholder="<%= @field.placeholder %>"><%== @field.value %></trix-editor>
3
+ <trix-editor input="<%= trix_id %>" placeholder="<%= @field.placeholder %>"><%== @field.value %></trix-editor>
4
4
  <%= @form.text_area @field.id,
5
5
  id: trix_id,
6
6
  class: helpers.input_classes('w-full hidden', has_error: (@resource.model.present? and @resource.model.errors.include?(@field.id))),
@@ -1,9 +1,11 @@
1
1
  <div <%== data_attributes %>>
2
2
  <div class="mb-6">
3
3
  <div>
4
- <div class="breadcrumbs">
5
- <%= helpers.render_breadcrumbs(separator: helpers.svg('chevron-right', class: 'inline-block h-3 stroke-current relative top-[-1px] ml-1' )) if Avo.configuration.display_breadcrumbs %>
6
- </div>
4
+ <% if show_breadcrumbs? %>
5
+ <div class="breadcrumbs">
6
+ <%= helpers.render_breadcrumbs(separator: helpers.svg('chevron-right', class: 'inline-block h-3 stroke-current relative top-[-1px] ml-1' )) if Avo.configuration.display_breadcrumbs %>
7
+ </div>
8
+ <% end %>
7
9
  <div class="text-2xl tracking-normal font-bold text-gray-800 truncate">
8
10
  <%= @title %>
9
11
  </div>
@@ -6,10 +6,11 @@ class Avo::PanelComponent < ViewComponent::Base
6
6
  renders_one :bare_content
7
7
  renders_one :footer
8
8
 
9
- def initialize(title: nil, body_classes: nil, data: {})
9
+ def initialize(title: nil, body_classes: nil, data: {}, show_breadcrumbs: true)
10
10
  @title = title
11
11
  @body_classes = body_classes
12
12
  @data = data
13
+ @show_breadcrumbs = show_breadcrumbs
13
14
  end
14
15
 
15
16
  private
@@ -21,4 +22,8 @@ class Avo::PanelComponent < ViewComponent::Base
21
22
  " data-#{key}=\"#{value}\""
22
23
  end.join
23
24
  end
25
+
26
+ def show_breadcrumbs?
27
+ @show_breadcrumbs
28
+ end
24
29
  end
@@ -5,6 +5,7 @@
5
5
  placeholder: @field.placeholder,
6
6
  disabled: @field.readonly,
7
7
  'data-simple-mde-target': 'element',
8
+ 'data-component-options': @field.options.to_json,
8
9
  'data-view': :show %>
9
10
  </div>
10
11
  <% end %>
@@ -1,4 +1,4 @@
1
- <%= render Avo::PanelComponent.new title: title, body_classes: 'py-4', data: { component: 'resources-index' } do |c| %>
1
+ <%= render Avo::PanelComponent.new title: title, body_classes: 'py-4', data: { component: 'resources-index' }, show_breadcrumbs: @reflection.blank? do |c| %>
2
2
  <% c.tools do %>
3
3
  <%= render 'actions' if @actions.present? %>
4
4
 
@@ -3,7 +3,7 @@
3
3
  data-selected-resources="[<%= @resource.model.id %>]"
4
4
  >
5
5
  <% @resource.panels.each do |resource_panel| %>
6
- <%= render(Avo::PanelComponent.new(title: resource_panel[:name])) do |c| %>
6
+ <%= render Avo::PanelComponent.new(title: resource_panel[:name], show_breadcrumbs: @reflection.blank?) do |c| %>
7
7
  <% c.tools do %>
8
8
  <% if resource_panel[:name] == @resource.default_panel_name %>
9
9
  <%= render 'actions' %>
@@ -4,6 +4,7 @@ module Avo
4
4
  include Pagy::Backend
5
5
  protect_from_forgery with: :exception
6
6
  before_action :init_app
7
+ before_action :check_avo_license
7
8
  before_action :set_authorization
8
9
  before_action :_authenticate!
9
10
  before_action :set_container_classes
@@ -34,6 +35,24 @@ module Avo
34
35
  end
35
36
  end
36
37
 
38
+ def render(*args)
39
+ raise Avo::LicenseVerificationTemperedError, "License verification mechanism tempered with." unless method(:check_avo_license).source_location.first.match?(/.*\/app\/controllers\/avo\/application_controller\.rb/)
40
+
41
+ super(*args)
42
+ end
43
+
44
+ def check_avo_license
45
+ unless on_root_path || on_resources_path
46
+ if @license.invalid? || @license.lacks(:custom_tools)
47
+ if Rails.env.development?
48
+ @custom_tools_alert_visible = true
49
+ else
50
+ raise Avo::LicenseInvalidError, "Your license is invalid or doesn't support custom tools."
51
+ end
52
+ end
53
+ end
54
+ end
55
+
37
56
  def _current_user
38
57
  instance_eval(&Avo.configuration.current_user)
39
58
  end
@@ -245,5 +264,13 @@ module Avo
245
264
  def add_initial_breadcrumbs
246
265
  instance_eval(&Avo.configuration.initial_breadcrumbs) if Avo.configuration.initial_breadcrumbs.present?
247
266
  end
267
+
268
+ def on_root_path
269
+ [Avo.configuration.root_path, "#{Avo.configuration.root_path}/"].include?(request.original_fullpath)
270
+ end
271
+
272
+ def on_resources_path
273
+ request.original_url.match?(/.*\/#{Avo.configuration.namespace}\/resources\/.*/)
274
+ end
248
275
  end
249
276
  end
@@ -3,9 +3,10 @@ require_dependency "avo/application_controller"
3
3
  module Avo
4
4
  class HomeController < ApplicationController
5
5
  def index
6
- @page_title = "Get started"
7
-
8
- unless Rails.env.development?
6
+ if Avo.configuration.home_path.present?
7
+ redirect_to Avo.configuration.home_path
8
+ elsif !Rails.env.development?
9
+ @page_title = "Get started"
9
10
  redirect_to resources_path Avo::App.get_resources.min_by { |resource| resource.route_key }.model_class
10
11
  end
11
12
  end
@@ -1,10 +1,16 @@
1
1
  module Avo
2
2
  module ApplicationHelper
3
- include ::Webpacker::Helper
3
+ include ::Manifester::Helper
4
4
  include ::Pagy::Frontend
5
5
 
6
6
  def current_webpacker_instance
7
- Avo.webpacker
7
+ return Avo.webpacker if Avo::IN_DEVELOPMENT || Rails.env.test?
8
+
9
+ super
10
+ end
11
+
12
+ def current_manifester_instance
13
+ Avo.manifester
8
14
  end
9
15
 
10
16
  def render_license_warnings
@@ -19,19 +19,6 @@ window.Turbolinks = Turbo
19
19
 
20
20
  Mousetrap.bind('r r r', () => Turbo.visit(window.location.href, { action: 'replace' }))
21
21
 
22
- function initTippy() {
23
- tippy('[data-tippy="tooltip"]', {
24
- theme: 'light',
25
- content(reference) {
26
- const title = reference.getAttribute('title')
27
- reference.removeAttribute('title')
28
-
29
- return title
30
- },
31
- })
32
- }
33
- window.initTippy = initTippy
34
-
35
22
  const application = Application.start()
36
23
 
37
24
  const context = require.context('./../js/controllers', true, /\.js$/)
@@ -42,7 +29,16 @@ application.load(definitionsFromContext(fieldsContext))
42
29
 
43
30
  document.addEventListener('turbo:load', () => {
44
31
  document.body.classList.remove('turbo-loading')
45
- initTippy()
32
+
33
+ tippy('[data-tippy="tooltip"]', {
34
+ theme: 'light',
35
+ content(reference) {
36
+ const title = reference.getAttribute('title')
37
+ reference.removeAttribute('title')
38
+
39
+ return title
40
+ },
41
+ })
46
42
  })
47
43
  document.addEventListener('turbo:visit', () => document.body.classList.add('turbo-loading'))
48
44
  document.addEventListener('turbo:submit-start', () => document.body.classList.add('turbo-loading'))
@@ -12,6 +12,7 @@ import 'codemirror/mode/shell/shell'
12
12
  import 'codemirror/mode/sql/sql'
13
13
  import 'codemirror/mode/vue/vue'
14
14
  import 'codemirror/mode/xml/xml'
15
+
15
16
  import { Controller } from 'stimulus'
16
17
  import { castBoolean } from '@/js/helpers/cast_boolean'
17
18
  import CodeMirror from 'codemirror'
@@ -30,6 +31,8 @@ export default class extends Controller {
30
31
  lineNumbers: true,
31
32
  }
32
33
 
33
- CodeMirror.fromTextArea(this.elementTarget, options)
34
+ setTimeout(() => {
35
+ CodeMirror.fromTextArea(this.elementTarget, options)
36
+ }, 1)
34
37
  }
35
38
  }
@@ -8,9 +8,18 @@ export default class extends Controller {
8
8
  return this.elementTarget.dataset.view
9
9
  }
10
10
 
11
+ get componentOptions() {
12
+ try {
13
+ return JSON.parse(this.elementTarget.dataset.componentOptions)
14
+ } catch (error) {
15
+ return {}
16
+ }
17
+ }
18
+
11
19
  connect() {
12
20
  const options = {
13
21
  element: this.elementTarget,
22
+ spellChecker: this.componentOptions.spell_checker,
14
23
  }
15
24
 
16
25
  if (this.view === 'show') {
@@ -9,3 +9,8 @@
9
9
  height: var(--height) !important;
10
10
  min-height: auto;
11
11
  }
12
+
13
+ /* overlay CodeMirror fullscreen & Preview on small screens */
14
+ .CodeMirror-fullscreen, .editor-preview-active-side {
15
+ z-index: 50;
16
+ }
@@ -1,16 +1,16 @@
1
1
  <div>
2
2
  <h3>Actions</h3>
3
3
 
4
- <div class="mt-2" data-controller="hidden-input">
4
+ <div class="mt-2">
5
5
  Avo actions allow you to perform specific tasks on one or more of your records. For example, you might want to mark a user as inactive and optionally send a message that may be customized by the person that wants to run the action.
6
6
 
7
- <strong class="cursor-pointer block mt-2" data-action="click->hidden-input#showContent">Generate action 👇</strong>
8
-
9
- <div class="mt-2 hidden" data-hidden-input-target="content">
7
+ <div class="mt-2">
10
8
  <code class="text-lg">Toggle published</code>
11
- <div>
9
+ <div class="mt-1">
12
10
  <code class="p-1 rounded bg-light-blue-500 text-white">bin/rails generate avo:action toggle_published</code>
13
11
  </div>
14
12
  </div>
13
+
14
+ <a href="https://docs.avohq.io/1.0/actions.html" target="_blank" title="Avo Actions documentation" class="text-bold cursor-pointer block mt-2">Actions in the docs 👉</a>
15
15
  </div>
16
16
  </div>
@@ -4,6 +4,6 @@
4
4
  <div class="mt-2">
5
5
  We take pride in our documentation. Please check it out to see what you can build with Avo
6
6
 
7
- <a href="https://docs.avohq.io" class="text-bold cursor-pointer block mt-2">Check out the docs 👉</a>
7
+ <a href="https://docs.avohq.io" target="_blank" title="Avo documentation" class="text-bold cursor-pointer block mt-2">Check out the docs 👉</a>
8
8
  </div>
9
9
  </div>
@@ -4,13 +4,13 @@
4
4
  <div class="mt-2" data-controller="hidden-input">
5
5
  Filters allow you to better scope the index queries for records you are looking for.
6
6
 
7
- <strong class="cursor-pointer block mt-2" data-action="click->hidden-input#showContent">Generate filter 👇</strong>
8
-
9
- <div class="mt-2 hidden" data-hidden-input-target="content">
7
+ <div class="mt-2">
10
8
  <code class="text-lg">Published filter</code>
11
- <div>
9
+ <div class="mt-1">
12
10
  <code class="p-1 rounded bg-light-blue-500 text-white">bin/rails generate avo:filter published_filter</code>
13
11
  </div>
14
12
  </div>
13
+
14
+ <a href="https://docs.avohq.io/1.0/filters.html" target="_blank" title="Avo Filters documentation" class="text-bold cursor-pointer block mt-2">Filters in the docs 👉</a>
15
15
  </div>
16
16
  </div>
@@ -1,5 +1,9 @@
1
1
  <%
2
- models = ApplicationRecord.descendants
2
+ models = begin
3
+ ApplicationRecord.descendants
4
+ rescue => exception
5
+ []
6
+ end
3
7
  %>
4
8
  <div>
5
9
  <h3>Resources</h3>
@@ -10,7 +14,7 @@
10
14
  <div class="mt-2" data-controller="hidden-input">
11
15
  It seems you already have <%= models.count %> <%= 'model'.pluralize models.count %> in your app. You can generate resources for each one with the following commands.
12
16
 
13
- <strong class="cursor-pointer block mt-2" data-action="click->hidden-input#showContent">Generate resources 👇</strong>
17
+ <strong class="cursor-pointer block mt-2" data-action="click->hidden-input#showContent">Generate resources 👇 (click to reveal)</strong>
14
18
 
15
19
  <div class="mt-2 hidden" data-hidden-input-target="content">
16
20
  <% models.each do |model| %>
@@ -22,7 +26,16 @@
22
26
  </div>
23
27
  </div>
24
28
  <% else %>
29
+ <div class="mt-2" data-controller="hidden-input">
30
+ You may generate a resource using the following command:
31
+ <br>
25
32
 
33
+ <code class="p-1 rounded bg-light-blue-500 text-white">bin/rails generate avo:resource post</code>
34
+ </div>
26
35
  <% end %>
36
+
37
+ <p>
38
+ <a href="https://docs.avohq.io/1.0/resources.html" target="_blank" title="Avo Resources documentation">Docs</a>
39
+ </p>
27
40
  </div>
28
41