avo 1.4.4.pre.1 → 1.4.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 (57) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -2
  3. data/Gemfile.lock +1 -7
  4. data/README.md +4 -4
  5. data/app/components/avo/views/resource_index_component.html.erb +3 -3
  6. data/app/controllers/avo/application_controller.rb +7 -14
  7. data/app/controllers/avo/relations_controller.rb +1 -1
  8. data/app/controllers/avo/search_controller.rb +35 -50
  9. data/app/packs/entrypoints/application.css +1 -2
  10. data/app/packs/entrypoints/application.js +0 -3
  11. data/app/views/avo/partials/_profile_dropdown.html.erb +12 -8
  12. data/app/views/layouts/avo/application.html.erb +4 -2
  13. data/avo.gemspec +0 -1
  14. data/config/routes.rb +6 -2
  15. data/lib/avo/app.rb +1 -3
  16. data/lib/avo/base_resource.rb +7 -83
  17. data/lib/avo/configuration.rb +0 -2
  18. data/lib/avo/fields/base_field.rb +0 -6
  19. data/lib/avo/fields/file_field.rb +0 -4
  20. data/lib/avo/licensing/license.rb +0 -10
  21. data/lib/avo/licensing/pro_license.rb +1 -3
  22. data/lib/avo/services/authorization_service.rb +1 -1
  23. data/lib/avo/version.rb +1 -1
  24. data/lib/generators/avo/templates/initializer/avo.tt +0 -1
  25. data/lib/generators/avo/templates/resource/resource.tt +0 -3
  26. data/lib/generators/avo/templates/tool/sidebar_item.tt +1 -1
  27. data/public/avo-packs/css/{application-d69fe930.css → application-68691c73.css} +6 -183
  28. data/public/avo-packs/css/application-68691c73.css.br +0 -0
  29. data/public/avo-packs/css/application-68691c73.css.gz +0 -0
  30. data/public/avo-packs/css/application-68691c73.css.map +1 -0
  31. data/public/avo-packs/css/application-68691c73.css.map.br +0 -0
  32. data/public/avo-packs/css/application-68691c73.css.map.gz +0 -0
  33. data/public/avo-packs/js/application-6a0b9e58526ae6bef242.js +26 -0
  34. data/public/avo-packs/js/{application-7b3d507875f4bc1f6677.js.LICENSE.txt → application-6a0b9e58526ae6bef242.js.LICENSE.txt} +0 -0
  35. data/public/avo-packs/js/application-6a0b9e58526ae6bef242.js.br +0 -0
  36. data/public/avo-packs/js/application-6a0b9e58526ae6bef242.js.gz +0 -0
  37. data/public/avo-packs/js/application-6a0b9e58526ae6bef242.js.map +1 -0
  38. data/public/avo-packs/js/application-6a0b9e58526ae6bef242.js.map.br +0 -0
  39. data/public/avo-packs/js/application-6a0b9e58526ae6bef242.js.map.gz +0 -0
  40. data/public/avo-packs/manifest.json +15 -15
  41. metadata +17 -36
  42. data/app/packs/js/controllers/search_controller.js +0 -120
  43. data/app/packs/js/helpers/debounce_promise.js +0 -13
  44. data/app/packs/stylesheets/search.css +0 -79
  45. data/app/views/avo/partials/_global_search.html.erb +0 -17
  46. data/app/views/avo/partials/_resource_search.html.erb +0 -10
  47. data/public/avo-packs/css/application-d69fe930.css.br +0 -0
  48. data/public/avo-packs/css/application-d69fe930.css.gz +0 -0
  49. data/public/avo-packs/css/application-d69fe930.css.map +0 -1
  50. data/public/avo-packs/css/application-d69fe930.css.map.br +0 -0
  51. data/public/avo-packs/css/application-d69fe930.css.map.gz +0 -0
  52. data/public/avo-packs/js/application-7b3d507875f4bc1f6677.js +0 -26
  53. data/public/avo-packs/js/application-7b3d507875f4bc1f6677.js.br +0 -0
  54. data/public/avo-packs/js/application-7b3d507875f4bc1f6677.js.gz +0 -0
  55. data/public/avo-packs/js/application-7b3d507875f4bc1f6677.js.map +0 -1
  56. data/public/avo-packs/js/application-7b3d507875f4bc1f6677.js.map.br +0 -0
  57. data/public/avo-packs/js/application-7b3d507875f4bc1f6677.js.map.gz +0 -0
@@ -1,19 +1,19 @@
1
1
  {
2
- "application.css": "/avo-packs/css/application-d69fe930.css",
3
- "application.js": "/avo-packs/js/application-7b3d507875f4bc1f6677.js",
4
- "css/application-d69fe930.css.br": "/avo-packs/css/application-d69fe930.css.br",
5
- "css/application-d69fe930.css.gz": "/avo-packs/css/application-d69fe930.css.gz",
6
- "css/application-d69fe930.css.map": "/avo-packs/css/application-d69fe930.css.map",
7
- "css/application-d69fe930.css.map.br": "/avo-packs/css/application-d69fe930.css.map.br",
8
- "css/application-d69fe930.css.map.gz": "/avo-packs/css/application-d69fe930.css.map.gz",
2
+ "application.css": "/avo-packs/css/application-68691c73.css",
3
+ "application.js": "/avo-packs/js/application-6a0b9e58526ae6bef242.js",
4
+ "css/application-68691c73.css.br": "/avo-packs/css/application-68691c73.css.br",
5
+ "css/application-68691c73.css.gz": "/avo-packs/css/application-68691c73.css.gz",
6
+ "css/application-68691c73.css.map": "/avo-packs/css/application-68691c73.css.map",
7
+ "css/application-68691c73.css.map.br": "/avo-packs/css/application-68691c73.css.map.br",
8
+ "css/application-68691c73.css.map.gz": "/avo-packs/css/application-68691c73.css.map.gz",
9
9
  "entrypoints": {
10
10
  "application": {
11
11
  "assets": {
12
12
  "css": [
13
- "/avo-packs/css/application-d69fe930.css"
13
+ "/avo-packs/css/application-68691c73.css"
14
14
  ],
15
15
  "js": [
16
- "/avo-packs/js/application-7b3d507875f4bc1f6677.js"
16
+ "/avo-packs/js/application-6a0b9e58526ae6bef242.js"
17
17
  ]
18
18
  }
19
19
  }
@@ -24,12 +24,12 @@
24
24
  "js/219-9aa2b689f44613118203.chunk.js.map": "/avo-packs/js/219-9aa2b689f44613118203.chunk.js.map",
25
25
  "js/219-9aa2b689f44613118203.chunk.js.map.br": "/avo-packs/js/219-9aa2b689f44613118203.chunk.js.map.br",
26
26
  "js/219-9aa2b689f44613118203.chunk.js.map.gz": "/avo-packs/js/219-9aa2b689f44613118203.chunk.js.map.gz",
27
- "js/application-7b3d507875f4bc1f6677.js.LICENSE.txt": "/avo-packs/js/application-7b3d507875f4bc1f6677.js.LICENSE.txt",
28
- "js/application-7b3d507875f4bc1f6677.js.br": "/avo-packs/js/application-7b3d507875f4bc1f6677.js.br",
29
- "js/application-7b3d507875f4bc1f6677.js.gz": "/avo-packs/js/application-7b3d507875f4bc1f6677.js.gz",
30
- "js/application-7b3d507875f4bc1f6677.js.map": "/avo-packs/js/application-7b3d507875f4bc1f6677.js.map",
31
- "js/application-7b3d507875f4bc1f6677.js.map.br": "/avo-packs/js/application-7b3d507875f4bc1f6677.js.map.br",
32
- "js/application-7b3d507875f4bc1f6677.js.map.gz": "/avo-packs/js/application-7b3d507875f4bc1f6677.js.map.gz",
27
+ "js/application-6a0b9e58526ae6bef242.js.LICENSE.txt": "/avo-packs/js/application-6a0b9e58526ae6bef242.js.LICENSE.txt",
28
+ "js/application-6a0b9e58526ae6bef242.js.br": "/avo-packs/js/application-6a0b9e58526ae6bef242.js.br",
29
+ "js/application-6a0b9e58526ae6bef242.js.gz": "/avo-packs/js/application-6a0b9e58526ae6bef242.js.gz",
30
+ "js/application-6a0b9e58526ae6bef242.js.map": "/avo-packs/js/application-6a0b9e58526ae6bef242.js.map",
31
+ "js/application-6a0b9e58526ae6bef242.js.map.br": "/avo-packs/js/application-6a0b9e58526ae6bef242.js.map.br",
32
+ "js/application-6a0b9e58526ae6bef242.js.map.gz": "/avo-packs/js/application-6a0b9e58526ae6bef242.js.map.gz",
33
33
  "media/images/13ae283c0d7cc04efe7e.svg.br": "/avo-packs/media/images/13ae283c0d7cc04efe7e.svg.br",
34
34
  "media/images/13ae283c0d7cc04efe7e.svg.gz": "/avo-packs/media/images/13ae283c0d7cc04efe7e.svg.gz",
35
35
  "media/images/195026a50008c53526ef.svg.br": "/avo-packs/media/images/195026a50008c53526ef.svg.br",
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: 1.4.4.pre.1
4
+ version: 1.4.4
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: 2021-05-06 00:00:00.000000000 Z
12
+ date: 2021-04-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -207,20 +207,6 @@ dependencies:
207
207
  - - ">="
208
208
  - !ruby/object:Gem::Version
209
209
  version: '0'
210
- - !ruby/object:Gem::Dependency
211
- name: ransack
212
- requirement: !ruby/object:Gem::Requirement
213
- requirements:
214
- - - ">="
215
- - !ruby/object:Gem::Version
216
- version: '0'
217
- type: :runtime
218
- prerelease: false
219
- version_requirements: !ruby/object:Gem::Requirement
220
- requirements:
221
- - - ">="
222
- - !ruby/object:Gem::Version
223
- version: '0'
224
210
  description: Avo is a beautiful next-generation framework that empowers you, the developer,
225
211
  to create fantastic admin panels for your Ruby on Rails apps with the flexibility
226
212
  to fit your needs as you grow.
@@ -470,12 +456,10 @@ files:
470
456
  - app/packs/js/controllers/item_selector_controller.js
471
457
  - app/packs/js/controllers/modal_controller.js
472
458
  - app/packs/js/controllers/per_page_controller.js
473
- - app/packs/js/controllers/search_controller.js
474
459
  - app/packs/js/controllers/select_filter_controller.js
475
460
  - app/packs/js/controllers/tippy_controller.js
476
461
  - app/packs/js/controllers/toggle_panel_controller.js
477
462
  - app/packs/js/helpers/cast_boolean.js
478
- - app/packs/js/helpers/debounce_promise.js
479
463
  - app/packs/js/toastr.js
480
464
  - app/packs/stylesheets/alerts.css
481
465
  - app/packs/stylesheets/breadcrumbs.css
@@ -485,7 +469,6 @@ files:
485
469
  - app/packs/stylesheets/fonts.css
486
470
  - app/packs/stylesheets/loader.css
487
471
  - app/packs/stylesheets/pagination.css
488
- - app/packs/stylesheets/search.css
489
472
  - app/packs/stylesheets/tailwindcss/base.css
490
473
  - app/packs/stylesheets/tailwindcss/components.css
491
474
  - app/packs/stylesheets/tailwindcss/utilities.css
@@ -558,14 +541,12 @@ files:
558
541
  - app/views/avo/partials/_custom_tools_alert.html.erb
559
542
  - app/views/avo/partials/_empty_state.html.erb
560
543
  - app/views/avo/partials/_footer.html.erb
561
- - app/views/avo/partials/_global_search.html.erb
562
544
  - app/views/avo/partials/_head.html.erb
563
545
  - app/views/avo/partials/_header.html.erb
564
546
  - app/views/avo/partials/_javascript.html.erb
565
547
  - app/views/avo/partials/_logo.html.erb
566
548
  - app/views/avo/partials/_paginator.html.erb
567
549
  - app/views/avo/partials/_profile_dropdown.html.erb
568
- - app/views/avo/partials/_resource_search.html.erb
569
550
  - app/views/avo/partials/_scripts.html.erb
570
551
  - app/views/avo/partials/_sortable_component.html.erb
571
552
  - app/views/avo/partials/_table_header.html.erb
@@ -697,25 +678,25 @@ files:
697
678
  - lib/generators/avo/templates/tool/view.tt
698
679
  - lib/generators/avo/tool_generator.rb
699
680
  - lib/tasks/avo_tasks.rake
700
- - public/avo-packs/css/application-d69fe930.css
701
- - public/avo-packs/css/application-d69fe930.css.br
702
- - public/avo-packs/css/application-d69fe930.css.gz
703
- - public/avo-packs/css/application-d69fe930.css.map
704
- - public/avo-packs/css/application-d69fe930.css.map.br
705
- - public/avo-packs/css/application-d69fe930.css.map.gz
681
+ - public/avo-packs/css/application-68691c73.css
682
+ - public/avo-packs/css/application-68691c73.css.br
683
+ - public/avo-packs/css/application-68691c73.css.gz
684
+ - public/avo-packs/css/application-68691c73.css.map
685
+ - public/avo-packs/css/application-68691c73.css.map.br
686
+ - public/avo-packs/css/application-68691c73.css.map.gz
706
687
  - public/avo-packs/js/219-9aa2b689f44613118203.chunk.js
707
688
  - public/avo-packs/js/219-9aa2b689f44613118203.chunk.js.br
708
689
  - public/avo-packs/js/219-9aa2b689f44613118203.chunk.js.gz
709
690
  - public/avo-packs/js/219-9aa2b689f44613118203.chunk.js.map
710
691
  - public/avo-packs/js/219-9aa2b689f44613118203.chunk.js.map.br
711
692
  - public/avo-packs/js/219-9aa2b689f44613118203.chunk.js.map.gz
712
- - public/avo-packs/js/application-7b3d507875f4bc1f6677.js
713
- - public/avo-packs/js/application-7b3d507875f4bc1f6677.js.LICENSE.txt
714
- - public/avo-packs/js/application-7b3d507875f4bc1f6677.js.br
715
- - public/avo-packs/js/application-7b3d507875f4bc1f6677.js.gz
716
- - public/avo-packs/js/application-7b3d507875f4bc1f6677.js.map
717
- - public/avo-packs/js/application-7b3d507875f4bc1f6677.js.map.br
718
- - public/avo-packs/js/application-7b3d507875f4bc1f6677.js.map.gz
693
+ - public/avo-packs/js/application-6a0b9e58526ae6bef242.js
694
+ - public/avo-packs/js/application-6a0b9e58526ae6bef242.js.LICENSE.txt
695
+ - public/avo-packs/js/application-6a0b9e58526ae6bef242.js.br
696
+ - public/avo-packs/js/application-6a0b9e58526ae6bef242.js.gz
697
+ - public/avo-packs/js/application-6a0b9e58526ae6bef242.js.map
698
+ - public/avo-packs/js/application-6a0b9e58526ae6bef242.js.map.br
699
+ - public/avo-packs/js/application-6a0b9e58526ae6bef242.js.map.gz
719
700
  - public/avo-packs/manifest.json
720
701
  - public/avo-packs/media/images/13ae283c0d7cc04efe7e.svg
721
702
  - public/avo-packs/media/images/13ae283c0d7cc04efe7e.svg.br
@@ -756,9 +737,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
756
737
  version: '0'
757
738
  required_rubygems_version: !ruby/object:Gem::Requirement
758
739
  requirements:
759
- - - ">"
740
+ - - ">="
760
741
  - !ruby/object:Gem::Version
761
- version: 1.3.1
742
+ version: '0'
762
743
  requirements: []
763
744
  rubygems_version: 3.0.3
764
745
  signing_key:
@@ -1,120 +0,0 @@
1
- /* eslint-disable no-underscore-dangle */
2
- import * as Mousetrap from 'mousetrap'
3
- import { Controller } from 'stimulus'
4
- import { Turbo } from '@hotwired/turbo-rails'
5
- import { autocomplete } from '@algolia/autocomplete-js'
6
- import debouncePromise from '@/js/helpers/debounce_promise'
7
-
8
- export default class extends Controller {
9
- static targets = ['autocomplete', 'button']
10
-
11
- debouncedFetch = debouncePromise(fetch, this.debounceTimeout)
12
-
13
- get translationKeys() {
14
- let keys
15
- try {
16
- keys = JSON.parse(this.autocompleteTarget.dataset.translationKeys)
17
- } catch (error) {
18
- keys = {}
19
- }
20
-
21
- return keys
22
- }
23
-
24
- get debounceTimeout() {
25
- return this.autocompleteTarget.dataset.debounceTimeout
26
- }
27
-
28
- get searchResource() {
29
- return this.autocompleteTarget.dataset.searchResource
30
- }
31
-
32
- get isGlobalSearch() {
33
- return this.searchResource === 'global'
34
- }
35
-
36
- get searchUrl() {
37
- return this.isGlobalSearch ? '/avo/avo_api/search' : `/avo/avo_api/${this.searchResource}/search`
38
- }
39
-
40
- addSource(resourceName, data) {
41
- const that = this
42
-
43
- return {
44
- sourceId: resourceName,
45
- getItems: () => data.results,
46
- onSelect({ item }) {
47
- Turbo.visit(item._url, { action: 'replace' })
48
- },
49
- templates: {
50
- header() {
51
- return data.header
52
- },
53
- item({ item, createElement }) {
54
- let element = ''
55
-
56
- if (item._avatar) {
57
- let classes
58
-
59
- switch (item._avatar_type) {
60
- default:
61
- case 'circle':
62
- classes = 'rounded-full'
63
- break
64
- case 'rounded':
65
- classes = 'rounded'
66
- break
67
- }
68
-
69
- element += `<img src="${item._avatar}" alt="${item._label}" class="flex-shrink-0 w-8 h-8 my-[2px] inline mr-2 ${classes}" />`
70
- }
71
- element += `<div>${item._label}`
72
-
73
- if (item._description) {
74
- element += `<div class="aa-ItemDescription">${item._description}</div>`
75
- }
76
-
77
- element += '</div>'
78
-
79
- return createElement('div', {
80
- class: 'flex',
81
- dangerouslySetInnerHTML: {
82
- __html: element,
83
- },
84
- })
85
- },
86
- noResults() {
87
- return that.translationKeys.no_item_found.replace('%{item}', resourceName)
88
- },
89
- },
90
- }
91
- }
92
-
93
- showSearchPanel() {
94
- this.autocompleteTarget.querySelector('button').click()
95
- }
96
-
97
- connect() {
98
- const that = this
99
-
100
- this.buttonTarget.onclick = () => this.showSearchPanel()
101
-
102
- if (this.isGlobalSearch) {
103
- Mousetrap.bind(['command+k', 'ctrl+k'], () => this.showSearchPanel())
104
- }
105
-
106
- autocomplete({
107
- container: this.autocompleteTarget,
108
- placeholder: 'Search',
109
- openOnFocus: true,
110
- detachedMediaQuery: '',
111
- getSources: ({ query }) => {
112
- const endpoint = `${that.searchUrl}?q=${query}`
113
-
114
- return that.debouncedFetch(endpoint)
115
- .then((response) => response.json())
116
- .then((data) => Object.keys(data).map((resourceName) => that.addSource(resourceName, data[resourceName])))
117
- },
118
- })
119
- }
120
- }
@@ -1,13 +0,0 @@
1
- export default (fn, time) => {
2
- let timerId
3
-
4
- return (...args) => {
5
- if (timerId) {
6
- clearTimeout(timerId)
7
- }
8
-
9
- return new Promise((resolve) => {
10
- timerId = setTimeout(() => resolve(fn(...args)), time)
11
- })
12
- }
13
- }
@@ -1,79 +0,0 @@
1
- :root {
2
- --aa-primary-color: --tw-ring-color;
3
- --aa-selected-color: --tw-ring-color;
4
- --aa-primary-color-rgb: 5, 150, 105;
5
- }
6
-
7
- .global-search {
8
- .aa-DetachedSearchButton:focus,
9
- .aa-DetachedSearchButton {
10
- border: none !important;
11
- }
12
- }
13
-
14
- .resource-search {
15
- .aa-Autocomplete {
16
- @apply w-full;
17
- }
18
-
19
- .aa-DetachedSearchButton {
20
- @apply rounded-full border-gray-300;
21
- }
22
- }
23
-
24
- .aa-SourceHeader {
25
- @apply uppercase text-xs font-semibold;
26
- }
27
-
28
- .aa-DetachedFormContainer,
29
- .aa-DetachedContainer .aa-Panel {
30
- @apply bg-blue-gray-100 border-b-0;
31
- }
32
-
33
- .aa-Form {
34
- &:focus-within {
35
- @apply ring-0 !important;
36
- }
37
-
38
- input {
39
- @apply focus:ring-0 !important;
40
- }
41
- &:focus-within {
42
- .aa-InputWrapperPrefix{
43
- .aa-SubmitButton {
44
- @apply ring-0;
45
- }
46
- }
47
- }
48
- }
49
- .aa-Input {
50
- @apply focus:ring-green-600;
51
- }
52
-
53
- .aa-DetachedContainer {
54
- .aa-PanelLayout {
55
- @apply pt-0 space-y-3;
56
- }
57
-
58
- .aa-Source {
59
- .aa-List {
60
- @apply space-y-1;
61
-
62
- .aa-Item {
63
- @apply bg-white rounded-md px-3 py-4 shadow;
64
-
65
- .aa-ItemDescription {
66
- @apply text-gray-500 text-sm;
67
- }
68
-
69
- &[aria-selected=true]{
70
- @apply bg-blue-700 text-white;
71
-
72
- .aa-ItemDescription {
73
- @apply text-white;
74
- }
75
- }
76
- }
77
- }
78
- }
79
- }
@@ -1,17 +0,0 @@
1
- <div data-controller="search" class="global-search" data-turbo-remove-before-cache>
2
- <div class="inline-block"
3
- data-search-target="autocomplete"
4
- data-search-resource="global"
5
- data-translation-keys='{"no_item_found": "<%= I18n.translate 'avo.no_item_found' %>"}'
6
- data-debounce-timeout='<%= Avo.configuration.search_debounce %>'
7
- >
8
- </div>
9
- <div class="relative top-[-5px] inline-flex text-gray-400 text-sm leading-5 py-0.5 px-1.5 border border-gray-300 rounded-md cursor-pointer"
10
- data-search-target="button"
11
- >
12
- <span class="sr-only">Press </span>
13
- <kbd class="font-sans"><abbr title="Command" class="no-underline">⌘</abbr></kbd>
14
- <span class="sr-only"> and </span>
15
- <kbd class="font-sans">K</kbd><span class="sr-only"> to search</span>
16
- </div>
17
- </div>
@@ -1,10 +0,0 @@
1
- <div data-controller="search" class="resource-search flex items-center h-full w-full" data-turbo-remove-before-cache>
2
- <div class="w-full"
3
- data-search-target="autocomplete"
4
- data-search-resource="<%= resource %>"
5
- data-translation-keys='{"no_item_found": "<%= I18n.translate 'avo.no_item_found' %>"}'
6
- data-debounce-timeout='<%= Avo.configuration.search_debounce %>'
7
- >
8
- </div>
9
- <div class="relative inline-flex text-gray-400 text-sm border border-gray-300 rounded-full cursor-pointer" data-search-target="button"></div>
10
- </div>