avo 1.2.11.pre.4 → 1.3.0.pre.1

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 (71) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -4
  3. data/Gemfile.lock +8 -12
  4. data/app/components/avo/common/key_value_component.html.erb +53 -0
  5. data/app/components/avo/common/key_value_component.rb +11 -0
  6. data/app/components/avo/edit/fields/key_value_field_component.html.erb +3 -0
  7. data/app/components/avo/edit/fields/key_value_field_component.rb +4 -0
  8. data/app/components/avo/show/fields/key_value_field_component.html.erb +3 -0
  9. data/app/components/avo/show/fields/key_value_field_component.rb +4 -0
  10. data/app/controllers/avo/application_controller.rb +0 -27
  11. data/app/controllers/avo/home_controller.rb +3 -4
  12. data/app/helpers/avo/application_helper.rb +2 -8
  13. data/app/packs/entrypoints/application.js +14 -10
  14. data/app/packs/js/controllers/fields/code_field_controller.js +1 -4
  15. data/app/packs/js/controllers/fields/key_value_controller.js +132 -0
  16. data/app/packs/js/controllers/fields/simple_mde_controller.js +0 -1
  17. data/app/packs/stylesheets/components/code.css +0 -5
  18. data/app/views/avo/home/_actions.html.erb +5 -5
  19. data/app/views/avo/home/_docs.html.erb +1 -1
  20. data/app/views/avo/home/_filters.html.erb +4 -4
  21. data/app/views/avo/home/_resources.html.erb +2 -15
  22. data/app/views/avo/home/index.html.erb +1 -1
  23. data/app/views/avo/partials/_logo.html.erb +1 -1
  24. data/app/views/avo/sidebar/_license_warning.html.erb +7 -3
  25. data/app/views/avo/sidebar/_sidebar.html.erb +1 -2
  26. data/app/views/layouts/avo/application.html.erb +4 -9
  27. data/avo.gemspec +1 -1
  28. data/bin/helpers.rb +1 -1
  29. data/bin/spring +5 -5
  30. data/config/webpacker.yml +1 -1
  31. data/lib/avo/app.rb +3 -7
  32. data/lib/avo/configuration.rb +0 -6
  33. data/lib/avo/fields/key_value_field.rb +24 -1
  34. data/lib/avo/licensing/h_q.rb +3 -3
  35. data/lib/avo/licensing/license.rb +0 -2
  36. data/lib/avo/licensing/pro_license.rb +1 -2
  37. data/lib/avo/version.rb +1 -1
  38. data/lib/avo.rb +0 -13
  39. data/lib/generators/avo/eject_generator.rb +4 -5
  40. data/lib/generators/avo/filter_generator.rb +1 -1
  41. data/lib/generators/avo/resource_generator.rb +4 -1
  42. data/lib/generators/avo/templates/initializer/avo.tt +1 -10
  43. data/lib/generators/avo/tool_generator.rb +2 -2
  44. data/public/avo-packs/css/{application-af3e670d.css → application-5af67922.css} +103 -40
  45. data/public/avo-packs/css/application-5af67922.css.br +0 -0
  46. data/public/avo-packs/css/application-5af67922.css.gz +0 -0
  47. data/public/avo-packs/css/application-5af67922.css.map +1 -0
  48. data/public/avo-packs/css/application-5af67922.css.map.br +0 -0
  49. data/public/avo-packs/css/application-5af67922.css.map.gz +0 -0
  50. data/public/avo-packs/js/application-a48a99244065c8d7a1d1.js +26 -0
  51. data/public/avo-packs/js/{application-e66a1f4df5d01326ce36.js.LICENSE.txt → application-a48a99244065c8d7a1d1.js.LICENSE.txt} +0 -0
  52. data/public/avo-packs/js/application-a48a99244065c8d7a1d1.js.br +0 -0
  53. data/public/avo-packs/js/application-a48a99244065c8d7a1d1.js.gz +0 -0
  54. data/public/avo-packs/js/application-a48a99244065c8d7a1d1.js.map +1 -0
  55. data/public/avo-packs/js/application-a48a99244065c8d7a1d1.js.map.br +0 -0
  56. data/public/avo-packs/js/application-a48a99244065c8d7a1d1.js.map.gz +0 -0
  57. data/public/avo-packs/manifest.json +15 -15
  58. metadata +33 -28
  59. data/app/views/avo/partials/_custom_tools_alert.html.erb +0 -6
  60. data/app/views/avo/partials/_head.html.erb +0 -0
  61. data/public/avo-packs/css/application-af3e670d.css.br +0 -0
  62. data/public/avo-packs/css/application-af3e670d.css.gz +0 -0
  63. data/public/avo-packs/css/application-af3e670d.css.map +0 -1
  64. data/public/avo-packs/css/application-af3e670d.css.map.br +0 -0
  65. data/public/avo-packs/css/application-af3e670d.css.map.gz +0 -0
  66. data/public/avo-packs/js/application-e66a1f4df5d01326ce36.js +0 -26
  67. data/public/avo-packs/js/application-e66a1f4df5d01326ce36.js.br +0 -0
  68. data/public/avo-packs/js/application-e66a1f4df5d01326ce36.js.gz +0 -0
  69. data/public/avo-packs/js/application-e66a1f4df5d01326ce36.js.map +0 -1
  70. data/public/avo-packs/js/application-e66a1f4df5d01326ce36.js.map.br +0 -0
  71. data/public/avo-packs/js/application-e66a1f4df5d01326ce36.js.map.gz +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0e04eeebd11ad1f927113dd7aefe2b72988089713cd0abc5ea7ded746f0d5d2d
4
- data.tar.gz: 0677f4dbad8ce2adaabdd82d745301ef190bbbe75ff0769107c7ce5368cfa149
3
+ metadata.gz: a62f55a2092f0dd2716cdaacc87e2eea086745d164d032ff8024757748830e54
4
+ data.tar.gz: a104302aecf8c7f57ac9915fe61eaf26866d3ac25678f40eee2b2244de5d3664
5
5
  SHA512:
6
- metadata.gz: 59f16efb569f7c1cc52fce93ef5ec7ee5a2292bdb06bd89e9ac0c090f4802f81063fb5b426e8656e2f93d7324faff9859b823964a3d54b7ee84c1823911fda22
7
- data.tar.gz: 8f04ea620dc5f8144cb8edfd0030d89fb5fc7ce3ec0c07790cdfc62dfcdb9f095b15ca86063252c5ae40c449317d73190dc2f93ee43963c700f8b1f9627cdaa8
6
+ metadata.gz: 88e0ca48ccbc7ff735cbf14178e8bfce1085b34996ed3cad80238e3a625adc0eeab918092b5fee304a3fc31ab9d2465a5f0b5580aac6b5efd308b09218f340cd
7
+ data.tar.gz: 8b1847c9083ef9998ee2e6a49202addcb9e670c2b5fa1904672287bfa902dd886df4ed5a6ba21de1f5db9020a3a1bc1e5e868765d672677928840d9c14ad83e1
data/Gemfile CHANGED
@@ -123,7 +123,3 @@ gem "appraisal"
123
123
  gem 'meta-tags'
124
124
 
125
125
  gem 'breadcrumbs_on_rails'
126
-
127
- gem 'manifester'
128
- # gem 'manifester', path: '/Users/adrian/work/avocado/gem/manifester'
129
-
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (1.2.11.pre.4)
4
+ avo (1.3.0.pre.1)
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
13
12
  meta-tags
14
13
  pagy
15
14
  pundit
16
15
  rails (>= 6.0)
17
16
  view_component
17
+ webpacker
18
18
  zeitwerk
19
19
 
20
20
  GEM
@@ -159,15 +159,12 @@ 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.1)
162
+ loofah (2.9.0)
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
- manifester (0.1.7)
168
- rails (>= 6.0)
169
- zeitwerk
170
- marcel (1.0.1)
167
+ marcel (1.0.0)
171
168
  meta-tags (2.14.0)
172
169
  actionpack (>= 3.2.0, < 6.2)
173
170
  method_source (1.0.0)
@@ -175,16 +172,16 @@ GEM
175
172
  mime-types-data (~> 3.2015)
176
173
  mime-types-data (3.2021.0225)
177
174
  mini_magick (4.11.0)
178
- mini_mime (1.1.0)
175
+ mini_mime (1.0.3)
179
176
  mini_portile2 (2.5.0)
180
177
  minitest (5.14.4)
181
178
  msgpack (1.3.3)
182
179
  multi_xml (0.6.0)
183
180
  nio4r (2.5.7)
184
- nokogiri (1.11.3)
181
+ nokogiri (1.11.2)
185
182
  mini_portile2 (~> 2.5.0)
186
183
  racc (~> 1.4)
187
- nokogiri (1.11.3-x86_64-linux)
184
+ nokogiri (1.11.2-x86_64-linux)
188
185
  racc (~> 1.4)
189
186
  orm_adapter (0.5.0)
190
187
  pagy (3.12.0)
@@ -383,7 +380,6 @@ DEPENDENCIES
383
380
  iso
384
381
  jbuilder (~> 2.7)
385
382
  listen (>= 3.5.1)
386
- manifester
387
383
  meta-tags
388
384
  pg (>= 0.18, < 2.0)
389
385
  puma (~> 4.3.5)
@@ -409,4 +405,4 @@ DEPENDENCIES
409
405
  zeitwerk (~> 2.3)
410
406
 
411
407
  BUNDLED WITH
412
- 2.2.11
408
+ 2.2.5
@@ -0,0 +1,53 @@
1
+ <div class="w-full shadow-lg rounded-lg overflow-hidden"
2
+ data-controller="key-value"
3
+ data-key-value-target="controller"
4
+ data-options="<%= @field.options.to_json %>"
5
+ data-input-classes="<%= input_classes %>"
6
+ data-editable="<%= @view.in?([:edit, :create]) %>"
7
+ >
8
+ <div class="w-full flex flex-col">
9
+ <div class="flex w-full">
10
+ <div class="flex w-full bg-gray-800 shadow overflow-hidden">
11
+ <div class="w-1/2 py-3 px-3 uppercase font-semibold text-xs text-white border-gray-600 border-r">
12
+ <%= @field.key_label %>
13
+ </div>
14
+ <div class="w-1/2 py-3 px-3 uppercase font-semibold text-xs text-white">
15
+ <%= @field.value_label %>
16
+ </div>
17
+ <% if @view.in?([:edit, :create]) %>
18
+ <div class="flex items-center justify-center p-2 px-3 border-l border-gray-600">
19
+ <a href="javascript:void(0);"
20
+ title="<%= @field.action_text %>"
21
+ data-tippy="tooltip"
22
+ data-button="add-row"
23
+ data-action="click->key-value#addRow"
24
+ <% if @field.disable_adding_rows %>
25
+ class="cursor-not-allowed"
26
+ <% end %>
27
+ >
28
+ <%= svg 'plus-circle', class: 'text-gray-400 h-5 hover:text-gray-500' %>
29
+ </a>
30
+ </div>
31
+ <% end %>
32
+ </div>
33
+ </div>
34
+ <div data-key-value-target="rows"></div>
35
+ </div>
36
+ <% if @form.present? %>
37
+ <%= @form.text_area @field.id,
38
+ value: @field.parsed_value,
39
+ class: 'hidden',
40
+ placeholder: @field.placeholder,
41
+ 'data-key-value-target': 'input',
42
+ 'data-view': :edit
43
+ %>
44
+ <% else %>
45
+ <%= text_area_tag @field.id,
46
+ @field.parsed_value,
47
+ class: 'hidden',
48
+ placeholder: @field.placeholder,
49
+ 'data-key-value-target': 'input',
50
+ 'data-view': :edit
51
+ %>
52
+ <% end %>
53
+ </div>
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Avo::Common::KeyValueComponent < ViewComponent::Base
4
+ include Avo::ApplicationHelper
5
+
6
+ def initialize(field:, form: nil, view: :show)
7
+ @field = field
8
+ @form = form
9
+ @view = view
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ <%= edit_field_wrapper field: @field, index: @index, form: @form, resource: @resource, displayed_in_modal: @displayed_in_modal do %>
2
+ <%= render Avo::Common::KeyValueComponent.new field: @field, form: @form, view: :edit %>
3
+ <% end %>
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Avo::Edit::Fields::KeyValueFieldComponent < Avo::Edit::Fields::FieldComponent
4
+ end
@@ -0,0 +1,3 @@
1
+ <%= show_field_wrapper field: @field, index: @index do %>
2
+ <%= render Avo::Common::KeyValueComponent.new field: @field, view: :show %>
3
+ <% end %>
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Avo::Show::Fields::KeyValueFieldComponent < Avo::Show::Fields::FieldComponent
4
+ end
@@ -4,7 +4,6 @@ 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
8
7
  before_action :set_authorization
9
8
  before_action :_authenticate!
10
9
  before_action :set_container_classes
@@ -35,24 +34,6 @@ module Avo
35
34
  end
36
35
  end
37
36
 
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
-
56
37
  def _current_user
57
38
  instance_eval(&Avo.configuration.current_user)
58
39
  end
@@ -264,13 +245,5 @@ module Avo
264
245
  def add_initial_breadcrumbs
265
246
  instance_eval(&Avo.configuration.initial_breadcrumbs) if Avo.configuration.initial_breadcrumbs.present?
266
247
  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
275
248
  end
276
249
  end
@@ -3,10 +3,9 @@ require_dependency "avo/application_controller"
3
3
  module Avo
4
4
  class HomeController < ApplicationController
5
5
  def index
6
- if Avo.configuration.home_path.present?
7
- redirect_to Avo.configuration.home_path
8
- elsif !Rails.env.development?
9
- @page_title = "Get started"
6
+ @page_title = "Get started"
7
+
8
+ unless Rails.env.development?
10
9
  redirect_to resources_path Avo::App.get_resources.min_by { |resource| resource.route_key }.model_class
11
10
  end
12
11
  end
@@ -1,16 +1,10 @@
1
1
  module Avo
2
2
  module ApplicationHelper
3
- include ::Manifester::Helper
3
+ include ::Webpacker::Helper
4
4
  include ::Pagy::Frontend
5
5
 
6
6
  def current_webpacker_instance
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
7
+ Avo.webpacker
14
8
  end
15
9
 
16
10
  def render_license_warnings
@@ -19,6 +19,19 @@ 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
+
22
35
  const application = Application.start()
23
36
 
24
37
  const context = require.context('./../js/controllers', true, /\.js$/)
@@ -29,16 +42,7 @@ application.load(definitionsFromContext(fieldsContext))
29
42
 
30
43
  document.addEventListener('turbo:load', () => {
31
44
  document.body.classList.remove('turbo-loading')
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
- })
45
+ initTippy()
42
46
  })
43
47
  document.addEventListener('turbo:visit', () => document.body.classList.add('turbo-loading'))
44
48
  document.addEventListener('turbo:submit-start', () => document.body.classList.add('turbo-loading'))
@@ -12,7 +12,6 @@ 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
-
16
15
  import { Controller } from 'stimulus'
17
16
  import { castBoolean } from '@/js/helpers/cast_boolean'
18
17
  import CodeMirror from 'codemirror'
@@ -31,8 +30,6 @@ export default class extends Controller {
31
30
  lineNumbers: true,
32
31
  }
33
32
 
34
- setTimeout(() => {
35
- CodeMirror.fromTextArea(this.elementTarget, options)
36
- }, 1)
33
+ CodeMirror.fromTextArea(this.elementTarget, options)
37
34
  }
38
35
  }
@@ -0,0 +1,132 @@
1
+ import { Controller } from 'stimulus'
2
+ import { castBoolean } from '@/js/helpers/cast_boolean'
3
+
4
+ export default class extends Controller {
5
+ static targets = ['input', 'controller', 'rows']
6
+
7
+ fieldValue = []
8
+
9
+ options = {}
10
+
11
+ get keyInputDisabled() {
12
+ return !this.options.editable || this.options.disable_editing_keys
13
+ }
14
+
15
+ get valueInputDisabled() {
16
+ return !this.options.editable
17
+ }
18
+
19
+ connect() {
20
+ this.setOptions()
21
+
22
+ try {
23
+ const objectValue = JSON.parse(this.inputTarget.value)
24
+ Object.keys(objectValue).forEach((key) => this.fieldValue.push([key, objectValue[key]]))
25
+ } catch (error) {
26
+ this.fieldValue = []
27
+ }
28
+
29
+ this.updateKeyValueComponent()
30
+ }
31
+
32
+ addRow() {
33
+ if (this.options.disable_adding_rows || !this.options.editable) return
34
+ this.fieldValue.push(['', ''])
35
+ this.updateKeyValueComponent()
36
+ }
37
+
38
+ deleteRow(event) {
39
+ if (this.options.disable_deleting_rows || !this.options.editable) return
40
+ const { index } = event.target.dataset
41
+ this.fieldValue.splice(index, 1)
42
+ this.updateTextareaInput()
43
+ this.updateKeyValueComponent()
44
+ }
45
+
46
+ valueFieldUpdated(event) {
47
+ const { value } = event.target
48
+ const { index } = event.target.dataset
49
+ this.fieldValue[index][1] = value
50
+
51
+ this.updateTextareaInput()
52
+ }
53
+
54
+ keyFieldUpdated(event) {
55
+ const { value } = event.target
56
+ const { index } = event.target.dataset
57
+ this.fieldValue[index][0] = value
58
+
59
+ this.updateTextareaInput()
60
+ }
61
+
62
+ updateTextareaInput() {
63
+ if (!this.hasInputTarget) return
64
+ let result = {}
65
+ if (this.fieldValue && this.fieldValue.length > 0) {
66
+ result = Object.assign(...this.fieldValue.map(([key, val]) => ({ [key]: val })))
67
+ }
68
+ this.inputTarget.value = JSON.stringify(result)
69
+ }
70
+
71
+ updateKeyValueComponent() {
72
+ let result = ''
73
+ let index = 0
74
+ this.fieldValue.forEach((row) => {
75
+ const [key, value] = row
76
+ result += this.interpolatedRow(key, value, index)
77
+ index++
78
+ })
79
+ this.rowsTarget.innerHTML = result
80
+ window.initTippy()
81
+ }
82
+
83
+ interpolatedRow(key, value, index) {
84
+ let result = `<div class="flex"><input type="text"
85
+ class="${this.options.inputClasses} border-gray-600 border-r border-l-0 border-b-0 border-t-0 focus:border-gray-700 w-1/2 rounded-none focus:outline-none outline-none focus:border-none"
86
+ data-action="input->key-value#keyFieldUpdated"
87
+ placeholder="${this.options.key_label}"
88
+ data-index="${index}"
89
+ ${this.keyInputDisabled ? "disabled='disabled'" : ''}
90
+ value="${key}"
91
+ autofocus
92
+ />
93
+ <input type="text"
94
+ class="${this.options.inputClasses} border-gray-600 border-r border-l-0 border-b-0 border-t-0 focus:border-gray-700 w-1/2 rounded-none focus:outline-none outline-none focus:border-none"
95
+ data-action="input->key-value#valueFieldUpdated"
96
+ placeholder="${this.options.value_label}"
97
+ data-index="${index}"
98
+ ${this.valueInputDisabled ? "disabled='disabled'" : ''}
99
+ value="${value}"
100
+ />`
101
+ if (this.options.editable) {
102
+ result += `<a
103
+ href="javascript:void(0);"
104
+ data-index="${index}"
105
+ data-action="click->key-value#deleteRow"
106
+ title="${this.options.delete_text}"
107
+ data-tippy="tooltip"
108
+ data-button="delete-row"
109
+ ${this.options.disable_deleting_rows ? "disabled='disabled'" : ''}
110
+ class="flex items-center justify-center p-2 px-3 border-l ${this.options.disable_deleting_rows ? 'cursor-not-allowed' : ''}"
111
+ ><svg class="pointer-events-none text-gray-500 h-5 hover:text-gray-500" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" stroke="currentColor"><path d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"></path></svg></a>`
112
+ }
113
+ result += '</div>'
114
+
115
+ return result
116
+ }
117
+
118
+ setOptions() {
119
+ let fieldOptions
120
+
121
+ try {
122
+ fieldOptions = JSON.parse(this.controllerTarget.dataset.options)
123
+ } catch (error) {
124
+ fieldOptions = {}
125
+ }
126
+ this.options = {
127
+ ...fieldOptions,
128
+ inputClasses: this.controllerTarget.dataset.inputClasses,
129
+ editable: castBoolean(this.controllerTarget.dataset.editable),
130
+ }
131
+ }
132
+ }
@@ -11,7 +11,6 @@ export default class extends Controller {
11
11
  connect() {
12
12
  const options = {
13
13
  element: this.elementTarget,
14
- spellChecker: false,
15
14
  }
16
15
 
17
16
  if (this.view === 'show') {
@@ -9,8 +9,3 @@
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">
4
+ <div class="mt-2" data-controller="hidden-input">
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
- <div class="mt-2">
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">
8
10
  <code class="text-lg">Toggle published</code>
9
- <div class="mt-1">
11
+ <div>
10
12
  <code class="p-1 rounded bg-light-blue-500 text-white">bin/rails generate avo:action toggle_published</code>
11
13
  </div>
12
14
  </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" target="_blank" title="Avo documentation" class="text-bold cursor-pointer block mt-2">Check out the docs 👉</a>
7
+ <a href="https://docs.avohq.io" 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
- <div class="mt-2">
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">
8
10
  <code class="text-lg">Published filter</code>
9
- <div class="mt-1">
11
+ <div>
10
12
  <code class="p-1 rounded bg-light-blue-500 text-white">bin/rails generate avo:filter published_filter</code>
11
13
  </div>
12
14
  </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,9 +1,5 @@
1
1
  <%
2
- models = begin
3
- ApplicationRecord.descendants
4
- rescue => exception
5
- []
6
- end
2
+ models = ApplicationRecord.descendants
7
3
  %>
8
4
  <div>
9
5
  <h3>Resources</h3>
@@ -14,7 +10,7 @@
14
10
  <div class="mt-2" data-controller="hidden-input">
15
11
  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.
16
12
 
17
- <strong class="cursor-pointer block mt-2" data-action="click->hidden-input#showContent">Generate resources 👇 (click to reveal)</strong>
13
+ <strong class="cursor-pointer block mt-2" data-action="click->hidden-input#showContent">Generate resources 👇</strong>
18
14
 
19
15
  <div class="mt-2 hidden" data-hidden-input-target="content">
20
16
  <% models.each do |model| %>
@@ -26,16 +22,7 @@
26
22
  </div>
27
23
  </div>
28
24
  <% else %>
29
- <div class="mt-2" data-controller="hidden-input">
30
- You may generate a resource using the following command:
31
- <br>
32
25
 
33
- <code class="p-1 rounded bg-light-blue-500 text-white">bin/rails generate avo:resource post</code>
34
- </div>
35
26
  <% 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>
40
27
  </div>
41
28
 
@@ -27,7 +27,7 @@
27
27
  <li><span class="mr-2">👍</span> Grid view</li>
28
28
  <li><span class="mr-2">👍</span> Authorization</li>
29
29
  <li><span class="mr-2">👍</span> Localization</li>
30
- <li><span class="mr-2">👍</span> Custom tools</li>
30
+ <li><span class="mr-2">⏳</span> Custom tools</li>
31
31
  <li><span class="mr-2">⏳</span> Custom fields</li>
32
32
  <li><span class="mr-2">⏳</span> Search</li>
33
33
  <li><span class="mr-2">🕐</span> Dashboards</li>
@@ -1 +1 @@
1
- <%= image_manifest_tag 'logo.png', class: 'h-full', title: 'Avo' %>
1
+ <%= image_pack_tag 'logo.png', class: 'h-full', title: 'Avo' %>
@@ -1,8 +1,12 @@
1
1
  <div class="w-10/12 ml-1/12 inset-auto bottom-0 z-50 my-4 opacity-50 hover:opacity-100 transition-opacity duration-150 group">
2
- <a href="https://avohq.io/pricing" target="_blank" class="rounded bg-green-700 text-white py-2 px-4 text-sm block group-hover:pt-4">
3
- <%= svg 'exclamation', class: 'h-6 inline mr-1 text-bold' %> <%= title %>
2
+ <a href="https://avohq.io/pricing" target="_blank" class="rounded bg-teal-700 text-white py-2 px-4 text-sm block group-hover:pt-4">
3
+ <% if icon.present? %>
4
+ <div class="h-6 inline mr-1 text-bold" :is="iconElement" v-if="icon">
5
+ <%= title %>
6
+ </div>
7
+ <% end %>
4
8
  <div class="group-hover:block hidden py-2">
5
- <%= message %> <%= svg 'arrow-circle-right', class: "h-6 inline float-right" %>
9
+ <%= message %> <arrow-circle-right-icon class="h-6 inline float-right"></arrow-circle-right-icon>
6
10
  </div>
7
11
  </a>
8
12
  </div>
@@ -6,8 +6,7 @@
6
6
 
7
7
  <div class="flex-1 flex flex-col justify-between">
8
8
  <div class="tools py-4">
9
- <%= render Avo::NavigationLinkComponent.new label: 'Get started', path: Avo.configuration.root_path, active: :exclusive if Rails.env.development? && Avo.configuration.home_path.nil? %>
10
-
9
+ <%= render Avo::NavigationLinkComponent.new label: 'Get started', path: '/avo', active: :exclusive if Rails.env.development? %>
11
10
  <%= render Avo::NavigationHeadingComponent.new label: t('avo.resources') %>
12
11
 
13
12
  <div class="w-full">
@@ -7,10 +7,9 @@
7
7
  <%= csp_meta_tag %>
8
8
 
9
9
  <%= render partial: 'avo/partials/javascript' %>
10
- <%= render partial: 'avo/partials/head' %>
11
10
 
12
- <%= javascript_manifest_tag 'application' %>
13
- <%= stylesheet_manifest_tag 'application', media: 'all' %>
11
+ <%= javascript_pack_tag 'application' %>
12
+ <%= stylesheet_pack_tag 'application', media: 'all' %>
14
13
  </head>
15
14
  <body class="bg-blue-gray-200">
16
15
 
@@ -31,12 +30,8 @@
31
30
  </div>
32
31
 
33
32
  <div class="content p-8 flex-1 flex flex-col justify-between items-stretch <%= @container_classes %>">
34
- <%= render partial: "avo/partials/custom_tools_alert" if @custom_tools_alert_visible %>
35
-
36
- <div class="flex flex-1 flex-col justify-between items-stretch">
37
- <%= yield %>
38
- <%= render partial: "avo/partials/footer" %>
39
- </div>
33
+ <%= yield %>
34
+ <%= render partial: "avo/partials/footer" %>
40
35
  </div>
41
36
  </div>
42
37
  </div>
data/avo.gemspec CHANGED
@@ -34,6 +34,7 @@ Gem::Specification.new do |spec|
34
34
  spec.add_dependency "rails", ">= 6.0"
35
35
  spec.add_dependency "pagy"
36
36
  spec.add_dependency "zeitwerk"
37
+ spec.add_dependency "webpacker"
37
38
  spec.add_dependency "countries"
38
39
  spec.add_dependency "pundit"
39
40
  spec.add_dependency "httparty"
@@ -44,5 +45,4 @@ Gem::Specification.new do |spec|
44
45
  spec.add_dependency "addressable"
45
46
  spec.add_dependency "meta-tags"
46
47
  spec.add_dependency "breadcrumbs_on_rails"
47
- spec.add_dependency "manifester"
48
48
  end
data/bin/helpers.rb CHANGED
@@ -23,7 +23,7 @@ end
23
23
  def ask(question:, valid_answers: [])
24
24
  puts "\n#{question} (#{valid_answers.join('/')})"
25
25
 
26
- input = gets.chomp
26
+ input = gets.downcase.chomp
27
27
 
28
28
  while !valid_answers.include?(input)
29
29
  puts 'Invalid input, please try again.'