avo 0.5.0.beta7 → 0.5.0.beta12
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 +48 -47
- data/Gemfile.lock +28 -18
- data/Rakefile +14 -14
- data/app/components/avo/common/badge_viewer_component.html.erb +1 -1
- data/app/components/avo/common/gravatar_viewer_component.html.erb +2 -2
- data/app/components/avo/common/gravatar_viewer_component.rb +2 -1
- data/app/components/avo/common/multiple_file_viewer_component.rb +1 -1
- data/app/components/avo/common/single_file_viewer_component.rb +1 -1
- data/app/components/avo/edit/field_wrapper_component.rb +3 -3
- data/app/components/avo/edit/fields/trix_field_component.html.erb +1 -1
- data/app/components/avo/index/field_wrapper_component.html.erb +1 -1
- data/app/components/avo/index/field_wrapper_component.rb +1 -1
- data/app/components/avo/index/fields/belongs_to_field_component.html.erb +1 -5
- data/app/components/avo/index/fields/boolean_group_field_component.html.erb +1 -1
- data/app/components/avo/index/fields/gravatar_field_component.html.erb +2 -1
- data/app/components/avo/index/fields/has_one_field_component.html.erb +1 -5
- data/app/components/avo/index/fields/id_field_component.html.erb +1 -1
- data/app/components/avo/index/grid_item_component.html.erb +2 -2
- data/app/components/avo/index/grid_item_component.rb +10 -9
- data/app/components/avo/index/resource_controls_component.html.erb +12 -4
- data/app/components/avo/index/resource_controls_component.rb +2 -2
- data/app/components/avo/panel_component.rb +7 -6
- data/app/components/avo/resource_component.rb +4 -3
- data/app/components/avo/show/field_wrapper_component.html.erb +1 -1
- data/app/components/avo/show/field_wrapper_component.rb +3 -3
- data/app/components/avo/show/fields/boolean_group_field_component.html.erb +1 -1
- data/app/components/avo/show/fields/external_image_field_component.html.erb +1 -1
- data/app/components/avo/views/resource_edit_component.rb +4 -3
- data/app/components/avo/views/resource_index_component.rb +8 -7
- data/app/components/avo/views/resource_new_component.rb +4 -3
- data/app/components/avo/views/resource_show_component.html.erb +14 -2
- data/app/components/avo/views/resource_show_component.rb +21 -21
- data/app/controllers/avo/actions_controller.rb +34 -32
- data/app/controllers/avo/application_controller.rb +122 -119
- data/app/controllers/avo/attachments_controller.rb +3 -3
- data/app/controllers/avo/base_controller.rb +80 -82
- data/app/controllers/avo/home_controller.rb +2 -2
- data/app/controllers/avo/relations_controller.rb +29 -28
- data/app/controllers/avo/resources_controller.rb +1 -1
- data/app/controllers/avo/search_controller.rb +20 -19
- data/app/helpers/avo/application_helper.rb +49 -43
- data/app/helpers/avo/resources_helper.rb +11 -11
- data/app/mailers/avo/application_mailer.rb +2 -2
- data/app/{frontend/css → packs/entrypoints}/application.css +12 -11
- data/app/{frontend/packs → packs/entrypoints}/application.js +9 -3
- data/app/{frontend → packs}/fonts/nunito-v16-latin-700.eot +0 -0
- data/app/{frontend → packs}/fonts/nunito-v16-latin-700.svg +0 -0
- data/app/{frontend → packs}/fonts/nunito-v16-latin-700.ttf +0 -0
- data/app/{frontend → packs}/fonts/nunito-v16-latin-700.woff +0 -0
- data/app/{frontend → packs}/fonts/nunito-v16-latin-700.woff2 +0 -0
- data/app/{frontend → packs}/fonts/nunito-v16-latin-regular.eot +0 -0
- data/app/{frontend → packs}/fonts/nunito-v16-latin-regular.svg +0 -0
- data/app/{frontend → packs}/fonts/nunito-v16-latin-regular.ttf +0 -0
- data/app/{frontend → packs}/fonts/nunito-v16-latin-regular.woff +0 -0
- data/app/{frontend → packs}/fonts/nunito-v16-latin-regular.woff2 +0 -0
- data/app/{frontend → packs}/images/logo.png +0 -0
- data/app/{frontend → packs}/importmap.json.erb +0 -0
- data/app/{frontend → packs}/js/controllers/action_controller.js +0 -0
- data/app/{frontend → packs}/js/controllers/actions_picker_controller.js +0 -0
- data/app/{frontend → packs}/js/controllers/alerts_controller.js +0 -0
- data/app/{frontend → packs}/js/controllers/attachments_controller.js +0 -0
- data/app/{frontend → packs}/js/controllers/boolean_filter_controller.js +0 -0
- data/app/{frontend → packs}/js/controllers/fields/code_field_controller.js +14 -14
- data/app/{frontend → packs}/js/controllers/fields/date_field_controller.js +0 -0
- data/app/{frontend → packs}/js/controllers/fields/simple_mde_controller.js +0 -0
- data/app/{frontend → packs}/js/controllers/filter_controller.js +20 -3
- data/app/{frontend → packs}/js/controllers/hidden_input_controller.js +0 -0
- data/app/{frontend → packs}/js/controllers/item_selector_controller.js +0 -0
- data/app/{frontend → packs}/js/controllers/modal_controller.js +0 -0
- data/app/{frontend → packs}/js/controllers/per_page_controller.js +5 -1
- data/app/{frontend → packs}/js/controllers/select_filter_controller.js +0 -0
- data/app/{frontend → packs}/js/controllers/tippy_controller.js +0 -0
- data/app/{frontend → packs}/js/controllers/toggle_panel_controller.js +0 -0
- data/app/{frontend → packs}/js/helpers/cast_boolean.js +0 -0
- data/app/{frontend → packs}/js/toastr.js +1 -0
- data/app/{frontend/css → packs/stylesheets}/alerts.css +0 -0
- data/app/packs/stylesheets/components/code.css +11 -0
- data/app/{frontend/css → packs/stylesheets}/components/status.css +0 -0
- data/app/{frontend/css → packs/stylesheets}/fonts.css +0 -0
- data/app/{frontend/css → packs/stylesheets}/loader.css +0 -0
- data/app/{frontend/css → packs/stylesheets}/pagination.css +0 -0
- data/app/{frontend/css → packs/stylesheets}/tailwindcss/base.css +0 -0
- data/app/{frontend/css → packs/stylesheets}/tailwindcss/components.css +0 -0
- data/app/{frontend/css → packs/stylesheets}/tailwindcss/utilities.css +0 -0
- data/app/{frontend/css → packs/stylesheets}/tooltips.css +0 -0
- data/app/{frontend/css → packs/stylesheets}/typography.css +0 -0
- data/app/{frontend → packs}/svgs/arrow-circle-right.svg +0 -0
- data/app/{frontend → packs}/svgs/arrow-left.svg +0 -0
- data/app/{frontend → packs}/svgs/avocado.svg +0 -0
- data/app/{frontend → packs}/svgs/badge-check-sm.svg +0 -0
- data/app/{frontend → packs}/svgs/check-circle.svg +0 -0
- data/app/{frontend → packs}/svgs/chevron-down.svg +0 -0
- data/app/{frontend → packs}/svgs/chevron-up.svg +0 -0
- data/app/{frontend → packs}/svgs/code.svg +0 -0
- data/app/{frontend → packs}/svgs/color-swatch.svg +0 -0
- data/app/{frontend → packs}/svgs/document-text.svg +0 -0
- data/app/{frontend → packs}/svgs/download.svg +0 -0
- data/app/{frontend → packs}/svgs/edit.svg +0 -0
- data/app/{frontend → packs}/svgs/exclamation-circle-sm.svg +0 -0
- data/app/{frontend → packs}/svgs/exclamation-sm.svg +0 -0
- data/app/{frontend → packs}/svgs/exclamation.svg +0 -0
- data/app/{frontend → packs}/svgs/eye.svg +0 -0
- data/app/{frontend → packs}/svgs/filter.svg +0 -0
- data/app/{frontend → packs}/svgs/fire.svg +0 -0
- data/app/{frontend → packs}/svgs/game-board.svg +0 -0
- data/app/{frontend → packs}/svgs/globe.svg +0 -0
- data/app/{frontend → packs}/svgs/information-circle-sm.svg +0 -0
- data/app/{frontend → packs}/svgs/information-circle.svg +0 -0
- data/app/{frontend → packs}/svgs/library.svg +0 -0
- data/app/{frontend → packs}/svgs/photograph.svg +0 -0
- data/app/{frontend → packs}/svgs/play.svg +0 -0
- data/app/{frontend → packs}/svgs/plus-circle.svg +0 -0
- data/app/{frontend → packs}/svgs/plus.svg +0 -0
- data/app/{frontend → packs}/svgs/question-mark-circle.svg +0 -0
- data/app/{frontend → packs}/svgs/save.svg +0 -0
- data/app/{frontend → packs}/svgs/selector.svg +0 -0
- data/app/{frontend → packs}/svgs/sort-ascending.svg +0 -0
- data/app/{frontend → packs}/svgs/sort-descending.svg +0 -0
- data/app/{frontend → packs}/svgs/switch-horizontal.svg +0 -0
- data/app/{frontend → packs}/svgs/thumbs-down.svg +0 -0
- data/app/{frontend → packs}/svgs/thumbs-up.svg +0 -0
- data/app/{frontend → packs}/svgs/times.svg +0 -0
- data/app/{frontend → packs}/svgs/trash-sm.svg +0 -0
- data/app/{frontend → packs}/svgs/trash.svg +0 -0
- data/app/{frontend → packs}/svgs/view-grid-add.svg +0 -0
- data/app/{frontend → packs}/svgs/view-grid.svg +0 -0
- data/app/{frontend → packs}/svgs/view-list.svg +0 -0
- data/app/{frontend → packs}/svgs/x-circle.svg +0 -0
- data/app/views/avo/actions/show.html.erb +3 -39
- data/app/views/avo/attachments/show.html.erb +8 -1
- data/app/views/avo/base/_boolean_filter.html.erb +1 -0
- data/app/views/avo/base/_filters.html.erb +1 -0
- data/app/views/avo/base/_select_filter.html.erb +1 -0
- data/app/views/avo/partials/_paginator.html.erb +24 -5
- data/app/views/avo/relations/new.html.erb +5 -1
- data/app/views/layouts/avo/application.html.erb +0 -5
- data/avo.gemspec +31 -30
- data/bin/helpers.rb +0 -0
- data/bin/rspec +1 -0
- data/bin/webpack +3 -1
- data/config/initializers/inline_svg.rb +1 -1
- data/config/initializers/pagy.rb +1 -1
- data/config/routes.rb +12 -12
- data/config/spring.rb +5 -5
- data/config/webpack/aliases.js +1 -1
- data/config/webpack/base.js +14 -0
- data/config/webpack/development.js +2 -2
- data/config/webpack/production.js +2 -2
- data/config/webpack/test.js +2 -2
- data/config/webpacker.yml +5 -44
- data/db/factories.rb +4 -5
- data/lib/avo.rb +6 -6
- data/lib/avo/action_model.rb +20 -0
- data/lib/avo/app.rb +18 -60
- data/lib/avo/base_action.rb +55 -52
- data/lib/avo/base_resource.rb +66 -95
- data/lib/avo/configuration.rb +16 -22
- data/lib/avo/engine.rb +30 -14
- data/lib/avo/fields/badge_field.rb +2 -2
- data/lib/avo/fields/base_field.rb +38 -29
- data/lib/avo/fields/belongs_to_field.rb +13 -12
- data/lib/avo/fields/boolean_field.rb +4 -4
- data/lib/avo/fields/boolean_group_field.rb +3 -3
- data/lib/avo/fields/code_field.rb +4 -4
- data/lib/avo/fields/country_field.rb +2 -2
- data/lib/avo/fields/currency_field.rb +3 -3
- data/lib/avo/fields/date_field.rb +3 -3
- data/lib/avo/fields/date_time_field.rb +2 -2
- data/lib/avo/fields/external_image_field.rb +2 -2
- data/lib/avo/fields/field_extensions/has_field_name.rb +2 -9
- data/lib/avo/fields/field_extensions/visible_in_different_views.rb +34 -33
- data/lib/avo/fields/file_field.rb +1 -1
- data/lib/avo/fields/files_field.rb +2 -2
- data/lib/avo/fields/gravatar_field.rb +10 -10
- data/lib/avo/fields/has_and_belongs_to_many_field.rb +1 -1
- data/lib/avo/fields/has_many_field.rb +1 -1
- data/lib/avo/fields/has_one_field.rb +2 -2
- data/lib/avo/fields/heading_field.rb +2 -2
- data/lib/avo/fields/hidden_field.rb +1 -1
- data/lib/avo/fields/id_field.rb +3 -3
- data/lib/avo/fields/key_value_field.rb +12 -12
- data/lib/avo/fields/markdown_field.rb +2 -2
- data/lib/avo/fields/number_field.rb +3 -3
- data/lib/avo/fields/password_field.rb +1 -1
- data/lib/avo/fields/select_field.rb +8 -12
- data/lib/avo/fields/status_field.rb +4 -4
- data/lib/avo/fields/text_field.rb +2 -2
- data/lib/avo/fields/textarea_field.rb +2 -2
- data/lib/avo/fields/trix_field.rb +1 -1
- data/lib/avo/fields_collector.rb +30 -0
- data/lib/avo/filters/base_filter.rb +6 -6
- data/lib/avo/filters/boolean_filter.rb +1 -1
- data/lib/avo/filters/select_filter.rb +1 -1
- data/lib/avo/grid_collector.rb +39 -0
- data/lib/avo/has_context.rb +7 -0
- data/lib/avo/licensing/h_q.rb +56 -55
- data/lib/avo/licensing/license.rb +5 -5
- data/lib/avo/licensing/license_manager.rb +4 -4
- data/lib/avo/licensing/null_license.rb +2 -2
- data/lib/avo/licensing/pro_license.rb +1 -1
- data/lib/avo/loaders/fields_loader.rb +4 -4
- data/lib/avo/services/authorization_service.rb +2 -2
- data/lib/avo/services/panel_service.rb +4 -4
- data/lib/avo/version.rb +1 -1
- data/lib/generators/avo/action_generator.rb +4 -4
- data/lib/generators/avo/controller_generator.rb +4 -4
- data/lib/generators/avo/filter_generator.rb +5 -5
- data/lib/generators/avo/install_generator.rb +8 -8
- data/lib/generators/avo/locales_generator.rb +5 -5
- data/lib/generators/avo/partials_generator.rb +4 -4
- data/lib/generators/avo/resource_generator.rb +5 -5
- data/lib/generators/avo/templates/action.tt +1 -5
- data/lib/generators/avo/templates/resource/resource.tt +3 -13
- data/lib/tasks/avo_tasks.rake +0 -60
- data/public/avo-packs/css/application-4e16d6a6.css +5975 -0
- data/public/avo-packs/css/application-4e16d6a6.css.br +0 -0
- data/public/avo-packs/css/application-4e16d6a6.css.gz +0 -0
- data/public/avo-packs/css/application-4e16d6a6.css.map +1 -0
- data/public/avo-packs/css/application-4e16d6a6.css.map.br +0 -0
- data/public/avo-packs/css/application-4e16d6a6.css.map.gz +0 -0
- data/public/avo-packs/js/219-9aa2b689f44613118203.chunk.js +2 -0
- data/public/avo-packs/js/219-9aa2b689f44613118203.chunk.js.br +0 -0
- data/public/avo-packs/js/219-9aa2b689f44613118203.chunk.js.gz +0 -0
- data/public/avo-packs/js/219-9aa2b689f44613118203.chunk.js.map +1 -0
- data/public/avo-packs/js/219-9aa2b689f44613118203.chunk.js.map.br +0 -0
- data/public/avo-packs/js/219-9aa2b689f44613118203.chunk.js.map.gz +0 -0
- data/public/avo-packs/js/application-8eb130a4688f2c667703.js +26 -0
- data/public/avo-packs/js/{application-8849c6e2c8f75d55c666.js.LICENSE.txt → application-8eb130a4688f2c667703.js.LICENSE.txt} +17 -17
- data/public/avo-packs/js/application-8eb130a4688f2c667703.js.br +0 -0
- data/public/avo-packs/js/application-8eb130a4688f2c667703.js.gz +0 -0
- data/public/avo-packs/js/application-8eb130a4688f2c667703.js.map +1 -0
- data/public/avo-packs/js/application-8eb130a4688f2c667703.js.map.br +0 -0
- data/public/avo-packs/js/application-8eb130a4688f2c667703.js.map.gz +0 -0
- data/public/avo-packs/manifest.json +46 -23
- data/public/avo-packs/media/{fonts/nunito-v16-latin-regular-00fbd8a72a3708b8314cce5f0515640e.svg → images/13ae283c0d7cc04efe7e.svg} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-regular-00fbd8a72a3708b8314cce5f0515640e.svg.br → images/13ae283c0d7cc04efe7e.svg.br} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-regular-00fbd8a72a3708b8314cce5f0515640e.svg.gz → images/13ae283c0d7cc04efe7e.svg.gz} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-700-35bd1c96bc2e402cf22ea812ae067995.svg → images/195026a50008c53526ef.svg} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-700-35bd1c96bc2e402cf22ea812ae067995.svg.br → images/195026a50008c53526ef.svg.br} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-700-35bd1c96bc2e402cf22ea812ae067995.svg.gz → images/195026a50008c53526ef.svg.gz} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-regular-cb632c9fe211ba2c2bf1564c9a9295cc.woff → images/1f30e08faa7c60d1f7ac.woff} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-700-2cc22f9c0cf217cbfc371f3b74992305.ttf → images/1fd17dabf6b7d2b15348.ttf} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-700-2cc22f9c0cf217cbfc371f3b74992305.ttf.br → images/1fd17dabf6b7d2b15348.ttf.br} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-700-2cc22f9c0cf217cbfc371f3b74992305.ttf.gz → images/1fd17dabf6b7d2b15348.ttf.gz} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-regular-bcf84d6cb8a0ac214c8c14ba9af834f3.woff2 → images/39a18f443d434999b89b.woff2} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-700-412073df419ad5f6f8f2ea76eb4aced9.woff2 → images/4ad349571e28bb59c5a5.woff2} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-regular-2fae1e2418251b68fe5d0505ab93dd5c.eot → images/57a5470848663767abbf.eot} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-regular-df8c4bee41b6ca0ed2b7b71456ed7fbb.ttf → images/b2e4cf0fab6c8ca66b7f.ttf} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-regular-df8c4bee41b6ca0ed2b7b71456ed7fbb.ttf.br → images/b2e4cf0fab6c8ca66b7f.ttf.br} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-regular-df8c4bee41b6ca0ed2b7b71456ed7fbb.ttf.gz → images/b2e4cf0fab6c8ca66b7f.ttf.gz} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-700-df7e79af617f98cd3b95d320e8b2a1af.eot → images/b78d61ab7e046de8c156.eot} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-700-7c472b19cb573f537bad8ef62ca917ac.woff → images/c9ab29becb76ddab01d0.woff} +0 -0
- data/public/avo-packs/media/images/{logo-edf8d8d0d263e0c1f73bb32a222d9991.png → f1b4befac91a3336db9a.png} +0 -0
- metadata +144 -127
- data/app/frontend/css/components/code.css +0 -27
- data/app/views/layouts/avo/application_vue.html.erb +0 -61
- data/config/webpack/environment.js +0 -18
- data/db/migrate/20210305082639_add_url_to_teams.rb +0 -5
- data/public/avo-packs/css/application-c75ac28c.css +0 -6
- 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 +0 -2
- 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 +0 -1
- 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 +0 -26
- 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 +0 -1
- 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.br +0 -0
- data/public/avo-packs/manifest.json.gz +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
<td class="px-4 py-2 leading-tight whitespace-nowrap h-12 text-blue-gray-800 <%= @classes %>" data-field-id="<%= @field.id %>">
|
1
|
+
<td class="px-4 py-2 leading-tight whitespace-nowrap h-12 text-blue-gray-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 %>
|
@@ -4,7 +4,7 @@ class Avo::Index::FieldWrapperComponent < ViewComponent::Base
|
|
4
4
|
def initialize(field: nil, dash_if_blank: true, **args)
|
5
5
|
@field = field
|
6
6
|
@dash_if_blank = dash_if_blank
|
7
|
-
@classes = args[:class].present? ? args[:class] :
|
7
|
+
@classes = args[:class].present? ? args[:class] : ""
|
8
8
|
@args = args
|
9
9
|
end
|
10
10
|
end
|
@@ -5,7 +5,8 @@
|
|
5
5
|
size: @field.size,
|
6
6
|
rounded: @field.rounded,
|
7
7
|
link_to_resource: @field.link_to_resource,
|
8
|
-
link: helpers.resource_path(@resource.model)
|
8
|
+
link: helpers.resource_path(@resource.model),
|
9
|
+
title: t('avo.view_item', { item: @resource.name}).humanize
|
9
10
|
)
|
10
11
|
%>
|
11
12
|
<% end %>
|
@@ -6,5 +6,5 @@
|
|
6
6
|
path = helpers.resource_path(@resource.model)
|
7
7
|
end
|
8
8
|
%>
|
9
|
-
<% link_to_if (@field.link_to_resource or Avo.configuration.id_links_to_resource), @field.value, path %>
|
9
|
+
<% link_to_if (@field.link_to_resource or Avo.configuration.id_links_to_resource), @field.value, path, title: t('avo.view_item', { item: @resource.name}).humanize %>
|
10
10
|
<% end %>
|
@@ -5,8 +5,8 @@
|
|
5
5
|
<%== item_selector_input floating: true, size: :lg %>
|
6
6
|
|
7
7
|
<% if cover.respond_to? :to_image %>
|
8
|
-
|
9
|
-
<% elsif cover.type == '
|
8
|
+
<%= link_to_if cover.link_to_resource, image_tag(cover.to_image, class: 'absolute h-full w-full object-cover'), helpers.resource_path(@resource.model), class: 'absolute h-full w-full object-cover', title: title.value %>
|
9
|
+
<% elsif cover.type == 'file' %>
|
10
10
|
<% if cover.value.attached? && cover.value.representable? %>
|
11
11
|
<%= link_to_if cover.link_to_resource, image_tag(cover.variant(resize_to_limit: [480, 480]), class: 'absolute h-full w-full object-cover'), helpers.resource_path(@resource.model), class: 'absolute h-full w-full object-cover', title: title.value %>
|
12
12
|
<% else %>
|
@@ -11,15 +11,16 @@ class Avo::Index::GridItemComponent < ViewComponent::Base
|
|
11
11
|
end
|
12
12
|
|
13
13
|
private
|
14
|
-
def cover
|
15
|
-
@grid_fields[:cover].first
|
16
|
-
end
|
17
14
|
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
def cover
|
16
|
+
@grid_fields.cover_field
|
17
|
+
end
|
18
|
+
|
19
|
+
def title
|
20
|
+
@grid_fields.title_field
|
21
|
+
end
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
|
23
|
+
def body
|
24
|
+
@grid_fields.body_field
|
25
|
+
end
|
25
26
|
end
|
@@ -23,7 +23,9 @@
|
|
23
23
|
<% end %>
|
24
24
|
|
25
25
|
<% if can_detach? %>
|
26
|
-
<%= form_with url: helpers.resource_detach_path(params[:resource_name], params[:id], params[:related_name], @resource.model.id), method: :delete, html: {
|
26
|
+
<%= form_with url: helpers.resource_detach_path(params[:resource_name], params[:id], params[:related_name], @resource.model.id), method: :delete, html: {
|
27
|
+
'data-turbo-frame': params[:turbo_frame]
|
28
|
+
} do |form| %>
|
27
29
|
<%= form.button helpers.svg('trash-sm', class: 'text-gray-400 h-6 hover:text-gray-600'),
|
28
30
|
title: t('avo.detach_item', { item: @resource.model.model_name.name.downcase }).capitalize,
|
29
31
|
type: :submit,
|
@@ -34,12 +36,16 @@
|
|
34
36
|
'tippy': 'tooltip',
|
35
37
|
}
|
36
38
|
%>
|
37
|
-
<%= hidden_field_tag :
|
39
|
+
<%= hidden_field_tag :turbo_frame, params[:turbo_frame], id: "turbo_frame_destroy_#{@resource.model.id}" if params[:turbo_frame] %>
|
40
|
+
<%= hidden_field_tag :referrer, request.fullpath, id: "referrer_destroy_#{@resource.model.id}" if params[:turbo_frame] %>
|
41
|
+
<%#= hidden_field_tag :referrer, request.fullpath, id: "referrer_detach_#{@resource.model.id}" if params[:via_resource_class] %>
|
38
42
|
<% end %>
|
39
43
|
<% end %>
|
40
44
|
|
41
45
|
<% if can_delete? %>
|
42
|
-
<%= form_with url: helpers.resource_path(@resource.model), method: :delete, html: {
|
46
|
+
<%= form_with url: helpers.resource_path(@resource.model), method: :delete, html: {
|
47
|
+
'data-turbo-frame': params[:turbo_frame]
|
48
|
+
} do |form| %>
|
43
49
|
<%= form.button helpers.svg('trash', class: 'text-gray-400 h-6 hover:text-gray-600'),
|
44
50
|
title: t('avo.delete_item', { item: @resource.model.model_name.name.downcase }).capitalize,
|
45
51
|
type: :submit,
|
@@ -50,7 +56,9 @@
|
|
50
56
|
'tippy': 'tooltip',
|
51
57
|
}
|
52
58
|
%>
|
53
|
-
<%= form.hidden_field :
|
59
|
+
<%= form.hidden_field :view_type, value: params[:view_type], id: "turbo_view_type_#{@resource.model.id}" if params[:view_type] %>
|
60
|
+
<%= form.hidden_field :turbo_frame, value: params[:turbo_frame], id: "turbo_frame_destroy_#{@resource.model.id}" if params[:turbo_frame] %>
|
61
|
+
<%= form.hidden_field :referrer, value: request.fullpath, id: "referrer_destroy_#{@resource.model.id}" if params[:turbo_frame] %>
|
54
62
|
<% end %>
|
55
63
|
<% end %>
|
56
64
|
</div>
|
@@ -9,8 +9,8 @@ class Avo::Index::ResourceControlsComponent < Avo::ResourceComponent
|
|
9
9
|
|
10
10
|
def can_detach?
|
11
11
|
@reflection.present? &&
|
12
|
-
|
13
|
-
|
12
|
+
@resource.model.present? &&
|
13
|
+
(@reflection.is_a?(::ActiveRecord::Reflection::HasManyReflection) || @reflection.is_a?(::ActiveRecord::Reflection::ThroughReflection))
|
14
14
|
end
|
15
15
|
|
16
16
|
def can_edit?
|
@@ -10,11 +10,12 @@ class Avo::PanelComponent < ViewComponent::Base
|
|
10
10
|
end
|
11
11
|
|
12
12
|
private
|
13
|
-
def data_attributes
|
14
|
-
return if @data.blank?
|
15
13
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
def data_attributes
|
15
|
+
return if @data.blank?
|
16
|
+
|
17
|
+
@data.map do |key, value|
|
18
|
+
" data-#{key}=\"#{value}\""
|
19
|
+
end.join
|
20
|
+
end
|
20
21
|
end
|
@@ -8,7 +8,8 @@ class Avo::ResourceComponent < ViewComponent::Base
|
|
8
8
|
end
|
9
9
|
|
10
10
|
private
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
|
12
|
+
def simple_relation?
|
13
|
+
@reflection.is_a? ::ActiveRecord::Reflection::HasManyReflection
|
14
|
+
end
|
14
15
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div class="flex items-start leading-tight <%= @classes %> min-h-16" data-field-id="<%= @field.id %>">
|
1
|
+
<div class="flex items-start leading-tight <%= @classes %> min-h-16" data-field-id="<%= @field.id %>" data-field-type="<%= @field.type %>">
|
2
2
|
<div class="h-16 flex self-start items-center text-blue-gray-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 %>
|
@@ -4,12 +4,12 @@ class Avo::Show::FieldWrapperComponent < ViewComponent::Base
|
|
4
4
|
def initialize(field: nil, dash_if_blank: true, full_width: false, **args)
|
5
5
|
@field = field
|
6
6
|
@dash_if_blank = dash_if_blank
|
7
|
-
@classes = args[:class].present? ? args[:class] :
|
7
|
+
@classes = args[:class].present? ? args[:class] : ""
|
8
8
|
@args = args
|
9
9
|
@full_width = full_width
|
10
10
|
|
11
|
-
if @index != 0
|
12
|
-
@classes +=
|
11
|
+
if (@index != 0) || @displayed_in_modal
|
12
|
+
@classes += " border-t"
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -17,7 +17,8 @@ class Avo::Views::ResourceEditComponent < ViewComponent::Base
|
|
17
17
|
end
|
18
18
|
|
19
19
|
private
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
|
21
|
+
def via_resource?
|
22
|
+
params[:via_resource_class].present? && params[:via_resource_id].present?
|
23
|
+
end
|
23
24
|
end
|
@@ -13,7 +13,7 @@ class Avo::Views::ResourceIndexComponent < Avo::ResourceComponent
|
|
13
13
|
filters: [],
|
14
14
|
actions: [],
|
15
15
|
reflection: nil,
|
16
|
-
turbo_frame:
|
16
|
+
turbo_frame: "",
|
17
17
|
parent_model: nil
|
18
18
|
)
|
19
19
|
@resource = resource
|
@@ -63,7 +63,7 @@ class Avo::Views::ResourceIndexComponent < Avo::ResourceComponent
|
|
63
63
|
if @reflection.present?
|
64
64
|
path_args = {
|
65
65
|
via_relation_class: @parent_model.model_name,
|
66
|
-
via_resource_id: @parent_model.id
|
66
|
+
via_resource_id: @parent_model.id
|
67
67
|
}
|
68
68
|
|
69
69
|
if @reflection.inverse_of.present?
|
@@ -77,7 +77,7 @@ class Avo::Views::ResourceIndexComponent < Avo::ResourceComponent
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def attach_path
|
80
|
-
"#{Avo.configuration.root_path}#{request.env[
|
80
|
+
"#{Avo.configuration.root_path}#{request.env["PATH_INFO"]}/new"
|
81
81
|
end
|
82
82
|
|
83
83
|
def detach_path
|
@@ -85,9 +85,10 @@ class Avo::Views::ResourceIndexComponent < Avo::ResourceComponent
|
|
85
85
|
end
|
86
86
|
|
87
87
|
private
|
88
|
-
def simple_relation?
|
89
|
-
return @reflection.is_a? ::ActiveRecord::Reflection::HasManyReflection if @reflection.present?
|
90
88
|
|
91
|
-
|
92
|
-
|
89
|
+
def simple_relation?
|
90
|
+
return @reflection.is_a? ::ActiveRecord::Reflection::HasManyReflection if @reflection.present?
|
91
|
+
|
92
|
+
true
|
93
|
+
end
|
93
94
|
end
|
@@ -21,7 +21,8 @@ class Avo::Views::ResourceNewComponent < ViewComponent::Base
|
|
21
21
|
end
|
22
22
|
|
23
23
|
private
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
|
25
|
+
def via_resource?
|
26
|
+
params[:via_relation_class].present? && params[:via_resource_id].present?
|
27
|
+
end
|
27
28
|
end
|
@@ -18,8 +18,20 @@
|
|
18
18
|
<% end %>
|
19
19
|
|
20
20
|
<% if @resource.authorization.authorize_action(:destroy, raise_exception: false) %>
|
21
|
-
<%=
|
22
|
-
<%=
|
21
|
+
<%= form_with url: helpers.resource_path(@resource.model), method: :delete, html: { 'data-turbo-frame': params[:turbo_frame] } do |form| %>
|
22
|
+
<%= a_button title: t('avo.delete_item', { item: @resource.model.model_name.name.downcase }).capitalize,
|
23
|
+
color: 'red',
|
24
|
+
variant: 'outlined',
|
25
|
+
type: :submit,
|
26
|
+
data: {
|
27
|
+
confirm: t('avo.are_you_sure', { item: @resource.model.model_name.name.downcase }),
|
28
|
+
control: :destroy,
|
29
|
+
'resource-id': @resource.model.id,
|
30
|
+
'tippy': 'tooltip',
|
31
|
+
} do
|
32
|
+
%>
|
33
|
+
<%= svg 'trash' %> <%= t('avo.delete').capitalize %>
|
34
|
+
<% end %>
|
23
35
|
<% end %>
|
24
36
|
<% end %>
|
25
37
|
|
@@ -38,29 +38,29 @@ class Avo::Views::ResourceShowComponent < Avo::ResourceComponent
|
|
38
38
|
end
|
39
39
|
|
40
40
|
private
|
41
|
-
def via_resource?
|
42
|
-
params[:via_resource_class].present? and params[:via_resource_id].present?
|
43
|
-
end
|
44
41
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
@has_many_panels = []
|
49
|
-
@has_as_belongs_to_many_panels = []
|
42
|
+
def via_resource?
|
43
|
+
params[:via_resource_class].present? && params[:via_resource_id].present?
|
44
|
+
end
|
50
45
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
@has_many_panels << field
|
57
|
-
when 'Avo::Fields::HasAndBelongsToManyField'
|
58
|
-
@has_as_belongs_to_many_panels << field
|
59
|
-
else
|
60
|
-
@fields_by_panel[field.panel_name] ||= []
|
61
|
-
@fields_by_panel[field.panel_name] << field
|
62
|
-
end
|
63
|
-
end
|
46
|
+
def split_panel_fields
|
47
|
+
@fields_by_panel = {}
|
48
|
+
@has_one_panels = []
|
49
|
+
@has_many_panels = []
|
50
|
+
@has_as_belongs_to_many_panels = []
|
64
51
|
|
52
|
+
@resource.get_fields.each do |field|
|
53
|
+
case field.class.to_s
|
54
|
+
when "Avo::Fields::HasOneField"
|
55
|
+
@has_one_panels << field
|
56
|
+
when "Avo::Fields::HasManyField"
|
57
|
+
@has_many_panels << field
|
58
|
+
when "Avo::Fields::HasAndBelongsToManyField"
|
59
|
+
@has_as_belongs_to_many_panels << field
|
60
|
+
else
|
61
|
+
@fields_by_panel[field.panel_name] ||= []
|
62
|
+
@fields_by_panel[field.panel_name] << field
|
63
|
+
end
|
65
64
|
end
|
65
|
+
end
|
66
66
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require_dependency
|
1
|
+
require_dependency "avo/application_controller"
|
2
2
|
|
3
3
|
module Avo
|
4
4
|
class ActionsController < ApplicationController
|
@@ -6,61 +6,63 @@ module Avo
|
|
6
6
|
before_action :set_resource
|
7
7
|
before_action :set_action, only: [:show, :handle]
|
8
8
|
|
9
|
-
def show
|
9
|
+
def show
|
10
|
+
@model = ActionModel.new @action.get_attributes_for_action
|
11
|
+
end
|
10
12
|
|
11
13
|
def handle
|
12
|
-
resource_ids = action_params[:fields][:resource_ids].split(
|
14
|
+
resource_ids = action_params[:fields][:resource_ids].split(",").map(&:to_i)
|
13
15
|
models = @resource.model_class.find resource_ids
|
14
16
|
|
15
17
|
fields = action_params[:fields].select do |key, value|
|
16
|
-
key !=
|
18
|
+
key != "resource_ids"
|
17
19
|
end
|
18
20
|
|
19
|
-
performed_action = @action.handle_action(
|
21
|
+
performed_action = @action.handle_action(models: models, fields: fields)
|
20
22
|
|
21
23
|
respond performed_action.response
|
22
24
|
end
|
23
25
|
|
24
26
|
private
|
25
|
-
def action_params
|
26
|
-
params.permit(:resource_name, :action_id, fields: {})
|
27
|
-
end
|
28
27
|
|
29
|
-
|
30
|
-
|
28
|
+
def action_params
|
29
|
+
params.permit(:resource_name, :action_id, fields: {})
|
30
|
+
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
end
|
32
|
+
def set_action
|
33
|
+
action_class = params[:action_id].gsub("avo_actions_", "").classify.safe_constantize
|
35
34
|
|
36
|
-
|
37
|
-
|
35
|
+
if params[:id].present?
|
36
|
+
model = @resource.model_class.find params[:id]
|
38
37
|
end
|
39
38
|
|
40
|
-
|
41
|
-
|
42
|
-
response[:message_type] ||= :notice
|
43
|
-
response[:message] ||= I18n.t('avo.action_ran_successfully')
|
39
|
+
@action = action_class.new(model: model, resource: resource, user: _current_user)
|
40
|
+
end
|
44
41
|
|
45
|
-
|
46
|
-
|
47
|
-
|
42
|
+
def respond(response)
|
43
|
+
response[:type] ||= :reload
|
44
|
+
response[:message_type] ||= :notice
|
45
|
+
response[:message] ||= I18n.t("avo.action_ran_successfully")
|
48
46
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
path = response[:path]
|
47
|
+
if response[:type] == :download
|
48
|
+
return send_data response[:path], filename: response[:filename]
|
49
|
+
end
|
53
50
|
|
54
|
-
|
55
|
-
|
56
|
-
|
51
|
+
respond_to do |format|
|
52
|
+
format.html do
|
53
|
+
if response[:type] == :redirect
|
54
|
+
path = response[:path]
|
57
55
|
|
58
|
-
|
59
|
-
|
60
|
-
redirect_back fallback_location: resources_path(@resource.model_class), "#{response[:message_type]}": response[:message]
|
56
|
+
if path.respond_to? :call
|
57
|
+
path = instance_eval(&path)
|
61
58
|
end
|
59
|
+
|
60
|
+
redirect_to path, "#{response[:message_type]}": response[:message]
|
61
|
+
elsif response[:type] == :reload
|
62
|
+
redirect_back fallback_location: resources_path(@resource.model_class), "#{response[:message_type]}": response[:message]
|
62
63
|
end
|
63
64
|
end
|
64
65
|
end
|
66
|
+
end
|
65
67
|
end
|
66
68
|
end
|