avo 2.11.1 → 2.11.2.pre.3
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/app/assets/stylesheets/avo.css +1 -4
- data/app/assets/stylesheets/css/sidebar.css +18 -0
- data/app/assets/svgs/failed_to_load.svg +15 -0
- data/app/components/avo/common_field_wrapper_component.html.erb +4 -0
- data/app/components/avo/fields/has_one_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/has_one_field/show_component.rb +7 -6
- data/app/components/avo/fields/text_field/index_component.html.erb +2 -0
- data/app/components/avo/fields/text_field/show_component.html.erb +2 -0
- data/app/components/avo/fields/trix_field/edit_component.rb +1 -1
- data/app/components/avo/index/field_wrapper_component.html.erb +4 -0
- data/app/components/avo/index/resource_controls_component.html.erb +3 -0
- data/app/components/avo/index/resource_controls_component.rb +7 -5
- data/app/components/avo/index/resource_table_component.html.erb +1 -1
- data/app/components/avo/index/resource_table_component.rb +2 -1
- data/app/components/avo/index/table_row_component.html.erb +14 -5
- data/app/components/avo/index/table_row_component.rb +2 -1
- data/app/components/avo/item_switcher_component.html.erb +1 -1
- data/app/components/avo/resource_component.rb +11 -5
- data/app/components/avo/sidebar_component.html.erb +8 -2
- data/app/components/avo/sidebar_component.rb +9 -0
- data/app/components/avo/tab_switcher_component.rb +4 -0
- data/app/components/avo/views/resource_edit_component.rb +4 -6
- data/app/components/avo/views/resource_index_component.html.erb +1 -1
- data/app/components/avo/views/resource_index_component.rb +5 -3
- data/app/components/avo/views/resource_show_component.html.erb +1 -1
- data/app/components/avo/views/resource_show_component.rb +3 -1
- data/app/controllers/avo/application_controller.rb +25 -10
- data/app/controllers/avo/associations_controller.rb +38 -12
- data/app/controllers/avo/base_controller.rb +7 -2
- data/app/javascript/js/controllers/fields/key_value_controller.js +3 -1
- data/app/javascript/js/controllers/sidebar_controller.js +49 -0
- data/app/javascript/js/controllers.js +2 -2
- data/app/views/avo/base/index.html.erb +1 -0
- data/app/views/avo/base/show.html.erb +7 -1
- data/app/views/avo/home/failed_to_load.html copy.erb +23 -0
- data/app/views/avo/home/failed_to_load.html.erb +9 -15
- data/app/views/avo/partials/_javascript.html.erb +1 -0
- data/app/views/avo/partials/_navbar.html.erb +5 -2
- data/app/views/avo/partials/_table_header.html.erb +12 -5
- data/app/views/layouts/avo/application.html.erb +9 -4
- data/bin/init +5 -0
- data/lib/avo/base_resource.rb +9 -1
- data/lib/avo/concerns/has_fields.rb +12 -3
- data/lib/avo/concerns/has_html_attributes.rb +1 -1
- data/lib/avo/concerns/model_class_constantized.rb +1 -1
- data/lib/avo/configuration/resource_configuration.rb +21 -0
- data/lib/avo/configuration.rb +2 -0
- data/lib/avo/fields/has_base_field.rb +11 -0
- data/lib/avo/fields/text_field.rb +4 -2
- data/lib/avo/items_holder.rb +6 -0
- data/lib/avo/panel_builder.rb +1 -0
- data/lib/avo/services/authorization_service.rb +41 -37
- data/lib/avo/version.rb +1 -1
- data/lib/avo.rb +1 -0
- data/public/avo-assets/avo.css +78 -16
- data/public/avo-assets/avo.js +70 -69
- data/public/avo-assets/avo.js.map +3 -3
- metadata +9 -5
- data/app/javascript/js/controllers/mobile_controller.js +0 -9
@@ -4,43 +4,6 @@ module Avo
|
|
4
4
|
attr_accessor :user
|
5
5
|
attr_accessor :record
|
6
6
|
|
7
|
-
def initialize(user = nil, record = nil)
|
8
|
-
@user = user
|
9
|
-
@record = record
|
10
|
-
end
|
11
|
-
|
12
|
-
def authorize(action, **args)
|
13
|
-
self.class.authorize(user, record, action, **args)
|
14
|
-
end
|
15
|
-
|
16
|
-
def set_record(record)
|
17
|
-
@record = record
|
18
|
-
|
19
|
-
self
|
20
|
-
end
|
21
|
-
|
22
|
-
def set_user(user)
|
23
|
-
@user = user
|
24
|
-
|
25
|
-
self
|
26
|
-
end
|
27
|
-
|
28
|
-
def authorize_action(action, **args)
|
29
|
-
self.class.authorize_action(user, record, action, **args)
|
30
|
-
end
|
31
|
-
|
32
|
-
def apply_policy(model)
|
33
|
-
self.class.apply_policy(user, model)
|
34
|
-
end
|
35
|
-
|
36
|
-
def defined_methods(model, **args)
|
37
|
-
self.class.defined_methods(user, model, **args)
|
38
|
-
end
|
39
|
-
|
40
|
-
def has_method?(method, **args)
|
41
|
-
self.class.defined_methods(user, record, **args).include? method.to_sym
|
42
|
-
end
|
43
|
-
|
44
7
|
class << self
|
45
8
|
def authorize(user, record, action, **args)
|
46
9
|
return true if skip_authorization
|
@@ -111,6 +74,10 @@ module Avo
|
|
111
74
|
|
112
75
|
def defined_methods(user, record, **args)
|
113
76
|
Pundit.policy!(user, record).methods
|
77
|
+
rescue Pundit::NotDefinedError => e
|
78
|
+
return [] unless Avo.configuration.raise_error_on_missing_policy
|
79
|
+
|
80
|
+
raise e
|
114
81
|
rescue => error
|
115
82
|
if args[:raise_exception] == false
|
116
83
|
[]
|
@@ -119,6 +86,43 @@ module Avo
|
|
119
86
|
end
|
120
87
|
end
|
121
88
|
end
|
89
|
+
|
90
|
+
def initialize(user = nil, record = nil)
|
91
|
+
@user = user
|
92
|
+
@record = record
|
93
|
+
end
|
94
|
+
|
95
|
+
def authorize(action, **args)
|
96
|
+
self.class.authorize(user, record, action, **args)
|
97
|
+
end
|
98
|
+
|
99
|
+
def set_record(record)
|
100
|
+
@record = record
|
101
|
+
|
102
|
+
self
|
103
|
+
end
|
104
|
+
|
105
|
+
def set_user(user)
|
106
|
+
@user = user
|
107
|
+
|
108
|
+
self
|
109
|
+
end
|
110
|
+
|
111
|
+
def authorize_action(action, **args)
|
112
|
+
self.class.authorize_action(user, record, action, **args)
|
113
|
+
end
|
114
|
+
|
115
|
+
def apply_policy(model)
|
116
|
+
self.class.apply_policy(user, model)
|
117
|
+
end
|
118
|
+
|
119
|
+
def defined_methods(model, **args)
|
120
|
+
self.class.defined_methods(user, model, **args)
|
121
|
+
end
|
122
|
+
|
123
|
+
def has_method?(method, **args)
|
124
|
+
defined_methods(record, **args).include? method.to_sym
|
125
|
+
end
|
122
126
|
end
|
123
127
|
end
|
124
128
|
end
|
data/lib/avo/version.rb
CHANGED
data/lib/avo.rb
CHANGED
data/public/avo-assets/avo.css
CHANGED
@@ -4536,6 +4536,29 @@ input[type=file][data-direct-upload-url][disabled] {
|
|
4536
4536
|
display: none;
|
4537
4537
|
}
|
4538
4538
|
|
4539
|
+
.application-sidebar .active:hover, .application-sidebar .active{
|
4540
|
+
--tw-bg-opacity:1;
|
4541
|
+
background-color:rgb(206 231 248 / var(--tw-bg-opacity));
|
4542
|
+
--tw-text-opacity:1;
|
4543
|
+
color:rgb(8 134 222 / var(--tw-text-opacity))
|
4544
|
+
}
|
4545
|
+
|
4546
|
+
/* remove the left padding. */
|
4547
|
+
|
4548
|
+
@media (min-width: 1024px){
|
4549
|
+
.content-area .main-content-area{
|
4550
|
+
padding-left:0px
|
4551
|
+
}
|
4552
|
+
}
|
4553
|
+
|
4554
|
+
/* Add padding to the main area to allow for the sidebar to expand. */
|
4555
|
+
|
4556
|
+
@media (min-width: 1024px){
|
4557
|
+
.content-area.sidebar-open .main-content-area{
|
4558
|
+
padding-left:16rem
|
4559
|
+
}
|
4560
|
+
}
|
4561
|
+
|
4539
4562
|
.button-spinner {
|
4540
4563
|
width: 24px;
|
4541
4564
|
height: 24px;
|
@@ -6593,6 +6616,14 @@ trix-editor .attachment__metadata .attachment__size {
|
|
6593
6616
|
height:2rem
|
6594
6617
|
}
|
6595
6618
|
|
6619
|
+
.h-64{
|
6620
|
+
height:16rem
|
6621
|
+
}
|
6622
|
+
|
6623
|
+
.h-52{
|
6624
|
+
height:13rem
|
6625
|
+
}
|
6626
|
+
|
6596
6627
|
.h-6{
|
6597
6628
|
height:1.5rem
|
6598
6629
|
}
|
@@ -6763,6 +6794,16 @@ trix-editor .attachment__metadata .attachment__size {
|
|
6763
6794
|
transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))
|
6764
6795
|
}
|
6765
6796
|
|
6797
|
+
.-translate-x-full{
|
6798
|
+
--tw-translate-x:-100%;
|
6799
|
+
transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))
|
6800
|
+
}
|
6801
|
+
|
6802
|
+
.translate-x-0{
|
6803
|
+
--tw-translate-x:0px;
|
6804
|
+
transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))
|
6805
|
+
}
|
6806
|
+
|
6766
6807
|
.-translate-y-full{
|
6767
6808
|
--tw-translate-y:-100%;
|
6768
6809
|
transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))
|
@@ -7456,6 +7497,11 @@ trix-editor .attachment__metadata .attachment__size {
|
|
7456
7497
|
padding-bottom:3rem
|
7457
7498
|
}
|
7458
7499
|
|
7500
|
+
.py-4{
|
7501
|
+
padding-top:1rem;
|
7502
|
+
padding-bottom:1rem
|
7503
|
+
}
|
7504
|
+
|
7459
7505
|
.py-6{
|
7460
7506
|
padding-top:1.5rem;
|
7461
7507
|
padding-bottom:1.5rem
|
@@ -7501,16 +7547,19 @@ trix-editor .attachment__metadata .attachment__size {
|
|
7501
7547
|
padding-right:2.5rem
|
7502
7548
|
}
|
7503
7549
|
|
7504
|
-
.py-4{
|
7505
|
-
padding-top:1rem;
|
7506
|
-
padding-bottom:1rem
|
7507
|
-
}
|
7508
|
-
|
7509
7550
|
.py-8{
|
7510
7551
|
padding-top:2rem;
|
7511
7552
|
padding-bottom:2rem
|
7512
7553
|
}
|
7513
7554
|
|
7555
|
+
.pb-6{
|
7556
|
+
padding-bottom:1.5rem
|
7557
|
+
}
|
7558
|
+
|
7559
|
+
.pb-3{
|
7560
|
+
padding-bottom:0.75rem
|
7561
|
+
}
|
7562
|
+
|
7514
7563
|
.pb-1{
|
7515
7564
|
padding-bottom:0.25rem
|
7516
7565
|
}
|
@@ -7869,6 +7918,14 @@ trix-editor .attachment__metadata .attachment__size {
|
|
7869
7918
|
opacity:0.5
|
7870
7919
|
}
|
7871
7920
|
|
7921
|
+
.opacity-0{
|
7922
|
+
opacity:0
|
7923
|
+
}
|
7924
|
+
|
7925
|
+
.opacity-100{
|
7926
|
+
opacity:1
|
7927
|
+
}
|
7928
|
+
|
7872
7929
|
.shadow-panel{
|
7873
7930
|
--tw-shadow:0px 4px 8px rgba(0, 0, 0, 0.04), 0px 0px 2px rgba(0, 0, 0, 0.06), 0px 0px 1px rgba(0, 0, 0, 0.04);
|
7874
7931
|
--tw-shadow-colored:0px 4px 8px var(--tw-shadow-color), 0px 0px 2px var(--tw-shadow-color), 0px 0px 1px var(--tw-shadow-color);
|
@@ -7939,10 +7996,22 @@ trix-editor .attachment__metadata .attachment__size {
|
|
7939
7996
|
transition-duration:150ms
|
7940
7997
|
}
|
7941
7998
|
|
7999
|
+
.duration-75{
|
8000
|
+
transition-duration:75ms
|
8001
|
+
}
|
8002
|
+
|
7942
8003
|
.ease-in-out{
|
7943
8004
|
transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)
|
7944
8005
|
}
|
7945
8006
|
|
8007
|
+
.ease-out{
|
8008
|
+
transition-timing-function:cubic-bezier(0, 0, 0.2, 1)
|
8009
|
+
}
|
8010
|
+
|
8011
|
+
.ease-in{
|
8012
|
+
transition-timing-function:cubic-bezier(0.4, 0, 1, 1)
|
8013
|
+
}
|
8014
|
+
|
7946
8015
|
html, body{
|
7947
8016
|
position:relative;
|
7948
8017
|
height:100%;
|
@@ -8003,13 +8072,6 @@ html, body{
|
|
8003
8072
|
opacity:0
|
8004
8073
|
}
|
8005
8074
|
|
8006
|
-
.application-sidebar .active:hover, .application-sidebar .active{
|
8007
|
-
--tw-bg-opacity:1;
|
8008
|
-
background-color:rgb(206 231 248 / var(--tw-bg-opacity));
|
8009
|
-
--tw-text-opacity:1;
|
8010
|
-
color:rgb(8 134 222 / var(--tw-text-opacity))
|
8011
|
-
}
|
8012
|
-
|
8013
8075
|
.turbo-progress-bar{
|
8014
8076
|
--tw-bg-opacity:1;
|
8015
8077
|
background-color:rgb(57 158 229 / var(--tw-bg-opacity))
|
@@ -8913,6 +8975,10 @@ trix-editor {
|
|
8913
8975
|
margin-bottom:-1rem
|
8914
8976
|
}
|
8915
8977
|
|
8978
|
+
.lg\:block{
|
8979
|
+
display:block
|
8980
|
+
}
|
8981
|
+
|
8916
8982
|
.lg\:flex{
|
8917
8983
|
display:flex
|
8918
8984
|
}
|
@@ -8972,10 +9038,6 @@ trix-editor {
|
|
8972
9038
|
.lg\:pl-4{
|
8973
9039
|
padding-left:1rem
|
8974
9040
|
}
|
8975
|
-
|
8976
|
-
.lg\:pl-64{
|
8977
|
-
padding-left:16rem
|
8978
|
-
}
|
8979
9041
|
}
|
8980
9042
|
|
8981
9043
|
@media (min-width: 1280px){
|