avo 3.0.0.pre12 → 3.0.0.pre15
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 +1 -1
- data/Gemfile.lock +2 -1
- data/app/assets/stylesheets/avo.base.css +1 -1
- data/app/components/avo/actions_component.html.erb +1 -1
- data/app/components/avo/actions_component.rb +40 -16
- 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 +2 -2
- data/app/components/avo/field_wrapper_component.rb +1 -1
- data/app/components/avo/fields/area_field/edit_component.html.erb +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 -4
- data/app/components/avo/fields/boolean_field/edit_component.html.erb +1 -0
- 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 +1 -0
- data/app/components/avo/fields/common/heading_component.html.erb +1 -1
- data/app/components/avo/fields/country_field/edit_component.html.erb +1 -0
- data/app/components/avo/fields/file_field/index_component.rb +2 -2
- data/app/components/avo/fields/has_one_field/show_component.html.erb +1 -0
- data/app/components/avo/fields/index_component.rb +1 -0
- data/app/components/avo/fields/location_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/markdown_field/edit_component.html.erb +4 -3
- 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 -0
- data/app/components/avo/fields/password_field/edit_component.html.erb +1 -0
- data/app/components/avo/fields/progress_bar_field/edit_component.html.erb +1 -0
- data/app/components/avo/fields/status_field/edit_component.html.erb +1 -1
- data/app/components/avo/fields/text_field/edit_component.html.erb +1 -1
- data/app/components/avo/fields/textarea_field/edit_component.html.erb +1 -0
- data/app/components/avo/fields/trix_field/edit_component.html.erb +2 -1
- 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/grid_item_component.html.erb +9 -35
- data/app/components/avo/index/grid_item_component.rb +36 -10
- data/app/components/avo/index/resource_controls_component.rb +6 -6
- data/app/components/avo/index/resource_table_component.rb +1 -1
- data/app/components/avo/item_switcher_component.html.erb +9 -4
- data/app/components/avo/item_switcher_component.rb +2 -1
- data/app/components/avo/panel_component.html.erb +1 -1
- data/app/components/avo/profile_item_component.html.erb +17 -2
- data/app/components/avo/profile_item_component.rb +13 -1
- data/app/components/avo/resource_component.rb +6 -3
- data/app/components/avo/resource_sidebar_component.rb +1 -1
- data/app/components/avo/row_component.html.erb +3 -0
- data/app/components/avo/row_component.rb +12 -0
- data/app/components/avo/sidebar/link_component.html.erb +2 -0
- data/app/components/avo/sidebar/link_component.rb +5 -3
- 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.rb +1 -1
- data/app/components/avo/views/resource_index_component.html.erb +1 -1
- data/app/components/avo/views/resource_index_component.rb +8 -8
- data/app/controllers/avo/actions_controller.rb +16 -8
- data/app/controllers/avo/application_controller.rb +71 -66
- data/app/controllers/avo/associations_controller.rb +4 -6
- data/app/controllers/avo/attachments_controller.rb +1 -1
- data/app/controllers/avo/base_controller.rb +39 -27
- data/app/controllers/avo/home_controller.rb +1 -1
- data/app/controllers/avo/search_controller.rb +18 -20
- data/app/controllers/concerns/avo/initializes_avo.rb +3 -6
- data/app/javascript/js/controllers/fields/{simple_mde_controller.js → easy_mde_controller.js} +4 -3
- data/app/javascript/js/controllers/search_controller.js +3 -1
- data/app/javascript/js/controllers.js +2 -2
- data/app/views/avo/actions/show.html.erb +2 -1
- data/app/views/avo/associations/new.html.erb +1 -1
- data/app/views/avo/debug/status.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/_profile_menu_extra.html.erb +2 -0
- data/app/views/layouts/avo/application.html.erb +2 -2
- data/avo.gemspec +1 -0
- data/config/initializers/pagy.rb +12 -10
- data/config/routes.rb +3 -3
- data/db/factories.rb +2 -1
- data/lib/avo/base_action.rb +12 -3
- data/lib/avo/base_resource.rb +183 -181
- data/lib/avo/concerns/filters_session_handler.rb +0 -1
- data/lib/avo/concerns/has_item_type.rb +4 -0
- data/lib/avo/concerns/has_items.rb +28 -23
- data/lib/avo/concerns/model_class_constantized.rb +0 -2
- data/lib/avo/configuration.rb +6 -2
- data/lib/avo/current.rb +29 -2
- data/lib/avo/dsl/field_parser.rb +1 -1
- data/lib/avo/dynamic_router.rb +12 -1
- data/lib/avo/engine.rb +8 -6
- data/lib/avo/execution_context.rb +1 -1
- data/lib/avo/fields/base_field.rb +25 -7
- data/lib/avo/fields/belongs_to_field.rb +20 -13
- data/lib/avo/fields/concerns/is_searchable.rb +1 -1
- data/lib/avo/fields/concerns/use_resource.rb +1 -1
- data/lib/avo/fields/field_manager.rb +13 -3
- data/lib/avo/fields/has_base_field.rb +5 -5
- data/lib/avo/fields/has_one_field.rb +1 -1
- data/lib/avo/fields/location_field.rb +18 -1
- data/lib/avo/filters/base_filter.rb +3 -1
- data/lib/avo/html/builder.rb +3 -1
- data/lib/avo/licensing/h_q.rb +11 -6
- data/lib/avo/licensing/license.rb +1 -1
- data/lib/avo/licensing/license_manager.rb +1 -1
- data/lib/avo/licensing/{null_license.rb → nil_license.rb} +1 -1
- data/lib/avo/loaders/fields_loader.rb +7 -1
- data/lib/avo/plugin_manager.rb +2 -4
- data/lib/avo/reloader.rb +1 -1
- data/lib/avo/resources/controls/actions_list.rb +2 -1
- data/lib/avo/resources/items/holder.rb +5 -1
- data/lib/avo/resources/items/item_group.rb +1 -0
- data/lib/avo/resources/items/row.rb +54 -0
- data/lib/avo/resources/resource_manager.rb +4 -7
- data/lib/avo/services/debug_service.rb +6 -6
- data/lib/avo/services/telemetry_service.rb +3 -3
- data/lib/avo/version.rb +1 -1
- data/lib/avo.rb +107 -25
- data/lib/generators/avo/action_generator.rb +8 -8
- data/lib/generators/avo/card_generator.rb +27 -0
- data/lib/generators/avo/eject_generator.rb +1 -0
- data/lib/generators/avo/filter_generator.rb +8 -8
- data/lib/generators/avo/install_generator.rb +0 -1
- data/lib/generators/avo/resource_generator.rb +4 -1
- data/lib/generators/avo/templates/action.tt +3 -3
- 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 +1 -1
- data/lib/generators/avo/templates/resource/resource.tt +3 -4
- data/lib/generators/avo/templates/scope.tt +1 -1
- data/lib/tasks/avo_tasks.rake +1 -1
- data/public/avo-assets/avo.base.css +295 -165
- data/public/avo-assets/avo.base.js +307 -278
- data/public/avo-assets/avo.base.js.map +3 -3
- metadata +23 -10
- data/lib/avo/app.rb +0 -170
- data/lib/avo/grid_collector.rb +0 -40
- data/lib/generators/avo/card/chartkick_generator.rb +0 -18
- data/lib/generators/avo/card/metric_generator.rb +0 -18
- data/lib/generators/avo/card/partial_generator.rb +0 -19
- data/lib/generators/avo/templates/standalone_action.tt +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b1b68ed3a24e1223b230516bb904a16816ad0f27a3bf2419120a603cd7e26d4
|
4
|
+
data.tar.gz: 07b958d68bff512090a9dbedf6762cfe6cc39ea04e6da075a470ac8deed681d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5891cb96687009033562eb024652abee10398d7a093ae8475ee5d06001dd4e578ab941980d8a657cae1a9824548a28e46f9cc0a53a74c2671c6ef7b6b98024d5
|
7
|
+
data.tar.gz: 58611c02f92e01e5fb35845c06c3fe4fb3164ed00971af40a6591c5f6cf009ad77df8037d629ca661575f8053dcd9f7a35153f0e3f482e6189609036f20593e1
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
@import './../../../node_modules/
|
1
|
+
@import './../../../node_modules/easymde/dist/easymde.min.css';
|
2
2
|
@import './../../../node_modules/tippy.js/dist/tippy.css';
|
3
3
|
@import './../../../node_modules/tippy.js/themes/light.css';
|
4
4
|
@import './../../../node_modules/flatpickr/dist/flatpickr.css';
|
@@ -32,7 +32,7 @@
|
|
32
32
|
>
|
33
33
|
<div data-target="actions-list" class="w-full space divide-y">
|
34
34
|
<% actions.each_with_index do |action, index| %>
|
35
|
-
<%= link_to action_path(action
|
35
|
+
<%= link_to action_path(action),
|
36
36
|
data: {
|
37
37
|
action_name: action.action_name,
|
38
38
|
'turbo-frame': 'actions_show',
|
@@ -4,11 +4,12 @@ class Avo::ActionsComponent < ViewComponent::Base
|
|
4
4
|
include Avo::ApplicationHelper
|
5
5
|
attr_reader :label, :size, :as_row_control
|
6
6
|
|
7
|
-
def initialize(actions: [], resource: nil, view: nil, exclude: [], style: :outline, color: :primary, label: nil, size: :md, as_row_control: false)
|
7
|
+
def initialize(actions: [], resource: nil, view: nil, exclude: [], include: [], style: :outline, color: :primary, label: nil, size: :md, as_row_control: false)
|
8
8
|
@actions = actions || []
|
9
9
|
@resource = resource
|
10
10
|
@view = view
|
11
11
|
@exclude = exclude
|
12
|
+
@include = include
|
12
13
|
@color = color
|
13
14
|
@style = style
|
14
15
|
@label = label || I18n.t("avo.actions")
|
@@ -21,19 +22,25 @@ class Avo::ActionsComponent < ViewComponent::Base
|
|
21
22
|
end
|
22
23
|
|
23
24
|
def actions
|
24
|
-
@
|
25
|
+
if @exclude.present?
|
26
|
+
@actions.reject { |action| action.class.in?(@exclude) }
|
27
|
+
elsif @include.present?
|
28
|
+
@actions.select { |action| action.class.in?(@include) }
|
29
|
+
else
|
30
|
+
@actions
|
31
|
+
end
|
25
32
|
end
|
26
33
|
|
27
34
|
# When running an action for one record we should do it on a special path.
|
28
35
|
# We do that so we get the `record` param inside the action so we can prefill fields.
|
29
|
-
def action_path(
|
30
|
-
return single_record_path(
|
31
|
-
return many_records_path(
|
36
|
+
def action_path(action)
|
37
|
+
return single_record_path(action) if as_row_control
|
38
|
+
return many_records_path(action) unless @resource.has_record_id?
|
32
39
|
|
33
40
|
if on_record_page?
|
34
|
-
single_record_path
|
41
|
+
single_record_path action
|
35
42
|
else
|
36
|
-
many_records_path
|
43
|
+
many_records_path action
|
37
44
|
end
|
38
45
|
end
|
39
46
|
|
@@ -54,17 +61,34 @@ class Avo::ActionsComponent < ViewComponent::Base
|
|
54
61
|
!on_record_page?
|
55
62
|
end
|
56
63
|
|
57
|
-
def single_record_path(
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
64
|
+
def single_record_path(action)
|
65
|
+
action_url(action, @resource.record_path)
|
66
|
+
end
|
67
|
+
|
68
|
+
def many_records_path(action)
|
69
|
+
action_url(action, @resource.records_path)
|
62
70
|
end
|
63
71
|
|
64
|
-
def
|
65
|
-
Avo::Services::URIService.parse(
|
72
|
+
def action_url(action, path)
|
73
|
+
Avo::Services::URIService.parse(path)
|
66
74
|
.append_paths("actions")
|
67
|
-
.append_query(
|
68
|
-
|
75
|
+
.append_query(
|
76
|
+
{
|
77
|
+
action_id: action.param_id,
|
78
|
+
arguments: encrypted_arguments(action)
|
79
|
+
}.compact
|
80
|
+
).to_s
|
81
|
+
end
|
82
|
+
|
83
|
+
# Encrypt the arguments so we can pass them as a query param.
|
84
|
+
# EncryptionService can generate special characters that can break the URL.
|
85
|
+
# We use Base64 to encode the encrypted string so we can safely pass it as a query param and don't break the URL.
|
86
|
+
def encrypted_arguments(action)
|
87
|
+
return if action.arguments.blank?
|
88
|
+
|
89
|
+
Base64.encode64 Avo::Services::EncryptionService.encrypt(
|
90
|
+
message: action.arguments,
|
91
|
+
purpose: :action_arguments
|
92
|
+
)
|
69
93
|
end
|
70
94
|
end
|
@@ -4,7 +4,7 @@ class Avo::BaseComponent < ViewComponent::Base
|
|
4
4
|
include Turbo::FramesHelper
|
5
5
|
|
6
6
|
def has_with_trial(ability)
|
7
|
-
|
7
|
+
Avo.license.has_with_trial(ability)
|
8
8
|
end
|
9
9
|
|
10
10
|
private
|
@@ -18,7 +18,7 @@ class Avo::BaseComponent < ViewComponent::Base
|
|
18
18
|
|
19
19
|
# Fetch the resource and hydrate it with the record
|
20
20
|
def association_resource
|
21
|
-
resource =
|
21
|
+
resource = Avo.resource_manager.get_resource(params[:via_resource_class])
|
22
22
|
|
23
23
|
model_class = if params[:via_relation_class].present?
|
24
24
|
::Avo::BaseResource.get_model_by_name params[:via_relation_class]
|
@@ -26,23 +26,23 @@ class Avo::BaseComponent < ViewComponent::Base
|
|
26
26
|
resource.model_class
|
27
27
|
end
|
28
28
|
|
29
|
-
resource =
|
29
|
+
resource = Avo.resource_manager.get_resource_by_model_class model_class if resource.blank?
|
30
30
|
|
31
31
|
record = resource.find_record params[:via_record_id], query: model_class, params: params
|
32
32
|
|
33
|
-
resource.
|
33
|
+
resource.new record: record
|
34
34
|
end
|
35
35
|
|
36
36
|
# Get the resource for the resource using the klass attribute so we get the namespace too
|
37
37
|
def reflection_resource
|
38
|
-
|
38
|
+
Avo.resource_manager.get_resource_by_model_class(@reflection.klass.to_s)
|
39
39
|
rescue
|
40
40
|
nil
|
41
41
|
end
|
42
42
|
|
43
43
|
# Get the resource for the resource using the klass attribute so we get the namespace too
|
44
44
|
def reflection_parent_resource
|
45
|
-
|
45
|
+
Avo.resource_manager.get_resource_by_model_class(@reflection.active_record.to_s)
|
46
46
|
rescue
|
47
47
|
nil
|
48
48
|
end
|
@@ -51,7 +51,7 @@ class Avo::BaseComponent < ViewComponent::Base
|
|
51
51
|
return @resource unless link_to_child_resource_is_enabled?
|
52
52
|
return @resource if @resource.record.class.base_class == @resource.record.class
|
53
53
|
|
54
|
-
|
54
|
+
Avo.resource_manager.get_resource_by_model_class(@resource.record.class) || @resource
|
55
55
|
end
|
56
56
|
|
57
57
|
def link_to_child_resource_is_enabled?
|
@@ -24,13 +24,13 @@
|
|
24
24
|
<div class="text-red-600 mt-2 text-sm"><%= record.errors.full_messages_for(field.id).to_sentence %></div>
|
25
25
|
<% end %>
|
26
26
|
<% if help.present? %>
|
27
|
-
<div class="text-gray-600 mt-2 text-sm"
|
27
|
+
<div class="text-gray-600 mt-2 text-sm"><%= sanitize help %></div>
|
28
28
|
<% end %>
|
29
29
|
<% end %>
|
30
30
|
</div>
|
31
31
|
</div>
|
32
32
|
<% if params[:avo_debug].present? %>
|
33
33
|
<!-- Raw value: -->
|
34
|
-
<!--
|
34
|
+
<!-- <%= sanitize field.value.inspect %> -->
|
35
35
|
<% end %>
|
36
36
|
<% end %>
|
@@ -43,7 +43,7 @@ class Avo::FieldWrapperComponent < ViewComponent::Base
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def classes(extra_classes = "")
|
46
|
-
"field-wrapper relative flex flex-col
|
46
|
+
"field-wrapper relative flex flex-col grow pb-2 md:pb-0 leading-tight min-h-14 h-full #{stacked? ? "field-wrapper-layout-stacked" : "field-wrapper-layout-inline md:flex-row md:items-center"} #{compact? ? "field-wrapper-size-compact" : "field-wrapper-size-regular"} #{full_width? ? "field-width-full" : "field-width-regular"} #{@classes || ""} #{extra_classes || ""} #{@field.get_html(:classes, view: view, element: :wrapper)}"
|
47
47
|
end
|
48
48
|
|
49
49
|
def style
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<%
|
3
3
|
# Set the model keys so we can pass them over
|
4
4
|
model_keys = @field.types.map do |type|
|
5
|
-
resource = Avo
|
5
|
+
resource = Avo.resource_manager.get_resource_by_model_class(type.to_s)
|
6
6
|
[type.to_s, resource.model_key]
|
7
7
|
end.to_h
|
8
8
|
%>
|
@@ -13,7 +13,7 @@
|
|
13
13
|
data-association-class="<%= @field&.target_resource&.model_class || nil %>"
|
14
14
|
>
|
15
15
|
<%= field_wrapper **field_wrapper_args, help: @field.polymorphic_help || '' do %>
|
16
|
-
<%= @form.select @field.type_input_foreign_key, @field.types.map { |type| [
|
16
|
+
<%= @form.select @field.type_input_foreign_key, @field.types.map { |type| [Avo.resource_manager.get_resource_by_model_class(type.to_s).name, type.to_s] },
|
17
17
|
{
|
18
18
|
value: @field.value,
|
19
19
|
include_blank: @field.placeholder,
|
@@ -40,9 +40,9 @@
|
|
40
40
|
data-belongs-to-field-target="type"
|
41
41
|
data-type="<%= type %>"
|
42
42
|
>
|
43
|
-
<%= field_wrapper **field_wrapper_args, label:
|
43
|
+
<%= field_wrapper **field_wrapper_args, label: Avo.resource_manager.get_resource_by_model_class(type.to_s).name do %>
|
44
44
|
<% if @field.is_searchable? %>
|
45
|
-
<%= render
|
45
|
+
<%= render Avo::Pro::SearchableAssociations::AutocompleteComponent.new form: @form,
|
46
46
|
disabled: disabled,
|
47
47
|
field: @field,
|
48
48
|
foreign_key: @field.id_input_foreign_key,
|
@@ -81,7 +81,7 @@
|
|
81
81
|
<% else %>
|
82
82
|
<%= field_wrapper **field_wrapper_args do %>
|
83
83
|
<% if @field.is_searchable? %>
|
84
|
-
<%= render
|
84
|
+
<%= render Avo::Pro::SearchableAssociations::AutocompleteComponent.new form: @form,
|
85
85
|
field: @field,
|
86
86
|
model_key: @field.target_resource&.model_key,
|
87
87
|
foreign_key: @field.id_input_foreign_key,
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class Avo::Fields::BelongsToField::EditComponent < Avo::Fields::EditComponent
|
4
|
-
def initialize(
|
5
|
-
super
|
4
|
+
def initialize(...)
|
5
|
+
super(...)
|
6
6
|
|
7
7
|
@polymorphic_record = nil
|
8
8
|
end
|
@@ -32,7 +32,7 @@ class Avo::Fields::BelongsToField::EditComponent < Avo::Fields::EditComponent
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def polymorphic_resource
|
35
|
-
Avo
|
35
|
+
Avo.resource_manager.get_resource_by_model_class(polymorphic_class)
|
36
36
|
end
|
37
37
|
|
38
38
|
# Get the polymorphic id
|
@@ -60,6 +60,6 @@ class Avo::Fields::BelongsToField::EditComponent < Avo::Fields::EditComponent
|
|
60
60
|
private
|
61
61
|
|
62
62
|
def visit_through_association?
|
63
|
-
@field.target_resource.
|
63
|
+
@field.target_resource.to_s == params[:via_resource_class].to_s
|
64
64
|
end
|
65
65
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
<%= field_wrapper **field_wrapper_args, dash_if_blank: false do %>
|
2
2
|
<div class="h-8 flex items-center">
|
3
3
|
<%= @form.check_box @field.id,
|
4
|
+
value: @field.value,
|
4
5
|
checked: @field.value,
|
5
6
|
class: "text-lg h-4 w-4 checked:bg-primary-400 focus:checked:!bg-primary-400 rounded #{@field.get_html(:classes, view: view, element: :input)}",
|
6
7
|
data: @field.get_html(:data, view: view, element: :input),
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<div class="flex items-center">
|
3
3
|
<div class="space-y-2">
|
4
4
|
<% model_param_key = model_name_from_record_or_class(@resource.record).param_key %>
|
5
|
-
<%= check_box_tag "#{
|
5
|
+
<%= check_box_tag "#{model_param_key}[#{@field.id}][]", '', true, { class: "hidden" } %>
|
6
6
|
<% @field.options.each do |id, label| %>
|
7
7
|
<%
|
8
8
|
checked = false
|
@@ -6,10 +6,10 @@ class Avo::Fields::FileField::IndexComponent < Avo::Fields::IndexComponent
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def has_image_tag?
|
9
|
-
|
9
|
+
field.value.present? && field.value.attached? && field.value.representable? && field.is_image
|
10
10
|
end
|
11
11
|
|
12
12
|
def has_audio_tag?
|
13
|
-
|
13
|
+
field.value.present? && field.value.attached? && field.is_audio
|
14
14
|
end
|
15
15
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%= field_wrapper **field_wrapper_args do %>
|
2
2
|
<% if field.value_present? %>
|
3
|
-
<%= js_map [{latitude: field.value[0], longitude: field.value[1]}], id: "location-map" %>
|
3
|
+
<%= js_map [{latitude: field.value[0], longitude: field.value[1]}], id: "location-map", zoom: field.zoom, controls: true %>
|
4
4
|
<% else %>
|
5
5
|
—
|
6
6
|
<% end %>
|
@@ -1,10 +1,11 @@
|
|
1
1
|
<%= field_wrapper **field_wrapper_args, full_width: true do %>
|
2
|
-
<div data-controller="
|
2
|
+
<div data-controller="easy-mde">
|
3
3
|
<%= @form.text_area @field.id,
|
4
|
-
|
4
|
+
value: @field.value,
|
5
|
+
class: classes("w-full js-has-easy-mde-editor"),
|
5
6
|
data: {
|
6
7
|
view: view,
|
7
|
-
'
|
8
|
+
'easy-mde-target': 'element',
|
8
9
|
'component-options': @field.options.to_json,
|
9
10
|
},
|
10
11
|
disabled: disabled?,
|
@@ -1,10 +1,10 @@
|
|
1
1
|
<%= field_wrapper **field_wrapper_args, full_width: true do %>
|
2
|
-
<div data-controller="
|
2
|
+
<div data-controller="easy-mde">
|
3
3
|
<%= text_area_tag @field.id, @field.value,
|
4
|
-
class: helpers.input_classes('w-full js-has-
|
4
|
+
class: helpers.input_classes('w-full js-has-easy-mde-editor'),
|
5
5
|
placeholder: @field.placeholder,
|
6
6
|
disabled: disabled?,
|
7
|
-
'data-
|
7
|
+
'data-easy-mde-target': 'element',
|
8
8
|
'data-component-options': @field.options.to_json,
|
9
9
|
'data-view': :show %>
|
10
10
|
</div>
|
@@ -1,11 +1,11 @@
|
|
1
1
|
<%= field_wrapper **field_wrapper_args do %>
|
2
2
|
<%= form.text_field @field.id,
|
3
|
+
value: @field.value,
|
3
4
|
class: classes("w-full"),
|
4
5
|
data: @field.get_html(:data, view: view, element: :input),
|
5
6
|
disabled: disabled?,
|
6
7
|
placeholder: @field.placeholder,
|
7
8
|
style: @field.get_html(:style, view: view, element: :input),
|
8
|
-
# value: @field.value,
|
9
9
|
multiple: multiple,
|
10
10
|
autocomplete: @field.autocomplete
|
11
11
|
%>
|
@@ -20,9 +20,10 @@
|
|
20
20
|
},
|
21
21
|
input: trix_id,
|
22
22
|
placeholder: @field.placeholder do %>
|
23
|
-
|
23
|
+
<%= sanitize @field.value.to_s %>
|
24
24
|
<% end %>
|
25
25
|
<%= @form.text_area @field.id,
|
26
|
+
value: @field.value,
|
26
27
|
class: classes("w-full hidden"),
|
27
28
|
data: @field.get_html(:data, view: view, element: :input),
|
28
29
|
disabled: disabled?,
|
@@ -8,7 +8,7 @@
|
|
8
8
|
<%= link_to t('avo.show_content'), 'javascript:void(0);', class: 'font-bold inline-block', data: { action: 'click->hidden-input#showContent' } %>
|
9
9
|
<% end %>
|
10
10
|
<div class="<%= content_classes %> " data-hidden-input-target="content">
|
11
|
-
|
11
|
+
<%= sanitize @field.value.to_s %>
|
12
12
|
</div>
|
13
13
|
</div>
|
14
14
|
<% end %>
|
@@ -5,45 +5,19 @@
|
|
5
5
|
data-resource-name="<%= @resource.class.to_s %>"
|
6
6
|
data-record-id="<%= @resource.record.id %>"
|
7
7
|
>
|
8
|
-
<%= content_tag :div,
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
<%= link_to resource_view_path do %>
|
14
|
-
<%= render Avo::Index::GridCoverEmptyStateComponent.new %>
|
15
|
-
<% end %>
|
16
|
-
<% elsif cover.respond_to?(:to_image) && cover.to_image.present? %>
|
17
|
-
<%= link_to_if cover.link_to_resource, image_tag(cover.to_image, class: 'absolute h-full w-full object-cover'), resource_view_path, class: 'absolute h-full w-full object-cover', title: title.value %>
|
18
|
-
<% elsif cover.type == 'file' %>
|
19
|
-
<% if cover.value.attached? && cover.value.representable? %>
|
20
|
-
<%= link_to_if cover.link_to_resource, image_tag(helpers.main_app.url_for(cover.value.variant(resize_to_limit: [480, 480])), class: 'absolute h-full w-full object-cover'), resource_view_path, class: 'absolute h-full w-full object-cover', title: title.value %>
|
21
|
-
<% else %>
|
22
|
-
<%= link_to resource_view_path do %>
|
23
|
-
<%= render Avo::Index::GridCoverEmptyStateComponent.new %>
|
24
|
-
<% end %>
|
25
|
-
<% end %>
|
26
|
-
<% elsif cover.value.present? %>
|
27
|
-
<%= link_to_if cover.link_to_resource, image_tag(cover.value, class: 'absolute h-full w-full object-cover'), resource_view_path, class: 'absolute h-full w-full object-cover', title: title.value %>
|
28
|
-
<% else %>
|
29
|
-
<%= render Avo::Index::GridCoverEmptyStateComponent.new %>
|
30
|
-
<% end %>
|
8
|
+
<%= content_tag :div,
|
9
|
+
class: "relative w-full pb-3/4 rounded-t overflow-hidden #{html(:cover, :classes)}",
|
10
|
+
style: html(:cover, :style) do %>
|
11
|
+
<%== item_selector_input(floating: true, size: :lg) if @resource.record_selector%>
|
12
|
+
<%= render_cover %>
|
31
13
|
<% end %>
|
32
|
-
|
14
|
+
<div class="grid grid-cols-1 place-content-between p-4 h-full">
|
33
15
|
<div class="mb-4 h-full flex flex-col space-between">
|
34
|
-
|
35
|
-
|
36
|
-
<%= link_to_if title.link_to_resource, title.value, resource_view_path %>
|
37
|
-
<% end %>
|
38
|
-
<% end %>
|
39
|
-
<% if body.present? %>
|
40
|
-
<%= content_tag :div, class: "text-sm break-words text-gray-500 #{body.get_html(:classes, view: :index, element: :wrapper)}", style: body.get_html(:style, view: :index, element: :wrapper) do %>
|
41
|
-
<%= body.value %>
|
42
|
-
<% end %>
|
43
|
-
<% end %>
|
16
|
+
<%= render_title %>
|
17
|
+
<%= render_body %>
|
44
18
|
</div>
|
45
19
|
<div class="w-full place-self-end">
|
46
20
|
<%= render(Avo::Index::ResourceControlsComponent.new(resource: @resource, reflection: @reflection, parent_record: @parent_record, parent_resource: @parent_resource, view_type: :grid, actions: actions)) %>
|
47
21
|
</div>
|
48
|
-
|
22
|
+
</div>
|
49
23
|
</div>
|