avo 1.22.0.pre.1 → 1.22.0
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 -3
- data/app/assets/images/avo/logo.png +0 -0
- data/app/assets/stylesheets/avo.css +1 -1
- data/app/assets/stylesheets/css/fonts.css +0 -53
- data/app/assets/stylesheets/css/pagination.css +9 -9
- data/app/assets/stylesheets/css/search.css +2 -3
- data/app/components/avo/fields/boolean_field/index_component.html.erb +1 -1
- data/app/components/avo/index/field_wrapper_component.html.erb +2 -8
- data/app/components/avo/index/field_wrapper_component.rb +1 -2
- data/app/components/avo/index/resource_table_component.html.erb +3 -3
- data/app/components/avo/index/table_row_component.html.erb +1 -1
- data/app/components/avo/navigation_heading_component.html.erb +2 -2
- data/app/components/avo/navigation_heading_component.rb +1 -5
- data/app/components/avo/navigation_link_component.html.erb +2 -2
- data/app/components/avo/navigation_link_component.rb +2 -6
- data/app/components/avo/panel_component.html.erb +3 -5
- data/app/components/avo/views/resource_index_component.html.erb +7 -8
- data/app/components/avo/views/resource_show_component.html.erb +0 -10
- data/app/controllers/avo/application_controller.rb +16 -14
- data/app/controllers/avo/base_controller.rb +1 -4
- data/app/helpers/avo/application_helper.rb +5 -7
- data/app/helpers/avo/resources_helper.rb +2 -2
- data/app/views/avo/base/_actions.html.erb +3 -4
- data/app/views/avo/base/_filters.html.erb +1 -3
- data/app/views/avo/partials/_global_search.html.erb +2 -2
- data/app/views/avo/partials/_logo.html.erb +1 -1
- data/app/views/avo/partials/_paginator.html.erb +3 -4
- data/app/views/avo/partials/_profile_dropdown.html.erb +25 -0
- data/app/views/avo/partials/_resource_search.html.erb +1 -1
- data/app/views/avo/partials/_table_header.html.erb +3 -3
- data/app/views/avo/partials/_view_toggle_button.html.erb +16 -22
- data/app/views/avo/{partials → sidebar}/_sidebar.html.erb +10 -14
- data/app/views/layouts/avo/application.html.erb +13 -3
- data/lib/avo/app.rb +3 -4
- data/lib/avo/fields/key_value_field.rb +28 -8
- data/lib/avo/version.rb +1 -1
- data/lib/generators/avo/templates/locales/avo.en.yml +1 -0
- data/lib/generators/avo/templates/locales/avo.nb-NO.yml +1 -0
- data/lib/generators/avo/templates/locales/avo.pt-BR.yml +1 -0
- data/lib/generators/avo/templates/locales/avo.ro.yml +1 -0
- data/public/avo-assets/avo.css +224 -405
- data/public/avo-assets/logo.png +0 -0
- metadata +7 -37
- data/app/assets/builds/avo.css +0 -8787
- data/app/assets/builds/avo.js +0 -87848
- data/app/assets/builds/avo.js.map +0 -7
- data/app/assets/svgs/dashboards-icon.svg +0 -6
- data/app/assets/svgs/resources-icon.svg +0 -13
- data/app/assets/svgs/three-dots.svg +0 -5
- data/app/assets/svgs/tools-icon.svg +0 -3
- data/app/components/avo/button_component.html.erb +0 -1
- data/app/components/avo/button_component.rb +0 -111
- data/app/components/avo/sidebar_profile_component.html.erb +0 -28
- data/app/components/avo/sidebar_profile_component.rb +0 -43
- data/app/views/avo/partials/_navbar.html.erb +0 -11
- data/public/avo-assets/fonts/inter-v7-latin-500.eot +0 -0
- data/public/avo-assets/fonts/inter-v7-latin-500.svg +0 -351
- data/public/avo-assets/fonts/inter-v7-latin-500.ttf +0 -0
- data/public/avo-assets/fonts/inter-v7-latin-500.woff +0 -0
- data/public/avo-assets/fonts/inter-v7-latin-500.woff2 +0 -0
- data/public/avo-assets/fonts/inter-v7-latin-600.eot +0 -0
- data/public/avo-assets/fonts/inter-v7-latin-600.svg +0 -351
- data/public/avo-assets/fonts/inter-v7-latin-600.ttf +0 -0
- data/public/avo-assets/fonts/inter-v7-latin-600.woff +0 -0
- data/public/avo-assets/fonts/inter-v7-latin-600.woff2 +0 -0
- data/public/avo-assets/fonts/inter-v7-latin-700.eot +0 -0
- data/public/avo-assets/fonts/inter-v7-latin-700.svg +0 -352
- data/public/avo-assets/fonts/inter-v7-latin-700.ttf +0 -0
- data/public/avo-assets/fonts/inter-v7-latin-700.woff +0 -0
- data/public/avo-assets/fonts/inter-v7-latin-700.woff2 +0 -0
- data/public/avo-assets/fonts/inter-v7-latin-regular.eot +0 -0
- data/public/avo-assets/fonts/inter-v7-latin-regular.svg +0 -351
- data/public/avo-assets/fonts/inter-v7-latin-regular.ttf +0 -0
- data/public/avo-assets/fonts/inter-v7-latin-regular.woff +0 -0
- data/public/avo-assets/fonts/inter-v7-latin-regular.woff2 +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 629be34248470405b26afdad89b08373587cd4ea00fb10f910315072338b5f39
|
4
|
+
data.tar.gz: ef5eb75f5e6b863af0d69fdefee87455a44283a17333000adcb2ab076f827fb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35cc7ab3e7086fd1b701e8600f25a33f3a7b779d03626ea293b75e19f375e4de5bc4ab29dc243d49eeb9bd0afe5411d35c87165aac01ca029b2de9cee6f6e1f1
|
7
|
+
data.tar.gz: 0b4e462976362acfaf3ecf5673a70f474f1c0c4b0e11d7f502c81cf3a9f53def31306988defa28599de643c10f9a4ee27b77182e1f6231d509cd1374e9cebd84
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
avo (1.22.0
|
4
|
+
avo (1.22.0)
|
5
5
|
active_link_to
|
6
6
|
addressable
|
7
7
|
breadcrumbs_on_rails
|
@@ -230,8 +230,6 @@ GEM
|
|
230
230
|
nokogiri (1.13.1)
|
231
231
|
mini_portile2 (~> 2.7.0)
|
232
232
|
racc (~> 1.4)
|
233
|
-
nokogiri (1.13.1-x86_64-linux)
|
234
|
-
racc (~> 1.4)
|
235
233
|
orm_adapter (0.5.0)
|
236
234
|
pagy (5.10.1)
|
237
235
|
activesupport
|
Binary file
|
@@ -24,56 +24,3 @@
|
|
24
24
|
url('/avo-assets/fonts/nunito-v16-latin-700.ttf') format('truetype'), /* Safari, Android, iOS */
|
25
25
|
url('/avo-assets/fonts/nunito-v16-latin-700.svg#Nunito') format('svg'); /* Legacy iOS */
|
26
26
|
}
|
27
|
-
|
28
|
-
/* inter-regular - latin */
|
29
|
-
@font-face {
|
30
|
-
font-family: 'Inter';
|
31
|
-
font-style: normal;
|
32
|
-
font-weight: 400;
|
33
|
-
src: url('/avo-assets/fonts/inter-v7-latin-regular.eot'); /* IE9 Compat Modes */
|
34
|
-
src: local(''),
|
35
|
-
url('/avo-assets/fonts/inter-v7-latin-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
|
36
|
-
url('/avo-assets/fonts/inter-v7-latin-regular.woff2') format('woff2'), /* Super Modern Browsers */
|
37
|
-
url('/avo-assets/fonts/inter-v7-latin-regular.woff') format('woff'), /* Modern Browsers */
|
38
|
-
url('/avo-assets/fonts/inter-v7-latin-regular.ttf') format('truetype'), /* Safari, Android, iOS */
|
39
|
-
url('/avo-assets/fonts/inter-v7-latin-regular.svg#Inter') format('svg'); /* Legacy iOS */
|
40
|
-
}
|
41
|
-
/* inter-500 - latin */
|
42
|
-
@font-face {
|
43
|
-
font-family: 'Inter';
|
44
|
-
font-style: normal;
|
45
|
-
font-weight: 500;
|
46
|
-
src: url('/avo-assets/fonts/inter-v7-latin-500.eot'); /* IE9 Compat Modes */
|
47
|
-
src: local(''),
|
48
|
-
url('/avo-assets/fonts/inter-v7-latin-500.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
|
49
|
-
url('/avo-assets/fonts/inter-v7-latin-500.woff2') format('woff2'), /* Super Modern Browsers */
|
50
|
-
url('/avo-assets/fonts/inter-v7-latin-500.woff') format('woff'), /* Modern Browsers */
|
51
|
-
url('/avo-assets/fonts/inter-v7-latin-500.ttf') format('truetype'), /* Safari, Android, iOS */
|
52
|
-
url('/avo-assets/fonts/inter-v7-latin-500.svg#Inter') format('svg'); /* Legacy iOS */
|
53
|
-
}
|
54
|
-
/* inter-600 - latin */
|
55
|
-
@font-face {
|
56
|
-
font-family: 'Inter';
|
57
|
-
font-style: normal;
|
58
|
-
font-weight: 600;
|
59
|
-
src: url('/avo-assets/fonts/inter-v7-latin-600.eot'); /* IE9 Compat Modes */
|
60
|
-
src: local(''),
|
61
|
-
url('/avo-assets/fonts/inter-v7-latin-600.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
|
62
|
-
url('/avo-assets/fonts/inter-v7-latin-600.woff2') format('woff2'), /* Super Modern Browsers */
|
63
|
-
url('/avo-assets/fonts/inter-v7-latin-600.woff') format('woff'), /* Modern Browsers */
|
64
|
-
url('/avo-assets/fonts/inter-v7-latin-600.ttf') format('truetype'), /* Safari, Android, iOS */
|
65
|
-
url('/avo-assets/fonts/inter-v7-latin-600.svg#Inter') format('svg'); /* Legacy iOS */
|
66
|
-
}
|
67
|
-
/* inter-700 - latin */
|
68
|
-
@font-face {
|
69
|
-
font-family: 'Inter';
|
70
|
-
font-style: normal;
|
71
|
-
font-weight: 700;
|
72
|
-
src: url('/avo-assets/fonts/inter-v7-latin-700.eot'); /* IE9 Compat Modes */
|
73
|
-
src: local(''),
|
74
|
-
url('/avo-assets/fonts/inter-v7-latin-700.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
|
75
|
-
url('/avo-assets/fonts/inter-v7-latin-700.woff2') format('woff2'), /* Super Modern Browsers */
|
76
|
-
url('/avo-assets/fonts/inter-v7-latin-700.woff') format('woff'), /* Modern Browsers */
|
77
|
-
url('/avo-assets/fonts/inter-v7-latin-700.ttf') format('truetype'), /* Safari, Android, iOS */
|
78
|
-
url('/avo-assets/fonts/inter-v7-latin-700.svg#Inter') format('svg'); /* Legacy iOS */
|
79
|
-
}
|
@@ -21,18 +21,18 @@
|
|
21
21
|
.pagy-nav-js .page a,
|
22
22
|
.pagy-combo-nav-js .page a,
|
23
23
|
.pagy-combo-nav-js .pagy-combo-input a {
|
24
|
-
@apply rounded-lg px-3 py-1 text-sm text-gray-500 font-semibold bg-
|
24
|
+
@apply rounded-lg px-3 py-1 text-sm text-gray-500 font-semibold bg-gray-200 shadow-md;
|
25
25
|
|
26
26
|
&:focus{
|
27
27
|
@apply border-blue-300;
|
28
28
|
}
|
29
29
|
|
30
30
|
&:hover{
|
31
|
-
@apply bg-gray-
|
31
|
+
@apply bg-gray-300;
|
32
32
|
}
|
33
33
|
|
34
34
|
&:active{
|
35
|
-
@apply bg-gray-
|
35
|
+
@apply bg-gray-400 text-white;
|
36
36
|
}
|
37
37
|
}
|
38
38
|
|
@@ -42,26 +42,26 @@
|
|
42
42
|
.pagy-nav .page.next.disabled,
|
43
43
|
.pagy-nav-js .page.next.disabled,
|
44
44
|
.pagy-combo-nav-js .page.next.disabled {
|
45
|
-
@apply text-gray-
|
45
|
+
@apply text-gray-400 cursor-default;
|
46
46
|
|
47
47
|
&:hover {
|
48
|
-
@apply text-gray-
|
48
|
+
@apply text-gray-400 bg-gray-200;
|
49
49
|
}
|
50
50
|
|
51
51
|
&:active {
|
52
|
-
@apply text-gray-
|
52
|
+
@apply text-gray-400 bg-gray-200;
|
53
53
|
}
|
54
54
|
}
|
55
55
|
|
56
56
|
.pagy-nav .page.active,
|
57
57
|
.pagy-nav-js .page.active {
|
58
|
-
@apply text-white cursor-default bg-gray-
|
58
|
+
@apply text-white cursor-default bg-gray-400;
|
59
59
|
|
60
60
|
&:hover {
|
61
|
-
@apply text-white bg-gray-
|
61
|
+
@apply text-white bg-gray-400;
|
62
62
|
}
|
63
63
|
|
64
64
|
&:active {
|
65
|
-
@apply bg-gray-
|
65
|
+
@apply bg-gray-400 text-white;
|
66
66
|
}
|
67
67
|
}
|
@@ -1,14 +1,13 @@
|
|
1
1
|
:root {
|
2
2
|
--aa-primary-color: --tw-ring-color;
|
3
3
|
--aa-selected-color: --tw-ring-color;
|
4
|
-
--aa-primary-color-rgb:
|
4
|
+
--aa-primary-color-rgb: 5, 150, 105;
|
5
5
|
}
|
6
6
|
|
7
7
|
.global-search {
|
8
8
|
.aa-DetachedSearchButton:focus,
|
9
9
|
.aa-DetachedSearchButton {
|
10
10
|
border: none !important;
|
11
|
-
@apply text-gray-500;
|
12
11
|
}
|
13
12
|
}
|
14
13
|
|
@@ -18,7 +17,7 @@
|
|
18
17
|
}
|
19
18
|
|
20
19
|
.aa-DetachedSearchButton {
|
21
|
-
@apply rounded border-gray-300
|
20
|
+
@apply rounded-full border-gray-300;
|
22
21
|
}
|
23
22
|
}
|
24
23
|
|
@@ -1,13 +1,7 @@
|
|
1
|
-
<td class="px-4 py-
|
1
|
+
<td class="px-4 py-2 leading-tight whitespace-nowrap h-12 text-slate-800 <%= @classes %>" data-field-id="<%= @field.id %>" data-field-type="<%= @field.type %>">
|
2
2
|
<% if @field.value.blank? && @dash_if_blank %>
|
3
3
|
—
|
4
4
|
<% else %>
|
5
|
-
|
6
|
-
<div class="flex items-center justify-center">
|
7
|
-
<%= content %>
|
8
|
-
</div>
|
9
|
-
<% else %>
|
10
|
-
<%= content %>
|
11
|
-
<% end %>
|
5
|
+
<%= content %>
|
12
6
|
<% end %>
|
13
7
|
</td>
|
@@ -1,10 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class Avo::Index::FieldWrapperComponent < ViewComponent::Base
|
4
|
-
def initialize(field: nil, dash_if_blank: true,
|
4
|
+
def initialize(field: nil, dash_if_blank: true, **args)
|
5
5
|
@field = field
|
6
6
|
@dash_if_blank = dash_if_blank
|
7
|
-
@center_content = center_content
|
8
7
|
@classes = args[:class].present? ? args[:class] : ""
|
9
8
|
@args = args
|
10
9
|
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
<div class="w-full
|
1
|
+
<div class="w-full">
|
2
2
|
<% if @resources.present?%>
|
3
|
-
<table class="w-full px-4 overflow-hidden
|
3
|
+
<table class="w-full px-4 overflow-hidden" data-resource-name='<%= @resource.model_key %>' data-controller='item-select-all'>
|
4
4
|
<%= render partial: 'avo/partials/table_header', locals: {fields: @resource.get_fields(reflection: @reflection)} %>
|
5
|
-
<tbody
|
5
|
+
<tbody>
|
6
6
|
<% @resources.each_with_index do |resource, index| %>
|
7
7
|
<% cache_if Avo.configuration.cache_resources_on_index_view, resource.cache_hash(@parent_model) do %>
|
8
8
|
<%= render Avo::Index::TableRowComponent.new(resource: resource, reflection: @reflection, parent_model: @parent_model) %>
|
@@ -1,3 +1,3 @@
|
|
1
|
-
<div class="flex items-center p-
|
2
|
-
|
1
|
+
<div class="flex items-center my-2 p-3 text-gray-500 font-bold text-sm -mb-1 leading-none">
|
2
|
+
<div class="w-4"></div> <%= @label %>
|
3
3
|
</div>
|
@@ -1,3 +1,3 @@
|
|
1
|
-
<%= active_link_to @path, class: 'px-4 block
|
2
|
-
<%= @label %>
|
1
|
+
<%= active_link_to @path, class: 'text-gray-800 py-2 px-4 block font-normal hover:bg-gray-100 rounded-md mb-1 mx-3 text-sm leading-none', active: @active, target: @target do %>
|
2
|
+
<div class="w-4"></div> <%= @label %>
|
3
3
|
<% end %>
|
@@ -1,15 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class Avo::NavigationLinkComponent < ViewComponent::Base
|
4
|
-
|
5
|
-
attr_reader :path
|
6
|
-
attr_reader :active
|
7
|
-
attr_reader :size
|
8
|
-
|
9
|
-
def initialize(label: nil, path: nil, active: :inclusive, size: :md)
|
4
|
+
def initialize(label: nil, path: nil, active: :inclusive, size: :md, target: "_self")
|
10
5
|
@label = label
|
11
6
|
@path = path
|
12
7
|
@active = active
|
13
8
|
@size = size
|
9
|
+
@target = target
|
14
10
|
end
|
15
11
|
end
|
@@ -6,12 +6,10 @@
|
|
6
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
7
|
</div>
|
8
8
|
<% end %>
|
9
|
-
|
10
|
-
<div class="text-2xl tracking-normal font-semibold text-gray-800 truncate" data-target="title">
|
9
|
+
<div class="text-2xl tracking-normal font-bold text-gray-800 truncate" data-target="title">
|
11
10
|
<%= @title %>
|
12
11
|
</div>
|
13
|
-
|
14
|
-
<div class="text-base tracking-normal font-medium text-gray-600" data-target="description">
|
12
|
+
<div class="text-sm tracking-normal text-gray-600" data-target="description">
|
15
13
|
<%== description %>
|
16
14
|
</div>
|
17
15
|
</div>
|
@@ -23,7 +21,7 @@
|
|
23
21
|
</div>
|
24
22
|
</div>
|
25
23
|
|
26
|
-
<div class="relative bg-white rounded-
|
24
|
+
<div class="relative bg-white rounded-xl shadow-xl mb-8 <%= @body_classes %>">
|
27
25
|
<%= body %>
|
28
26
|
</div>
|
29
27
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
<div>
|
2
|
-
<%= render Avo::PanelComponent.new(title: title, description: description, body_classes: 'py-
|
2
|
+
<%= render Avo::PanelComponent.new(title: title, description: description, body_classes: 'py-4', data: { component: 'resources-index' }, display_breadcrumbs: @reflection.blank?) do |c| %>
|
3
3
|
<% c.tools do %>
|
4
4
|
<% if can_see_the_actions_button? %>
|
5
5
|
<%= render 'actions' %>
|
6
6
|
<% end %>
|
7
7
|
|
8
8
|
<% if can_see_the_create_button? %>
|
9
|
-
<%= a_link create_path, 'data-target': 'create'
|
9
|
+
<%= a_link create_path, 'data-target': 'create' do %>
|
10
10
|
<%= svg 'plus' %> <%= t('avo.create_new_item', item: singular_resource_name.downcase ) %>
|
11
11
|
<% end %>
|
12
12
|
<% end %>
|
@@ -19,7 +19,7 @@
|
|
19
19
|
<% end %>
|
20
20
|
|
21
21
|
<% c.body do %>
|
22
|
-
<div class="flex justify-between min-h-16"
|
22
|
+
<div class="flex justify-between pt-2 pb-2 min-h-16"
|
23
23
|
data-selected-resources-name="<%= @resource.model_key %>"
|
24
24
|
data-selected-resources="[]"
|
25
25
|
>
|
@@ -27,14 +27,11 @@
|
|
27
27
|
<%= render partial: 'avo/partials/resource_search', locals: {resource: @resource.model_key} if @resource.search_query.present? %>
|
28
28
|
</div>
|
29
29
|
<div class="flex justify-end items-center px-6 space-x-3">
|
30
|
-
<%= render 'filters' if @filters.present? %>
|
31
|
-
|
32
30
|
<%= render partial: 'avo/partials/view_toggle_button', locals: { available_view_types: available_view_types, view_type: view_type, turbo_frame: @turbo_frame } if @models.present? %>
|
31
|
+
<%= render 'filters' if @filters.present? %>
|
33
32
|
</div>
|
34
33
|
</div>
|
35
|
-
<% end %>
|
36
34
|
|
37
|
-
<% c.bare_content do %>
|
38
35
|
<% if view_type.to_sym == :table %>
|
39
36
|
<div class="w-full overflow-auto flex flex-col mt-4">
|
40
37
|
<div class="relative flex-1 flex">
|
@@ -48,11 +45,13 @@
|
|
48
45
|
<% end %>
|
49
46
|
</div>
|
50
47
|
<% end %>
|
48
|
+
<% end %>
|
51
49
|
|
50
|
+
<% c.bare_content do %>
|
52
51
|
<% if view_type.to_sym == :grid %>
|
53
52
|
<%= render Avo::Index::ResourceGridComponent.new(resources: @resources, resource: @resource, reflection: @reflection, parent_model: @parent_model) %>
|
54
53
|
|
55
|
-
<div class="mt-8 py-6">
|
54
|
+
<div class="bg-white rounded-xl shadow-xl mt-8 py-6">
|
56
55
|
<%= render partial: 'avo/partials/paginator', locals: { pagy: @pagy, turbo_frame: @turbo_frame || 'none' } %>
|
57
56
|
</div>
|
58
57
|
<% end %>
|
@@ -24,16 +24,6 @@
|
|
24
24
|
<%= svg 'arrow-left' %> <%= t('avo.go_back') %>
|
25
25
|
<% end %>
|
26
26
|
|
27
|
-
<%# -- %>
|
28
|
-
|
29
|
-
<%#= render Avo::ButtonComponent.new(icon: svg('arrow-left'), is_link: true, href: back_path) do %>
|
30
|
-
<%#= t('avo.go_back') %>
|
31
|
-
<%# end %>
|
32
|
-
|
33
|
-
<%#= render Avo::ButtonComponent.new(color: 'green', spinner: true, type: :submit, icon: svg('save')) do %>
|
34
|
-
<%#= t('avo.save').capitalize %>
|
35
|
-
<%# end %>
|
36
|
-
|
37
27
|
<% if can_see_the_destroy_button? %>
|
38
28
|
<%= form_with url: helpers.resource_path(model: @resource.model, resource: @resource), method: :delete, html: { 'data-turbo-frame': params[:turbo_frame] } do |form| %>
|
39
29
|
<%= a_button title: t('avo.delete_item', item: @resource.model.model_name.name.downcase).capitalize,
|
@@ -1,6 +1,11 @@
|
|
1
1
|
module Avo
|
2
2
|
class ApplicationController < ::ActionController::Base
|
3
|
-
|
3
|
+
if defined?(Pundit::Authorization)
|
4
|
+
include Pundit::Authorization
|
5
|
+
else
|
6
|
+
include Pundit
|
7
|
+
end
|
8
|
+
|
4
9
|
include Pagy::Backend
|
5
10
|
include Avo::ApplicationHelper
|
6
11
|
include Avo::UrlHelpers
|
@@ -111,7 +116,12 @@ module Avo
|
|
111
116
|
end
|
112
117
|
|
113
118
|
def fill_model
|
114
|
-
|
119
|
+
# We have to skip filling the the model if this is an attach action
|
120
|
+
is_attach_action = params[model_param_key].blank? && params[:related_name].present? && params[:fields].present?
|
121
|
+
|
122
|
+
unless is_attach_action
|
123
|
+
@model = @resource.fill_model(@model_to_fill, cast_nullable(model_params))
|
124
|
+
end
|
115
125
|
end
|
116
126
|
|
117
127
|
def hydrate_resource
|
@@ -187,18 +197,6 @@ module Avo
|
|
187
197
|
query
|
188
198
|
end
|
189
199
|
|
190
|
-
# def authorize_user
|
191
|
-
# return if params[:controller] == 'avo/search'
|
192
|
-
|
193
|
-
# model = record = resource.model
|
194
|
-
|
195
|
-
# if ['show', 'edit', 'update'].include?(params[:action]) && params[:controller] == 'avo/resources'
|
196
|
-
# record = resource
|
197
|
-
# end
|
198
|
-
|
199
|
-
# # AuthorizationService::authorize_action _current_user, record, params[:action] return render_unauthorized unless
|
200
|
-
# end
|
201
|
-
|
202
200
|
def _authenticate!
|
203
201
|
instance_eval(&Avo.configuration.authenticate)
|
204
202
|
end
|
@@ -243,5 +241,9 @@ module Avo
|
|
243
241
|
def on_api_path
|
244
242
|
request.original_url.match?(/.*#{Avo::App.root_path}\/avo_api\/.*/)
|
245
243
|
end
|
244
|
+
|
245
|
+
def model_param_key
|
246
|
+
@resource.form_scope
|
247
|
+
end
|
246
248
|
end
|
247
249
|
end
|
@@ -7,6 +7,7 @@ module Avo
|
|
7
7
|
before_action :hydrate_resource
|
8
8
|
before_action :set_model, only: [:show, :edit, :destroy, :update]
|
9
9
|
before_action :set_model_to_fill
|
10
|
+
before_action :fill_model, only: [:create, :update]
|
10
11
|
before_action :authorize_action
|
11
12
|
before_action :reset_pagination_if_filters_changed, only: :index
|
12
13
|
before_action :cache_applied_filters, only: :index
|
@@ -112,7 +113,6 @@ module Avo
|
|
112
113
|
|
113
114
|
def create
|
114
115
|
# model gets instantiated and filled in the fill_model method
|
115
|
-
fill_model
|
116
116
|
saved = @model.save
|
117
117
|
@resource.hydrate(model: @model, view: :new, user: _current_user)
|
118
118
|
|
@@ -166,7 +166,6 @@ module Avo
|
|
166
166
|
|
167
167
|
def update
|
168
168
|
# model gets instantiated and filled in the fill_model method
|
169
|
-
fill_model
|
170
169
|
saved = @model.save
|
171
170
|
@resource = @resource.hydrate(model: @model, view: :edit, user: _current_user)
|
172
171
|
|
@@ -194,8 +193,6 @@ module Avo
|
|
194
193
|
private
|
195
194
|
|
196
195
|
def model_params
|
197
|
-
model_param_key = @resource.form_scope
|
198
|
-
|
199
196
|
request_params = params.require(model_param_key).permit(permitted_params)
|
200
197
|
|
201
198
|
if @resource.devise_password_optional && request_params[:password].blank? && request_params[:password_confirmation].blank?
|
@@ -68,14 +68,14 @@ module Avo
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
-
def button_classes(extra_classes = nil, color: nil, variant: nil, size: :md
|
72
|
-
classes = "inline-flex flex-grow-0 items-center text-sm font-
|
71
|
+
def button_classes(extra_classes = nil, color: nil, variant: nil, size: :md)
|
72
|
+
classes = "inline-flex flex-grow-0 items-center text-sm font-bold leading-none fill-current whitespace-nowrap transition duration-100 rounded-lg shadow-xl transform transition duration-100 active:translate-x-px active:translate-y-px cursor-pointer disabled:cursor-not-allowed #{extra_classes}"
|
73
73
|
|
74
74
|
if color.present?
|
75
75
|
if variant.present? && (variant.to_sym == :outlined)
|
76
76
|
classes += " bg-white border"
|
77
77
|
|
78
|
-
classes += " hover:border-#{color}-700 border-#{color}-
|
78
|
+
classes += " hover:border-#{color}-700 border-#{color}-600 text-#{color}-600 hover:text-#{color}-700 disabled:border-gray-300 disabled:text-gray-600"
|
79
79
|
else
|
80
80
|
classes += " text-white bg-#{color}-500 hover:bg-#{color}-600 disabled:bg-#{color}-300"
|
81
81
|
end
|
@@ -88,11 +88,9 @@ module Avo
|
|
88
88
|
when :xs
|
89
89
|
" p-2 py-1"
|
90
90
|
when :sm
|
91
|
-
"
|
91
|
+
" p-3"
|
92
92
|
when :md
|
93
|
-
"
|
94
|
-
when :xl
|
95
|
-
" py-3 px-4"
|
93
|
+
" p-4"
|
96
94
|
else
|
97
95
|
" p-4"
|
98
96
|
end
|
@@ -47,7 +47,7 @@ module Avo
|
|
47
47
|
|
48
48
|
def item_selector_input(floating: false, size: :md)
|
49
49
|
"<input type='checkbox'
|
50
|
-
class='mx-3
|
50
|
+
class='mx-3 #{"absolute inset-auto left-0 mt-2 z-10 hidden group-hover:block checked:block" if floating} #{size.to_sym == :lg ? "w-5 h-5" : "w-4 h-4"}'
|
51
51
|
data-action='input->item-selector#toggle input->item-select-all#update'
|
52
52
|
data-item-select-all-target='itemCheckbox'
|
53
53
|
name='#{t "avo.select_item"}'
|
@@ -58,7 +58,7 @@ module Avo
|
|
58
58
|
|
59
59
|
def item_select_all_input
|
60
60
|
"<input type='checkbox'
|
61
|
-
class='mx-3
|
61
|
+
class='mx-3 w-4 h-4'
|
62
62
|
data-action='input->item-select-all#toggle'
|
63
63
|
data-item-select-all-target='checkbox'
|
64
64
|
name='#{t "avo.select_all"}'
|
@@ -1,12 +1,11 @@
|
|
1
1
|
<% if @actions.count > 0 %>
|
2
2
|
<div class="relative z-40 js-actions-dropdown" data-controller="toggle-panel actions-picker">
|
3
3
|
<%= a_button class: "focus:outline-none",
|
4
|
-
color: '
|
5
|
-
size: :xl,
|
4
|
+
color: 'sky',
|
6
5
|
'data-action': "click->toggle-panel#togglePanel",
|
7
6
|
'data-actions-dropdown-button': @resource.model_key do
|
8
7
|
%>
|
9
|
-
<%= svg 'arrow-
|
8
|
+
<%= svg 'arrow-left', class: 'h-4 mr-1 transform -rotate-90' %> <%= t 'avo.actions' %>
|
10
9
|
<% end %>
|
11
10
|
<div
|
12
11
|
class="absolute block inset-auto right-0 top-full bg-white min-w-300px mt-2 py-4 z-20 shadow-context rounded-xl overflow-hidden hidden"
|
@@ -27,7 +26,7 @@
|
|
27
26
|
'data-turbo-frame': 'actions_show',
|
28
27
|
'data-action': 'click->actions-picker#visitAction',
|
29
28
|
'data-actions-picker-target': action.standalone ? 'standaloneAction' : 'resourceAction',
|
30
|
-
class: "flex items-center w-full py-2 px-4 font-
|
29
|
+
class: "flex items-center w-full py-2 px-4 font-bold text-gray-700 hover:text-white hover:bg-blue-500 #{disabled ? 'text-gray-500' : 'text-gray-700'}",
|
31
30
|
'data-disabled': disabled do %>
|
32
31
|
<%= svg 'play', class: 'h-5 mr-1 inline' %> <%= action.action_name %>
|
33
32
|
<% end %>
|
@@ -1,9 +1,7 @@
|
|
1
1
|
<div data-controller="toggle-panel">
|
2
2
|
<div class="relative w-full flex justify-between z-30">
|
3
3
|
<%= a_button class: 'focus:outline-none',
|
4
|
-
color: '
|
5
|
-
variant: 'outlined',
|
6
|
-
size: :sm,
|
4
|
+
color: 'slate',
|
7
5
|
title: t('avo.click_to_reveal_filters'),
|
8
6
|
'data-button': 'resource-filters',
|
9
7
|
'data-action': 'click->toggle-panel#togglePanel',
|
@@ -1,5 +1,5 @@
|
|
1
|
-
<div data-controller="search" class="global-search
|
2
|
-
<div class="inline-block
|
1
|
+
<div data-controller="search" class="global-search" data-turbo-remove-before-cache>
|
2
|
+
<div class="inline-block"
|
3
3
|
data-search-target="autocomplete"
|
4
4
|
data-search-resource="global"
|
5
5
|
data-translation-keys='{"no_item_found": "<%= I18n.translate 'avo.no_item_found' %>", "placeholder": "<%= I18n.translate 'avo.search.placeholder' %>", "cancel_button": "<%= I18n.translate 'avo.search.cancel_button' %>"}'
|
@@ -8,10 +8,12 @@
|
|
8
8
|
per_page_options = per_page_options.sort.uniq
|
9
9
|
%>
|
10
10
|
|
11
|
-
<div class="flex items-center justify-between aborder-t aborder-slate-200 rounded-xl">
|
11
|
+
<div class="bg-white px-4 flex items-center justify-between aborder-t aborder-slate-200 sm:px-6 rounded-xl">
|
12
12
|
<div class="hidden sm:flex-2 sm:flex sm:items-center sm:justify-between">
|
13
13
|
<div>
|
14
14
|
<div class="text-sm leading-5 text-slate-600 flex items-center">
|
15
|
+
<div class="mr-2"><%== pagy_info @pagy %></div>
|
16
|
+
|
15
17
|
<div data-controller="per-page">
|
16
18
|
<div class="flex items-center">
|
17
19
|
<%= select_tag 'per_page',
|
@@ -37,10 +39,7 @@
|
|
37
39
|
</div>
|
38
40
|
</div>
|
39
41
|
<div class="flex">
|
40
|
-
|
41
42
|
<div class="flex-2 sm:flex sm:items-center sm:justify-between">
|
42
|
-
<div class="mr-4"><%== pagy_info @pagy %></div>
|
43
|
-
|
44
43
|
<%# @todo: add first & last page. make the first and last buttons rounded %>
|
45
44
|
<% if @pagy.pages > 1 %>
|
46
45
|
<%== pagy_nav @pagy %>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<% destroy_user_session_path = "destroy_#{Avo.configuration.current_user_resource_name}_session_path".to_sym %>
|
2
|
+
|
3
|
+
<div <% if main_app.respond_to?(destroy_user_session_path) %> data-controller="toggle-panel" <% end %>>
|
4
|
+
<a href="javascript:void(0);" class="flex items-center cursor-pointer font-semibold text-gray-700" data-action="click->toggle-panel#togglePanel">
|
5
|
+
<% if _current_user.respond_to?(:avatar) && _current_user.avatar.present? %>
|
6
|
+
<%= image_tag _current_user.avatar, class: "h-12 rounded-full border-4 border-white mr-1" %>
|
7
|
+
<% end %>
|
8
|
+
<% if _current_user.respond_to?(:name) && _current_user.name.present? %>
|
9
|
+
<%= _current_user.name %>
|
10
|
+
<% elsif _current_user.respond_to?(:email) && _current_user.email.present? %>
|
11
|
+
<%= _current_user.email %>
|
12
|
+
<% else %>
|
13
|
+
Avo user
|
14
|
+
<% end %>
|
15
|
+
<% if main_app.respond_to?(destroy_user_session_path) %>
|
16
|
+
<%= svg 'chevron-down', class: "ml-1 h-4" %>
|
17
|
+
<% end %>
|
18
|
+
</a>
|
19
|
+
|
20
|
+
<% if main_app.respond_to?(destroy_user_session_path) %>
|
21
|
+
<div class="hidden absolute inset-auto right-0 mr-6 mt-0 py-4 bg-white rounded-xl min-w-[200px] shadow-context" data-toggle-panel-target="panel">
|
22
|
+
<%= button_to t('avo.sign_out'), main_app.send(:destroy_user_session_path), method: :delete, form: { "data-turbo" => "false" }, class: "appearance-none bg-white text-left cursor-pointer text-green-600 font-semibold hover:text-white hover:bg-green-500 block px-4 py-1 w-full" %>
|
23
|
+
</div>
|
24
|
+
<% end %>
|
25
|
+
</div>
|
@@ -5,5 +5,5 @@
|
|
5
5
|
data-translation-keys='{"no_item_found": "<%= I18n.translate 'avo.no_item_found' %>"}'
|
6
6
|
>
|
7
7
|
</div>
|
8
|
-
<div class="hidden relative inline-flex text-gray-400 text-sm border border-gray-300 rounded cursor-pointer" data-search-target="button"></div>
|
8
|
+
<div class="hidden relative inline-flex text-gray-400 text-sm border border-gray-300 rounded-full cursor-pointer" data-search-target="button"></div>
|
9
9
|
</div>
|