avo 0.4.10 → 0.5.0.beta5
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 +37 -9
- data/Gemfile.lock +108 -85
- data/README.md +8 -0
- data/app/components/avo/common/badge_viewer_component.html.erb +24 -0
- data/app/components/avo/common/badge_viewer_component.rb +8 -0
- data/app/components/avo/common/boolean_check_component.html.erb +12 -0
- data/app/components/avo/common/boolean_check_component.rb +7 -0
- data/app/components/avo/common/boolean_group_component.html.erb +16 -0
- data/app/components/avo/common/boolean_group_component.rb +8 -0
- data/app/components/avo/common/files_list_viewer_component.html.erb +5 -0
- data/app/components/avo/common/files_list_viewer_component.rb +8 -0
- data/app/components/avo/common/gravatar_viewer_component.html.erb +12 -0
- data/app/components/avo/common/gravatar_viewer_component.rb +12 -0
- data/app/components/avo/common/heading_component.html.erb +13 -0
- data/app/components/avo/common/heading_component.rb +8 -0
- data/app/components/avo/common/multiple_file_viewer_component.html.erb +26 -0
- data/app/components/avo/common/multiple_file_viewer_component.rb +13 -0
- data/app/components/avo/common/single_file_viewer_component.html.erb +28 -0
- data/app/components/avo/common/single_file_viewer_component.rb +13 -0
- data/app/components/avo/common/status_viewer_component.html.erb +10 -0
- data/app/components/avo/common/status_viewer_component.rb +8 -0
- data/app/components/avo/edit/field_wrapper_component.html.erb +20 -0
- data/app/components/avo/edit/field_wrapper_component.rb +19 -0
- data/app/components/avo/edit/fields/belongs_to_field_component.html.erb +19 -0
- data/app/components/avo/edit/fields/belongs_to_field_component.rb +4 -0
- data/app/components/avo/edit/fields/boolean_field_component.html.erb +9 -0
- data/app/components/avo/edit/fields/boolean_field_component.rb +4 -0
- data/app/components/avo/edit/fields/boolean_group_field_component.html.erb +25 -0
- data/app/components/avo/edit/fields/boolean_group_field_component.rb +4 -0
- data/app/components/avo/edit/fields/code_field_component.html.erb +19 -0
- data/app/components/avo/edit/fields/code_field_component.rb +4 -0
- data/app/components/avo/edit/fields/country_field_component.html.erb +7 -0
- data/app/components/avo/edit/fields/country_field_component.rb +4 -0
- data/app/components/avo/edit/fields/date_field_component.html.erb +18 -0
- data/app/components/avo/edit/fields/date_field_component.rb +4 -0
- data/app/components/avo/edit/fields/date_time_field_component.html.erb +20 -0
- data/app/components/avo/edit/fields/date_time_field_component.rb +4 -0
- data/app/components/avo/edit/fields/external_image_field_component.html.erb +6 -0
- data/app/components/avo/edit/fields/external_image_field_component.rb +4 -0
- data/app/components/avo/edit/fields/field_component.rb +13 -0
- data/app/components/avo/edit/fields/file_field_component.html.erb +9 -0
- data/app/components/avo/edit/fields/file_field_component.rb +4 -0
- data/app/components/avo/edit/fields/files_field_component.html.erb +5 -0
- data/app/components/avo/edit/fields/files_field_component.rb +4 -0
- data/app/components/avo/edit/fields/heading_field_component.html.erb +3 -0
- data/app/components/avo/edit/fields/heading_field_component.rb +4 -0
- data/app/components/avo/edit/fields/hidden_field_component.html.erb +1 -0
- data/app/components/avo/edit/fields/hidden_field_component.rb +4 -0
- data/app/components/avo/edit/fields/id_field_component.html.erb +3 -0
- data/app/components/avo/edit/fields/id_field_component.rb +4 -0
- data/app/components/avo/edit/fields/markdown_field_component.html.erb +11 -0
- data/app/components/avo/edit/fields/markdown_field_component.rb +4 -0
- data/app/components/avo/edit/fields/number_field_component.html.erb +9 -0
- data/app/components/avo/edit/fields/number_field_component.rb +4 -0
- data/app/components/avo/edit/fields/password_field_component.html.erb +7 -0
- data/app/components/avo/edit/fields/password_field_component.rb +4 -0
- data/app/components/avo/edit/fields/select_field_component.html.erb +6 -0
- data/app/components/avo/edit/fields/select_field_component.rb +4 -0
- data/app/components/avo/edit/fields/status_field_component.html.erb +7 -0
- data/app/components/avo/edit/fields/status_field_component.rb +4 -0
- data/app/components/avo/edit/fields/text_field_component.html.erb +6 -0
- data/app/components/avo/edit/fields/text_field_component.rb +4 -0
- data/app/components/avo/edit/fields/textarea_field_component.html.erb +7 -0
- data/app/components/avo/edit/fields/textarea_field_component.rb +4 -0
- data/app/components/avo/edit/fields/trix_field_component.html.erb +11 -0
- data/app/components/avo/edit/fields/trix_field_component.rb +4 -0
- data/app/components/avo/index/field_wrapper_component.html.erb +7 -0
- data/app/components/avo/index/field_wrapper_component.rb +10 -0
- data/app/components/avo/index/fields/badge_field_component.html.erb +3 -0
- data/app/components/avo/index/fields/badge_field_component.rb +4 -0
- data/app/components/avo/index/fields/belongs_to_field_component.html.erb +7 -0
- data/app/components/avo/index/fields/belongs_to_field_component.rb +4 -0
- data/app/components/avo/index/fields/boolean_field_component.html.erb +3 -0
- data/app/components/avo/index/fields/boolean_field_component.rb +4 -0
- data/app/components/avo/index/fields/boolean_group_field_component.html.erb +3 -0
- data/app/components/avo/index/fields/boolean_group_field_component.rb +4 -0
- data/app/components/avo/index/fields/country_field_component.html.erb +7 -0
- data/app/components/avo/index/fields/country_field_component.rb +4 -0
- data/app/components/avo/index/fields/date_field_component.html.erb +3 -0
- data/app/components/avo/index/fields/date_field_component.rb +4 -0
- data/app/components/avo/index/fields/date_time_field_component.html.erb +3 -0
- data/app/components/avo/index/fields/date_time_field_component.rb +4 -0
- data/app/components/avo/index/fields/external_image_field_component.html.erb +9 -0
- data/app/components/avo/index/fields/external_image_field_component.rb +4 -0
- data/app/components/avo/index/fields/field_component.html.erb +1 -0
- data/app/components/avo/index/fields/field_component.rb +11 -0
- data/app/components/avo/index/fields/file_field_component.html.erb +11 -0
- data/app/components/avo/index/fields/file_field_component.rb +4 -0
- data/app/components/avo/index/fields/files_field_component.html.erb +3 -0
- data/app/components/avo/index/fields/files_field_component.rb +4 -0
- data/app/components/avo/index/fields/gravatar_field_component.html.erb +11 -0
- data/app/components/avo/index/fields/gravatar_field_component.rb +4 -0
- data/app/components/avo/index/fields/has_one_field_component.html.erb +7 -0
- data/app/components/avo/index/fields/has_one_field_component.rb +4 -0
- data/app/components/avo/index/fields/id_field_component.html.erb +10 -0
- data/app/components/avo/index/fields/id_field_component.rb +4 -0
- data/app/components/avo/index/fields/number_field_component.html.erb +3 -0
- data/app/components/avo/index/fields/number_field_component.rb +4 -0
- data/app/components/avo/index/fields/select_field_component.html.erb +3 -0
- data/app/components/avo/index/fields/select_field_component.rb +4 -0
- data/app/components/avo/index/fields/status_field_component.html.erb +3 -0
- data/app/components/avo/index/fields/status_field_component.rb +4 -0
- data/app/components/avo/index/fields/text_field_component.html.erb +3 -0
- data/app/components/avo/index/fields/text_field_component.rb +4 -0
- data/app/components/avo/index/grid_item_component.html.erb +41 -0
- data/app/components/avo/index/grid_item_component.rb +25 -0
- data/app/components/avo/index/resource_controls_component.html.erb +56 -0
- data/app/components/avo/index/resource_controls_component.rb +39 -0
- data/app/components/avo/index/resource_grid_component.html.erb +13 -0
- data/app/components/avo/index/resource_grid_component.rb +10 -0
- data/app/components/avo/index/resource_table_component.html.erb +16 -0
- data/app/components/avo/index/resource_table_component.rb +10 -0
- data/app/components/avo/index/table_row_component.html.erb +18 -0
- data/app/components/avo/index/table_row_component.rb +11 -0
- data/app/components/avo/loading_component.html.erb +10 -0
- data/app/components/avo/loading_component.rb +7 -0
- data/app/components/avo/modal_component.html.erb +20 -0
- data/app/components/avo/modal_component.rb +5 -0
- data/app/components/avo/navigation_heading_component.html.erb +3 -0
- data/app/components/avo/navigation_heading_component.rb +7 -0
- data/app/components/avo/navigation_link_component.html.erb +3 -0
- data/app/components/avo/navigation_link_component.rb +10 -0
- data/app/components/avo/panel_component.html.erb +27 -0
- data/app/components/avo/panel_component.rb +20 -0
- data/app/components/avo/resource_component.rb +14 -0
- data/app/components/avo/show/field_wrapper_component.html.erb +16 -0
- data/app/components/avo/show/field_wrapper_component.rb +15 -0
- data/app/components/avo/show/fields/badge_field_component.html.erb +3 -0
- data/app/components/avo/show/fields/badge_field_component.rb +4 -0
- data/app/components/avo/show/fields/belongs_to_field_component.html.erb +3 -0
- data/app/components/avo/show/fields/belongs_to_field_component.rb +4 -0
- data/app/components/avo/show/fields/boolean_field_component.html.erb +3 -0
- data/app/components/avo/show/fields/boolean_field_component.rb +4 -0
- data/app/components/avo/show/fields/boolean_group_field_component.html.erb +3 -0
- data/app/components/avo/show/fields/boolean_group_field_component.rb +4 -0
- data/app/components/avo/show/fields/code_field_component.html.erb +19 -0
- data/app/components/avo/show/fields/code_field_component.rb +4 -0
- data/app/components/avo/show/fields/country_field_component.html.erb +7 -0
- data/app/components/avo/show/fields/country_field_component.rb +4 -0
- data/app/components/avo/show/fields/date_field_component.html.erb +3 -0
- data/app/components/avo/show/fields/date_field_component.rb +4 -0
- data/app/components/avo/show/fields/date_time_field_component.html.erb +3 -0
- data/app/components/avo/show/fields/date_time_field_component.rb +4 -0
- data/app/components/avo/show/fields/external_image_field_component.html.erb +5 -0
- data/app/components/avo/show/fields/external_image_field_component.rb +4 -0
- data/app/components/avo/show/fields/field_component.rb +11 -0
- data/app/components/avo/show/fields/file_field_component.html.erb +3 -0
- data/app/components/avo/show/fields/file_field_component.rb +4 -0
- data/app/components/avo/show/fields/files_field_component.html.erb +3 -0
- data/app/components/avo/show/fields/files_field_component.rb +4 -0
- data/app/components/avo/show/fields/gravatar_field_component.html.erb +7 -0
- data/app/components/avo/show/fields/gravatar_field_component.rb +4 -0
- data/app/components/avo/show/fields/has_many_field_component.html.erb +3 -0
- data/app/components/avo/show/fields/has_many_field_component.rb +4 -0
- data/app/components/avo/show/fields/has_one_field_component.html.erb +19 -0
- data/app/components/avo/show/fields/has_one_field_component.rb +5 -0
- data/app/components/avo/show/fields/heading_field_component.html.erb +3 -0
- data/app/components/avo/show/fields/heading_field_component.rb +4 -0
- data/app/components/avo/show/fields/id_field_component.html.erb +3 -0
- data/app/components/avo/show/fields/id_field_component.rb +4 -0
- data/app/components/avo/show/fields/markdown_field_component.html.erb +10 -0
- data/app/components/avo/show/fields/markdown_field_component.rb +4 -0
- data/app/components/avo/show/fields/number_field_component.html.erb +3 -0
- data/app/components/avo/show/fields/number_field_component.rb +4 -0
- data/app/components/avo/show/fields/select_field_component.html.erb +3 -0
- data/app/components/avo/show/fields/select_field_component.rb +4 -0
- data/app/components/avo/show/fields/status_field_component.html.erb +3 -0
- data/app/components/avo/show/fields/status_field_component.rb +4 -0
- data/app/components/avo/show/fields/text_field_component.html.erb +3 -0
- data/app/components/avo/show/fields/text_field_component.rb +4 -0
- data/app/components/avo/show/fields/textarea_field_component.html.erb +3 -0
- data/app/components/avo/show/fields/textarea_field_component.rb +4 -0
- data/app/components/avo/show/fields/trix_field_component.html.erb +14 -0
- data/app/components/avo/show/fields/trix_field_component.rb +4 -0
- data/app/components/avo/views/resource_edit_component.html.erb +29 -0
- data/app/components/avo/views/resource_edit_component.rb +23 -0
- data/app/components/avo/views/resource_index_component.html.erb +62 -0
- data/app/components/avo/views/resource_index_component.rb +93 -0
- data/app/components/avo/views/resource_new_component.html.erb +25 -0
- data/app/components/avo/views/resource_new_component.rb +27 -0
- data/app/components/avo/views/resource_show_component.html.erb +64 -0
- data/app/components/avo/views/resource_show_component.rb +66 -0
- data/app/controllers/avo/actions_controller.rb +51 -22
- data/app/controllers/avo/application_controller.rb +189 -27
- data/app/controllers/avo/attachments_controller.rb +25 -0
- data/app/controllers/avo/base_controller.rb +226 -0
- data/app/controllers/avo/home_controller.rb +3 -0
- data/app/controllers/avo/relations_controller.rb +88 -19
- data/app/controllers/avo/resources_controller.rb +2 -259
- data/app/controllers/avo/search_controller.rb +8 -7
- data/app/frontend/css/alerts.css +35 -0
- data/app/frontend/css/application.css +73 -0
- data/app/frontend/css/components/code.css +27 -0
- data/app/frontend/css/components/status.css +30 -0
- data/app/frontend/css/fonts.css +26 -0
- data/app/frontend/css/loader.css +134 -0
- data/app/frontend/css/pagination.css +67 -0
- data/app/frontend/css/tailwindcss/base.css +1 -0
- data/app/frontend/css/tailwindcss/components.css +1 -0
- data/app/frontend/css/tailwindcss/utilities.css +1 -0
- data/app/frontend/css/tooltips.css +105 -0
- data/app/frontend/css/typography.css +23 -0
- data/app/frontend/fonts/nunito-v16-latin-700.eot +0 -0
- data/app/frontend/fonts/nunito-v16-latin-700.svg +388 -0
- data/app/frontend/fonts/nunito-v16-latin-700.ttf +0 -0
- data/app/frontend/fonts/nunito-v16-latin-700.woff +0 -0
- data/app/frontend/fonts/nunito-v16-latin-700.woff2 +0 -0
- data/app/frontend/fonts/nunito-v16-latin-regular.eot +0 -0
- data/app/frontend/fonts/nunito-v16-latin-regular.svg +380 -0
- data/app/frontend/fonts/nunito-v16-latin-regular.ttf +0 -0
- data/app/frontend/fonts/nunito-v16-latin-regular.woff +0 -0
- data/app/frontend/fonts/nunito-v16-latin-regular.woff2 +0 -0
- data/app/frontend/images/logo.png +0 -0
- data/app/frontend/importmap.json.erb +5 -0
- data/app/frontend/js/controllers/action_controller.js +32 -0
- data/app/frontend/js/controllers/actions_picker_controller.js +44 -0
- data/app/frontend/js/controllers/alerts_controller.js +26 -0
- data/app/frontend/js/controllers/attachments_controller.js +9 -0
- data/app/frontend/js/controllers/boolean_filter_controller.js +21 -0
- data/app/frontend/js/controllers/fields/code_field_controller.js +35 -0
- data/app/frontend/js/controllers/fields/date_field_controller.js +53 -0
- data/app/frontend/js/controllers/fields/simple_mde_controller.js +26 -0
- data/app/frontend/js/controllers/filter_controller.js +52 -0
- data/app/frontend/js/controllers/hidden_input_controller.js +10 -0
- data/app/frontend/js/controllers/item_selector_controller.js +68 -0
- data/app/frontend/js/controllers/modal_controller.js +11 -0
- data/app/frontend/js/controllers/per_page_controller.js +9 -0
- data/app/frontend/js/controllers/select_filter_controller.js +15 -0
- data/app/frontend/js/controllers/tippy_controller.js +14 -0
- data/app/frontend/js/controllers/toggle_panel_controller.js +18 -0
- data/app/frontend/js/helpers/cast_boolean.js +2 -0
- data/app/frontend/js/toastr.js +9 -0
- data/app/frontend/packs/application.js +45 -0
- data/{public/avo-packs/media/svgs/arrow-circle-right-1ad1e15ec9a7aa54b67d126566a5aa2d.svg → app/frontend/svgs/arrow-circle-right.svg} +0 -0
- data/{public/avo-packs/media/svgs/arrow-left-0e8e808ff771a62a348d0232c8ccf539.svg → app/frontend/svgs/arrow-left.svg} +0 -0
- data/{public/avo-packs/media/svgs/avocado-bca389be7cf81162df902dfbd09b8adb.svg → app/frontend/svgs/avocado.svg} +0 -0
- data/app/frontend/svgs/badge-check-sm.svg +3 -0
- data/{public/avo-packs/media/svgs/check-circle-be9e4dcbd25467ae9a3d3c6c5c7a09fa.svg → app/frontend/svgs/check-circle.svg} +0 -0
- data/{public/avo-packs/media/svgs/chevron-down-01208b17a1f70a1bb8d82bba131da4f4.svg → app/frontend/svgs/chevron-down.svg} +0 -0
- data/{public/avo-packs/media/svgs/chevron-up-25ecf340dd76966d5ed63c85c025befc.svg → app/frontend/svgs/chevron-up.svg} +0 -0
- data/{public/avo-packs/media/svgs/code-69010c6ddb6ad50be8677f16468c51f8.svg → app/frontend/svgs/code.svg} +0 -0
- data/{public/avo-packs/media/svgs/color-swatch-60cf90fb6b5386e38f3b003f34e7ecbe.svg → app/frontend/svgs/color-swatch.svg} +0 -0
- data/app/frontend/svgs/document-text.svg +3 -0
- data/{public/avo-packs/media/svgs/download-c6ae3f12364a467c28cbf41dc90afbdd.svg → app/frontend/svgs/download.svg} +0 -0
- data/{public/avo-packs/media/svgs/edit-46c6dbef52ba6ddfc9afbc37186dfa2b.svg → app/frontend/svgs/edit.svg} +0 -0
- data/app/frontend/svgs/exclamation-circle-sm.svg +3 -0
- data/app/frontend/svgs/exclamation-sm.svg +3 -0
- data/{public/avo-packs/media/svgs/exclamation-8d1c0baa390a8df9bb52176011eb5892.svg → app/frontend/svgs/exclamation.svg} +0 -0
- data/{public/avo-packs/media/svgs/eye-cc6f85c70ebed6929712a5c7d51f102d.svg → app/frontend/svgs/eye.svg} +0 -0
- data/{public/avo-packs/media/svgs/filter-0007cddbc85cfe207f9876d4d184444a.svg → app/frontend/svgs/filter.svg} +0 -0
- data/{public/avo-packs/media/svgs/fire-782f08df79993311b6d907e12d9ebe9f.svg → app/frontend/svgs/fire.svg} +0 -0
- data/{public/avo-packs/media/svgs/game-board-6c59fe04181ac9954356c9f1f4d28053.svg → app/frontend/svgs/game-board.svg} +0 -0
- data/{public/avo-packs/media/svgs/globe-dfd9977c9d65814d2fc576904406dd08.svg → app/frontend/svgs/globe.svg} +0 -0
- data/app/frontend/svgs/information-circle-sm.svg +3 -0
- data/app/frontend/svgs/information-circle.svg +1 -0
- data/{public/avo-packs/media/svgs/library-7d391192a15da64fbb527908c9e035c7.svg → app/frontend/svgs/library.svg} +0 -0
- data/{public/avo-packs/media/svgs/photograph-9f37f1f5e6a48e68ce3b7d9cbe7b6fad.svg → app/frontend/svgs/photograph.svg} +0 -0
- data/app/frontend/svgs/play.svg +1 -0
- data/{public/avo-packs/media/svgs/plus-circle-b379b2a2aa803511ae5945b6fd323204.svg → app/frontend/svgs/plus-circle.svg} +0 -0
- data/{public/avo-packs/media/svgs/plus-530f0af27b9f1a4552454233c2f9a641.svg → app/frontend/svgs/plus.svg} +0 -0
- data/{public/avo-packs/media/svgs/question-mark-circle-3ece1d61091827910cdd097db711062b.svg → app/frontend/svgs/question-mark-circle.svg} +0 -0
- data/{public/avo-packs/media/svgs/save-e54acd7ac9646053e36382776f822756.svg → app/frontend/svgs/save.svg} +0 -0
- data/{public/avo-packs/media/svgs/selector-b43b3957d7cc121d06be14312613c218.svg → app/frontend/svgs/selector.svg} +0 -0
- data/{public/avo-packs/media/svgs/sort-ascending-f5bc0761702809cab20b0ea3065cb88a.svg → app/frontend/svgs/sort-ascending.svg} +0 -0
- data/{public/avo-packs/media/svgs/sort-descending-1c8ddc56c72be6781e59d808f9d06203.svg → app/frontend/svgs/sort-descending.svg} +0 -0
- data/{public/avo-packs/media/svgs/switch-horizontal-d23337f0fb533a86d14b746d25ad48ae.svg → app/frontend/svgs/switch-horizontal.svg} +0 -0
- data/{public/avo-packs/media/svgs/thumbs-down-44f83eacbf5b8fe0f2f085da75866ce0.svg → app/frontend/svgs/thumbs-down.svg} +0 -0
- data/{public/avo-packs/media/svgs/thumbs-up-b866900017db179b50d6b19a1424ed25.svg → app/frontend/svgs/thumbs-up.svg} +0 -0
- data/app/frontend/svgs/times.svg +3 -0
- data/app/frontend/svgs/trash-sm.svg +3 -0
- data/{public/avo-packs/media/svgs/trash-a61412a066e358bcc24494a5080b7255.svg → app/frontend/svgs/trash.svg} +0 -0
- data/{public/avo-packs/media/svgs/view-grid-add-d0ee477a044e5d46c0c62af66cb6de77.svg → app/frontend/svgs/view-grid-add.svg} +0 -0
- data/{public/avo-packs/media/svgs/view-grid-393669034db69f59497616d5416ae411.svg → app/frontend/svgs/view-grid.svg} +0 -0
- data/{public/avo-packs/media/svgs/view-list-8a7a159ca5d892f72cf8c6744a2074e2.svg → app/frontend/svgs/view-list.svg} +0 -0
- data/{public/avo-packs/media/svgs/x-circle-c540f9ccfe937ad9b4f662e0b65e47e2.svg → app/frontend/svgs/x-circle.svg} +0 -0
- data/app/helpers/avo/actions_helper.rb +4 -0
- data/app/helpers/avo/application_helper.rb +156 -3
- data/app/helpers/avo/attachments_helper.rb +4 -0
- data/app/helpers/avo/resources_helper.rb +101 -0
- data/app/views/avo/actions/show.html.erb +71 -0
- data/app/views/avo/attachments/show.html.erb +7 -0
- data/app/views/avo/base/_actions.html.erb +30 -0
- data/app/views/avo/base/_boolean_filter.html.erb +33 -0
- data/app/views/avo/base/_filters.html.erb +29 -0
- data/app/views/avo/base/_select_filter.html.erb +20 -0
- data/app/views/avo/base/edit.html.erb +1 -0
- data/app/views/avo/base/index.html.erb +15 -0
- data/app/views/avo/base/new.html.erb +1 -0
- data/app/views/avo/base/show.html.erb +3 -0
- data/app/views/avo/home/_actions.html.erb +16 -0
- data/app/views/avo/home/_docs.html.erb +9 -0
- data/app/views/avo/home/_filters.html.erb +16 -0
- data/app/views/avo/home/_resources.html.erb +28 -0
- data/app/views/avo/home/index.html.erb +54 -3
- data/app/views/avo/partials/_a_button.html.erb +7 -0
- data/app/views/avo/partials/_a_link.html.erb +7 -0
- data/app/views/avo/partials/_alert.html.erb +1 -0
- data/app/views/avo/partials/_alerts.html.erb +3 -0
- data/app/views/avo/partials/_empty_state.html.erb +17 -0
- data/app/views/{partials → avo/partials}/_footer.html.erb +0 -0
- data/app/views/{partials → avo/partials}/_header.html.erb +0 -0
- data/app/views/avo/partials/_javascript.html.erb +3 -0
- data/app/views/{partials → avo/partials}/_logo.html.erb +0 -0
- data/app/views/avo/partials/_paginator.html.erb +30 -0
- data/app/views/avo/partials/_sortable_component.html.erb +14 -0
- data/app/views/avo/partials/_table_header.html.erb +50 -0
- data/app/views/avo/partials/_view_toggle_button.html.erb +17 -0
- data/app/views/avo/relations/new.html.erb +29 -0
- data/app/views/avo/sidebar/_license_warning.html.erb +12 -0
- data/app/views/avo/sidebar/_license_warnings.html.erb +6 -0
- data/app/views/avo/sidebar/_sidebar.html.erb +23 -0
- data/app/views/kaminari/_first_page.html.erb +3 -0
- data/app/views/kaminari/_last_page.html.erb +3 -0
- data/app/views/kaminari/_next_page.html.erb +9 -0
- data/app/views/kaminari/_page.html.erb +12 -0
- data/app/views/kaminari/_prev_page.html.erb +9 -0
- data/app/views/layouts/avo/_filter_wrapper.html.erb +8 -0
- data/app/views/layouts/avo/application.html.erb +33 -40
- data/app/views/layouts/avo/application_vue.html.erb +61 -0
- data/avo.gemspec +5 -3
- data/bin/helpers.rb +34 -0
- data/bin/init +35 -0
- data/bin/rspec +8 -0
- data/bin/spring +17 -0
- data/bin/test +21 -0
- data/bin/webpack +9 -10
- data/bin/webpack-dev-server +9 -10
- data/config/cable.yml +11 -0
- data/config/initializers/inline_svg.rb +33 -0
- data/config/initializers/pagy.rb +1 -0
- data/config/routes.rb +22 -18
- data/config/spring.rb +7 -0
- data/config/webpack/environment.js +14 -10
- data/config/webpacker.yml +14 -26
- data/db/factories.rb +10 -3
- data/db/migrate/20210305082639_add_url_to_teams.rb +5 -0
- data/lib/avo.rb +5 -13
- data/lib/avo/app.rb +190 -0
- data/lib/avo/base_action.rb +115 -0
- data/lib/avo/base_resource.rb +321 -0
- data/lib/avo/configuration.rb +14 -0
- data/lib/avo/engine.rb +15 -31
- data/lib/avo/fields/badge_field.rb +18 -0
- data/lib/avo/fields/base_field.rb +184 -0
- data/lib/avo/fields/belongs_to_field.rb +65 -0
- data/lib/avo/{app/fields → fields}/boolean_field.rb +9 -11
- data/lib/avo/fields/boolean_group_field.rb +40 -0
- data/lib/avo/fields/code_field.rb +29 -0
- data/lib/avo/fields/country_field.rb +32 -0
- data/lib/avo/{app/fields → fields}/currency_field.rb +2 -3
- data/lib/avo/{app/fields → fields}/date_field.rb +16 -13
- data/lib/avo/fields/date_time_field.rb +36 -0
- data/lib/avo/fields/external_image_field.rb +24 -0
- data/lib/avo/{app/fields → fields}/field_extensions/has_field_name.rb +0 -0
- data/lib/avo/{app/fields → fields}/field_extensions/visible_in_different_views.rb +6 -6
- data/lib/avo/fields/file_field.rb +29 -0
- data/lib/avo/fields/files_field.rb +33 -0
- data/lib/avo/{app/fields → fields}/gravatar_field.rb +19 -14
- data/lib/avo/fields/has_and_belongs_to_many_field.rb +37 -0
- data/lib/avo/fields/has_many_field.rb +38 -0
- data/lib/avo/fields/has_one_field.rb +63 -0
- data/lib/avo/{app/fields → fields}/heading_field.rb +3 -9
- data/lib/avo/{app/fields → fields}/hidden_field.rb +2 -4
- data/lib/avo/{app/fields → fields}/id_field.rb +3 -9
- data/lib/avo/{app/fields → fields}/key_value_field.rb +6 -3
- data/lib/avo/{app/fields → fields}/markdown_field.rb +2 -4
- data/lib/avo/fields/number_field.rb +20 -0
- data/lib/avo/{app/fields → fields}/password_field.rb +1 -3
- data/lib/avo/fields/select_field.rb +51 -0
- data/lib/avo/{app/fields → fields}/status_field.rb +10 -8
- data/lib/avo/{app/fields → fields}/text_field.rb +2 -9
- data/lib/avo/fields/textarea_field.rb +18 -0
- data/lib/avo/{app/fields → fields}/trix_field.rb +4 -10
- data/lib/avo/filters/base_filter.rb +20 -0
- data/lib/avo/filters/boolean_filter.rb +7 -0
- data/lib/avo/filters/select_filter.rb +7 -0
- data/lib/avo/{app/grid_fields → grid_fields}/body_field.rb +0 -2
- data/lib/avo/{app/grid_fields → grid_fields}/grid_field.rb +0 -0
- data/lib/avo/{app/grid_fields → grid_fields}/preview_field.rb +0 -2
- data/lib/avo/{app/grid_fields → grid_fields}/title_field.rb +0 -2
- data/lib/avo/licensing/community_license.rb +6 -0
- data/lib/avo/licensing/h_q.rb +88 -0
- data/lib/avo/licensing/license.rb +50 -0
- data/lib/avo/licensing/license_manager.rb +22 -0
- data/lib/avo/licensing/null_license.rb +14 -0
- data/lib/avo/licensing/pro_license.rb +11 -0
- data/lib/avo/loaders/actions_loader.rb +6 -0
- data/lib/avo/loaders/fields_loader.rb +27 -0
- data/lib/avo/loaders/filters_loader.rb +6 -0
- data/lib/avo/loaders/loader.rb +15 -0
- data/lib/avo/services/authorization_service.rb +93 -0
- data/lib/avo/services/panel_service.rb +27 -0
- data/lib/avo/{app/tools_manager.rb → tools_manager.rb} +0 -0
- data/lib/avo/version.rb +1 -1
- data/lib/generators/avo/action_generator.rb +11 -5
- data/lib/generators/avo/controller_generator.rb +19 -0
- data/lib/generators/avo/filter_generator.rb +14 -8
- data/lib/generators/avo/install_generator.rb +14 -10
- data/lib/generators/avo/locales_generator.rb +16 -0
- data/lib/generators/avo/partials_generator.rb +14 -0
- data/lib/generators/avo/resource_generator.rb +37 -5
- data/lib/generators/avo/templates/{action.rb → action.tt} +2 -4
- data/lib/generators/avo/templates/filters/boolean_filter.tt +11 -0
- data/lib/generators/avo/templates/filters/select_filter.tt +11 -0
- data/lib/generators/avo/templates/initializer/{avo.rb → avo.tt} +9 -4
- data/lib/generators/avo/templates/locales/avo.en.yml +22 -1
- data/lib/generators/avo/templates/partials/_footer.html.erb +3 -0
- data/lib/generators/avo/templates/partials/_header.html.erb +1 -0
- data/lib/generators/avo/templates/{views → partials}/_logo.html.erb +0 -0
- data/lib/generators/avo/templates/{views → partials}/_scripts.html.erb +0 -0
- data/lib/generators/avo/templates/resource/controller.tt +2 -0
- data/lib/generators/avo/templates/resource/resource.tt +17 -0
- data/public/avo-packs/css/application-c75ac28c.css +6 -0
- data/public/avo-packs/css/application-c75ac28c.css.br +0 -0
- data/public/avo-packs/css/application-c75ac28c.css.gz +0 -0
- data/public/avo-packs/js/1-0565987ca0c3045602ad.chunk.js +2 -0
- data/public/avo-packs/js/1-0565987ca0c3045602ad.chunk.js.br +0 -0
- data/public/avo-packs/js/1-0565987ca0c3045602ad.chunk.js.gz +0 -0
- data/public/avo-packs/js/1-0565987ca0c3045602ad.chunk.js.map +1 -0
- data/public/avo-packs/js/1-0565987ca0c3045602ad.chunk.js.map.br +0 -0
- data/public/avo-packs/js/1-0565987ca0c3045602ad.chunk.js.map.gz +0 -0
- data/public/avo-packs/js/application-8849c6e2c8f75d55c666.js +26 -0
- data/public/avo-packs/js/application-8849c6e2c8f75d55c666.js.LICENSE.txt +77 -0
- data/public/avo-packs/js/application-8849c6e2c8f75d55c666.js.br +0 -0
- data/public/avo-packs/js/application-8849c6e2c8f75d55c666.js.gz +0 -0
- data/public/avo-packs/js/application-8849c6e2c8f75d55c666.js.map +1 -0
- data/public/avo-packs/js/application-8849c6e2c8f75d55c666.js.map.br +0 -0
- data/public/avo-packs/js/application-8849c6e2c8f75d55c666.js.map.gz +0 -0
- data/public/avo-packs/manifest.json +17 -46
- data/public/avo-packs/manifest.json.br +0 -0
- data/public/avo-packs/manifest.json.gz +0 -0
- data/public/avo-packs/media/fonts/nunito-v16-latin-700-2cc22f9c0cf217cbfc371f3b74992305.ttf +0 -0
- data/public/avo-packs/media/fonts/nunito-v16-latin-700-2cc22f9c0cf217cbfc371f3b74992305.ttf.br +0 -0
- data/public/avo-packs/media/fonts/nunito-v16-latin-700-2cc22f9c0cf217cbfc371f3b74992305.ttf.gz +0 -0
- data/public/avo-packs/media/fonts/nunito-v16-latin-700-35bd1c96bc2e402cf22ea812ae067995.svg +388 -0
- data/public/avo-packs/media/fonts/nunito-v16-latin-700-35bd1c96bc2e402cf22ea812ae067995.svg.br +0 -0
- data/public/avo-packs/media/fonts/nunito-v16-latin-700-35bd1c96bc2e402cf22ea812ae067995.svg.gz +0 -0
- data/public/avo-packs/media/fonts/nunito-v16-latin-700-412073df419ad5f6f8f2ea76eb4aced9.woff2 +0 -0
- data/public/avo-packs/media/fonts/nunito-v16-latin-700-7c472b19cb573f537bad8ef62ca917ac.woff +0 -0
- data/public/avo-packs/media/fonts/nunito-v16-latin-700-df7e79af617f98cd3b95d320e8b2a1af.eot +0 -0
- data/public/avo-packs/media/fonts/nunito-v16-latin-regular-00fbd8a72a3708b8314cce5f0515640e.svg +380 -0
- data/public/avo-packs/media/fonts/nunito-v16-latin-regular-00fbd8a72a3708b8314cce5f0515640e.svg.br +0 -0
- data/public/avo-packs/media/fonts/nunito-v16-latin-regular-00fbd8a72a3708b8314cce5f0515640e.svg.gz +0 -0
- data/public/avo-packs/media/fonts/nunito-v16-latin-regular-2fae1e2418251b68fe5d0505ab93dd5c.eot +0 -0
- data/public/avo-packs/media/fonts/nunito-v16-latin-regular-bcf84d6cb8a0ac214c8c14ba9af834f3.woff2 +0 -0
- data/public/avo-packs/media/fonts/nunito-v16-latin-regular-cb632c9fe211ba2c2bf1564c9a9295cc.woff +0 -0
- data/public/avo-packs/media/fonts/nunito-v16-latin-regular-df8c4bee41b6ca0ed2b7b71456ed7fbb.ttf +0 -0
- data/public/avo-packs/media/fonts/nunito-v16-latin-regular-df8c4bee41b6ca0ed2b7b71456ed7fbb.ttf.br +0 -0
- data/public/avo-packs/media/fonts/nunito-v16-latin-regular-df8c4bee41b6ca0ed2b7b71456ed7fbb.ttf.gz +0 -0
- metadata +466 -194
- data/app/controllers/avo/filters_controller.rb +0 -19
- data/app/controllers/avo/resource_overview_controller.rb +0 -24
- data/app/views/avo/home/router.html.erb +0 -8
- data/app/views/layouts/avo/_javascript.html.erb +0 -8
- data/app/views/layouts/avo/_translations.html.erb +0 -5
- data/config/webpack/loaders/vue-post-css.js +0 -20
- data/config/webpack/loaders/vue-svg.js +0 -21
- data/config/webpack/loaders/vue.js +0 -6
- data/lib/avo/app/action.rb +0 -156
- data/lib/avo/app/app.rb +0 -169
- data/lib/avo/app/fields/badge_field.rb +0 -45
- data/lib/avo/app/fields/belongs_to.rb +0 -77
- data/lib/avo/app/fields/boolean_group_field.rb +0 -38
- data/lib/avo/app/fields/code_field.rb +0 -27
- data/lib/avo/app/fields/country_field.rb +0 -41
- data/lib/avo/app/fields/datetime_field.rb +0 -34
- data/lib/avo/app/fields/field.rb +0 -196
- data/lib/avo/app/fields/file_field.rb +0 -36
- data/lib/avo/app/fields/files_field.rb +0 -42
- data/lib/avo/app/fields/has_and_belongs_to_many.rb +0 -48
- data/lib/avo/app/fields/has_many.rb +0 -51
- data/lib/avo/app/fields/has_one.rb +0 -70
- data/lib/avo/app/fields/number_field.rb +0 -29
- data/lib/avo/app/fields/select_field.rb +0 -28
- data/lib/avo/app/fields/textarea_field.rb +0 -27
- data/lib/avo/app/filter.rb +0 -34
- data/lib/avo/app/filters/boolean_filter.rb +0 -13
- data/lib/avo/app/filters/select_filter.rb +0 -13
- data/lib/avo/app/licensing/community_license.rb +0 -4
- data/lib/avo/app/licensing/hq.rb +0 -86
- data/lib/avo/app/licensing/license.rb +0 -48
- data/lib/avo/app/licensing/license_manager.rb +0 -25
- data/lib/avo/app/licensing/null_license.rb +0 -12
- data/lib/avo/app/licensing/pro_license.rb +0 -9
- data/lib/avo/app/resource.rb +0 -233
- data/lib/avo/app/resource_actions.rb +0 -18
- data/lib/avo/app/resource_fields.rb +0 -26
- data/lib/avo/app/resource_filters.rb +0 -18
- data/lib/avo/app/resource_grid_fields.rb +0 -30
- data/lib/avo/app/services/authorization_service.rb +0 -48
- data/lib/avo/app/tool.rb +0 -5
- data/lib/generators/avo/templates/filters/boolean_filter.rb +0 -17
- data/lib/generators/avo/templates/filters/select_filter.rb +0 -17
- data/lib/generators/avo/templates/resource.rb +0 -14
- data/lib/generators/avo/templates/views/_footer.html.erb +0 -3
- data/lib/generators/avo/templates/views/_header.html.erb +0 -1
- data/lib/generators/avo/views_generator.rb +0 -8
- data/public/avo-packs/css/application-c9595d99.css +0 -3
- data/public/avo-packs/css/application-c9595d99.css.br +0 -0
- data/public/avo-packs/css/application-c9595d99.css.gz +0 -0
- data/public/avo-packs/js/application-78fe71b4e59ebc7141f4.js +0 -3
- data/public/avo-packs/js/application-78fe71b4e59ebc7141f4.js.LICENSE.txt +0 -767
- data/public/avo-packs/js/application-78fe71b4e59ebc7141f4.js.br +0 -0
- data/public/avo-packs/js/application-78fe71b4e59ebc7141f4.js.gz +0 -0
- data/public/avo-packs/js/application-78fe71b4e59ebc7141f4.js.map +0 -1
- data/public/avo-packs/js/application-78fe71b4e59ebc7141f4.js.map.br +0 -0
- data/public/avo-packs/js/application-78fe71b4e59ebc7141f4.js.map.gz +0 -0
- data/public/avo-packs/media/font/fontello-068ca2b3.ttf +0 -0
- data/public/avo-packs/media/font/fontello-068ca2b3.ttf.br +0 -0
- data/public/avo-packs/media/font/fontello-068ca2b3.ttf.gz +0 -0
- data/public/avo-packs/media/font/fontello-8d4a4e6f.woff2 +0 -0
- data/public/avo-packs/media/font/fontello-9354499c.svg +0 -72
- data/public/avo-packs/media/font/fontello-9354499c.svg.br +0 -0
- data/public/avo-packs/media/font/fontello-9354499c.svg.gz +0 -0
- data/public/avo-packs/media/font/fontello-a782baa8.woff +0 -0
- data/public/avo-packs/media/font/fontello-e73a0647.eot +0 -0
- data/public/avo-packs/media/font/fontello-e73a0647.eot.br +0 -0
- data/public/avo-packs/media/font/fontello-e73a0647.eot.gz +0 -0
- data/public/avo-packs/media/svgs/arrow-circle-right-1ad1e15ec9a7aa54b67d126566a5aa2d.svg.br +0 -0
- data/public/avo-packs/media/svgs/arrow-circle-right-1ad1e15ec9a7aa54b67d126566a5aa2d.svg.gz +0 -0
- data/public/avo-packs/media/svgs/arrow-left-0e8e808ff771a62a348d0232c8ccf539.svg.br +0 -0
- data/public/avo-packs/media/svgs/avocado-bca389be7cf81162df902dfbd09b8adb.svg.br +0 -0
- data/public/avo-packs/media/svgs/avocado-bca389be7cf81162df902dfbd09b8adb.svg.gz +0 -0
- data/public/avo-packs/media/svgs/check-circle-be9e4dcbd25467ae9a3d3c6c5c7a09fa.svg.br +0 -0
- data/public/avo-packs/media/svgs/chevron-down-01208b17a1f70a1bb8d82bba131da4f4.svg.br +0 -0
- data/public/avo-packs/media/svgs/chevron-down-01208b17a1f70a1bb8d82bba131da4f4.svg.gz +0 -0
- data/public/avo-packs/media/svgs/chevron-up-25ecf340dd76966d5ed63c85c025befc.svg.br +0 -0
- data/public/avo-packs/media/svgs/chevron-up-25ecf340dd76966d5ed63c85c025befc.svg.gz +0 -0
- data/public/avo-packs/media/svgs/code-69010c6ddb6ad50be8677f16468c51f8.svg.br +0 -0
- data/public/avo-packs/media/svgs/color-swatch-60cf90fb6b5386e38f3b003f34e7ecbe.svg.br +0 -0
- data/public/avo-packs/media/svgs/color-swatch-60cf90fb6b5386e38f3b003f34e7ecbe.svg.gz +0 -0
- data/public/avo-packs/media/svgs/download-c6ae3f12364a467c28cbf41dc90afbdd.svg.br +0 -0
- data/public/avo-packs/media/svgs/download-c6ae3f12364a467c28cbf41dc90afbdd.svg.gz +0 -0
- data/public/avo-packs/media/svgs/edit-46c6dbef52ba6ddfc9afbc37186dfa2b.svg.br +0 -0
- data/public/avo-packs/media/svgs/edit-46c6dbef52ba6ddfc9afbc37186dfa2b.svg.gz +0 -0
- data/public/avo-packs/media/svgs/exclamation-8d1c0baa390a8df9bb52176011eb5892.svg.br +0 -0
- data/public/avo-packs/media/svgs/exclamation-8d1c0baa390a8df9bb52176011eb5892.svg.gz +0 -0
- data/public/avo-packs/media/svgs/eye-cc6f85c70ebed6929712a5c7d51f102d.svg.br +0 -1
- data/public/avo-packs/media/svgs/eye-cc6f85c70ebed6929712a5c7d51f102d.svg.gz +0 -0
- data/public/avo-packs/media/svgs/filter-0007cddbc85cfe207f9876d4d184444a.svg.br +0 -0
- data/public/avo-packs/media/svgs/filter-0007cddbc85cfe207f9876d4d184444a.svg.gz +0 -0
- data/public/avo-packs/media/svgs/fire-782f08df79993311b6d907e12d9ebe9f.svg.br +0 -0
- data/public/avo-packs/media/svgs/fire-782f08df79993311b6d907e12d9ebe9f.svg.gz +0 -0
- data/public/avo-packs/media/svgs/game-board-6c59fe04181ac9954356c9f1f4d28053.svg.br +0 -0
- data/public/avo-packs/media/svgs/game-board-6c59fe04181ac9954356c9f1f4d28053.svg.gz +0 -0
- data/public/avo-packs/media/svgs/globe-dfd9977c9d65814d2fc576904406dd08.svg.br +0 -0
- data/public/avo-packs/media/svgs/globe-dfd9977c9d65814d2fc576904406dd08.svg.gz +0 -0
- data/public/avo-packs/media/svgs/library-7d391192a15da64fbb527908c9e035c7.svg.br +0 -0
- data/public/avo-packs/media/svgs/photograph-9f37f1f5e6a48e68ce3b7d9cbe7b6fad.svg.br +0 -2
- data/public/avo-packs/media/svgs/photograph-9f37f1f5e6a48e68ce3b7d9cbe7b6fad.svg.gz +0 -0
- data/public/avo-packs/media/svgs/plus-530f0af27b9f1a4552454233c2f9a641.svg.br +0 -0
- data/public/avo-packs/media/svgs/plus-circle-b379b2a2aa803511ae5945b6fd323204.svg.br +0 -0
- data/public/avo-packs/media/svgs/question-mark-circle-3ece1d61091827910cdd097db711062b.svg.br +0 -0
- data/public/avo-packs/media/svgs/question-mark-circle-3ece1d61091827910cdd097db711062b.svg.gz +0 -0
- data/public/avo-packs/media/svgs/save-e54acd7ac9646053e36382776f822756.svg.br +0 -0
- data/public/avo-packs/media/svgs/save-e54acd7ac9646053e36382776f822756.svg.gz +0 -0
- data/public/avo-packs/media/svgs/selector-b43b3957d7cc121d06be14312613c218.svg.br +0 -0
- data/public/avo-packs/media/svgs/sort-ascending-f5bc0761702809cab20b0ea3065cb88a.svg.br +0 -0
- data/public/avo-packs/media/svgs/sort-descending-1c8ddc56c72be6781e59d808f9d06203.svg.br +0 -0
- data/public/avo-packs/media/svgs/switch-horizontal-d23337f0fb533a86d14b746d25ad48ae.svg.br +0 -2
- data/public/avo-packs/media/svgs/switch-horizontal-d23337f0fb533a86d14b746d25ad48ae.svg.gz +0 -0
- data/public/avo-packs/media/svgs/thumbs-down-44f83eacbf5b8fe0f2f085da75866ce0.svg.br +0 -0
- data/public/avo-packs/media/svgs/thumbs-down-44f83eacbf5b8fe0f2f085da75866ce0.svg.gz +0 -0
- data/public/avo-packs/media/svgs/thumbs-up-b866900017db179b50d6b19a1424ed25.svg.br +0 -4
- data/public/avo-packs/media/svgs/thumbs-up-b866900017db179b50d6b19a1424ed25.svg.gz +0 -0
- data/public/avo-packs/media/svgs/times-539256e95a00360c3bbc6160c6b695cd.svg +0 -1
- data/public/avo-packs/media/svgs/times-539256e95a00360c3bbc6160c6b695cd.svg.br +0 -0
- data/public/avo-packs/media/svgs/times-539256e95a00360c3bbc6160c6b695cd.svg.gz +0 -0
- data/public/avo-packs/media/svgs/trash-a61412a066e358bcc24494a5080b7255.svg.br +0 -0
- data/public/avo-packs/media/svgs/trash-a61412a066e358bcc24494a5080b7255.svg.gz +0 -0
- data/public/avo-packs/media/svgs/view-grid-393669034db69f59497616d5416ae411.svg.br +0 -1
- data/public/avo-packs/media/svgs/view-grid-393669034db69f59497616d5416ae411.svg.gz +0 -0
- data/public/avo-packs/media/svgs/view-grid-add-d0ee477a044e5d46c0c62af66cb6de77.svg.br +0 -0
- data/public/avo-packs/media/svgs/view-grid-add-d0ee477a044e5d46c0c62af66cb6de77.svg.gz +0 -0
- data/public/avo-packs/media/svgs/view-list-8a7a159ca5d892f72cf8c6744a2074e2.svg.br +0 -3
- data/public/avo-packs/media/svgs/view-list-8a7a159ca5d892f72cf8c6744a2074e2.svg.gz +0 -0
- data/public/avo-packs/media/svgs/x-circle-c540f9ccfe937ad9b4f662e0b65e47e2.svg.br +0 -0
- data/public/avo-packs/media/svgs/x-circle-c540f9ccfe937ad9b4f662e0b65e47e2.svg.gz +0 -0
@@ -1,15 +1,21 @@
|
|
1
1
|
module Avo
|
2
|
-
class ApplicationController < ActionController::Base
|
3
|
-
|
2
|
+
class ApplicationController < ::ActionController::Base
|
3
|
+
include Pundit
|
4
|
+
include Pagy::Backend
|
4
5
|
protect_from_forgery with: :exception
|
5
6
|
before_action :init_app
|
7
|
+
before_action :set_authorization
|
6
8
|
before_action :_authenticate!
|
9
|
+
before_action :set_container_classes
|
10
|
+
|
11
|
+
rescue_from Pundit::NotAuthorizedError, with: :render_unauthorized
|
12
|
+
rescue_from ActiveRecord::RecordInvalid, with: :exception_logger
|
7
13
|
|
8
|
-
helper_method :_current_user
|
14
|
+
helper_method :_current_user, :resources_path, :resource_path, :new_resource_path, :edit_resource_path, :resource_attach_path, :resource_detach_path
|
15
|
+
add_flash_types :info, :warning, :success, :error
|
9
16
|
|
10
17
|
def init_app
|
11
|
-
Avo::App.
|
12
|
-
Avo::App.init request
|
18
|
+
Avo::App.init request: request, context: context
|
13
19
|
|
14
20
|
@license = Avo::App.license
|
15
21
|
end
|
@@ -18,7 +24,7 @@ module Avo
|
|
18
24
|
respond_to do |format|
|
19
25
|
format.html { raise exception }
|
20
26
|
format.json { render json: {
|
21
|
-
errors: exception.
|
27
|
+
errors: exception.record.present? ? exception.record.errors : [],
|
22
28
|
message: exception.message,
|
23
29
|
traces: exception.backtrace,
|
24
30
|
}, status: ActionDispatch::ExceptionWrapper.status_code_for_exception(exception.class.name) }
|
@@ -29,47 +35,203 @@ module Avo
|
|
29
35
|
instance_eval(&Avo.configuration.current_user)
|
30
36
|
end
|
31
37
|
|
38
|
+
def context
|
39
|
+
instance_eval(&Avo.configuration.context)
|
40
|
+
end
|
41
|
+
|
42
|
+
def resources_path(model, keep_query_params: false, **args)
|
43
|
+
return if model.nil?
|
44
|
+
|
45
|
+
existing_params = {}
|
46
|
+
|
47
|
+
begin
|
48
|
+
if keep_query_params
|
49
|
+
existing_params = Addressable::URI.parse(request.fullpath).query_values.symbolize_keys
|
50
|
+
end
|
51
|
+
rescue;end
|
52
|
+
|
53
|
+
send :"resources_#{model.model_name.route_key}_path", **existing_params, **args
|
54
|
+
end
|
55
|
+
|
56
|
+
def resource_path(model = nil, resource_id: nil, keep_query_params: false, **args)
|
57
|
+
existing_params = {}
|
58
|
+
|
59
|
+
begin
|
60
|
+
if keep_query_params
|
61
|
+
existing_params = Addressable::URI.parse(request.fullpath).query_values.symbolize_keys
|
62
|
+
end
|
63
|
+
rescue;end
|
64
|
+
|
65
|
+
return send :"resources_#{model.model_name.route_key.singularize}_path", resource_id, **args if resource_id.present?
|
66
|
+
|
67
|
+
send :"resources_#{model.model_name.route_key.singularize}_path", model, **args
|
68
|
+
end
|
69
|
+
|
70
|
+
def resource_attach_path(model_name, model_id, related_name, related_id = nil)
|
71
|
+
path = "#{Avo.configuration.root_path}/resources/#{model_name}/#{model_id}/#{related_name}/new"
|
72
|
+
|
73
|
+
path += "/#{related_id}" if related_id.present?
|
74
|
+
|
75
|
+
path
|
76
|
+
end
|
77
|
+
|
78
|
+
def resource_detach_path(model_name, model_id, related_name, related_id = nil)
|
79
|
+
path = "#{Avo.configuration.root_path}/resources/#{model_name}/#{model_id}/#{related_name}"
|
80
|
+
|
81
|
+
path += "/#{related_id}" if related_id.present?
|
82
|
+
|
83
|
+
path
|
84
|
+
end
|
85
|
+
|
86
|
+
def new_resource_path(model, **args)
|
87
|
+
send :"new_resources_#{model.model_name.route_key.singularize}_path", **args
|
88
|
+
end
|
89
|
+
|
90
|
+
def edit_resource_path(model, **args)
|
91
|
+
send :"edit_resources_#{model.model_name.route_key.singularize}_path", model, **args
|
92
|
+
end
|
93
|
+
|
32
94
|
private
|
33
|
-
def
|
34
|
-
|
95
|
+
def set_resource_name
|
96
|
+
@resource_name = resource_name
|
35
97
|
end
|
36
98
|
|
37
|
-
def
|
38
|
-
|
39
|
-
|
40
|
-
query = query.send :"with_attached_#{field}"
|
41
|
-
end
|
42
|
-
end
|
99
|
+
def set_related_resource_name
|
100
|
+
@related_resource_name = related_resource_name
|
101
|
+
end
|
43
102
|
|
44
|
-
|
103
|
+
def set_resource
|
104
|
+
@resource = resource.hydrate(params: params)
|
105
|
+
end
|
106
|
+
|
107
|
+
def set_related_resource
|
108
|
+
@related_resource = related_resource.hydrate(params: params)
|
45
109
|
end
|
46
110
|
|
47
|
-
def
|
48
|
-
|
111
|
+
def set_model
|
112
|
+
@model = eager_load_files(@resource, @resource.model_class).find params[:id]
|
49
113
|
end
|
50
114
|
|
51
|
-
def
|
52
|
-
|
115
|
+
def set_related_model
|
116
|
+
@related_model = eager_load_files(@related_resource, @related_resource.model_class).find params[:related_id]
|
53
117
|
end
|
54
118
|
|
55
|
-
def
|
56
|
-
|
119
|
+
def hydrate_resource
|
120
|
+
@resource.hydrate(view: action_name.to_sym, user: _current_user)
|
121
|
+
end
|
122
|
+
|
123
|
+
def hydrate_related_resource
|
124
|
+
@related_resource.hydrate(view: action_name.to_sym, user: _current_user)
|
125
|
+
end
|
126
|
+
|
127
|
+
def authorize_action
|
128
|
+
if @model.present?
|
129
|
+
@authorization.set_record(@model).authorize_action :index
|
130
|
+
else
|
131
|
+
@authorization.set_record(@resource.model_class).authorize_action :index
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
# Get the pluralized resource name for this request
|
136
|
+
# Ex: projects, teams, users
|
137
|
+
def resource_name
|
138
|
+
return params[:resource_name] if params[:resource_name].present?
|
139
|
+
|
140
|
+
return controller_name if controller_name.present?
|
141
|
+
|
142
|
+
begin
|
143
|
+
request.path
|
144
|
+
.match(/\/?#{Avo.configuration.root_path.gsub('/', '')}\/resources\/([a-z1-9\-_]*)\/?/mi)
|
145
|
+
.captures
|
146
|
+
.first
|
147
|
+
rescue => exception
|
148
|
+
end
|
149
|
+
end
|
57
150
|
|
58
|
-
|
151
|
+
def related_resource_name
|
152
|
+
params[:related_name]
|
153
|
+
end
|
59
154
|
|
60
|
-
|
61
|
-
|
155
|
+
# Gets the Avo resource for this request based on the request from the `resource_name` "param"
|
156
|
+
# Ex: Avo::Resources::Project, Avo::Resources::Team, Avo::Resources::User
|
157
|
+
def resource
|
158
|
+
App.get_resource @resource_name.to_s.camelize.singularize
|
159
|
+
end
|
160
|
+
|
161
|
+
def related_resource
|
162
|
+
reflection = @model._reflections[params[:related_name]]
|
163
|
+
|
164
|
+
if reflection.is_a? ::ActiveRecord::Reflection::HasOneReflection
|
165
|
+
reflected_model = reflection.klass
|
166
|
+
else
|
167
|
+
reflected_model = reflection.klass
|
62
168
|
end
|
63
169
|
|
64
|
-
|
170
|
+
App.get_resource_by_model_name reflected_model
|
65
171
|
end
|
66
172
|
|
67
|
-
def
|
68
|
-
|
173
|
+
def eager_load_files(resource, query)
|
174
|
+
if resource.attached_file_fields.present?
|
175
|
+
resource.attached_file_fields.map do |field|
|
176
|
+
# abort "#{field.pluralize}".inspect
|
177
|
+
# abort field.class.inspect
|
178
|
+
attachment = case field.class.to_s
|
179
|
+
when 'Avo::Fields::FileField'
|
180
|
+
'attachment'
|
181
|
+
when 'Avo::Fields::FilesField'
|
182
|
+
'attachments'
|
183
|
+
else
|
184
|
+
'attachment'
|
185
|
+
end
|
186
|
+
|
187
|
+
return query.eager_load "#{field.id}_#{attachment}": :blob
|
188
|
+
# return query.send :"with_attached_#{field}"
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
query
|
69
193
|
end
|
70
194
|
|
195
|
+
|
196
|
+
# def authorize_user
|
197
|
+
# return if params[:controller] == 'avo/search'
|
198
|
+
|
199
|
+
# model = record = resource.model
|
200
|
+
|
201
|
+
# if ['show', 'edit', 'update'].include?(params[:action]) && params[:controller] == 'avo/resources'
|
202
|
+
# record = resource
|
203
|
+
# end
|
204
|
+
|
205
|
+
# # AuthorizationService::authorize_action _current_user, record, params[:action] return render_unauthorized unless
|
206
|
+
# end
|
207
|
+
|
71
208
|
def _authenticate!
|
72
209
|
instance_eval(&Avo.configuration.authenticate)
|
73
210
|
end
|
211
|
+
|
212
|
+
def render_unauthorized(exception)
|
213
|
+
if !exception.is_a? Pundit::NotDefinedError
|
214
|
+
flash[:notice] = t 'avo.not_authorized'
|
215
|
+
|
216
|
+
redirect_url = if request.referrer.blank? or request.referrer == request.url
|
217
|
+
root_url
|
218
|
+
else
|
219
|
+
request.referrer
|
220
|
+
end
|
221
|
+
|
222
|
+
redirect_to(redirect_url)
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
def set_authorization
|
227
|
+
@authorization = Services::AuthorizationService.new _current_user
|
228
|
+
end
|
229
|
+
|
230
|
+
def set_container_classes
|
231
|
+
contain = !Avo.configuration.full_width_container
|
232
|
+
contain = false if Avo.configuration.full_width_index_view && action_name.to_sym == :index && self.class.superclass.to_s == 'Avo::ResourcesController'
|
233
|
+
|
234
|
+
@container_classes = contain ? '2xl:container 2xl:mx-auto' : ''
|
235
|
+
end
|
74
236
|
end
|
75
237
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require_dependency 'avo/application_controller'
|
2
|
+
|
3
|
+
module Avo
|
4
|
+
class AttachmentsController < ApplicationController
|
5
|
+
before_action :set_resource_name, only: :destroy
|
6
|
+
before_action :set_resource, only: :destroy
|
7
|
+
before_action :set_model, only: :destroy
|
8
|
+
|
9
|
+
def show
|
10
|
+
end
|
11
|
+
|
12
|
+
def destroy
|
13
|
+
blob = ActiveStorage::Blob.find(params[:signed_attachment_id])
|
14
|
+
attachment = blob.attachments.find_by record_id: params[:id], record_type: @model.class.to_s
|
15
|
+
|
16
|
+
if attachment.present?
|
17
|
+
attachment.destroy
|
18
|
+
|
19
|
+
redirect_to params[:referrer] || resource_path(@model), notice: t('avo.attachment_destroyed')
|
20
|
+
else
|
21
|
+
redirect_back fallback_location: resource_path(@model), notice: t('avo.failed_to_find_attachment')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,226 @@
|
|
1
|
+
require_dependency 'avo/application_controller'
|
2
|
+
|
3
|
+
module Avo
|
4
|
+
class BaseController < ApplicationController
|
5
|
+
before_action :set_resource_name
|
6
|
+
before_action :set_resource
|
7
|
+
before_action :hydrate_resource
|
8
|
+
before_action :authorize_action
|
9
|
+
before_action :set_model, only: [:show, :edit, :destroy, :update]
|
10
|
+
|
11
|
+
def index
|
12
|
+
set_index_params
|
13
|
+
set_filters
|
14
|
+
set_actions
|
15
|
+
|
16
|
+
# If we don't get a query object predefined from a child controller like relations, just spin one up
|
17
|
+
unless defined? @query
|
18
|
+
@query = @authorization.apply_policy @resource.model_class
|
19
|
+
end
|
20
|
+
|
21
|
+
# Eager load the relations
|
22
|
+
if @resource.includes.present?
|
23
|
+
@query = @query.includes(*@resource.includes)
|
24
|
+
end
|
25
|
+
|
26
|
+
# Eager load the active storage attachments
|
27
|
+
@query = eager_load_files(@resource, @query)
|
28
|
+
|
29
|
+
# Sort the items
|
30
|
+
if @index_params[:sort_by].present?
|
31
|
+
@query = @query.order("#{@resource.model_class.table_name}.#{@index_params[:sort_by]} #{@index_params[:sort_direction]}")
|
32
|
+
end
|
33
|
+
|
34
|
+
# Apply filters
|
35
|
+
applied_filters.each do |filter_class, filter_value|
|
36
|
+
@query = filter_class.safe_constantize.new.apply_query request, @query, filter_value
|
37
|
+
end
|
38
|
+
|
39
|
+
@pagy, @models = pagy(@query, items: @index_params[:per_page], link_extra: "data-turbo-frame=\"#{params[:turbo_frame]}\"", size: [1, 2, 2, 1])
|
40
|
+
|
41
|
+
# Create resources for each model
|
42
|
+
@resources = @models.map do |model|
|
43
|
+
@resource.hydrate(model: model, params: params).dup
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def show
|
48
|
+
set_actions
|
49
|
+
|
50
|
+
@resource = @resource.hydrate(model: @model, view: :show, user: _current_user, params: params)
|
51
|
+
end
|
52
|
+
|
53
|
+
def new
|
54
|
+
@model = @resource.model_class.new
|
55
|
+
@resource = @resource.hydrate(model: @model, view: :new, user: _current_user)
|
56
|
+
end
|
57
|
+
|
58
|
+
def edit
|
59
|
+
@resource = @resource.hydrate(model: @model, view: :edit, user: _current_user)
|
60
|
+
end
|
61
|
+
|
62
|
+
def create
|
63
|
+
@model = @resource.fill_model(@resource.model_class.new, cast_nullable(model_params))
|
64
|
+
saved = @model.save
|
65
|
+
@resource.hydrate(model: @model, view: :new, user: _current_user)
|
66
|
+
|
67
|
+
respond_to do |format|
|
68
|
+
if saved
|
69
|
+
if params[:via_relation_class].present? && params[:via_resource_id].present?
|
70
|
+
redirect_path = resource_path(params[:via_relation_class].safe_constantize, resource_id: params[:via_resource_id])
|
71
|
+
else
|
72
|
+
redirect_path = resource_path(@model)
|
73
|
+
end
|
74
|
+
|
75
|
+
format.html { redirect_to redirect_path, notice: "#{@model.class.name} was successfully created." }
|
76
|
+
format.json { render :show, status: :created, location: @model }
|
77
|
+
else
|
78
|
+
flash[:error] = t 'avo.you_missed_something_check_form'
|
79
|
+
format.html { render :new, status: :unprocessable_entity }
|
80
|
+
format.json { render json: @model.errors, status: :unprocessable_entity }
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def update
|
86
|
+
@model = @resource.fill_model(@model, cast_nullable(model_params))
|
87
|
+
saved = @model.save
|
88
|
+
@resource = @resource.hydrate(model: @model, view: :edit, user: _current_user)
|
89
|
+
|
90
|
+
respond_to do |format|
|
91
|
+
if saved
|
92
|
+
format.html { redirect_to params[:referrer] || resource_path(@model), notice: "#{@model.class.name} was successfully updated." }
|
93
|
+
format.json { render :show, status: :ok, location: @model }
|
94
|
+
else
|
95
|
+
flash[:error] = t 'avo.you_missed_something_check_form'
|
96
|
+
format.html { render :edit, status: :unprocessable_entity }
|
97
|
+
format.json { render json: @model.errors, status: :unprocessable_entity }
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def destroy
|
103
|
+
@model.destroy!
|
104
|
+
|
105
|
+
respond_to do |format|
|
106
|
+
format.html { redirect_to params[:referrer] || resources_path(@model), notice: t('avo.resource_destroyed', attachment_class: @attachment_class) }
|
107
|
+
format.json { head :no_content }
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
private
|
112
|
+
def model_route_key
|
113
|
+
@resource.model_class.model_name.route_key.singularize
|
114
|
+
end
|
115
|
+
|
116
|
+
def model_params
|
117
|
+
request_params = params.require(model_route_key).permit(permitted_params)
|
118
|
+
|
119
|
+
if @resource.devise_password_optional and request_params[:password].blank? and request_params[:password_confirmation].blank?
|
120
|
+
request_params.delete(:password_confirmation)
|
121
|
+
request_params.delete(:password)
|
122
|
+
end
|
123
|
+
|
124
|
+
request_params
|
125
|
+
end
|
126
|
+
|
127
|
+
def permitted_params
|
128
|
+
@resource.get_field_definitions.select(&:updatable).map(&:to_permitted_param)
|
129
|
+
end
|
130
|
+
|
131
|
+
def cast_nullable(params)
|
132
|
+
fields = @resource.get_field_definitions
|
133
|
+
|
134
|
+
nullable_fields = fields.filter do |field|
|
135
|
+
field.nullable
|
136
|
+
end
|
137
|
+
.map do |field|
|
138
|
+
[field.id, field.null_values]
|
139
|
+
end
|
140
|
+
.to_h
|
141
|
+
|
142
|
+
params.each do |key, value|
|
143
|
+
nullable = nullable_fields[key.to_sym]
|
144
|
+
|
145
|
+
if nullable.present? && value.in?(nullable)
|
146
|
+
params[key] = nil
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
params
|
151
|
+
end
|
152
|
+
|
153
|
+
def set_index_params
|
154
|
+
@index_params = {}
|
155
|
+
|
156
|
+
# Pagination
|
157
|
+
@index_params[:page] = params[:page] || 1
|
158
|
+
@index_params[:per_page] = Avo.configuration.per_page
|
159
|
+
|
160
|
+
if cookies[:per_page].present?
|
161
|
+
@index_params[:per_page] = cookies[:per_page]
|
162
|
+
end
|
163
|
+
|
164
|
+
if params[:per_page].present?
|
165
|
+
@index_params[:per_page] = params[:per_page]
|
166
|
+
end
|
167
|
+
|
168
|
+
if params[:per_page].present?
|
169
|
+
cookies[:per_page] = params[:per_page]
|
170
|
+
end
|
171
|
+
|
172
|
+
if @parent_model.present?
|
173
|
+
@index_params[:per_page] = Avo.configuration.via_per_page
|
174
|
+
end
|
175
|
+
|
176
|
+
# Sorting
|
177
|
+
@index_params[:sort_by] = params[:sort_by] || :created_at
|
178
|
+
@index_params[:sort_direction] = params[:sort_direction] || :desc
|
179
|
+
|
180
|
+
# View types
|
181
|
+
@index_params[:view_type] = params[:view_type] || @resource.default_view_type || Avo.configuration.default_view_type
|
182
|
+
@index_params[:available_view_types] = @resource.available_view_types
|
183
|
+
end
|
184
|
+
|
185
|
+
def set_filters
|
186
|
+
@filters = @resource.get_filters.map do |filter_class|
|
187
|
+
filter = filter_class.new
|
188
|
+
|
189
|
+
filter
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
def set_actions
|
194
|
+
if params[:resource_id].present?
|
195
|
+
model = @resource.model_class.find params[:resource_id]
|
196
|
+
end
|
197
|
+
|
198
|
+
@actions = @resource.get_actions.map do |action|
|
199
|
+
action = action.new
|
200
|
+
|
201
|
+
action.hydrate(model: model, resource: @resource)
|
202
|
+
action.boot_fields request
|
203
|
+
|
204
|
+
action
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
def applied_filters
|
209
|
+
if params[:filters].present?
|
210
|
+
return JSON.parse(Base64.decode64(params[:filters]))
|
211
|
+
end
|
212
|
+
|
213
|
+
filter_defaults = {}
|
214
|
+
|
215
|
+
@resource.get_filters.each do |filter_class|
|
216
|
+
filter = filter_class.new
|
217
|
+
|
218
|
+
if filter.default.present?
|
219
|
+
filter_defaults[filter_class.to_s] = filter.default
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
filter_defaults
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|