avo 3.0.0.beta1 → 3.0.0.pre1
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 +5 -5
- data/Gemfile.lock +81 -92
- data/{public/avo-assets/avo.css → app/assets/builds/avo.base.css} +686 -728
- data/app/assets/builds/avo.base.js +93804 -0
- data/app/assets/builds/avo.base.js.map +7 -0
- data/app/assets/stylesheets/avo.base.css +2 -1
- data/app/assets/svgs/failed_to_load.svg +1 -0
- data/app/assets/svgs/grid-empty-state.svg +1 -0
- data/app/assets/svgs/table-empty-state.svg +1 -0
- data/app/assets/svgs/triangle-up.svg +1 -1
- data/app/components/avo/actions_component.html.erb +1 -1
- data/app/components/avo/actions_component.rb +16 -42
- data/app/components/avo/alert_component.html.erb +1 -1
- data/app/components/avo/base_component.rb +7 -7
- data/app/components/avo/field_wrapper_component.html.erb +4 -4
- data/app/components/avo/field_wrapper_component.rb +1 -1
- data/app/components/avo/fields/belongs_to_field/edit_component.html.erb +5 -5
- data/app/components/avo/fields/belongs_to_field/edit_component.rb +4 -8
- data/app/components/avo/fields/boolean_field/edit_component.html.erb +0 -1
- data/app/components/avo/fields/boolean_group_field/edit_component.html.erb +1 -1
- data/app/components/avo/fields/code_field/edit_component.html.erb +0 -1
- data/app/components/avo/fields/common/files_list_viewer_component.html.erb +5 -0
- data/app/components/avo/fields/common/files_list_viewer_component.rb +8 -0
- data/app/components/avo/fields/common/heading_component.html.erb +1 -1
- data/app/components/avo/fields/common/single_file_viewer_component.html.erb +56 -0
- data/app/components/avo/fields/common/single_file_viewer_component.rb +55 -0
- data/app/components/avo/fields/country_field/edit_component.html.erb +1 -3
- data/app/components/avo/fields/file_field/edit_component.html.erb +2 -4
- data/app/components/avo/fields/file_field/edit_component.rb +0 -1
- data/app/components/avo/fields/file_field/index_component.rb +2 -2
- data/app/components/avo/fields/file_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/files_field/edit_component.html.erb +2 -4
- data/app/components/avo/fields/files_field/edit_component.rb +0 -1
- data/app/components/avo/fields/files_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/has_many_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/has_one_field/show_component.html.erb +4 -5
- data/app/components/avo/fields/has_one_field/show_component.rb +2 -6
- data/app/components/avo/fields/index_component.rb +0 -1
- data/app/components/avo/fields/markdown_field/edit_component.html.erb +3 -4
- data/app/components/avo/fields/markdown_field/show_component.html.erb +3 -3
- data/app/components/avo/fields/number_field/edit_component.html.erb +1 -3
- data/app/components/avo/fields/password_field/edit_component.html.erb +1 -3
- data/app/components/avo/fields/progress_bar_field/edit_component.html.erb +0 -1
- data/app/components/avo/fields/select_field/edit_component.html.erb +1 -2
- data/app/components/avo/fields/status_field/edit_component.html.erb +1 -1
- data/app/components/avo/fields/text_field/edit_component.html.erb +2 -3
- data/app/components/avo/fields/textarea_field/edit_component.html.erb +0 -1
- data/app/components/avo/fields/trix_field/edit_component.html.erb +1 -2
- data/app/components/avo/fields/trix_field/show_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 +12 -0
- data/app/components/avo/index/grid_item_component.html.erb +35 -9
- data/app/components/avo/index/grid_item_component.rb +10 -36
- data/app/components/avo/index/resource_controls_component.rb +11 -8
- data/app/components/avo/index/resource_table_component.rb +1 -1
- data/app/components/avo/item_switcher_component.html.erb +5 -10
- data/app/components/avo/item_switcher_component.rb +1 -2
- data/app/components/avo/modal_component.html.erb +1 -1
- data/app/components/avo/panel_component.html.erb +1 -6
- data/app/components/avo/panel_component.rb +0 -1
- data/app/components/avo/profile_item_component.html.erb +2 -17
- data/app/components/avo/profile_item_component.rb +1 -13
- data/app/components/avo/referrer_params_component.html.erb +0 -2
- data/app/components/avo/resource_component.rb +6 -69
- data/app/components/avo/resource_sidebar_component.rb +1 -1
- data/app/components/avo/sidebar/link_component.html.erb +0 -2
- data/app/components/avo/sidebar/link_component.rb +3 -5
- data/app/components/avo/sidebar_component.html.erb +3 -3
- data/app/components/avo/sidebar_component.rb +4 -4
- data/app/components/avo/sidebar_profile_component.html.erb +27 -27
- data/app/components/avo/views/resource_edit_component.html.erb +5 -5
- data/app/components/avo/views/resource_edit_component.rb +1 -1
- data/app/components/avo/views/resource_index_component.html.erb +10 -19
- data/app/components/avo/views/resource_index_component.rb +16 -22
- data/app/components/avo/views/resource_show_component.html.erb +4 -4
- data/app/controllers/avo/actions_controller.rb +20 -20
- data/app/controllers/avo/application_controller.rb +67 -90
- data/app/controllers/avo/associations_controller.rb +7 -5
- data/app/controllers/avo/attachments_controller.rb +7 -22
- data/app/controllers/avo/base_controller.rb +35 -47
- data/app/controllers/avo/home_controller.rb +1 -1
- data/app/controllers/avo/search_controller.rb +16 -20
- data/app/controllers/concerns/avo/initializes_avo.rb +8 -3
- data/app/helpers/avo/application_helper.rb +6 -13
- data/app/javascript/js/application.js +0 -2
- data/app/javascript/js/controllers/fields/{easy_mde_controller.js → simple_mde_controller.js} +3 -4
- data/app/javascript/js/controllers/search_controller.js +1 -3
- data/app/javascript/js/controllers.js +2 -2
- data/app/views/avo/actions/show.html.erb +3 -5
- data/app/views/avo/associations/new.html.erb +3 -3
- data/app/views/avo/debug/status.html.erb +5 -6
- data/app/views/avo/home/index.html.erb +1 -1
- data/app/views/avo/partials/_custom_tools_alert.html.erb +2 -2
- data/app/views/avo/partials/_footer.html.erb +1 -1
- data/app/views/avo/partials/_javascript.html.erb +1 -1
- data/app/views/avo/partials/_navbar.html.erb +1 -1
- data/app/views/avo/partials/_table_header.html.erb +8 -0
- data/app/views/avo/partials/_view_toggle_button.html.erb +0 -9
- data/app/views/avo/private/design.html.erb +2 -2
- data/app/views/layouts/avo/application.html.erb +3 -2
- data/avo.gemspec +1 -2
- data/config/initializers/pagy.rb +10 -12
- data/config/routes.rb +5 -5
- data/db/factories.rb +0 -17
- data/lib/avo/app.rb +165 -0
- data/lib/avo/base_action.rb +18 -31
- data/lib/avo/base_resource.rb +213 -238
- data/lib/avo/concerns/breadcrumbs.rb +2 -2
- data/lib/avo/concerns/can_replace_items.rb +7 -3
- data/lib/avo/concerns/filters_session_handler.rb +4 -5
- data/lib/avo/concerns/has_item_type.rb +0 -4
- data/lib/avo/concerns/has_items.rb +115 -93
- data/lib/avo/concerns/is_visible.rb +1 -1
- data/lib/avo/concerns/model_class_constantized.rb +2 -0
- data/lib/avo/configuration.rb +8 -9
- data/lib/avo/current.rb +1 -35
- data/lib/avo/dsl/field_parser.rb +1 -1
- data/lib/avo/dynamic_router.rb +2 -13
- data/lib/avo/engine.rb +13 -11
- data/lib/avo/execution_context.rb +2 -4
- data/lib/avo/fields/base_field.rb +14 -51
- data/lib/avo/fields/belongs_to_field.rb +13 -20
- data/lib/avo/fields/concerns/is_searchable.rb +1 -1
- data/lib/avo/fields/concerns/use_resource.rb +1 -1
- data/lib/avo/fields/date_field.rb +3 -16
- data/lib/avo/fields/field_manager.rb +3 -13
- data/lib/avo/fields/file_field.rb +0 -2
- data/lib/avo/fields/files_field.rb +0 -6
- data/lib/avo/fields/has_base_field.rb +5 -5
- data/lib/avo/fields/has_one_field.rb +1 -2
- data/lib/avo/fields/id_field.rb +1 -2
- data/lib/avo/filters/base_filter.rb +0 -9
- data/lib/avo/grid_collector.rb +40 -0
- data/lib/avo/html/builder.rb +1 -3
- data/lib/avo/licensing/h_q.rb +6 -11
- data/lib/avo/licensing/license.rb +1 -1
- data/lib/avo/licensing/license_manager.rb +1 -1
- data/lib/avo/licensing/{nil_license.rb → null_license.rb} +1 -1
- data/lib/avo/loaders/fields_loader.rb +1 -7
- data/lib/avo/plugin.rb +0 -10
- data/lib/avo/plugin_manager.rb +4 -2
- data/lib/avo/reloader.rb +1 -1
- data/lib/avo/resources/controls/actions_list.rb +1 -2
- data/lib/avo/resources/controls/create_button.rb +1 -1
- data/lib/avo/resources/controls/delete_button.rb +1 -1
- data/lib/avo/resources/controls/detach_button.rb +1 -1
- data/lib/avo/resources/controls/edit_button.rb +1 -1
- data/lib/avo/resources/controls/show_button.rb +1 -1
- data/lib/avo/resources/items/holder.rb +5 -13
- data/lib/avo/resources/items/item_group.rb +0 -1
- data/lib/avo/resources/resource_manager.rb +18 -11
- data/lib/avo/services/debug_service.rb +5 -6
- data/lib/avo/services/telemetry_service.rb +2 -3
- data/lib/avo/version.rb +1 -1
- data/lib/avo.rb +25 -109
- data/lib/generators/avo/action_generator.rb +8 -8
- data/lib/generators/avo/card/chartkick_generator.rb +18 -0
- data/lib/generators/avo/card/metric_generator.rb +18 -0
- data/lib/generators/avo/card/partial_generator.rb +19 -0
- data/lib/generators/avo/eject_generator.rb +0 -1
- data/lib/generators/avo/filter_generator.rb +8 -8
- data/lib/generators/avo/install_generator.rb +1 -11
- data/lib/generators/avo/resource_generator.rb +4 -22
- data/lib/generators/avo/tailwindcss/install_generator.rb +1 -4
- data/lib/generators/avo/templates/action.tt +5 -7
- data/lib/generators/avo/templates/cards/chartkick_card.tt +1 -1
- data/lib/generators/avo/templates/cards/chartkick_card_sample.tt +1 -1
- data/lib/generators/avo/templates/cards/metric_card.tt +1 -1
- data/lib/generators/avo/templates/cards/metric_card_sample.tt +1 -1
- data/lib/generators/avo/templates/cards/partial_card.tt +1 -1
- data/lib/generators/avo/templates/cards/partial_card_sample.tt +1 -1
- data/lib/generators/avo/templates/dashboards/dashboard.tt +3 -5
- data/lib/generators/avo/templates/initializer/avo.tt +2 -4
- data/lib/generators/avo/templates/resource/resource.tt +6 -6
- data/lib/generators/avo/templates/scope.tt +1 -1
- data/lib/generators/avo/templates/standalone_action.tt +8 -0
- data/lib/generators/avo/templates/tailwindcss/Procfile.dev +1 -1
- data/lib/tasks/avo_tasks.rake +0 -5
- metadata +19 -56
- data/app/assets/svgs/map-empty-state.svg +0 -35
- data/app/assets/svgs/map-view-type.svg +0 -3
- data/app/components/avo/fields/area_field/edit_component.html.erb +0 -7
- data/app/components/avo/fields/area_field/edit_component.rb +0 -4
- data/app/components/avo/fields/area_field/show_component.html.erb +0 -8
- data/app/components/avo/fields/area_field/show_component.rb +0 -4
- data/app/components/avo/fields/common/files/controls_component.html.erb +0 -29
- data/app/components/avo/fields/common/files/controls_component.rb +0 -19
- data/app/components/avo/fields/common/files/list_viewer_component.html.erb +0 -20
- data/app/components/avo/fields/common/files/list_viewer_component.rb +0 -41
- data/app/components/avo/fields/common/files/view_type/grid_component.html.erb +0 -27
- data/app/components/avo/fields/common/files/view_type/grid_component.rb +0 -51
- data/app/components/avo/fields/common/files/view_type/list_component.html.erb +0 -22
- data/app/components/avo/fields/common/files/view_type/list_component.rb +0 -15
- data/app/components/avo/fields/location_field/edit_component.html.erb +0 -22
- data/app/components/avo/fields/location_field/edit_component.rb +0 -4
- data/app/components/avo/fields/location_field/show_component.html.erb +0 -7
- data/app/components/avo/fields/location_field/show_component.rb +0 -4
- data/app/components/avo/index/resource_map_component.html.erb +0 -16
- data/app/components/avo/index/resource_map_component.rb +0 -109
- data/app/components/avo/row_component.html.erb +0 -3
- data/app/components/avo/row_component.rb +0 -12
- data/app/views/avo/attachments/destroy.turbo_stream.erb +0 -7
- data/app/views/avo/partials/_profile_menu_extra.html.erb +0 -2
- data/lib/avo/concerns/has_description.rb +0 -23
- data/lib/avo/fields/area_field.rb +0 -39
- data/lib/avo/fields/concerns/file_authorization.rb +0 -31
- data/lib/avo/fields/location_field.rb +0 -86
- data/lib/avo/resources/items/row.rb +0 -54
- data/lib/generators/avo/card_generator.rb +0 -27
- data/public/avo-assets/avo.base.css +0 -10542
- data/public/avo-assets/avo.base.js +0 -949
- data/public/avo-assets/avo.base.js.map +0 -7
- data/public/avo-assets/avo.js +0 -513
- data/public/avo-assets/avo.js.map +0 -7
@@ -1,4 +1,4 @@
|
|
1
|
-
class Avo::Cards::<%= class_name.camelize %> <
|
1
|
+
class Avo::Cards::<%= class_name.camelize %> < AvoDashboards::MetricCard
|
2
2
|
self.id = "<%= name.underscore %>"
|
3
3
|
self.label = "<%= name.underscore.humanize %>"
|
4
4
|
# self.description = "Some description"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class Avo::Cards::<%= class_name.camelize %> <
|
1
|
+
class Avo::Cards::<%= class_name.camelize %> < AvoDashboards::PartialCard
|
2
2
|
self.id = "<%= name.underscore %>"
|
3
3
|
self.label = "<%= name.underscore.humanize %>"
|
4
4
|
self.partial = "avo/cards/<%= name.underscore %>"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class Avo::Cards::<%= class_name.camelize %> <
|
1
|
+
class Avo::Cards::<%= class_name.camelize %> < AvoDashboards::PartialCard
|
2
2
|
self.id = "<%= name.underscore %>"
|
3
3
|
self.label = "<%= name.underscore.humanize %>"
|
4
4
|
self.partial = "avo/cards/<%= name.underscore %>"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class Avo::Dashboards::<%= class_name.camelize %> <
|
1
|
+
class Avo::Dashboards::<%= class_name.camelize %> < AvoDashboards::BaseDashboard
|
2
2
|
self.id = "<%= name.underscore %>"
|
3
3
|
self.name = "<%= name.underscore.humanize %>"
|
4
4
|
# self.description = "Tiny dashboard description"
|
@@ -7,8 +7,6 @@ class Avo::Dashboards::<%= class_name.camelize %> < Avo::Dashboards::BaseDashboa
|
|
7
7
|
# true
|
8
8
|
# end
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
# card UsersCount
|
13
|
-
end
|
10
|
+
# cards go here
|
11
|
+
# card UsersCount
|
14
12
|
end
|
@@ -2,8 +2,6 @@
|
|
2
2
|
Avo.configure do |config|
|
3
3
|
## == Routing ==
|
4
4
|
config.root_path = '/<%= options[:path] %>'
|
5
|
-
# used only when you have custom `map` configuration in your config.ru
|
6
|
-
# config.prefix_path = "/internal"
|
7
5
|
|
8
6
|
# Where should the user be redirected when visting the `/<%= options[:path] %>` url
|
9
7
|
# config.home_path = nil
|
@@ -31,7 +29,6 @@ Avo.configure do |config|
|
|
31
29
|
# update: 'update?',
|
32
30
|
# create: 'create?',
|
33
31
|
# destroy: 'destroy?',
|
34
|
-
# search: 'search?',
|
35
32
|
# }
|
36
33
|
# config.raise_error_on_missing_policy = false
|
37
34
|
# config.authorization_client = :pundit
|
@@ -51,7 +48,7 @@ Avo.configure do |config|
|
|
51
48
|
## permanent enable or disable cache_resource_filters, default value is false
|
52
49
|
# config.cache_resource_filters = false
|
53
50
|
## provide a lambda to enable or disable cache_resource_filters per user/resource.
|
54
|
-
# config.cache_resource_filters = -> { current_user.cache_resource_filters?
|
51
|
+
# config.cache_resource_filters = ->(current_user:, resource:) { current_user.cache_resource_filters?}
|
55
52
|
|
56
53
|
## == Customization ==
|
57
54
|
# config.app_name = 'Avocadelicious'
|
@@ -64,6 +61,7 @@ Avo.configure do |config|
|
|
64
61
|
# config.view_component_path = "app/components"
|
65
62
|
# config.display_license_request_timeout_error = true
|
66
63
|
# config.disabled_features = []
|
64
|
+
# config.resource_controls = :right
|
67
65
|
# config.buttons_on_form_footers = true
|
68
66
|
# config.field_wrapper_layout = true
|
69
67
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
class Avo::Resources::<%= resource_class %> < Avo::BaseResource
|
2
|
+
self.title = :id
|
2
3
|
self.includes = []<%= model_class_from_args %>
|
3
|
-
# self.
|
4
|
-
#
|
5
|
-
#
|
4
|
+
# self.search_query = -> do
|
5
|
+
# scope.ransack(id_eq: params[:q], m: "or").result(distinct: false)
|
6
|
+
# end
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
end
|
8
|
+
field :id, as: :id<%= generate_fields %>
|
9
|
+
# add fields here
|
10
10
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class Avo::Scopes::<%= class_name.camelize %> <
|
1
|
+
class Avo::Scopes::<%= class_name.camelize %> < AvoPro::Scopes::BaseScope
|
2
2
|
self.name = "<%= name.underscore.humanize %>"
|
3
3
|
self.description = "<%= name.underscore.humanize %>"
|
4
4
|
self.scope = -> { query.all }
|
@@ -1,2 +1,2 @@
|
|
1
1
|
web: bin/rails server -p 3000
|
2
|
-
avo_css:
|
2
|
+
avo_css: bin/rails avo:tailwindcss:watch
|
data/lib/tasks/avo_tasks.rake
CHANGED
@@ -3,11 +3,6 @@
|
|
3
3
|
# # Task goes here
|
4
4
|
# end
|
5
5
|
|
6
|
-
desc "Runs the update command for all Avo gems."
|
7
|
-
task "avo:update" do
|
8
|
-
system "bundle update avo avo-pro avo-advanced avo-dashboards avo_filters avo-menu avo_upgrade"
|
9
|
-
end
|
10
|
-
|
11
6
|
desc "Installs Avo assets and bundles them for when you want to use the GitHub repo in your app"
|
12
7
|
task "avo:build-assets" do
|
13
8
|
spec = get_gem_spec "avo"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.
|
4
|
+
version: 3.0.0.pre1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Marin
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-04-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -25,20 +25,6 @@ dependencies:
|
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '6.1'
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: activesupport
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - ">="
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '6.1'
|
35
|
-
type: :runtime
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - ">="
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '6.1'
|
42
28
|
- !ruby/object:Gem::Dependency
|
43
29
|
name: actionview
|
44
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,14 +101,14 @@ dependencies:
|
|
115
101
|
requirements:
|
116
102
|
- - ">="
|
117
103
|
- !ruby/object:Gem::Version
|
118
|
-
version:
|
104
|
+
version: '0'
|
119
105
|
type: :runtime
|
120
106
|
prerelease: false
|
121
107
|
version_requirements: !ruby/object:Gem::Requirement
|
122
108
|
requirements:
|
123
109
|
- - ">="
|
124
110
|
- !ruby/object:Gem::Version
|
125
|
-
version:
|
111
|
+
version: '0'
|
126
112
|
- !ruby/object:Gem::Dependency
|
127
113
|
name: turbo-rails
|
128
114
|
requirement: !ruby/object:Gem::Requirement
|
@@ -220,6 +206,9 @@ files:
|
|
220
206
|
- Gemfile.lock
|
221
207
|
- README.md
|
222
208
|
- Rakefile
|
209
|
+
- app/assets/builds/avo.base.css
|
210
|
+
- app/assets/builds/avo.base.js
|
211
|
+
- app/assets/builds/avo.base.js.map
|
223
212
|
- app/assets/config/avo_manifest.js
|
224
213
|
- app/assets/stylesheets/avo.base.css
|
225
214
|
- app/assets/stylesheets/css/active-storage.css
|
@@ -1306,8 +1295,6 @@ files:
|
|
1306
1295
|
- app/assets/svgs/information-circle.svg
|
1307
1296
|
- app/assets/svgs/library.svg
|
1308
1297
|
- app/assets/svgs/logout.svg
|
1309
|
-
- app/assets/svgs/map-empty-state.svg
|
1310
|
-
- app/assets/svgs/map-view-type.svg
|
1311
1298
|
- app/assets/svgs/menu-back.svg
|
1312
1299
|
- app/assets/svgs/menu.svg
|
1313
1300
|
- app/assets/svgs/photograph.svg
|
@@ -1354,10 +1341,6 @@ files:
|
|
1354
1341
|
- app/components/avo/empty_state_component.rb
|
1355
1342
|
- app/components/avo/field_wrapper_component.html.erb
|
1356
1343
|
- app/components/avo/field_wrapper_component.rb
|
1357
|
-
- app/components/avo/fields/area_field/edit_component.html.erb
|
1358
|
-
- app/components/avo/fields/area_field/edit_component.rb
|
1359
|
-
- app/components/avo/fields/area_field/show_component.html.erb
|
1360
|
-
- app/components/avo/fields/area_field/show_component.rb
|
1361
1344
|
- app/components/avo/fields/badge_field/index_component.html.erb
|
1362
1345
|
- app/components/avo/fields/badge_field/index_component.rb
|
1363
1346
|
- app/components/avo/fields/badge_field/show_component.html.erb
|
@@ -1390,14 +1373,8 @@ files:
|
|
1390
1373
|
- app/components/avo/fields/common/boolean_check_component.rb
|
1391
1374
|
- app/components/avo/fields/common/boolean_group_component.html.erb
|
1392
1375
|
- app/components/avo/fields/common/boolean_group_component.rb
|
1393
|
-
- app/components/avo/fields/common/
|
1394
|
-
- app/components/avo/fields/common/
|
1395
|
-
- app/components/avo/fields/common/files/list_viewer_component.html.erb
|
1396
|
-
- app/components/avo/fields/common/files/list_viewer_component.rb
|
1397
|
-
- app/components/avo/fields/common/files/view_type/grid_component.html.erb
|
1398
|
-
- app/components/avo/fields/common/files/view_type/grid_component.rb
|
1399
|
-
- app/components/avo/fields/common/files/view_type/list_component.html.erb
|
1400
|
-
- app/components/avo/fields/common/files/view_type/list_component.rb
|
1376
|
+
- app/components/avo/fields/common/files_list_viewer_component.html.erb
|
1377
|
+
- app/components/avo/fields/common/files_list_viewer_component.rb
|
1401
1378
|
- app/components/avo/fields/common/gravatar_viewer_component.html.erb
|
1402
1379
|
- app/components/avo/fields/common/gravatar_viewer_component.rb
|
1403
1380
|
- app/components/avo/fields/common/heading_component.html.erb
|
@@ -1406,6 +1383,8 @@ files:
|
|
1406
1383
|
- app/components/avo/fields/common/key_value_component.rb
|
1407
1384
|
- app/components/avo/fields/common/progress_bar_component.html.erb
|
1408
1385
|
- app/components/avo/fields/common/progress_bar_component.rb
|
1386
|
+
- app/components/avo/fields/common/single_file_viewer_component.html.erb
|
1387
|
+
- app/components/avo/fields/common/single_file_viewer_component.rb
|
1409
1388
|
- app/components/avo/fields/common/status_viewer_component.html.erb
|
1410
1389
|
- app/components/avo/fields/common/status_viewer_component.rb
|
1411
1390
|
- app/components/avo/fields/concerns/item_labels.rb
|
@@ -1473,10 +1452,6 @@ files:
|
|
1473
1452
|
- app/components/avo/fields/key_value_field/edit_component.rb
|
1474
1453
|
- app/components/avo/fields/key_value_field/show_component.html.erb
|
1475
1454
|
- app/components/avo/fields/key_value_field/show_component.rb
|
1476
|
-
- app/components/avo/fields/location_field/edit_component.html.erb
|
1477
|
-
- app/components/avo/fields/location_field/edit_component.rb
|
1478
|
-
- app/components/avo/fields/location_field/show_component.html.erb
|
1479
|
-
- app/components/avo/fields/location_field/show_component.rb
|
1480
1455
|
- app/components/avo/fields/markdown_field/edit_component.html.erb
|
1481
1456
|
- app/components/avo/fields/markdown_field/edit_component.rb
|
1482
1457
|
- app/components/avo/fields/markdown_field/show_component.html.erb
|
@@ -1544,8 +1519,6 @@ files:
|
|
1544
1519
|
- app/components/avo/index/resource_controls_component.rb
|
1545
1520
|
- app/components/avo/index/resource_grid_component.html.erb
|
1546
1521
|
- app/components/avo/index/resource_grid_component.rb
|
1547
|
-
- app/components/avo/index/resource_map_component.html.erb
|
1548
|
-
- app/components/avo/index/resource_map_component.rb
|
1549
1522
|
- app/components/avo/index/resource_table_component.html.erb
|
1550
1523
|
- app/components/avo/index/resource_table_component.rb
|
1551
1524
|
- app/components/avo/index/table_row_component.html.erb
|
@@ -1567,8 +1540,6 @@ files:
|
|
1567
1540
|
- app/components/avo/resource_component.rb
|
1568
1541
|
- app/components/avo/resource_sidebar_component.html.erb
|
1569
1542
|
- app/components/avo/resource_sidebar_component.rb
|
1570
|
-
- app/components/avo/row_component.html.erb
|
1571
|
-
- app/components/avo/row_component.rb
|
1572
1543
|
- app/components/avo/sidebar/base_item_component.rb
|
1573
1544
|
- app/components/avo/sidebar/group_component.html.erb
|
1574
1545
|
- app/components/avo/sidebar/group_component.rb
|
@@ -1623,9 +1594,9 @@ files:
|
|
1623
1594
|
- app/javascript/js/controllers/fields/belongs_to_field_controller.js
|
1624
1595
|
- app/javascript/js/controllers/fields/code_field_controller.js
|
1625
1596
|
- app/javascript/js/controllers/fields/date_field_controller.js
|
1626
|
-
- app/javascript/js/controllers/fields/easy_mde_controller.js
|
1627
1597
|
- app/javascript/js/controllers/fields/key_value_controller.js
|
1628
1598
|
- app/javascript/js/controllers/fields/progress_bar_field_controller.js
|
1599
|
+
- app/javascript/js/controllers/fields/simple_mde_controller.js
|
1629
1600
|
- app/javascript/js/controllers/fields/tags_field_helpers.js
|
1630
1601
|
- app/javascript/js/controllers/fields/trix_field_controller.js
|
1631
1602
|
- app/javascript/js/controllers/filter_controller.js
|
@@ -1657,7 +1628,6 @@ files:
|
|
1657
1628
|
- app/views/avo/actions/keep_modal_open.turbo_stream.erb
|
1658
1629
|
- app/views/avo/actions/show.html.erb
|
1659
1630
|
- app/views/avo/associations/new.html.erb
|
1660
|
-
- app/views/avo/attachments/destroy.turbo_stream.erb
|
1661
1631
|
- app/views/avo/base/_boolean_filter.html.erb
|
1662
1632
|
- app/views/avo/base/_multiple_select_filter.html.erb
|
1663
1633
|
- app/views/avo/base/_select_filter.html.erb
|
@@ -1686,7 +1656,6 @@ files:
|
|
1686
1656
|
- app/views/avo/partials/_logo.html.erb
|
1687
1657
|
- app/views/avo/partials/_navbar.html.erb
|
1688
1658
|
- app/views/avo/partials/_pre_head.html.erb
|
1689
|
-
- app/views/avo/partials/_profile_menu_extra.html.erb
|
1690
1659
|
- app/views/avo/partials/_resource_search.html.erb
|
1691
1660
|
- app/views/avo/partials/_scripts.html.erb
|
1692
1661
|
- app/views/avo/partials/_sidebar_extra.html.erb
|
@@ -1718,6 +1687,7 @@ files:
|
|
1718
1687
|
- db/factories.rb
|
1719
1688
|
- lib/avo.rb
|
1720
1689
|
- lib/avo/action_model.rb
|
1690
|
+
- lib/avo/app.rb
|
1721
1691
|
- lib/avo/asset_manager.rb
|
1722
1692
|
- lib/avo/base_action.rb
|
1723
1693
|
- lib/avo/base_resource.rb
|
@@ -1726,7 +1696,6 @@ files:
|
|
1726
1696
|
- lib/avo/concerns/can_replace_items.rb
|
1727
1697
|
- lib/avo/concerns/filters_session_handler.rb
|
1728
1698
|
- lib/avo/concerns/has_controls.rb
|
1729
|
-
- lib/avo/concerns/has_description.rb
|
1730
1699
|
- lib/avo/concerns/has_item_type.rb
|
1731
1700
|
- lib/avo/concerns/has_items.rb
|
1732
1701
|
- lib/avo/concerns/has_stimulus_controllers.rb
|
@@ -1743,14 +1712,12 @@ files:
|
|
1743
1712
|
- lib/avo/engine.rb
|
1744
1713
|
- lib/avo/error_manager.rb
|
1745
1714
|
- lib/avo/execution_context.rb
|
1746
|
-
- lib/avo/fields/area_field.rb
|
1747
1715
|
- lib/avo/fields/badge_field.rb
|
1748
1716
|
- lib/avo/fields/base_field.rb
|
1749
1717
|
- lib/avo/fields/belongs_to_field.rb
|
1750
1718
|
- lib/avo/fields/boolean_field.rb
|
1751
1719
|
- lib/avo/fields/boolean_group_field.rb
|
1752
1720
|
- lib/avo/fields/code_field.rb
|
1753
|
-
- lib/avo/fields/concerns/file_authorization.rb
|
1754
1721
|
- lib/avo/fields/concerns/handles_field_args.rb
|
1755
1722
|
- lib/avo/fields/concerns/has_default.rb
|
1756
1723
|
- lib/avo/fields/concerns/has_field_name.rb
|
@@ -1777,7 +1744,6 @@ files:
|
|
1777
1744
|
- lib/avo/fields/hidden_field.rb
|
1778
1745
|
- lib/avo/fields/id_field.rb
|
1779
1746
|
- lib/avo/fields/key_value_field.rb
|
1780
|
-
- lib/avo/fields/location_field.rb
|
1781
1747
|
- lib/avo/fields/markdown_field.rb
|
1782
1748
|
- lib/avo/fields/number_field.rb
|
1783
1749
|
- lib/avo/fields/password_field.rb
|
@@ -1794,6 +1760,7 @@ files:
|
|
1794
1760
|
- lib/avo/filters/multiple_select_filter.rb
|
1795
1761
|
- lib/avo/filters/select_filter.rb
|
1796
1762
|
- lib/avo/filters/text_filter.rb
|
1763
|
+
- lib/avo/grid_collector.rb
|
1797
1764
|
- lib/avo/grid_fields/body_field.rb
|
1798
1765
|
- lib/avo/grid_fields/grid_field.rb
|
1799
1766
|
- lib/avo/grid_fields/preview_field.rb
|
@@ -1804,7 +1771,7 @@ files:
|
|
1804
1771
|
- lib/avo/licensing/h_q.rb
|
1805
1772
|
- lib/avo/licensing/license.rb
|
1806
1773
|
- lib/avo/licensing/license_manager.rb
|
1807
|
-
- lib/avo/licensing/
|
1774
|
+
- lib/avo/licensing/null_license.rb
|
1808
1775
|
- lib/avo/licensing/pro_license.rb
|
1809
1776
|
- lib/avo/loaders/actions_loader.rb
|
1810
1777
|
- lib/avo/loaders/fields_loader.rb
|
@@ -1829,7 +1796,6 @@ files:
|
|
1829
1796
|
- lib/avo/resources/items/item_group.rb
|
1830
1797
|
- lib/avo/resources/items/main_panel.rb
|
1831
1798
|
- lib/avo/resources/items/panel.rb
|
1832
|
-
- lib/avo/resources/items/row.rb
|
1833
1799
|
- lib/avo/resources/items/sidebar.rb
|
1834
1800
|
- lib/avo/resources/items/tab.rb
|
1835
1801
|
- lib/avo/resources/items/tab_group.rb
|
@@ -1845,7 +1811,9 @@ files:
|
|
1845
1811
|
- lib/avo/version.rb
|
1846
1812
|
- lib/generators/avo/action_generator.rb
|
1847
1813
|
- lib/generators/avo/base_generator.rb
|
1848
|
-
- lib/generators/avo/
|
1814
|
+
- lib/generators/avo/card/chartkick_generator.rb
|
1815
|
+
- lib/generators/avo/card/metric_generator.rb
|
1816
|
+
- lib/generators/avo/card/partial_generator.rb
|
1849
1817
|
- lib/generators/avo/controller_generator.rb
|
1850
1818
|
- lib/generators/avo/dashboard_generator.rb
|
1851
1819
|
- lib/generators/avo/eject_generator.rb
|
@@ -1897,6 +1865,7 @@ files:
|
|
1897
1865
|
- lib/generators/avo/templates/resource_tools/partial.tt
|
1898
1866
|
- lib/generators/avo/templates/resource_tools/resource_tool.tt
|
1899
1867
|
- lib/generators/avo/templates/scope.tt
|
1868
|
+
- lib/generators/avo/templates/standalone_action.tt
|
1900
1869
|
- lib/generators/avo/templates/tailwindcss/Procfile.dev
|
1901
1870
|
- lib/generators/avo/templates/tailwindcss/avo.tailwind.css
|
1902
1871
|
- lib/generators/avo/templates/tool/controller.tt
|
@@ -1908,12 +1877,6 @@ files:
|
|
1908
1877
|
- lib/generators/rails/avo_resource_generator.rb
|
1909
1878
|
- lib/tasks/avo_tasks.rake
|
1910
1879
|
- lib/tasks/tailwindcss_rails.rake
|
1911
|
-
- public/avo-assets/avo.base.css
|
1912
|
-
- public/avo-assets/avo.base.js
|
1913
|
-
- public/avo-assets/avo.base.js.map
|
1914
|
-
- public/avo-assets/avo.css
|
1915
|
-
- public/avo-assets/avo.js
|
1916
|
-
- public/avo-assets/avo.js.map
|
1917
1880
|
- public/avo-assets/favicon.ico
|
1918
1881
|
- public/avo-assets/fonts/inter-v7-latin-500.eot
|
1919
1882
|
- public/avo-assets/fonts/inter-v7-latin-500.svg
|
@@ -1,35 +0,0 @@
|
|
1
|
-
<svg width="248" height="287" viewBox="0 0 248 287" fill="none" xmlns="http://www.w3.org/2000/svg" data-target="grid-empty-state-svg">
|
2
|
-
<path d="M124 270.227C192.483 270.227 248 214.71 248 146.227C248 77.7433 192.483 22.2266 124 22.2266C55.5167 22.2266 0 77.7433 0 146.227C0 214.71 55.5167 270.227 124 270.227Z" fill="rgb(var(--color-primary-100))"/>
|
3
|
-
<g filter="rgb(var(--color-primary-100))">
|
4
|
-
<path d="M195.093 93.3198H52.9068C48.3412 93.3198 44.6401 97.0209 44.6401 101.586V275.186C44.6401 279.752 48.3412 283.453 52.9068 283.453H195.093C199.659 283.453 203.36 279.752 203.36 275.186V101.586C203.36 97.0209 199.659 93.3198 195.093 93.3198Z" fill="white"/>
|
5
|
-
</g>
|
6
|
-
<path d="M107.467 118.12H64.48C61.7407 118.12 59.52 120.34 59.52 123.08C59.52 125.819 61.7407 128.04 64.48 128.04H107.467C110.206 128.04 112.427 125.819 112.427 123.08C112.427 120.34 110.206 118.12 107.467 118.12Z" fill="rgb(var(--color-primary-100))"/>
|
7
|
-
<path d="M137.227 139.613H64.48C61.7407 139.613 59.52 141.834 59.52 144.573C59.52 147.312 61.7407 149.533 64.48 149.533H137.227C139.966 149.533 142.187 147.312 142.187 144.573C142.187 141.834 139.966 139.613 137.227 139.613Z" fill="rgb(var(--color-primary-100))" opacity="0.6"/>
|
8
|
-
<path d="M107.467 162.76H64.48C61.7407 162.76 59.52 164.981 59.52 167.72C59.52 170.459 61.7407 172.68 64.48 172.68H107.467C110.206 172.68 112.427 170.459 112.427 167.72C112.427 164.981 110.206 162.76 107.467 162.76Z" fill="rgb(var(--color-primary-100))"/>
|
9
|
-
<path d="M137.227 184.253H64.48C61.7407 184.253 59.52 186.474 59.52 189.213C59.52 191.953 61.7407 194.173 64.48 194.173H137.227C139.966 194.173 142.187 191.953 142.187 189.213C142.187 186.474 139.966 184.253 137.227 184.253Z" fill="rgb(var(--color-primary-100))" opacity="0.6"/>
|
10
|
-
<path d="M107.467 207.4H64.48C61.7407 207.4 59.52 209.621 59.52 212.36C59.52 215.099 61.7407 217.32 64.48 217.32H107.467C110.206 217.32 112.427 215.099 112.427 212.36C112.427 209.621 110.206 207.4 107.467 207.4Z" fill="rgb(var(--color-primary-100))"/>
|
11
|
-
<path d="M137.227 228.893H64.48C61.7407 228.893 59.52 231.114 59.52 233.853C59.52 236.592 61.7407 238.813 64.48 238.813H137.227C139.966 238.813 142.187 236.592 142.187 233.853C142.187 231.114 139.966 228.893 137.227 228.893Z" fill="rgb(var(--color-primary-100))" opacity="0.6"/>
|
12
|
-
<g filter="url(#filter1_d_577_1090)">
|
13
|
-
<path d="M195.093 9H52.9068C48.3412 9 44.6401 12.7011 44.6401 17.2667V66.8667C44.6401 71.4322 48.3412 75.1333 52.9068 75.1333H195.093C199.659 75.1333 203.36 71.4322 203.36 66.8667V17.2667C203.36 12.7011 199.659 9 195.093 9Z" fill="rgb(var(--color-primary-500))"/>
|
14
|
-
</g>
|
15
|
-
<path d="M107.467 27.1865H64.48C61.7407 27.1865 59.52 29.4072 59.52 32.1465C59.52 34.8859 61.7407 37.1065 64.48 37.1065H107.467C110.206 37.1065 112.427 34.8859 112.427 32.1465C112.427 29.4072 110.206 27.1865 107.467 27.1865Z" fill="rgb(var(--color-primary-100))"/>
|
16
|
-
<path d="M137.227 48.6799H64.48C61.7407 48.6799 59.52 50.9006 59.52 53.6399C59.52 56.3793 61.7407 58.5999 64.48 58.5999H137.227C139.966 58.5999 142.187 56.3793 142.187 53.6399C142.187 50.9006 139.966 48.6799 137.227 48.6799Z" fill="white"/>
|
17
|
-
<defs>
|
18
|
-
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
19
|
-
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
20
|
-
<feOffset dy="-3"/>
|
21
|
-
<feGaussianBlur stdDeviation="3"/>
|
22
|
-
<feColorMatrix type="matrix" values="0 0 0 0 0.788235 0 0 0 0 0.803922 0 0 0 0 0.85098 0 0 0 0.349 0"/>
|
23
|
-
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_577_1090"/>
|
24
|
-
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_577_1090" result="shape"/>
|
25
|
-
<filter id="filter1_d_577_1090" x="38.6401" y="0" width="170.72" height="78.1333" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
26
|
-
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
27
|
-
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
28
|
-
<feOffset dy="-3"/>
|
29
|
-
<feGaussianBlur stdDeviation="3"/>
|
30
|
-
<feColorMatrix type="matrix" values="0 0 0 0 0.788235 0 0 0 0 0.803922 0 0 0 0 0.85098 0 0 0 0.349 0"/>
|
31
|
-
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_577_1090"/>
|
32
|
-
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_577_1090" result="shape"/>
|
33
|
-
</filter>
|
34
|
-
</defs>
|
35
|
-
</svg>
|
@@ -1,3 +0,0 @@
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true">
|
2
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M9 6.75V15m6-6v8.25m.503 3.498l4.875-2.437c.381-.19.622-.58.622-1.006V4.82c0-.836-.88-1.38-1.628-1.006l-3.869 1.934c-.317.159-.69.159-1.006 0L9.503 3.252a1.125 1.125 0 00-1.006 0L3.622 5.689C3.24 5.88 3 6.27 3 6.695V19.18c0 .836.88 1.38 1.628 1.006l3.869-1.934c.317-.159.69-.159 1.006 0l4.994 2.497c.317.158.69.158 1.006 0z"/>
|
3
|
-
</svg>
|
@@ -1,29 +0,0 @@
|
|
1
|
-
<div class="flex">
|
2
|
-
<% if can_download_file? %>
|
3
|
-
<%= a_link Rails.application.routes.url_helpers.rails_blob_path(file, only_path: true, disposition: :attachment),
|
4
|
-
icon: 'heroicons/outline/download',
|
5
|
-
color: :primary,
|
6
|
-
download: true,
|
7
|
-
class: 'text-center',
|
8
|
-
title: t('avo.download_file'),
|
9
|
-
data: { tippy: :tooltip },
|
10
|
-
compact: true,
|
11
|
-
size: :xs %>
|
12
|
-
<% end %>
|
13
|
-
</div>
|
14
|
-
<div>
|
15
|
-
<% if can_delete_file? %>
|
16
|
-
<%= a_link destroy_path,
|
17
|
-
icon: 'heroicons/outline/trash',
|
18
|
-
color: :red,
|
19
|
-
compact: true,
|
20
|
-
size: :xs,
|
21
|
-
class: 'text-center',
|
22
|
-
title: t('avo.delete_file', item: file.filename),
|
23
|
-
data: {
|
24
|
-
turbo_method: :delete,
|
25
|
-
turbo_confirm: t('avo.are_you_sure'),
|
26
|
-
tippy: :tooltip
|
27
|
-
} %>
|
28
|
-
<% end %>
|
29
|
-
</div>
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class Avo::Fields::Common::Files::ControlsComponent < ViewComponent::Base
|
4
|
-
include Avo::ApplicationHelper
|
5
|
-
include Avo::Fields::Concerns::FileAuthorization
|
6
|
-
|
7
|
-
attr_reader :file, :field, :resource
|
8
|
-
delegate :id, to: :field
|
9
|
-
|
10
|
-
def initialize(field:, file:, resource:)
|
11
|
-
@field = field
|
12
|
-
@file = file
|
13
|
-
@resource = resource
|
14
|
-
end
|
15
|
-
|
16
|
-
def destroy_path
|
17
|
-
Avo::Services::URIService.parse(@resource.record_path).append_paths("active_storage_attachments", id, file.id).to_s
|
18
|
-
end
|
19
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
<%= content_tag :div, class: wrapper_classes do %>
|
2
|
-
<%= turbo_frame_tag @field.id do %>
|
3
|
-
<% unless @field.hide_view_type_switcher %>
|
4
|
-
<div class="justify-self-end flex justify-end items-center space-x-3">
|
5
|
-
<%= render partial: 'avo/partials/view_toggle_button',
|
6
|
-
locals: {
|
7
|
-
available_view_types: available_view_types,
|
8
|
-
view_type: view_type,
|
9
|
-
turbo_frame: @field.id,
|
10
|
-
}
|
11
|
-
%>
|
12
|
-
</div>
|
13
|
-
<% end %>
|
14
|
-
<div class="<%= classes %>">
|
15
|
-
<% @field.value.attachments.each do |file| %>
|
16
|
-
<%= render view_type_component(file) %>
|
17
|
-
<% end %>
|
18
|
-
</div>
|
19
|
-
<% end %>
|
20
|
-
<% end %>
|
@@ -1,41 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class Avo::Fields::Common::Files::ListViewerComponent < ViewComponent::Base
|
4
|
-
include Turbo::FramesHelper
|
5
|
-
|
6
|
-
attr_reader :field, :resource
|
7
|
-
|
8
|
-
def initialize(field:, resource:)
|
9
|
-
@field = field
|
10
|
-
@resource = resource
|
11
|
-
end
|
12
|
-
|
13
|
-
def classes
|
14
|
-
base_classes = "py-4 rounded-xl max-w-full"
|
15
|
-
|
16
|
-
view_type_classes = if view_type == :list
|
17
|
-
"flex flex-col space-y-2"
|
18
|
-
else
|
19
|
-
"relative grid xs:grid-cols-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-6 gap-6"
|
20
|
-
end
|
21
|
-
|
22
|
-
"#{base_classes} #{view_type_classes}"
|
23
|
-
end
|
24
|
-
|
25
|
-
def wrapper_classes
|
26
|
-
(field.stacked && !field.hide_view_type_switcher) ? "-mt-9" : ""
|
27
|
-
end
|
28
|
-
|
29
|
-
def available_view_types
|
30
|
-
[:list, :grid]
|
31
|
-
end
|
32
|
-
|
33
|
-
def view_type_component(file)
|
34
|
-
component = "Avo::Fields::Common::Files::ViewType::#{view_type.to_s.capitalize}Component".constantize
|
35
|
-
component.new(field: field, resource: resource, file: file)
|
36
|
-
end
|
37
|
-
|
38
|
-
def view_type
|
39
|
-
(resource.params.dig(:view_type) || field.view_type).to_sym
|
40
|
-
end
|
41
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
<div id="<%= dom_id file %>" class="relative min-h-full max-w-full flex-1 flex flex-col justify-between space-y-2">
|
2
|
-
<% if file.present? %>
|
3
|
-
<div class="flex flex-col justify-between h-full">
|
4
|
-
<% if file.representable? && is_image? %>
|
5
|
-
<%= image_tag helpers.main_app.url_for(file), class: 'rounded-lg object-cover w-full aspect-video' %>
|
6
|
-
<% elsif is_audio? %>
|
7
|
-
<%= audio_tag(helpers.main_app.url_for(file), controls: true, preload: false, class: 'w-full') %>
|
8
|
-
<% elsif is_video? %>
|
9
|
-
<%= video_tag(helpers.main_app.url_for(file), controls: true, preload: false, class: 'w-full') %>
|
10
|
-
<% else %>
|
11
|
-
<div class="relative flex flex-col justify-evenly items-center px-2 rounded-lg border bg-white border-gray-500 min-h-24">
|
12
|
-
<div class="flex flex-col justify-center items-center w-full">
|
13
|
-
<%= helpers.svg 'document-text', class: 'h-10 text-gray-600 mb-2' %>
|
14
|
-
</div>
|
15
|
-
</div>
|
16
|
-
<% end %>
|
17
|
-
<% if field.display_filename %>
|
18
|
-
<span class="text-gray-500 mt-1 text-sm truncate" title="<%= file.filename %>"><%= file.filename %></span>
|
19
|
-
<% end %>
|
20
|
-
</div>
|
21
|
-
<div class="flex space-x-2">
|
22
|
-
<%= render Avo::Fields::Common::Files::ControlsComponent.new(field: field, file: file, resource: resource) %>
|
23
|
-
</div>
|
24
|
-
<% else %>
|
25
|
-
–
|
26
|
-
<% end %>
|
27
|
-
</div>
|
@@ -1,51 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class Avo::Fields::Common::Files::ViewType::GridComponent < ViewComponent::Base
|
4
|
-
attr_reader :field, :resource
|
5
|
-
|
6
|
-
def initialize(field:, resource:, file: nil)
|
7
|
-
@file = file
|
8
|
-
@field = field
|
9
|
-
@resource = resource
|
10
|
-
end
|
11
|
-
|
12
|
-
def id
|
13
|
-
field.id
|
14
|
-
end
|
15
|
-
|
16
|
-
def file
|
17
|
-
@file || field.value.attachment
|
18
|
-
rescue
|
19
|
-
nil
|
20
|
-
end
|
21
|
-
|
22
|
-
def is_image?
|
23
|
-
file.image? || field.is_image
|
24
|
-
rescue
|
25
|
-
false
|
26
|
-
end
|
27
|
-
|
28
|
-
def is_audio?
|
29
|
-
file.audio? || field.is_audio
|
30
|
-
rescue
|
31
|
-
false
|
32
|
-
end
|
33
|
-
|
34
|
-
def is_video?
|
35
|
-
file.video? || field.is_video
|
36
|
-
rescue
|
37
|
-
false
|
38
|
-
end
|
39
|
-
|
40
|
-
def render?
|
41
|
-
record_persisted?
|
42
|
-
end
|
43
|
-
|
44
|
-
# If record is not persistent blob is automatically destroyed otherwise it can be "lost" on storage
|
45
|
-
def record_persisted?
|
46
|
-
return true if @resource.record.persisted?
|
47
|
-
|
48
|
-
ActiveStorage::Blob.destroy(file.blob_id) if file.blob_id.present?
|
49
|
-
false
|
50
|
-
end
|
51
|
-
end
|