avo 1.19.1.pre.3 → 1.19.1.pre.7
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 +3 -7
- data/Gemfile.lock +31 -51
- data/README.md +3 -0
- data/app/assets/builds/avo.css +8590 -0
- data/app/assets/builds/avo.js +87755 -0
- data/app/assets/builds/avo.js.map +7 -0
- data/app/assets/config/avo_manifest.js +2 -1
- data/app/{packs/images → assets/images/avo}/logo.png +0 -0
- data/app/{packs/entrypoints/application.css → assets/stylesheets/avo.css} +31 -24
- data/app/{packs/stylesheets → assets/stylesheets/css}/active-storage.css +0 -0
- data/app/{packs/stylesheets → assets/stylesheets/css}/alerts.css +0 -0
- data/app/{packs/stylesheets → assets/stylesheets/css}/breadcrumbs.css +0 -0
- data/app/{packs/stylesheets → assets/stylesheets/css}/components/code.css +0 -0
- data/app/{packs/stylesheets → assets/stylesheets/css}/components/progress.css +0 -0
- data/app/{packs/stylesheets → assets/stylesheets/css}/components/status.css +0 -0
- data/app/assets/stylesheets/css/fonts.css +26 -0
- data/app/{packs/stylesheets → assets/stylesheets/css}/loader.css +0 -0
- data/app/{packs/stylesheets → assets/stylesheets/css}/pagination.css +0 -0
- data/app/{packs/stylesheets → assets/stylesheets/css}/search.css +1 -1
- data/app/{packs/stylesheets → assets/stylesheets/css}/spinner.css +0 -0
- data/app/{packs/stylesheets → assets/stylesheets/css}/tailwindcss/base.css +0 -0
- data/app/{packs/stylesheets → assets/stylesheets/css}/tailwindcss/components.css +0 -0
- data/app/{packs/stylesheets → assets/stylesheets/css}/tailwindcss/utilities.css +0 -0
- data/app/{packs/stylesheets → assets/stylesheets/css}/tooltips.css +0 -0
- data/app/{packs/stylesheets → assets/stylesheets/css}/typography.css +0 -0
- data/app/{packs → assets}/svgs/arrow-circle-right.svg +0 -0
- data/app/{packs → assets}/svgs/arrow-left.svg +0 -0
- data/app/{packs → assets}/svgs/avocado.svg +0 -0
- data/app/{packs → assets}/svgs/badge-check-sm.svg +0 -0
- data/app/{packs → assets}/svgs/check-circle-sm.svg +0 -0
- data/app/{packs → assets}/svgs/check-circle.svg +0 -0
- data/app/{packs → assets}/svgs/chevron-down.svg +0 -0
- data/app/{packs → assets}/svgs/chevron-right.svg +0 -0
- data/app/{packs → assets}/svgs/chevron-up.svg +0 -0
- data/app/{packs → assets}/svgs/code.svg +0 -0
- data/app/{packs → assets}/svgs/color-swatch.svg +0 -0
- data/app/{packs → assets}/svgs/document-text.svg +0 -0
- data/app/{packs → assets}/svgs/download.svg +0 -0
- data/app/{packs → assets}/svgs/edit.svg +0 -0
- data/app/{packs → assets}/svgs/exclamation-circle-sm.svg +0 -0
- data/app/{packs → assets}/svgs/exclamation-sm.svg +0 -0
- data/app/{packs → assets}/svgs/exclamation.svg +0 -0
- data/app/{packs → assets}/svgs/eye.svg +0 -0
- data/app/{packs → assets}/svgs/filter.svg +0 -0
- data/app/{packs → assets}/svgs/fire.svg +0 -0
- data/app/{packs → assets}/svgs/game-board.svg +0 -0
- data/app/{packs → assets}/svgs/globe.svg +0 -0
- data/app/{packs → assets}/svgs/information-circle-sm.svg +0 -0
- data/app/{packs → assets}/svgs/information-circle.svg +0 -0
- data/app/{packs → assets}/svgs/library.svg +0 -0
- data/app/{packs → assets}/svgs/photograph.svg +0 -0
- data/app/{packs → assets}/svgs/play.svg +0 -0
- data/app/{packs → assets}/svgs/plus-circle.svg +0 -0
- data/app/{packs → assets}/svgs/plus.svg +0 -0
- data/app/{packs → assets}/svgs/question-mark-circle.svg +0 -0
- data/app/{packs → assets}/svgs/save.svg +0 -0
- data/app/{packs → assets}/svgs/selector.svg +0 -0
- data/app/{packs → assets}/svgs/sort-ascending.svg +0 -0
- data/app/{packs → assets}/svgs/sort-descending.svg +0 -0
- data/app/{packs → assets}/svgs/switch-horizontal.svg +0 -0
- data/app/{packs → assets}/svgs/thumbs-down.svg +0 -0
- data/app/{packs → assets}/svgs/thumbs-up.svg +0 -0
- data/app/{packs → assets}/svgs/times.svg +0 -0
- data/app/{packs → assets}/svgs/trash-sm.svg +0 -0
- data/app/{packs → assets}/svgs/trash.svg +0 -0
- data/app/{packs → assets}/svgs/view-grid-add.svg +0 -0
- data/app/{packs → assets}/svgs/view-grid.svg +0 -0
- data/app/{packs → assets}/svgs/view-list.svg +0 -0
- data/app/{packs → assets}/svgs/x-circle-sm.svg +0 -0
- data/app/{packs → assets}/svgs/x-circle.svg +0 -0
- data/app/components/avo/edit/field_wrapper_component.html.erb +1 -1
- data/app/components/avo/fields/common/files_list_viewer_component.html.erb +1 -1
- data/app/components/avo/fields/common/heading_component.html.erb +1 -1
- data/app/components/avo/index/field_wrapper_component.html.erb +1 -1
- data/app/components/avo/index/table_row_component.html.erb +1 -1
- data/app/components/avo/resource_component.rb +0 -4
- data/app/components/avo/show/field_wrapper_component.html.erb +1 -1
- data/app/components/avo/views/resource_index_component.rb +18 -8
- data/app/components/avo/views/resource_new_component.html.erb +1 -1
- data/app/controllers/avo/base_controller.rb +39 -9
- data/app/helpers/avo/application_helper.rb +4 -16
- data/app/{packs/entrypoints/application.js → javascript/avo.js} +15 -18
- data/app/{packs → javascript}/js/active-storage.js +0 -0
- data/app/javascript/js/application.js +9 -0
- data/app/{packs → javascript}/js/controllers/action_controller.js +1 -1
- data/app/{packs → javascript}/js/controllers/actions_picker_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/alerts_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/attachments_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/boolean_filter_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/fields/belongs_to_field_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/fields/code_field_controller.js +2 -1
- data/app/{packs → javascript}/js/controllers/fields/date_field_controller.js +1 -1
- data/app/{packs → javascript}/js/controllers/fields/key_value_controller.js +1 -1
- data/app/{packs → javascript}/js/controllers/fields/simple_mde_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/fields/trix_field_controller.js +1 -1
- data/app/{packs → javascript}/js/controllers/filter_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/hidden_input_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/item_select_all_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/item_selector_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/loading_button_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/modal_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/multiple_select_filter_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/per_page_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/search_controller.js +1 -1
- data/app/{packs → javascript}/js/controllers/select_filter_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/text_filter_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/tippy_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/toggle_panel_controller.js +0 -0
- data/app/javascript/js/controllers.js +53 -0
- data/app/{packs → javascript}/js/helpers/cast_boolean.js +0 -0
- data/app/{packs → javascript}/js/helpers/debounce_promise.js +0 -0
- data/app/{packs → javascript}/js/toastr.js +0 -0
- data/app/views/avo/actions/show.html.erb +1 -1
- data/app/views/avo/base/_actions.html.erb +1 -1
- data/app/views/avo/base/_filters.html.erb +3 -3
- data/app/views/avo/home/_actions.html.erb +1 -1
- data/app/views/avo/home/_filters.html.erb +1 -1
- data/app/views/avo/home/_resources.html.erb +2 -2
- data/app/views/avo/partials/_footer.html.erb +1 -1
- data/app/views/avo/partials/_global_search.html.erb +4 -1
- data/app/views/avo/partials/_logo.html.erb +1 -1
- data/app/views/avo/partials/_paginator.html.erb +3 -3
- data/app/views/avo/partials/_table_header.html.erb +2 -2
- data/app/views/layouts/avo/application.html.erb +9 -4
- data/avo.gemspec +1 -2
- data/bin/dev +9 -0
- data/bin/test +2 -1
- data/lib/avo/base_resource.rb +4 -3
- data/lib/avo/configuration.rb +6 -0
- data/lib/avo/engine.rb +2 -16
- data/lib/avo/version.rb +1 -1
- data/lib/avo.rb +0 -18
- data/lib/generators/avo/filter_generator.rb +2 -0
- data/lib/generators/avo/templates/filters/text_filter.tt +8 -0
- data/lib/generators/avo/templates/initializer/avo.tt +4 -5
- data/public/avo-assets/avo.css +8590 -0
- data/public/avo-assets/avo.js +87755 -0
- data/public/avo-assets/avo.js.map +7 -0
- data/{app/packs → public/avo-assets}/fonts/nunito-v16-latin-700.eot +0 -0
- data/{app/packs → public/avo-assets}/fonts/nunito-v16-latin-700.svg +0 -0
- data/{app/packs → public/avo-assets}/fonts/nunito-v16-latin-700.ttf +0 -0
- data/{app/packs → public/avo-assets}/fonts/nunito-v16-latin-700.woff +0 -0
- data/{app/packs → public/avo-assets}/fonts/nunito-v16-latin-700.woff2 +0 -0
- data/{app/packs → public/avo-assets}/fonts/nunito-v16-latin-regular.eot +0 -0
- data/{app/packs → public/avo-assets}/fonts/nunito-v16-latin-regular.svg +0 -0
- data/{app/packs → public/avo-assets}/fonts/nunito-v16-latin-regular.ttf +0 -0
- data/{app/packs → public/avo-assets}/fonts/nunito-v16-latin-regular.woff +0 -0
- data/{app/packs → public/avo-assets}/fonts/nunito-v16-latin-regular.woff2 +0 -0
- metadata +115 -168
- data/app/assets/stylesheets/avo/application.css +0 -15
- data/app/packs/importmap.json.erb +0 -5
- data/app/packs/stylesheets/fonts.css +0 -26
- data/bin/webpack +0 -20
- data/bin/webpack-dev-server +0 -18
- data/config/webpack/aliases.js +0 -10
- data/config/webpack/base.js +0 -14
- data/config/webpack/development.js +0 -5
- data/config/webpack/production.js +0 -5
- data/config/webpack/test.js +0 -5
- data/config/webpacker.yml +0 -79
- data/public/avo-packs/css/application-c3b50b28.css +0 -6329
- data/public/avo-packs/css/application-c3b50b28.css.br +0 -0
- data/public/avo-packs/css/application-c3b50b28.css.gz +0 -0
- data/public/avo-packs/css/application-c3b50b28.css.map +0 -1
- data/public/avo-packs/css/application-c3b50b28.css.map.br +0 -0
- data/public/avo-packs/css/application-c3b50b28.css.map.gz +0 -0
- data/public/avo-packs/js/actioncable-7119dbc1a908641fb263.chunk.js +0 -2
- data/public/avo-packs/js/actioncable-7119dbc1a908641fb263.chunk.js.br +0 -0
- data/public/avo-packs/js/actioncable-7119dbc1a908641fb263.chunk.js.gz +0 -0
- data/public/avo-packs/js/actioncable-7119dbc1a908641fb263.chunk.js.map +0 -1
- data/public/avo-packs/js/actioncable-7119dbc1a908641fb263.chunk.js.map.br +0 -0
- data/public/avo-packs/js/actioncable-7119dbc1a908641fb263.chunk.js.map.gz +0 -0
- data/public/avo-packs/js/application-6fc968cfa52976c4582b.js +0 -26
- data/public/avo-packs/js/application-6fc968cfa52976c4582b.js.LICENSE.txt +0 -77
- data/public/avo-packs/js/application-6fc968cfa52976c4582b.js.br +0 -0
- data/public/avo-packs/js/application-6fc968cfa52976c4582b.js.gz +0 -0
- data/public/avo-packs/js/application-6fc968cfa52976c4582b.js.map +0 -1
- data/public/avo-packs/js/application-6fc968cfa52976c4582b.js.map.br +0 -0
- data/public/avo-packs/js/application-6fc968cfa52976c4582b.js.map.gz +0 -0
- data/public/avo-packs/manifest.json +0 -52
- data/public/avo-packs/media/images/13ae283c0d7cc04efe7e.svg +0 -380
- data/public/avo-packs/media/images/13ae283c0d7cc04efe7e.svg.br +0 -0
- data/public/avo-packs/media/images/13ae283c0d7cc04efe7e.svg.gz +0 -0
- data/public/avo-packs/media/images/195026a50008c53526ef.svg +0 -388
- data/public/avo-packs/media/images/195026a50008c53526ef.svg.br +0 -0
- data/public/avo-packs/media/images/195026a50008c53526ef.svg.gz +0 -0
- data/public/avo-packs/media/images/1f30e08faa7c60d1f7ac.woff +0 -0
- data/public/avo-packs/media/images/1fd17dabf6b7d2b15348.ttf +0 -0
- data/public/avo-packs/media/images/1fd17dabf6b7d2b15348.ttf.br +0 -0
- data/public/avo-packs/media/images/1fd17dabf6b7d2b15348.ttf.gz +0 -0
- data/public/avo-packs/media/images/39a18f443d434999b89b.woff2 +0 -0
- data/public/avo-packs/media/images/4ad349571e28bb59c5a5.woff2 +0 -0
- data/public/avo-packs/media/images/57a5470848663767abbf.eot +0 -0
- data/public/avo-packs/media/images/b2e4cf0fab6c8ca66b7f.ttf +0 -0
- data/public/avo-packs/media/images/b2e4cf0fab6c8ca66b7f.ttf.br +0 -0
- data/public/avo-packs/media/images/b2e4cf0fab6c8ca66b7f.ttf.gz +0 -0
- data/public/avo-packs/media/images/b78d61ab7e046de8c156.eot +0 -0
- data/public/avo-packs/media/images/c9ab29becb76ddab01d0.woff +0 -0
- data/public/avo-packs/media/images/dadf2db36589607d107d.png +0 -0
@@ -1 +1,2 @@
|
|
1
|
-
//= link_directory ../
|
1
|
+
//= link_directory ../images/avo
|
2
|
+
//= link_tree ../builds
|
File without changes
|
@@ -6,25 +6,26 @@
|
|
6
6
|
@import './../../../node_modules/flatpickr/dist/flatpickr.css';
|
7
7
|
@import './../../../node_modules/@algolia/autocomplete-theme-classic/dist/theme.css';
|
8
8
|
|
9
|
-
@import '
|
10
|
-
|
11
|
-
@import '
|
12
|
-
@import '
|
13
|
-
@import '
|
14
|
-
@import '
|
15
|
-
@import '
|
16
|
-
@import '
|
17
|
-
@import '
|
18
|
-
@import '
|
19
|
-
@import '
|
20
|
-
@import '
|
21
|
-
|
22
|
-
@import '
|
23
|
-
@import '
|
24
|
-
@import '
|
25
|
-
|
26
|
-
|
27
|
-
|
9
|
+
@import 'tailwindcss/base';
|
10
|
+
|
11
|
+
@import './css/fonts.css';
|
12
|
+
@import './css/typography.css';
|
13
|
+
@import './css/tooltips.css';
|
14
|
+
@import './css/alerts.css';
|
15
|
+
@import './css/loader.css';
|
16
|
+
@import './css/pagination.css';
|
17
|
+
@import './css/breadcrumbs.css';
|
18
|
+
@import './css/search.css';
|
19
|
+
@import './css/active-storage.css';
|
20
|
+
@import './css/spinner.css';
|
21
|
+
|
22
|
+
@import './css/components/status.css';
|
23
|
+
@import './css/components/code.css';
|
24
|
+
@import './css/components/progress.css';
|
25
|
+
|
26
|
+
@import 'tailwindcss/components';
|
27
|
+
|
28
|
+
@import 'tailwindcss/utilities';
|
28
29
|
|
29
30
|
html,
|
30
31
|
body {
|
@@ -67,13 +68,19 @@ body {
|
|
67
68
|
@apply opacity-0 translate-y-1;
|
68
69
|
}
|
69
70
|
|
70
|
-
.application-sidebar
|
71
|
-
|
72
|
-
|
73
|
-
@apply bg-gray-200;
|
74
|
-
}
|
71
|
+
.application-sidebar .active:hover,
|
72
|
+
.application-sidebar .active {
|
73
|
+
@apply bg-gray-200;
|
75
74
|
}
|
76
75
|
|
77
76
|
.turbo-progress-bar {
|
78
77
|
@apply bg-green-500;
|
79
78
|
}
|
79
|
+
|
80
|
+
body.os-mac .mac\:hidden {
|
81
|
+
display: none;
|
82
|
+
}
|
83
|
+
|
84
|
+
body.os-pc .pc\:hidden {
|
85
|
+
display: none;
|
86
|
+
}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,26 @@
|
|
1
|
+
/* nunito-regular - latin */
|
2
|
+
@font-face {
|
3
|
+
font-family: 'Nunito';
|
4
|
+
font-style: normal;
|
5
|
+
font-weight: 400;
|
6
|
+
src: url('/avo-assets/fonts/nunito-v16-latin-regular.eot'); /* IE9 Compat Modes */
|
7
|
+
src: local(''),
|
8
|
+
url('/avo-assets/fonts/nunito-v16-latin-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
|
9
|
+
url('/avo-assets/fonts/nunito-v16-latin-regular.woff2') format('woff2'), /* Super Modern Browsers */
|
10
|
+
url('/avo-assets/fonts/nunito-v16-latin-regular.woff') format('woff'), /* Modern Browsers */
|
11
|
+
url('/avo-assets/fonts/nunito-v16-latin-regular.ttf') format('truetype'), /* Safari, Android, iOS */
|
12
|
+
url('/avo-assets/fonts/nunito-v16-latin-regular.svg#Nunito') format('svg'); /* Legacy iOS */
|
13
|
+
}
|
14
|
+
/* nunito-700 - latin */
|
15
|
+
@font-face {
|
16
|
+
font-family: 'Nunito';
|
17
|
+
font-style: normal;
|
18
|
+
font-weight: 700;
|
19
|
+
src: url('/avo-assets/fonts/nunito-v16-latin-700.eot'); /* IE9 Compat Modes */
|
20
|
+
src: local(''),
|
21
|
+
url('/avo-assets/fonts/nunito-v16-latin-700.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
|
22
|
+
url('/avo-assets/fonts/nunito-v16-latin-700.woff2') format('woff2'), /* Super Modern Browsers */
|
23
|
+
url('/avo-assets/fonts/nunito-v16-latin-700.woff') format('woff'), /* Modern Browsers */
|
24
|
+
url('/avo-assets/fonts/nunito-v16-latin-700.ttf') format('truetype'), /* Safari, Android, iOS */
|
25
|
+
url('/avo-assets/fonts/nunito-v16-latin-700.svg#Nunito') format('svg'); /* Legacy iOS */
|
26
|
+
}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<div class="flex items-center py-0 leading-tight <%= @classes %> min-h-16" data-field-id="<%= @field.id %>" data-field-type="<%= @field.type %>">
|
2
|
-
<div class="h-16 flex self-start items-center text-
|
2
|
+
<div class="h-16 flex self-start items-center text-slate-800">
|
3
3
|
<div class="<% if @displayed_in_modal %> md:w-48 <% else %> md:w-64 <% end %> w-48 px-8 flex" data-slot="label">
|
4
4
|
<%= @form.label @field.id, label %> <% if @field.required %> <span class="text-red-600">*</span> <% end %>
|
5
5
|
</div>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div class="relative p-3 bg-
|
1
|
+
<div class="relative p-3 bg-slate-200 grid grid-cols-3 xl:grid-cols-4 gap-3 rounded-xl">
|
2
2
|
<% @field.value.attachments.each do |file| %>
|
3
3
|
<%= render Avo::Fields::Common::MultipleFileViewerComponent.new id: @field.id, file: file, is_image: @field.is_image, button_size: :xs, resource: @resource %>
|
4
4
|
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div class="flex items-start py-1 leading-tight border-t bg-
|
1
|
+
<div class="flex items-start py-1 leading-tight border-t bg-slate-600 text-white text-xs">
|
2
2
|
<div class="p-3 pl-6 h-full w-full">
|
3
3
|
<% if @value.present? %>
|
4
4
|
<% if @as_html %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<td class="px-4 py-2 leading-tight whitespace-nowrap h-12 text-
|
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 %>
|
@@ -25,10 +25,6 @@ class Avo::ResourceComponent < ViewComponent::Base
|
|
25
25
|
|
26
26
|
private
|
27
27
|
|
28
|
-
def simple_relation?
|
29
|
-
@reflection.is_a? ::ActiveRecord::Reflection::HasManyReflection
|
30
|
-
end
|
31
|
-
|
32
28
|
def relation_resource
|
33
29
|
::Avo::App.get_resource_by_model_name params[:via_resource_class].safe_constantize
|
34
30
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<div class="flex items-start leading-tight <%= @classes %> min-h-16" data-field-id="<%= @field.id %>" data-field-type="<%= @field.type %>">
|
2
|
-
<div class="h-16 flex self-start items-center text-
|
2
|
+
<div class="h-16 flex self-start items-center text-slate-800">
|
3
3
|
<div class="w-48 md:w-64 px-8" data-slot="label">
|
4
4
|
<%= @field.name %> <% if @field.required %> <span class="text-red-600">*</span> <% end %>
|
5
5
|
</div>
|
@@ -47,7 +47,7 @@ class Avo::Views::ResourceIndexComponent < Avo::ResourceComponent
|
|
47
47
|
# The Create button is dependent on the new? policy method.
|
48
48
|
# The create? should be called only when the user clicks the Save button so the developers gets access to the params from the form.
|
49
49
|
def can_see_the_create_button?
|
50
|
-
@resource.authorization.authorize_action(:new, raise_exception: false) &&
|
50
|
+
@resource.authorization.authorize_action(:new, raise_exception: false) && !has_reflection_and_is_read_only
|
51
51
|
end
|
52
52
|
|
53
53
|
def can_attach?
|
@@ -60,7 +60,7 @@ class Avo::Views::ResourceIndexComponent < Avo::ResourceComponent
|
|
60
60
|
def has_reflection_and_is_read_only
|
61
61
|
if @reflection.present? && @reflection.active_record.name && @reflection.name
|
62
62
|
fields = ::Avo::App.get_resource_by_model_name(@reflection.active_record.name).get_field_definitions
|
63
|
-
filtered_fields = fields.filter{ |f| f.id == @reflection.name}
|
63
|
+
filtered_fields = fields.filter { |f| f.id == @reflection.name }
|
64
64
|
else
|
65
65
|
return false
|
66
66
|
end
|
@@ -77,10 +77,22 @@ class Avo::Views::ResourceIndexComponent < Avo::ResourceComponent
|
|
77
77
|
|
78
78
|
if @reflection.present?
|
79
79
|
args = {
|
80
|
-
via_relation_class:
|
81
|
-
via_resource_id: @parent_model.id
|
80
|
+
via_relation_class: reflection_model_class,
|
81
|
+
via_resource_id: @parent_model.id,
|
82
82
|
}
|
83
83
|
|
84
|
+
if @reflection.is_a? ActiveRecord::Reflection::ThroughReflection
|
85
|
+
args[:via_relation] = params[:resource_name]
|
86
|
+
end
|
87
|
+
|
88
|
+
if @reflection.is_a? ActiveRecord::Reflection::HasManyReflection
|
89
|
+
args[:via_relation] = @reflection.name
|
90
|
+
end
|
91
|
+
|
92
|
+
if @reflection.parent_reflection.present? && @reflection.parent_reflection.inverse_of.present?
|
93
|
+
args[:via_relation] = @reflection.parent_reflection.inverse_of.name
|
94
|
+
end
|
95
|
+
|
84
96
|
if @reflection.inverse_of.present?
|
85
97
|
args[:via_relation] = @reflection.inverse_of.name
|
86
98
|
end
|
@@ -103,9 +115,7 @@ class Avo::Views::ResourceIndexComponent < Avo::ResourceComponent
|
|
103
115
|
|
104
116
|
private
|
105
117
|
|
106
|
-
def
|
107
|
-
|
108
|
-
|
109
|
-
true
|
118
|
+
def reflection_model_class
|
119
|
+
@reflection.active_record.to_s
|
110
120
|
end
|
111
121
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<div>
|
2
2
|
<% @resource.panels.each do |resource_panel| %>
|
3
|
-
<%= form_with model: @resource.model, url: helpers.resources_path(resource: @resource, via_relation_class: params[:via_relation_class], via_resource_id: params[:via_resource_id]), local: true, multipart: true do |form| %>
|
3
|
+
<%= form_with model: @resource.model, url: helpers.resources_path(resource: @resource, via_relation_class: params[:via_relation_class], via_relation: params[:via_relation], via_resource_id: params[:via_resource_id]), local: true, multipart: true do |form| %>
|
4
4
|
<%= render Avo::PanelComponent.new(title: resource_panel[:name], display_breadcrumbs: true) do |c| %>
|
5
5
|
<% c.tools do %>
|
6
6
|
<div class="flex justify-end space-x-2">
|
@@ -7,7 +7,6 @@ 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]
|
11
10
|
before_action :authorize_action
|
12
11
|
before_action :reset_pagination_if_filters_changed, only: :index
|
13
12
|
before_action :cache_applied_filters, only: :index
|
@@ -25,8 +24,8 @@ module Avo
|
|
25
24
|
@query = @resource.class.query_scope
|
26
25
|
end
|
27
26
|
|
28
|
-
# Remove default_scope for index view
|
29
|
-
if @resource.unscoped_queries_on_index
|
27
|
+
# Remove default_scope for index view if no parent_resource present
|
28
|
+
if @resource.unscoped_queries_on_index && @parent_resource.blank?
|
30
29
|
@query = @query.unscoped
|
31
30
|
end
|
32
31
|
|
@@ -112,17 +111,47 @@ module Avo
|
|
112
111
|
end
|
113
112
|
|
114
113
|
def create
|
115
|
-
# model gets instantiated and filled in the fill_model
|
114
|
+
# 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
|
|
119
|
+
# This means that the record has been created through another parent record and we need to attach it somehow.
|
120
|
+
if params[:via_resource_id].present?
|
121
|
+
@reflection = @model._reflections[params[:via_relation]]
|
122
|
+
# Figure out what kind of association does the record have with the parent record
|
123
|
+
|
124
|
+
# belongs_to
|
125
|
+
# has_many
|
126
|
+
# Get the foreign key and set it to the id we received in the params
|
127
|
+
if @reflection.is_a?(ActiveRecord::Reflection::BelongsToReflection) || @reflection.is_a?(ActiveRecord::Reflection::HasManyReflection)
|
128
|
+
foreign_key = @reflection.foreign_key
|
129
|
+
@model.send("#{foreign_key}=", params[:via_resource_id])
|
130
|
+
@model.save
|
131
|
+
end
|
132
|
+
|
133
|
+
# has_one
|
134
|
+
# has_one_through
|
135
|
+
|
136
|
+
# has_many_through
|
137
|
+
# has_and_belongs_to_many
|
138
|
+
# polymorphic
|
139
|
+
if @reflection.is_a? ActiveRecord::Reflection::ThroughReflection
|
140
|
+
# find the record
|
141
|
+
via_resource = ::Avo::App.get_resource_by_model_name params[:via_relation_class]
|
142
|
+
@related_record = via_resource.model_class.find params[:via_resource_id]
|
143
|
+
|
144
|
+
@model.send(params[:via_relation]) << @related_record
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
119
148
|
respond_to do |format|
|
120
149
|
if saved
|
121
|
-
redirect_path =
|
150
|
+
redirect_path = resource_path(model: @model, resource: @resource)
|
151
|
+
|
152
|
+
if params[:via_relation_class].present? && params[:via_resource_id].present?
|
122
153
|
parent_resource = ::Avo::App.get_resource_by_model_name params[:via_relation_class].safe_constantize
|
123
|
-
resource_path(model: params[:via_relation_class].safe_constantize, resource: parent_resource, resource_id: params[:via_resource_id])
|
124
|
-
else
|
125
|
-
resource_path(model: @model, resource: @resource)
|
154
|
+
redirect_path = resource_path(model: params[:via_relation_class].safe_constantize, resource: parent_resource, resource_id: params[:via_resource_id])
|
126
155
|
end
|
127
156
|
|
128
157
|
format.html { redirect_to redirect_path, notice: "#{@model.class.name} #{t("avo.was_successfully_created")}." }
|
@@ -136,7 +165,8 @@ module Avo
|
|
136
165
|
end
|
137
166
|
|
138
167
|
def update
|
139
|
-
# model gets instantiated and filled in the fill_model
|
168
|
+
# model gets instantiated and filled in the fill_model method
|
169
|
+
fill_model
|
140
170
|
saved = @model.save
|
141
171
|
@resource = @resource.hydrate(model: @model, view: :edit, user: _current_user)
|
142
172
|
|
@@ -1,18 +1,7 @@
|
|
1
1
|
module Avo
|
2
2
|
module ApplicationHelper
|
3
|
-
include ::Manifester::Helper
|
4
3
|
include ::Pagy::Frontend
|
5
4
|
|
6
|
-
def current_webpacker_instance
|
7
|
-
return Avo.webpacker if Avo::IN_DEVELOPMENT
|
8
|
-
|
9
|
-
super
|
10
|
-
end
|
11
|
-
|
12
|
-
def current_manifester_instance
|
13
|
-
Avo.manifester
|
14
|
-
end
|
15
|
-
|
16
5
|
def render_license_warnings
|
17
6
|
render partial: "avo/sidebar/license_warnings", locals: {
|
18
7
|
license: Avo::App.license.properties
|
@@ -40,8 +29,7 @@ module Avo
|
|
40
29
|
def a_button(label = nil, **args, &block)
|
41
30
|
args[:class] = button_classes(args[:class], color: args[:color], variant: args[:variant], size: args[:size])
|
42
31
|
if args[:spinner]
|
43
|
-
args["data-controller"] = "loading-button"
|
44
|
-
# args["data-action"] = "click->loading-button#onClick"
|
32
|
+
args[:"data-controller"] = "loading-button"
|
45
33
|
end
|
46
34
|
|
47
35
|
locals = {
|
@@ -116,7 +104,7 @@ module Avo
|
|
116
104
|
options[:class] += args[:extra_class].present? ? " #{args[:extra_class]}" : ""
|
117
105
|
|
118
106
|
# Create the path to the svgs directory
|
119
|
-
file_path = "#{Avo::Engine.root}/app/
|
107
|
+
file_path = "#{Avo::Engine.root}/app/assets/svgs/#{file_name}"
|
120
108
|
file_path = "#{file_path}.svg" unless file_path.end_with? ".svg"
|
121
109
|
|
122
110
|
# Create a cache hash
|
@@ -146,12 +134,12 @@ module Avo
|
|
146
134
|
end
|
147
135
|
|
148
136
|
def input_classes(extra_classes = "", has_error: false)
|
149
|
-
classes = "appearance-none inline-flex bg-
|
137
|
+
classes = "appearance-none inline-flex bg-slate-100 disabled:bg-slate-300 disabled:cursor-not-allowed focus:bg-white text-slate-700 disabled:text-slate-700 rounded-md py-2 px-3 leading-tight border outline-none outline"
|
150
138
|
|
151
139
|
classes += if has_error
|
152
140
|
" border-red-600"
|
153
141
|
else
|
154
|
-
" border-
|
142
|
+
" border-slate-300"
|
155
143
|
end
|
156
144
|
|
157
145
|
classes += " #{extra_classes}"
|
@@ -4,15 +4,14 @@ import 'core-js/stable'
|
|
4
4
|
import 'regenerator-runtime/runtime'
|
5
5
|
import * as ActiveStorage from '@rails/activestorage'
|
6
6
|
import * as Mousetrap from 'mousetrap'
|
7
|
-
import { Application } from 'stimulus'
|
8
7
|
import { Turbo } from '@hotwired/turbo-rails'
|
9
|
-
import { definitionsFromContext } from 'stimulus/webpack-helpers'
|
10
8
|
import Rails from '@rails/ujs'
|
11
9
|
import tippy from 'tippy.js'
|
12
10
|
|
13
11
|
// Toastr alerts
|
14
|
-
import '
|
15
|
-
import '
|
12
|
+
import './js/active-storage'
|
13
|
+
import './js/controllers'
|
14
|
+
import './js/toastr'
|
16
15
|
|
17
16
|
Rails.start()
|
18
17
|
|
@@ -20,6 +19,17 @@ window.Turbolinks = Turbo
|
|
20
19
|
|
21
20
|
Mousetrap.bind('r r r', () => Turbo.visit(window.location.href, { action: 'replace' }))
|
22
21
|
|
22
|
+
function isMac() {
|
23
|
+
const isMac = window.navigator.userAgent.indexOf('Mac OS X')
|
24
|
+
|
25
|
+
if (isMac) {
|
26
|
+
document.body.classList.add('os-mac')
|
27
|
+
document.body.classList.remove('os-pc')
|
28
|
+
} else {
|
29
|
+
document.body.classList.add('os-pc')
|
30
|
+
document.body.classList.remove('os-mac')
|
31
|
+
}
|
32
|
+
}
|
23
33
|
function initTippy() {
|
24
34
|
tippy('[data-tippy="tooltip"]', {
|
25
35
|
theme: 'light',
|
@@ -33,18 +43,12 @@ function initTippy() {
|
|
33
43
|
}
|
34
44
|
window.initTippy = initTippy
|
35
45
|
|
36
|
-
const application = Application.start()
|
37
46
|
ActiveStorage.start()
|
38
47
|
|
39
|
-
const context = require.context('./../js/controllers', true, /\.js$/)
|
40
|
-
application.load(definitionsFromContext(context))
|
41
|
-
|
42
|
-
const fieldsContext = require.context('./../js/controllers/fields', true, /\.js$/)
|
43
|
-
application.load(definitionsFromContext(fieldsContext))
|
44
|
-
|
45
48
|
document.addEventListener('turbo:load', () => {
|
46
49
|
document.body.classList.remove('turbo-loading')
|
47
50
|
initTippy()
|
51
|
+
isMac()
|
48
52
|
})
|
49
53
|
|
50
54
|
document.addEventListener('turbo:before-fetch-response', (e) => {
|
@@ -58,10 +62,3 @@ document.addEventListener('turbo:submit-start', () => document.body.classList.ad
|
|
58
62
|
document.addEventListener('turbo:before-cache', () => {
|
59
63
|
document.querySelectorAll('[data-turbo-remove-before-cache]').forEach((element) => element.remove())
|
60
64
|
})
|
61
|
-
|
62
|
-
// Uncomment to copy all static images under ../images to the output folder and reference
|
63
|
-
// them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>)
|
64
|
-
// or the `imagePath` JavaScript helper below.
|
65
|
-
//
|
66
|
-
const images = require.context('../images', true)
|
67
|
-
const imagePath = (name) => images(name, true)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|