avo 1.4.0.pre.1 → 1.4.4.pre.1
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 +2 -0
- data/Gemfile.lock +10 -4
- data/README.md +5 -4
- data/app/components/avo/fields/badge_field/index_component.html.erb +3 -0
- data/app/components/avo/fields/badge_field/index_component.rb +4 -0
- data/app/components/avo/fields/badge_field/show_component.html.erb +3 -0
- data/app/components/avo/fields/badge_field/show_component.rb +4 -0
- data/app/components/avo/{edit/fields/belongs_to_field_component.html.erb → fields/belongs_to_field/edit_component.html.erb} +0 -0
- data/app/components/avo/{edit/fields/belongs_to_field_component.rb → fields/belongs_to_field/edit_component.rb} +1 -1
- data/app/components/avo/{index/fields/belongs_to_field_component.html.erb → fields/belongs_to_field/index_component.html.erb} +0 -0
- data/app/components/avo/fields/belongs_to_field/index_component.rb +4 -0
- data/app/components/avo/{show/fields/belongs_to_field_component.html.erb → fields/belongs_to_field/show_component.html.erb} +0 -0
- data/app/components/avo/fields/belongs_to_field/show_component.rb +4 -0
- data/app/components/avo/{edit/fields/boolean_field_component.html.erb → fields/boolean_field/edit_component.html.erb} +0 -0
- data/app/components/avo/fields/boolean_field/edit_component.rb +4 -0
- data/app/components/avo/fields/boolean_field/index_component.html.erb +3 -0
- data/app/components/avo/fields/boolean_field/index_component.rb +4 -0
- data/app/components/avo/{show/fields/boolean_field_component.html.erb → fields/boolean_field/show_component.html.erb} +1 -1
- data/app/components/avo/fields/boolean_field/show_component.rb +4 -0
- data/app/components/avo/{edit/fields/boolean_group_field_component.html.erb → fields/boolean_group_field/edit_component.html.erb} +0 -0
- data/app/components/avo/fields/boolean_group_field/edit_component.rb +4 -0
- data/app/components/avo/fields/boolean_group_field/index_component.html.erb +3 -0
- data/app/components/avo/fields/boolean_group_field/index_component.rb +4 -0
- data/app/components/avo/fields/boolean_group_field/show_component.html.erb +3 -0
- data/app/components/avo/fields/boolean_group_field/show_component.rb +4 -0
- data/app/components/avo/{edit/fields/code_field_component.html.erb → fields/code_field/edit_component.html.erb} +0 -0
- data/app/components/avo/fields/code_field/edit_component.rb +4 -0
- data/app/components/avo/{show/fields/code_field_component.html.erb → fields/code_field/show_component.html.erb} +0 -0
- data/app/components/avo/fields/code_field/show_component.rb +4 -0
- data/app/components/avo/{common → fields/common}/badge_viewer_component.html.erb +0 -0
- data/app/components/avo/{common → fields/common}/badge_viewer_component.rb +1 -1
- data/app/components/avo/{common → fields/common}/boolean_check_component.html.erb +0 -0
- data/app/components/avo/{common → fields/common}/boolean_check_component.rb +1 -1
- data/app/components/avo/{common → fields/common}/boolean_group_component.html.erb +1 -1
- data/app/components/avo/{common → fields/common}/boolean_group_component.rb +1 -1
- data/app/components/avo/fields/common/files_list_viewer_component.html.erb +5 -0
- data/app/components/avo/{common → fields/common}/files_list_viewer_component.rb +1 -1
- data/app/components/avo/{common → fields/common}/gravatar_viewer_component.html.erb +0 -0
- data/app/components/avo/{common → fields/common}/gravatar_viewer_component.rb +1 -1
- data/app/components/avo/{common → fields/common}/heading_component.html.erb +0 -0
- data/app/components/avo/{common → fields/common}/heading_component.rb +1 -1
- data/app/components/avo/{common → fields/common}/key_value_component.html.erb +0 -0
- data/app/components/avo/{common → fields/common}/key_value_component.rb +1 -1
- data/app/components/avo/{common → fields/common}/multiple_file_viewer_component.html.erb +0 -0
- data/app/components/avo/{common → fields/common}/multiple_file_viewer_component.rb +1 -1
- data/app/components/avo/{common → fields/common}/single_file_viewer_component.html.erb +0 -0
- data/app/components/avo/{common → fields/common}/single_file_viewer_component.rb +1 -1
- data/app/components/avo/fields/common/status_viewer_component.html.erb +18 -0
- data/app/components/avo/{common → fields/common}/status_viewer_component.rb +1 -1
- data/app/components/avo/{edit/fields/country_field_component.html.erb → fields/country_field/edit_component.html.erb} +0 -0
- data/app/components/avo/fields/country_field/edit_component.rb +4 -0
- data/app/components/avo/{index/fields/country_field_component.html.erb → fields/country_field/index_component.html.erb} +0 -0
- data/app/components/avo/fields/country_field/index_component.rb +4 -0
- data/app/components/avo/{show/fields/country_field_component.html.erb → fields/country_field/show_component.html.erb} +0 -0
- data/app/components/avo/fields/country_field/show_component.rb +4 -0
- data/app/components/avo/{edit/fields/date_field_component.html.erb → fields/date_field/edit_component.html.erb} +0 -0
- data/app/components/avo/fields/date_field/edit_component.rb +4 -0
- data/app/components/avo/{index/fields/date_field_component.html.erb → fields/date_field/index_component.html.erb} +0 -0
- data/app/components/avo/fields/date_field/index_component.rb +4 -0
- data/app/components/avo/{show/fields/date_field_component.html.erb → fields/date_field/show_component.html.erb} +0 -0
- data/app/components/avo/fields/date_field/show_component.rb +4 -0
- data/app/components/avo/{edit/fields/date_time_field_component.html.erb → fields/date_time_field/edit_component.html.erb} +0 -0
- data/app/components/avo/fields/date_time_field/edit_component.rb +4 -0
- data/app/components/avo/{index/fields/date_time_field_component.html.erb → fields/date_time_field/index_component.html.erb} +0 -0
- data/app/components/avo/fields/date_time_field/index_component.rb +4 -0
- data/app/components/avo/{show/fields/date_time_field_component.html.erb → fields/date_time_field/show_component.html.erb} +0 -0
- data/app/components/avo/fields/date_time_field/show_component.rb +4 -0
- data/app/components/avo/{edit/fields/field_component.rb → fields/edit_component.rb} +1 -1
- data/app/components/avo/{edit/fields/external_image_field_component.html.erb → fields/external_image_field/edit_component.html.erb} +0 -0
- data/app/components/avo/fields/external_image_field/edit_component.rb +4 -0
- data/app/components/avo/{index/fields/external_image_field_component.html.erb → fields/external_image_field/index_component.html.erb} +0 -0
- data/app/components/avo/fields/external_image_field/index_component.rb +4 -0
- data/app/components/avo/{show/fields/external_image_field_component.html.erb → fields/external_image_field/show_component.html.erb} +0 -0
- data/app/components/avo/fields/external_image_field/show_component.rb +4 -0
- data/app/components/avo/{edit/fields/file_field_component.html.erb → fields/file_field/edit_component.html.erb} +1 -1
- data/app/components/avo/fields/file_field/edit_component.rb +4 -0
- data/app/components/avo/{index/fields/file_field_component.html.erb → fields/file_field/index_component.html.erb} +1 -1
- data/app/components/avo/fields/file_field/index_component.rb +4 -0
- data/app/components/avo/fields/file_field/show_component.html.erb +3 -0
- data/app/components/avo/fields/file_field/show_component.rb +4 -0
- data/app/components/avo/{edit/fields/files_field_component.html.erb → fields/files_field/edit_component.html.erb} +1 -1
- data/app/components/avo/fields/files_field/edit_component.rb +4 -0
- data/app/components/avo/{index/fields/files_field_component.html.erb → fields/files_field/index_component.html.erb} +0 -0
- data/app/components/avo/fields/files_field/index_component.rb +4 -0
- data/app/components/avo/fields/files_field/show_component.html.erb +3 -0
- data/app/components/avo/fields/files_field/show_component.rb +4 -0
- data/app/components/avo/{index/fields/gravatar_field_component.html.erb → fields/gravatar_field/index_component.html.erb} +2 -2
- data/app/components/avo/fields/gravatar_field/index_component.rb +4 -0
- data/app/components/avo/{show/fields/gravatar_field_component.html.erb → fields/gravatar_field/show_component.html.erb} +1 -1
- data/app/components/avo/fields/gravatar_field/show_component.rb +4 -0
- data/app/components/avo/{show/fields/has_many_field_component.html.erb → fields/has_many_field/show_component.html.erb} +0 -0
- data/app/components/avo/fields/has_many_field/show_component.rb +4 -0
- data/app/components/avo/{index/fields/has_one_field_component.html.erb → fields/has_one_field/index_component.html.erb} +0 -0
- data/app/components/avo/fields/has_one_field/index_component.rb +4 -0
- data/app/components/avo/{show/fields/has_one_field_component.html.erb → fields/has_one_field/show_component.html.erb} +0 -0
- data/app/components/avo/fields/has_one_field/show_component.rb +5 -0
- data/app/components/avo/{show/fields/heading_field_component.html.erb → fields/heading_field/edit_component.html.erb} +1 -1
- data/app/components/avo/fields/heading_field/edit_component.rb +4 -0
- data/app/components/avo/{edit/fields/heading_field_component.html.erb → fields/heading_field/show_component.html.erb} +1 -1
- data/app/components/avo/fields/heading_field/show_component.rb +4 -0
- data/app/components/avo/{edit/fields/hidden_field_component.html.erb → fields/hidden_field/edit_component.html.erb} +0 -0
- data/app/components/avo/fields/hidden_field/edit_component.rb +4 -0
- data/app/components/avo/{edit/fields/id_field_component.html.erb → fields/id_field/edit_component.html.erb} +0 -0
- data/app/components/avo/fields/id_field/edit_component.rb +4 -0
- data/app/components/avo/fields/id_field/index_component.html.erb +3 -0
- data/app/components/avo/fields/id_field/index_component.rb +4 -0
- data/app/components/avo/{show/fields/id_field_component.html.erb → fields/id_field/show_component.html.erb} +0 -0
- data/app/components/avo/fields/id_field/show_component.rb +4 -0
- data/app/components/avo/fields/index_component.rb +20 -0
- data/app/components/avo/{edit/fields/key_value_field_component.html.erb → fields/key_value_field/edit_component.html.erb} +1 -1
- data/app/components/avo/fields/key_value_field/edit_component.rb +4 -0
- data/app/components/avo/{show/fields/key_value_field_component.html.erb → fields/key_value_field/show_component.html.erb} +1 -1
- data/app/components/avo/fields/key_value_field/show_component.rb +4 -0
- data/app/components/avo/{edit/fields/markdown_field_component.html.erb → fields/markdown_field/edit_component.html.erb} +0 -0
- data/app/components/avo/fields/markdown_field/edit_component.rb +4 -0
- data/app/components/avo/{show/fields/markdown_field_component.html.erb → fields/markdown_field/show_component.html.erb} +1 -1
- data/app/components/avo/fields/markdown_field/show_component.rb +4 -0
- data/app/components/avo/{edit/fields/number_field_component.html.erb → fields/number_field/edit_component.html.erb} +3 -3
- data/app/components/avo/fields/number_field/edit_component.rb +4 -0
- data/app/components/avo/{index/fields/number_field_component.html.erb → fields/number_field/index_component.html.erb} +0 -0
- data/app/components/avo/fields/number_field/index_component.rb +4 -0
- data/app/components/avo/{show/fields/number_field_component.html.erb → fields/number_field/show_component.html.erb} +0 -0
- data/app/components/avo/fields/number_field/show_component.rb +4 -0
- data/app/components/avo/{edit/fields/password_field_component.html.erb → fields/password_field/edit_component.html.erb} +0 -0
- data/app/components/avo/fields/password_field/edit_component.rb +4 -0
- data/app/components/avo/fields/progress_bar_field/edit_component.html.erb +26 -0
- data/app/components/avo/fields/progress_bar_field/edit_component.rb +4 -0
- data/app/components/avo/fields/progress_bar_field/index_component.html.erb +8 -0
- data/app/components/avo/fields/progress_bar_field/index_component.rb +4 -0
- data/app/components/avo/fields/progress_bar_field/show_component.html.erb +8 -0
- data/app/components/avo/fields/progress_bar_field/show_component.rb +4 -0
- data/app/components/avo/{edit/fields/select_field_component.html.erb → fields/select_field/edit_component.html.erb} +0 -0
- data/app/components/avo/fields/select_field/edit_component.rb +4 -0
- data/app/components/avo/{index/fields/select_field_component.html.erb → fields/select_field/index_component.html.erb} +0 -0
- data/app/components/avo/fields/select_field/index_component.rb +4 -0
- data/app/components/avo/{show/fields/select_field_component.html.erb → fields/select_field/show_component.html.erb} +0 -0
- data/app/components/avo/fields/select_field/show_component.rb +4 -0
- data/app/components/avo/{show/fields/field_component.rb → fields/show_component.rb} +1 -1
- data/app/components/avo/{edit/fields/status_field_component.html.erb → fields/status_field/edit_component.html.erb} +0 -0
- data/app/components/avo/fields/status_field/edit_component.rb +4 -0
- data/app/components/avo/fields/status_field/index_component.html.erb +3 -0
- data/app/components/avo/fields/status_field/index_component.rb +4 -0
- data/app/components/avo/fields/status_field/show_component.html.erb +3 -0
- data/app/components/avo/fields/status_field/show_component.rb +4 -0
- data/app/components/avo/{edit/fields/text_field_component.html.erb → fields/text_field/edit_component.html.erb} +0 -0
- data/app/components/avo/fields/text_field/edit_component.rb +4 -0
- data/app/components/avo/fields/text_field/index_component.html.erb +3 -0
- data/app/components/avo/fields/text_field/index_component.rb +4 -0
- data/app/components/avo/{show/fields/text_field_component.html.erb → fields/text_field/show_component.html.erb} +0 -0
- data/app/components/avo/fields/text_field/show_component.rb +4 -0
- data/app/components/avo/{edit/fields/textarea_field_component.html.erb → fields/textarea_field/edit_component.html.erb} +1 -1
- data/app/components/avo/fields/textarea_field/edit_component.rb +4 -0
- data/app/components/avo/{show/fields/textarea_field_component.html.erb → fields/textarea_field/show_component.html.erb} +0 -0
- data/app/components/avo/fields/textarea_field/show_component.rb +4 -0
- data/app/components/avo/{edit/fields/trix_field_component.html.erb → fields/trix_field/edit_component.html.erb} +1 -2
- data/app/components/avo/fields/trix_field/edit_component.rb +4 -0
- data/app/components/avo/{show/fields/trix_field_component.html.erb → fields/trix_field/show_component.html.erb} +0 -0
- data/app/components/avo/fields/trix_field/show_component.rb +4 -0
- data/app/components/avo/index/resource_controls_component.html.erb +2 -3
- data/app/components/avo/index/table_row_component.html.erb +1 -1
- data/app/components/avo/panel_component.html.erb +1 -1
- data/app/components/avo/panel_component.rb +4 -4
- data/app/components/avo/views/resource_edit_component.html.erb +2 -2
- data/app/components/avo/views/resource_index_component.html.erb +6 -6
- data/app/components/avo/views/resource_new_component.html.erb +2 -2
- data/app/components/avo/views/resource_show_component.html.erb +5 -5
- data/app/controllers/avo/application_controller.rb +14 -7
- data/app/controllers/avo/base_controller.rb +26 -2
- data/app/controllers/avo/home_controller.rb +1 -1
- data/app/controllers/avo/relations_controller.rb +1 -1
- data/app/controllers/avo/search_controller.rb +50 -35
- data/app/helpers/avo/resources_helper.rb +0 -44
- data/app/packs/entrypoints/application.css +3 -1
- data/app/packs/entrypoints/application.js +3 -0
- data/app/packs/js/controllers/fields/key_value_controller.js +0 -1
- data/app/packs/js/controllers/search_controller.js +120 -0
- data/app/packs/js/helpers/debounce_promise.js +13 -0
- data/app/packs/stylesheets/components/progress.css +13 -0
- data/app/packs/stylesheets/components/status.css +31 -20
- data/app/packs/stylesheets/search.css +79 -0
- data/app/packs/svgs/check-circle-sm.svg +3 -0
- data/app/packs/svgs/x-circle-sm.svg +3 -0
- data/app/views/avo/actions/show.html.erb +1 -1
- data/app/views/avo/partials/_global_search.html.erb +17 -0
- data/app/views/avo/partials/_profile_dropdown.html.erb +19 -0
- data/app/views/avo/partials/_resource_search.html.erb +10 -0
- data/app/views/layouts/avo/application.html.erb +7 -6
- data/avo.gemspec +2 -1
- data/config/routes.rb +2 -6
- data/db/factories.rb +3 -0
- data/db/migrate/20210421064037_add_color_to_teams.rb +5 -0
- data/db/migrate/20210423075924_add_progress_to_projects.rb +5 -0
- data/lib/avo/app.rb +12 -21
- data/lib/avo/base_resource.rb +91 -7
- data/lib/avo/configuration.rb +3 -1
- data/lib/avo/engine.rb +1 -0
- data/lib/avo/fields/badge_field.rb +4 -6
- data/lib/avo/fields/base_field.rb +68 -83
- data/lib/avo/fields/belongs_to_field.rb +11 -11
- data/lib/avo/fields/boolean_field.rb +2 -7
- data/lib/avo/fields/boolean_group_field.rb +2 -7
- data/lib/avo/fields/code_field.rb +3 -7
- data/lib/avo/fields/country_field.rb +3 -6
- data/lib/avo/fields/currency_field.rb +4 -13
- data/lib/avo/fields/date_field.rb +2 -8
- data/lib/avo/fields/date_time_field.rb +2 -3
- data/lib/avo/fields/external_image_field.rb +3 -7
- data/lib/avo/fields/file_field.rb +8 -8
- data/lib/avo/fields/files_field.rb +6 -8
- data/lib/avo/fields/gravatar_field.rb +6 -9
- data/lib/avo/fields/has_and_belongs_to_many_field.rb +6 -7
- data/lib/avo/fields/has_many_field.rb +3 -9
- data/lib/avo/fields/has_one_field.rb +3 -8
- data/lib/avo/fields/heading_field.rb +10 -8
- data/lib/avo/fields/hidden_field.rb +2 -6
- data/lib/avo/fields/id_field.rb +5 -17
- data/lib/avo/fields/key_value_field.rb +4 -6
- data/lib/avo/fields/markdown_field.rb +3 -5
- data/lib/avo/fields/number_field.rb +8 -11
- data/lib/avo/fields/password_field.rb +2 -6
- data/lib/avo/fields/progress_bar_field.rb +19 -0
- data/lib/avo/fields/select_field.rb +13 -12
- data/lib/avo/fields/status_field.rb +2 -6
- data/lib/avo/fields/text_field.rb +3 -6
- data/lib/avo/fields/textarea_field.rb +4 -7
- data/lib/avo/fields/trix_field.rb +5 -9
- data/lib/avo/fields_collector.rb +47 -11
- data/lib/avo/licensing/license.rb +10 -0
- data/lib/avo/licensing/pro_license.rb +4 -1
- data/lib/avo/services/authorization_service.rb +1 -1
- data/lib/avo/version.rb +1 -1
- data/lib/generators/avo/eject_generator.rb +1 -0
- data/lib/generators/avo/field_generator.rb +17 -0
- data/lib/generators/avo/filter_generator.rb +1 -1
- data/lib/generators/avo/templates/field/%singular_name%_field.rb.tt +5 -0
- data/lib/generators/avo/templates/field/components/edit_component.html.erb.tt +6 -0
- data/lib/generators/avo/templates/field/components/edit_component.rb.tt +4 -0
- data/lib/generators/avo/templates/field/components/index_component.html.erb.tt +3 -0
- data/lib/generators/avo/templates/field/components/index_component.rb.tt +4 -0
- data/lib/generators/avo/templates/field/components/show_component.html.erb.tt +3 -0
- data/lib/generators/avo/templates/field/components/show_component.rb.tt +4 -0
- data/lib/generators/avo/templates/initializer/avo.tt +1 -0
- data/lib/generators/avo/templates/resource/resource.tt +3 -0
- data/lib/generators/avo/templates/tool/view.tt +1 -1
- data/public/avo-packs/css/{application-5bdca030.css → application-d69fe930.css} +303 -50
- data/public/avo-packs/css/application-d69fe930.css.br +0 -0
- data/public/avo-packs/css/application-d69fe930.css.gz +0 -0
- data/public/avo-packs/css/application-d69fe930.css.map +1 -0
- data/public/avo-packs/css/application-d69fe930.css.map.br +0 -0
- data/public/avo-packs/css/application-d69fe930.css.map.gz +0 -0
- data/public/avo-packs/js/application-7b3d507875f4bc1f6677.js +26 -0
- data/public/avo-packs/js/{application-16a456a2b7cb56b01153.js.LICENSE.txt → application-7b3d507875f4bc1f6677.js.LICENSE.txt} +0 -0
- data/public/avo-packs/js/application-7b3d507875f4bc1f6677.js.br +0 -0
- data/public/avo-packs/js/application-7b3d507875f4bc1f6677.js.gz +0 -0
- data/public/avo-packs/js/{application-16a456a2b7cb56b01153.js.map → application-7b3d507875f4bc1f6677.js.map} +1 -1
- data/public/avo-packs/js/application-7b3d507875f4bc1f6677.js.map.br +0 -0
- data/public/avo-packs/js/application-7b3d507875f4bc1f6677.js.map.gz +0 -0
- data/public/avo-packs/manifest.json +15 -15
- metadata +206 -173
- data/app/components/avo/common/files_list_viewer_component.html.erb +0 -5
- data/app/components/avo/common/status_viewer_component.html.erb +0 -10
- data/app/components/avo/edit/fields/boolean_field_component.rb +0 -4
- data/app/components/avo/edit/fields/boolean_group_field_component.rb +0 -4
- data/app/components/avo/edit/fields/code_field_component.rb +0 -4
- data/app/components/avo/edit/fields/country_field_component.rb +0 -4
- data/app/components/avo/edit/fields/date_field_component.rb +0 -4
- data/app/components/avo/edit/fields/date_time_field_component.rb +0 -4
- data/app/components/avo/edit/fields/external_image_field_component.rb +0 -4
- data/app/components/avo/edit/fields/file_field_component.rb +0 -4
- data/app/components/avo/edit/fields/files_field_component.rb +0 -4
- data/app/components/avo/edit/fields/heading_field_component.rb +0 -4
- data/app/components/avo/edit/fields/hidden_field_component.rb +0 -4
- data/app/components/avo/edit/fields/id_field_component.rb +0 -4
- data/app/components/avo/edit/fields/key_value_field_component.rb +0 -4
- data/app/components/avo/edit/fields/markdown_field_component.rb +0 -4
- data/app/components/avo/edit/fields/number_field_component.rb +0 -4
- data/app/components/avo/edit/fields/password_field_component.rb +0 -4
- data/app/components/avo/edit/fields/select_field_component.rb +0 -4
- data/app/components/avo/edit/fields/status_field_component.rb +0 -4
- data/app/components/avo/edit/fields/text_field_component.rb +0 -4
- data/app/components/avo/edit/fields/textarea_field_component.rb +0 -4
- data/app/components/avo/edit/fields/trix_field_component.rb +0 -4
- data/app/components/avo/index/fields/badge_field_component.html.erb +0 -3
- data/app/components/avo/index/fields/badge_field_component.rb +0 -4
- data/app/components/avo/index/fields/belongs_to_field_component.rb +0 -4
- data/app/components/avo/index/fields/boolean_field_component.html.erb +0 -3
- data/app/components/avo/index/fields/boolean_field_component.rb +0 -4
- data/app/components/avo/index/fields/boolean_group_field_component.html.erb +0 -3
- data/app/components/avo/index/fields/boolean_group_field_component.rb +0 -4
- data/app/components/avo/index/fields/country_field_component.rb +0 -4
- data/app/components/avo/index/fields/date_field_component.rb +0 -4
- data/app/components/avo/index/fields/date_time_field_component.rb +0 -4
- data/app/components/avo/index/fields/external_image_field_component.rb +0 -4
- data/app/components/avo/index/fields/field_component.html.erb +0 -1
- data/app/components/avo/index/fields/field_component.rb +0 -11
- data/app/components/avo/index/fields/file_field_component.rb +0 -4
- data/app/components/avo/index/fields/files_field_component.rb +0 -4
- data/app/components/avo/index/fields/gravatar_field_component.rb +0 -4
- data/app/components/avo/index/fields/has_one_field_component.rb +0 -4
- data/app/components/avo/index/fields/id_field_component.html.erb +0 -10
- data/app/components/avo/index/fields/id_field_component.rb +0 -4
- data/app/components/avo/index/fields/number_field_component.rb +0 -4
- data/app/components/avo/index/fields/select_field_component.rb +0 -4
- data/app/components/avo/index/fields/status_field_component.html.erb +0 -3
- data/app/components/avo/index/fields/status_field_component.rb +0 -4
- data/app/components/avo/index/fields/text_field_component.html.erb +0 -3
- data/app/components/avo/index/fields/text_field_component.rb +0 -4
- data/app/components/avo/show/fields/badge_field_component.html.erb +0 -3
- data/app/components/avo/show/fields/badge_field_component.rb +0 -4
- data/app/components/avo/show/fields/belongs_to_field_component.rb +0 -4
- data/app/components/avo/show/fields/boolean_field_component.rb +0 -4
- data/app/components/avo/show/fields/boolean_group_field_component.html.erb +0 -3
- data/app/components/avo/show/fields/boolean_group_field_component.rb +0 -4
- data/app/components/avo/show/fields/code_field_component.rb +0 -4
- data/app/components/avo/show/fields/country_field_component.rb +0 -4
- data/app/components/avo/show/fields/date_field_component.rb +0 -4
- data/app/components/avo/show/fields/date_time_field_component.rb +0 -4
- data/app/components/avo/show/fields/external_image_field_component.rb +0 -4
- data/app/components/avo/show/fields/file_field_component.html.erb +0 -3
- data/app/components/avo/show/fields/file_field_component.rb +0 -4
- data/app/components/avo/show/fields/files_field_component.html.erb +0 -3
- data/app/components/avo/show/fields/files_field_component.rb +0 -4
- data/app/components/avo/show/fields/gravatar_field_component.rb +0 -4
- data/app/components/avo/show/fields/has_many_field_component.rb +0 -4
- data/app/components/avo/show/fields/has_one_field_component.rb +0 -5
- data/app/components/avo/show/fields/heading_field_component.rb +0 -4
- data/app/components/avo/show/fields/id_field_component.rb +0 -4
- data/app/components/avo/show/fields/key_value_field_component.rb +0 -4
- data/app/components/avo/show/fields/markdown_field_component.rb +0 -4
- data/app/components/avo/show/fields/number_field_component.rb +0 -4
- data/app/components/avo/show/fields/select_field_component.rb +0 -4
- data/app/components/avo/show/fields/status_field_component.html.erb +0 -3
- data/app/components/avo/show/fields/status_field_component.rb +0 -4
- data/app/components/avo/show/fields/text_field_component.rb +0 -4
- data/app/components/avo/show/fields/textarea_field_component.rb +0 -4
- data/app/components/avo/show/fields/trix_field_component.rb +0 -4
- data/public/avo-packs/css/application-5bdca030.css.br +0 -0
- data/public/avo-packs/css/application-5bdca030.css.gz +0 -0
- data/public/avo-packs/css/application-5bdca030.css.map +0 -1
- data/public/avo-packs/css/application-5bdca030.css.map.br +0 -0
- data/public/avo-packs/css/application-5bdca030.css.map.gz +0 -0
- data/public/avo-packs/js/application-16a456a2b7cb56b01153.js +0 -26
- data/public/avo-packs/js/application-16a456a2b7cb56b01153.js.br +0 -0
- data/public/avo-packs/js/application-16a456a2b7cb56b01153.js.gz +0 -0
- data/public/avo-packs/js/application-16a456a2b7cb56b01153.js.map.br +0 -0
- data/public/avo-packs/js/application-16a456a2b7cb56b01153.js.map.gz +0 -0
@@ -6,14 +6,12 @@ module Avo
|
|
6
6
|
attr_reader :key_label
|
7
7
|
attr_reader :value_label
|
8
8
|
attr_reader :action_text
|
9
|
+
attr_reader :delete_text
|
10
|
+
attr_reader :disable_editing_keys
|
9
11
|
attr_reader :disable_adding_rows
|
10
12
|
|
11
|
-
def initialize(
|
12
|
-
|
13
|
-
partial_name: "key-value-field"
|
14
|
-
}
|
15
|
-
|
16
|
-
super(name, **args, &block)
|
13
|
+
def initialize(id, **args, &block)
|
14
|
+
super(id, **args, &block)
|
17
15
|
|
18
16
|
hide_on :index
|
19
17
|
|
@@ -1,12 +1,10 @@
|
|
1
1
|
module Avo
|
2
2
|
module Fields
|
3
3
|
class MarkdownField < BaseField
|
4
|
-
|
5
|
-
@defaults = {
|
6
|
-
partial_name: "markdown-field"
|
7
|
-
}
|
4
|
+
attr_reader :options
|
8
5
|
|
9
|
-
|
6
|
+
def initialize(id, **args, &block)
|
7
|
+
super(id, **args, &block)
|
10
8
|
|
11
9
|
hide_on :index
|
12
10
|
|
@@ -1,19 +1,16 @@
|
|
1
1
|
module Avo
|
2
2
|
module Fields
|
3
3
|
class NumberField < TextField
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
computable: true
|
8
|
-
}
|
4
|
+
attr_reader :min
|
5
|
+
attr_reader :max
|
6
|
+
attr_reader :step
|
9
7
|
|
10
|
-
|
8
|
+
def initialize(id, **args, &block)
|
9
|
+
super(id, **args, &block)
|
11
10
|
|
12
|
-
@
|
13
|
-
|
14
|
-
|
15
|
-
step: args[:step].present? ? args[:step].to_f : nil
|
16
|
-
}
|
11
|
+
@min = args[:min].present? ? args[:min].to_f : nil
|
12
|
+
@max = args[:max].present? ? args[:max].to_f : nil
|
13
|
+
@step = args[:step].present? ? args[:step].to_f : nil
|
17
14
|
end
|
18
15
|
end
|
19
16
|
end
|
@@ -1,14 +1,10 @@
|
|
1
1
|
module Avo
|
2
2
|
module Fields
|
3
3
|
class PasswordField < TextField
|
4
|
-
def initialize(
|
5
|
-
@defaults = {
|
6
|
-
partial_name: "password-field"
|
7
|
-
}
|
8
|
-
|
4
|
+
def initialize(id, **args, &block)
|
9
5
|
show_on :forms
|
10
6
|
|
11
|
-
super(
|
7
|
+
super(id, **args, &block)
|
12
8
|
|
13
9
|
hide_on [:index, :show]
|
14
10
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Avo
|
2
|
+
module Fields
|
3
|
+
class ProgressBarField < BaseField
|
4
|
+
attr_reader :max
|
5
|
+
attr_reader :step
|
6
|
+
attr_reader :display_value
|
7
|
+
attr_reader :value_suffix
|
8
|
+
|
9
|
+
def initialize(name, **args, &block)
|
10
|
+
super(name, **args, &block)
|
11
|
+
|
12
|
+
@max = args[:max] || 100
|
13
|
+
@step = args[:step] || 1
|
14
|
+
@display_value = args[:display_value] || false
|
15
|
+
@value_suffix = args[:value_suffix] || nil
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -5,18 +5,15 @@ module Avo
|
|
5
5
|
attr_reader :enum
|
6
6
|
attr_reader :display_value
|
7
7
|
|
8
|
-
def initialize(
|
9
|
-
|
10
|
-
partial_name: "select-field"
|
11
|
-
}
|
8
|
+
def initialize(id, **args, &block)
|
9
|
+
args[:placeholder] ||= I18n.t("avo.choose_an_option")
|
12
10
|
|
13
|
-
super(
|
11
|
+
super(id, **args, &block)
|
14
12
|
|
15
|
-
|
16
|
-
@options = ActiveSupport::HashWithIndifferentAccess.new
|
13
|
+
options = args[:options].present? ? args[:options] : args[:enum]
|
14
|
+
@options = ActiveSupport::HashWithIndifferentAccess.new options
|
17
15
|
@enum = args[:enum].present? ? args[:enum] : nil
|
18
16
|
@display_value = args[:display_value].present? ? args[:display_value] : false
|
19
|
-
@placeholder = args[:placeholder].present? ? args[:placeholder].to_s : I18n.t("avo.choose_an_option")
|
20
17
|
end
|
21
18
|
|
22
19
|
def options_for_select
|
@@ -34,12 +31,16 @@ module Avo
|
|
34
31
|
end
|
35
32
|
|
36
33
|
def label
|
37
|
-
if
|
34
|
+
if enum.present?
|
35
|
+
if display_value
|
36
|
+
options[value]
|
37
|
+
else
|
38
|
+
value
|
39
|
+
end
|
40
|
+
elsif display_value
|
38
41
|
value
|
39
|
-
elsif enum.present?
|
40
|
-
options[value]
|
41
42
|
else
|
42
|
-
options.invert[value]
|
43
|
+
options.invert.stringify_keys[value]
|
43
44
|
end
|
44
45
|
end
|
45
46
|
end
|
@@ -1,12 +1,8 @@
|
|
1
1
|
module Avo
|
2
2
|
module Fields
|
3
3
|
class StatusField < BaseField
|
4
|
-
def initialize(
|
5
|
-
|
6
|
-
partial_name: "status-field"
|
7
|
-
}
|
8
|
-
|
9
|
-
super(name, **args, &block)
|
4
|
+
def initialize(id, **args, &block)
|
5
|
+
super(id, **args, &block)
|
10
6
|
|
11
7
|
@loading_when = args[:loading_when].present? ? [args[:loading_when]].flatten : [:waiting, :running]
|
12
8
|
@failed_when = args[:failed_when].present? ? [args[:failed_when]].flatten : [:failed]
|
@@ -1,13 +1,10 @@
|
|
1
1
|
module Avo
|
2
2
|
module Fields
|
3
3
|
class TextField < BaseField
|
4
|
-
|
5
|
-
@defaults = {
|
6
|
-
partial_name: "text-field",
|
7
|
-
computable: true
|
8
|
-
}.merge(@defaults || {})
|
4
|
+
attr_reader :link_to_resource
|
9
5
|
|
10
|
-
|
6
|
+
def initialize(id, **args, &block)
|
7
|
+
super(id, **args, &block)
|
11
8
|
|
12
9
|
@link_to_resource = args[:link_to_resource].present? ? args[:link_to_resource] : false
|
13
10
|
end
|
@@ -1,17 +1,14 @@
|
|
1
1
|
module Avo
|
2
2
|
module Fields
|
3
3
|
class TextareaField < TextField
|
4
|
-
|
5
|
-
@defaults = {
|
6
|
-
partial_name: "textarea-field",
|
7
|
-
computable: true
|
8
|
-
}
|
4
|
+
attr_reader :rows
|
9
5
|
|
10
|
-
|
6
|
+
def initialize(id, **args, &block)
|
7
|
+
super(id, **args, &block)
|
11
8
|
|
12
9
|
hide_on :index
|
13
10
|
|
14
|
-
@
|
11
|
+
@rows = args[:rows].present? ? args[:rows].to_i : 5
|
15
12
|
end
|
16
13
|
end
|
17
14
|
end
|
@@ -5,18 +5,14 @@ module Avo
|
|
5
5
|
attr_reader :attachments_disabled
|
6
6
|
attr_reader :attachment_key
|
7
7
|
|
8
|
-
def initialize(
|
9
|
-
|
10
|
-
partial_name: "trix-field"
|
11
|
-
}
|
12
|
-
|
13
|
-
super(name, **args, &block)
|
8
|
+
def initialize(id, **args, &block)
|
9
|
+
super(id, **args, &block)
|
14
10
|
|
15
11
|
hide_on :index
|
16
12
|
|
17
|
-
@always_show = args[:always_show]
|
18
|
-
@attachments_disabled = args[:attachments_disabled]
|
19
|
-
@attachment_key = args[:attachment_key]
|
13
|
+
@always_show = args[:always_show] || false
|
14
|
+
@attachments_disabled = args[:attachments_disabled] || false
|
15
|
+
@attachment_key = args[:attachment_key]
|
20
16
|
end
|
21
17
|
end
|
22
18
|
end
|
data/lib/avo/fields_collector.rb
CHANGED
@@ -1,30 +1,66 @@
|
|
1
|
+
# require "active_support/inflector"
|
2
|
+
|
1
3
|
module Avo
|
2
4
|
module FieldsCollector
|
3
5
|
def field(field_name, as:, **args, &block)
|
4
6
|
self.fields ||= []
|
5
7
|
|
6
|
-
|
7
|
-
end
|
8
|
+
field_instance = parse_field(field_name, as: as, **args, &block)
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
if field_instance.present?
|
11
|
+
self.fields << field_instance
|
12
|
+
else
|
13
|
+
message = "[Avo] The #{field_name} field, as: #{as} from #{self.name} has an invalid configuration."
|
14
|
+
::Rails.logger.warn message
|
12
15
|
end
|
16
|
+
end
|
13
17
|
|
14
|
-
|
15
|
-
|
18
|
+
def parse_field(field_name, as:, **args, &block)
|
19
|
+
# The field is passed as a symbol eg: :text, :color_picker, :trix
|
20
|
+
if as.is_a? Symbol
|
21
|
+
field_class = field_class_from_symbol(as)
|
16
22
|
|
17
|
-
if
|
18
|
-
|
23
|
+
if field_class.present?
|
24
|
+
# The field has been registered before.
|
25
|
+
instantiate_field(field_name, klass: field_class, **args, &block)
|
19
26
|
else
|
20
|
-
|
21
|
-
|
27
|
+
# The symbol can be transformed to a class and found.
|
28
|
+
class_name = as.to_s.classify
|
29
|
+
field_class = "#{class_name}Field"
|
22
30
|
|
31
|
+
# Discover & load custom field classes
|
32
|
+
if Object.const_defined? field_class
|
33
|
+
instantiate_field(field_name, klass: field_class.safe_constantize, **args, &block)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
elsif as.is_a? Class
|
37
|
+
# The field has been passed as a class.
|
38
|
+
if Object.const_defined? as.to_s
|
39
|
+
instantiate_field(field_name, klass: as, **args, &block)
|
40
|
+
end
|
23
41
|
end
|
24
42
|
end
|
25
43
|
|
26
44
|
def heading(body, **args)
|
27
45
|
self.fields << Avo::Fields::HeadingField.new(body, **args)
|
28
46
|
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def instantiate_field(field_name, klass:, **args, &block)
|
51
|
+
if block
|
52
|
+
klass.new(field_name, **args || {}, &block)
|
53
|
+
else
|
54
|
+
klass.new(field_name, **args || {})
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def field_class_from_symbol(symbol)
|
59
|
+
matched_field = Avo::App.fields.find do |field|
|
60
|
+
field[:name].to_s == symbol.to_s
|
61
|
+
end
|
62
|
+
|
63
|
+
return matched_field[:class] if matched_field.present? && matched_field[:class].present?
|
64
|
+
end
|
29
65
|
end
|
30
66
|
end
|
@@ -47,6 +47,16 @@ module Avo
|
|
47
47
|
|
48
48
|
alias_method :has, :can
|
49
49
|
alias_method :lacks, :cant
|
50
|
+
|
51
|
+
# Returns if has ability and if is a valid license or app is in development.
|
52
|
+
def has_with_trial(ability)
|
53
|
+
can(ability) && (valid? || Rails.env.development? || Rails.env.test?)
|
54
|
+
end
|
55
|
+
|
56
|
+
# Returns if lacks ability and if is a valid license or app is in development.
|
57
|
+
def lacks_with_trial(ability)
|
58
|
+
!can(ability) && (valid? || Rails.env.development? || Rails.env.test?)
|
59
|
+
end
|
50
60
|
end
|
51
61
|
end
|
52
62
|
end
|
data/lib/avo/version.rb
CHANGED
@@ -15,6 +15,7 @@ module Generators
|
|
15
15
|
logo: "app/views/avo/partials/_logo.html.erb",
|
16
16
|
head: "app/views/avo/partials/_head.html.erb",
|
17
17
|
header: "app/views/avo/partials/_header.html.erb",
|
18
|
+
profile_dropdown: "app/views/avo/partials/_profile_dropdown.html.erb",
|
18
19
|
footer: "app/views/avo/partials/_footer.html.erb",
|
19
20
|
scripts: "app/views/avo/partials/_scripts.html.erb"
|
20
21
|
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require "rails/generators"
|
2
|
+
|
3
|
+
module Generators
|
4
|
+
module Avo
|
5
|
+
class FieldGenerator < ::Rails::Generators::NamedBase
|
6
|
+
source_root File.expand_path("templates", __dir__)
|
7
|
+
|
8
|
+
namespace "avo:field"
|
9
|
+
desc "Add a custom Avo field to your project."
|
10
|
+
|
11
|
+
def handle
|
12
|
+
directory "field/components", "app/components/avo/fields/#{singular_name}_field"
|
13
|
+
template "field/%singular_name%_field.rb.tt", "app/avo/fields/#{singular_name}_field.rb"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<%%= edit_field_wrapper field: @field, index: @index, form: @form, resource: @resource, displayed_in_modal: @displayed_in_modal do %>
|
2
|
+
<%%= @form.text_field @field.id,
|
3
|
+
class: helpers.input_classes('w-full', has_error: @field.model_errors.include?(@field.id)),
|
4
|
+
placeholder: @field.placeholder,
|
5
|
+
disabled: @field.readonly %>
|
6
|
+
<%% end %>
|
@@ -43,6 +43,7 @@ Avo.configure do |config|
|
|
43
43
|
# config.full_width_container = false
|
44
44
|
# config.full_width_index_view = false
|
45
45
|
# config.cache_resources_on_index_view = true
|
46
|
+
# config.search_debounce = 300
|
46
47
|
|
47
48
|
# Where should the user be redirected when he hits the `/<%= options[:path] %>` url
|
48
49
|
# config.home_path = nil
|