avo 2.19.0 → 2.21.0
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 -2
- data/Gemfile.lock +6 -6
- data/app/components/avo/card_component.html.erb +15 -15
- data/app/components/avo/card_component.rb +7 -5
- data/app/components/avo/empty_state_component.html.erb +1 -1
- data/app/components/avo/empty_state_component.rb +12 -10
- data/app/components/avo/fields/belongs_to_field/edit_component.rb +1 -1
- data/app/components/avo/fields/boolean_field/edit_component.html.erb +1 -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 +2 -2
- data/app/components/avo/fields/country_field/edit_component.html.erb +1 -1
- data/app/components/avo/fields/date_field/edit_component.html.erb +2 -2
- data/app/components/avo/fields/date_time_field/edit_component.html.erb +2 -2
- data/app/components/avo/fields/edit_component.rb +4 -0
- data/app/components/avo/fields/external_image_field/edit_component.html.erb +1 -1
- data/app/components/avo/fields/file_field/edit_component.html.erb +1 -1
- data/app/components/avo/fields/files_field/edit_component.html.erb +1 -1
- data/app/components/avo/fields/has_one_field/show_component.html.erb +3 -3
- data/app/components/avo/fields/markdown_field/edit_component.html.erb +1 -1
- data/app/components/avo/fields/markdown_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/number_field/edit_component.html.erb +1 -1
- data/app/components/avo/fields/password_field/edit_component.html.erb +1 -1
- data/app/components/avo/fields/progress_bar_field/edit_component.html.erb +1 -1
- data/app/components/avo/fields/select_field/edit_component.html.erb +2 -2
- data/app/components/avo/fields/show_component.rb +4 -0
- data/app/components/avo/fields/status_field/edit_component.html.erb +1 -1
- data/app/components/avo/fields/tags_field/edit_component.html.erb +2 -2
- 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 -1
- data/app/components/avo/fields/time_field/edit_component.html.erb +2 -2
- data/app/components/avo/fields/trix_field/edit_component.html.erb +3 -2
- data/app/components/avo/fields/trix_field/edit_component.rb +5 -1
- data/app/components/avo/index/resource_grid_component.html.erb +1 -1
- data/app/components/avo/index/resource_table_component.rb +3 -3
- data/app/components/avo/paginator_component.html.erb +1 -5
- data/app/components/avo/paginator_component.rb +8 -0
- data/app/components/avo/panel_component.html.erb +1 -1
- data/app/components/avo/resource_component.rb +17 -2
- data/app/components/avo/sidebar/group_component.html.erb +18 -12
- data/app/components/avo/sidebar/heading_component.html.erb +17 -10
- data/app/components/avo/views/resource_index_component.html.erb +1 -1
- data/app/controllers/avo/actions_controller.rb +27 -5
- data/app/controllers/avo/application_controller.rb +3 -2
- data/app/controllers/avo/associations_controller.rb +2 -1
- data/app/controllers/avo/attachments_controller.rb +4 -0
- data/app/controllers/avo/base_controller.rb +27 -16
- data/app/controllers/avo/dashboards/cards_controller.rb +1 -1
- data/app/controllers/avo/dashboards_controller.rb +1 -0
- data/app/controllers/avo/search_controller.rb +11 -5
- data/app/javascript/js/controllers/fields/trix_field_controller.js +6 -3
- data/app/javascript/js/controllers/item_select_all_controller.js +7 -4
- data/app/views/avo/actions/keep_modal_open.turbo_stream.erb +5 -0
- data/app/views/avo/actions/show.html.erb +3 -2
- data/app/views/avo/base/_multiple_select_filter.html.erb +1 -1
- data/app/views/avo/partials/_resource_search.html.erb +1 -1
- data/app/views/layouts/avo/application.html.erb +1 -1
- data/avo.gemspec +0 -1
- data/config/i18n-tasks.yml +1 -1
- data/config/initializers/pagy.rb +16 -0
- data/lib/avo/app.rb +4 -1
- data/lib/avo/base_action.rb +25 -4
- data/lib/avo/base_card.rb +8 -3
- data/lib/avo/base_resource.rb +21 -6
- data/lib/avo/concerns/breadcrumbs.rb +96 -0
- data/lib/avo/concerns/handles_field_args.rb +8 -1
- data/lib/avo/concerns/has_html_attributes.rb +14 -16
- data/lib/avo/dashboards/base_dashboard.rb +7 -1
- data/lib/avo/fields/base_field.rb +2 -1
- data/lib/avo/fields/concerns/is_disabled.rb +19 -0
- data/lib/avo/fields/select_field.rb +39 -34
- data/lib/avo/filters/base_filter.rb +9 -3
- data/lib/avo/hosts/resource_record_host.rb +7 -0
- data/lib/avo/hosts/visibility_host.rb +2 -1
- data/lib/avo/services/authorization_service.rb +2 -2
- data/lib/avo/version.rb +1 -1
- data/lib/generators/avo/templates/field/components/edit_component.html.erb.tt +1 -1
- data/lib/generators/avo/templates/locales/avo.en.yml +3 -2
- data/lib/generators/avo/templates/locales/avo.fr.yml +3 -2
- data/lib/generators/avo/templates/locales/avo.nb.yml +3 -2
- data/lib/generators/avo/templates/locales/avo.nn.yml +3 -2
- data/lib/generators/avo/templates/locales/avo.pt-BR.yml +3 -2
- data/lib/generators/avo/templates/locales/avo.pt.yml +120 -0
- data/lib/generators/avo/templates/locales/avo.ro.yml +56 -55
- data/lib/generators/avo/templates/locales/avo.tr.yml +3 -2
- data/lib/generators/avo/templates/locales/pagy/nn.yml +15 -0
- data/lib/generators/avo/templates/locales/pagy/ro.yml +17 -0
- data/public/avo-assets/avo.base.css +4 -4
- data/public/avo-assets/avo.base.js +2 -2
- data/public/avo-assets/avo.base.js.map +2 -2
- metadata +9 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 302280e8ea8c09012d0f68c72b017a8e903261346e02fdb8b4eaf2daa3160d39
|
4
|
+
data.tar.gz: eef2ab4ee6fd1576311d85ef6ae91add6f655f9762e3cc736f39bbb2f039c31e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bdf810fecb08f2a6d8a157238b28df1141b396b1a62387a88bb6094d0ac4c39195d36c319751eb7dca1368ed6f5174a241a23279bf558ade568091ce201d65ae
|
7
|
+
data.tar.gz: 983acf054fc7a5c8fd4f1f32b9f1a6c45e187d9c87f70a223203e8445f3d0ecd1d05eb80ac0fc02ec497604636a37a20d8ab8365a21477dbd9decc60ad1760f5
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
avo (2.
|
4
|
+
avo (2.21.0)
|
5
5
|
actionview (>= 6.0)
|
6
6
|
active_link_to
|
7
7
|
activerecord (>= 6.0)
|
8
8
|
addressable
|
9
|
-
breadcrumbs_on_rails
|
10
9
|
docile
|
11
10
|
dry-initializer
|
12
11
|
httparty
|
@@ -127,8 +126,6 @@ GEM
|
|
127
126
|
bootsnap (1.13.0)
|
128
127
|
msgpack (~> 1.2)
|
129
128
|
brakeman (5.3.1)
|
130
|
-
breadcrumbs_on_rails (4.1.0)
|
131
|
-
railties (>= 5.0)
|
132
129
|
builder (3.2.4)
|
133
130
|
bump (0.10.0)
|
134
131
|
bundler-integrity (1.0.9)
|
@@ -238,6 +235,9 @@ GEM
|
|
238
235
|
nokogiri (>= 1.5.9)
|
239
236
|
mail (2.7.1)
|
240
237
|
mini_mime (>= 0.1.1)
|
238
|
+
manifester (0.1.8)
|
239
|
+
rails (>= 6.0)
|
240
|
+
zeitwerk
|
241
241
|
marcel (1.0.2)
|
242
242
|
matrix (0.4.2)
|
243
243
|
meta-tags (2.17.0)
|
@@ -409,7 +409,7 @@ GEM
|
|
409
409
|
tzinfo (2.0.5)
|
410
410
|
concurrent-ruby (~> 1.0)
|
411
411
|
unicode-display_width (2.2.0)
|
412
|
-
view_component (2.
|
412
|
+
view_component (2.78.0)
|
413
413
|
activesupport (>= 5.0.0, < 8.0)
|
414
414
|
concurrent-ruby (~> 1.0)
|
415
415
|
method_source (~> 1.0)
|
@@ -454,7 +454,6 @@ DEPENDENCIES
|
|
454
454
|
aws-sdk-s3
|
455
455
|
bootsnap (>= 1.4.2)
|
456
456
|
brakeman
|
457
|
-
breadcrumbs_on_rails
|
458
457
|
bump
|
459
458
|
bundler-integrity (~> 1.0)
|
460
459
|
byebug
|
@@ -482,6 +481,7 @@ DEPENDENCIES
|
|
482
481
|
jsbundling-rails
|
483
482
|
launchy
|
484
483
|
listen (>= 3.5.1)
|
484
|
+
manifester
|
485
485
|
meta-tags
|
486
486
|
net-smtp
|
487
487
|
pg (>= 0.18, < 2.0)
|
@@ -1,18 +1,18 @@
|
|
1
1
|
<div class="relative flex-1 flex flex-col justify-between h-full"
|
2
2
|
data-controller="dashboard-card"
|
3
3
|
data-dashboard-card-target="card"
|
4
|
-
data-refresh-every="<%=
|
5
|
-
data-card-id="<%=
|
6
|
-
data-card-index="<%=
|
7
|
-
<% if
|
4
|
+
data-refresh-every="<%= card.refresh_every %>"
|
5
|
+
data-card-id="<%= card.id %>"
|
6
|
+
data-card-index="<%= card.index %>">
|
7
|
+
<% if card.class.display_header %>
|
8
8
|
<div class="px-4 pt-4">
|
9
9
|
<div class="flex justify-between items-center min-h-6">
|
10
10
|
<div class="text-base font-bold text-gray-700 leading-none">
|
11
|
-
<%=
|
11
|
+
<%= card.label %>
|
12
12
|
</div>
|
13
13
|
<div data-controller="select">
|
14
|
-
<% if
|
15
|
-
<%= select_tag "#{
|
14
|
+
<% if card.type.in?([:metric, :chartkick, :partial]) && card.ranges.present? %>
|
15
|
+
<%= select_tag "#{card.id}_#{card.index}_range", options_for_select(card.ranges, card.range),
|
16
16
|
class: 'appearance-none inline-flex bg-blue-gray-100 disabled:bg-blue-gray-300 disabled:cursor-not-allowed focus:bg-white text-sm text-blue-gray-700 disabled:text-blue-gray-700 leading-none rounded-md py-px px-2 leading-tight border outline-none outline w-24',
|
17
17
|
data: {
|
18
18
|
target: 'select',
|
@@ -24,18 +24,18 @@
|
|
24
24
|
</div>
|
25
25
|
</div>
|
26
26
|
<% end %>
|
27
|
-
<% if
|
28
|
-
<%= render 'chartkick_card', card:
|
29
|
-
<% elsif
|
30
|
-
<%= render
|
31
|
-
<% elsif
|
27
|
+
<% if card.type == :chartkick %>
|
28
|
+
<%= render 'chartkick_card', card: card %>
|
29
|
+
<% elsif card.type === :partial %>
|
30
|
+
<%= render card.class.partial %>
|
31
|
+
<% elsif card.type === :metric %>
|
32
32
|
<div class="flex-1 flex px-4 pb-4">
|
33
|
-
<%= render 'metric_card', card:
|
33
|
+
<%= render 'metric_card', card: card %>
|
34
34
|
</div>
|
35
35
|
<% end %>
|
36
|
-
<% if
|
36
|
+
<% if card.description.present? %>
|
37
37
|
<%= content_tag :div, class: "absolute inset-auto bottom-0 right-0 mb-4 mr-4",
|
38
|
-
title:
|
38
|
+
title: card.description,
|
39
39
|
data: {
|
40
40
|
target: 'card-description',
|
41
41
|
tippy: 'tooltip',
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class Avo::CardComponent < ViewComponent::Base
|
4
|
+
attr_reader :card
|
5
|
+
|
4
6
|
def initialize(card: nil)
|
5
7
|
@card = card
|
6
8
|
|
@@ -8,16 +10,16 @@ class Avo::CardComponent < ViewComponent::Base
|
|
8
10
|
end
|
9
11
|
|
10
12
|
def render?
|
11
|
-
|
13
|
+
card.present?
|
12
14
|
end
|
13
15
|
|
14
16
|
# Initializing the card byt running the query method.
|
15
17
|
# We'll still keep the query block around for compatibility reasons.
|
16
18
|
def init_card
|
17
|
-
if
|
18
|
-
|
19
|
-
elsif
|
20
|
-
|
19
|
+
if card.respond_to? :query
|
20
|
+
card.query
|
21
|
+
elsif card.query_block.present?
|
22
|
+
card.compute_result
|
21
23
|
end
|
22
24
|
end
|
23
25
|
end
|
@@ -1,24 +1,26 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class Avo::EmptyStateComponent < ViewComponent::Base
|
4
|
-
|
4
|
+
attr_reader :message, :view_type, :add_background, :by_association
|
5
|
+
|
6
|
+
def initialize(message: nil, view_type: :table, add_background: false, by_association: false)
|
5
7
|
@message = message
|
6
8
|
@view_type = view_type
|
7
|
-
@related_name = related_name
|
8
|
-
@resource_name = resource_name
|
9
9
|
@add_background = add_background
|
10
|
+
@by_association = by_association
|
10
11
|
end
|
11
12
|
|
12
|
-
def
|
13
|
-
|
14
|
-
|
15
|
-
translation_tag = @related_name.present? ? 'avo.no_related_item_found' : 'avo.no_item_found'
|
16
|
-
helpers.t translation_tag, item: @resource_name
|
13
|
+
def text
|
14
|
+
message || locale_message
|
17
15
|
end
|
18
16
|
|
19
17
|
def view_type_svg
|
20
|
-
|
18
|
+
"#{view_type}-empty-state"
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
21
22
|
|
22
|
-
|
23
|
+
def locale_message
|
24
|
+
helpers.t by_association ? 'avo.no_related_item_found' : 'avo.no_item_found'
|
23
25
|
end
|
24
26
|
end
|
@@ -8,7 +8,7 @@ class Avo::Fields::BelongsToField::EditComponent < Avo::Fields::EditComponent
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def disabled
|
11
|
-
return true if @field.is_readonly?
|
11
|
+
return true if @field.is_readonly? || @field.is_disabled?
|
12
12
|
|
13
13
|
# When visiting the record through it's association we keep the field disabled by default
|
14
14
|
# We make an exception when the user deliberately instructs Avo to allow detaching in this scenario
|
@@ -4,7 +4,7 @@
|
|
4
4
|
checked: @field.value,
|
5
5
|
class: "text-lg h-4 w-4 checked:bg-primary-400 focus:checked:!bg-primary-400 #{@field.get_html(:classes, view: view, element: :input)}",
|
6
6
|
data: @field.get_html(:data, view: view, element: :input),
|
7
|
-
disabled:
|
7
|
+
disabled: disabled?,
|
8
8
|
style: @field.get_html(:style, view: view, element: :input)
|
9
9
|
%>
|
10
10
|
</div>
|
@@ -20,7 +20,7 @@
|
|
20
20
|
<%= check_box_tag "#{model_param_key}[#{@field.id}][]", id, checked, {
|
21
21
|
class: "w-4 h-4 #{@field.get_html(:classes, view: view, element: :input)}",
|
22
22
|
data: @field.get_html(:data, view: view, element: :input),
|
23
|
-
disabled:
|
23
|
+
disabled: disabled?,
|
24
24
|
id: "#{model_param_key}_#{@field.id}_#{id}",
|
25
25
|
style: @field.get_html(:style, view: view, element: :input)
|
26
26
|
} %> <%= label %>
|
@@ -8,12 +8,12 @@
|
|
8
8
|
language: @field.language,
|
9
9
|
theme: @field.theme,
|
10
10
|
'tab-size': @field.tab_size,
|
11
|
-
'read-only':
|
11
|
+
'read-only': disabled?,
|
12
12
|
'indent-with-tabs': @field.indent_with_tabs,
|
13
13
|
'line-wrapping': @field.line_wrapping,
|
14
14
|
**@field.get_html(:data, view: view, element: :input),
|
15
15
|
},
|
16
|
-
disabled:
|
16
|
+
disabled: disabled?,
|
17
17
|
placeholder: @field.placeholder,
|
18
18
|
style: @field.get_html(:style, view: view, element: :input)
|
19
19
|
%>
|
@@ -8,7 +8,7 @@
|
|
8
8
|
},
|
9
9
|
class: classes("w-full"),
|
10
10
|
data: @field.get_html(:data, view: view, element: :input),
|
11
|
-
disabled:
|
11
|
+
disabled: disabled?,
|
12
12
|
style: @field.get_html(:style, view: view, element: :input),
|
13
13
|
placeholder: @field.include_blank.present? ? nil : @field.placeholder
|
14
14
|
%>
|
@@ -18,7 +18,7 @@
|
|
18
18
|
placeholder: @field.placeholder,
|
19
19
|
**@field.get_html(:data, view: view, element: :input)
|
20
20
|
},
|
21
|
-
disabled:
|
21
|
+
disabled: disabled?,
|
22
22
|
placeholder: @field.placeholder,
|
23
23
|
style: @field.get_html(:style, view: view, element: :input)
|
24
24
|
%>
|
@@ -30,7 +30,7 @@
|
|
30
30
|
placeholder: @field.placeholder,
|
31
31
|
**@field.get_html(:data, view: view, element: :input)
|
32
32
|
},
|
33
|
-
disabled:
|
33
|
+
disabled: disabled?,
|
34
34
|
placeholder: @field.placeholder,
|
35
35
|
style: @field.get_html(:style, view: view, element: :input)
|
36
36
|
%>
|
@@ -20,7 +20,7 @@
|
|
20
20
|
placeholder: @field.placeholder,
|
21
21
|
**@field.get_html(:data, view: view, element: :input)
|
22
22
|
},
|
23
|
-
disabled:
|
23
|
+
disabled: disabled?,
|
24
24
|
placeholder: @field.placeholder,
|
25
25
|
style: @field.get_html(:style, view: view, element: :input)
|
26
26
|
%>
|
@@ -32,7 +32,7 @@
|
|
32
32
|
placeholder: @field.placeholder,
|
33
33
|
**@field.get_html(:data, view: view, element: :input)
|
34
34
|
},
|
35
|
-
disabled:
|
35
|
+
disabled: disabled?,
|
36
36
|
placeholder: @field.placeholder,
|
37
37
|
style: @field.get_html(:style, view: view, element: :input)
|
38
38
|
%>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<%= @form.text_field @field.id,
|
3
3
|
class: classes("w-full"),
|
4
4
|
data: @field.get_html(:data, view: view, element: :input),
|
5
|
-
disabled:
|
5
|
+
disabled: disabled?,
|
6
6
|
placeholder: @field.placeholder,
|
7
7
|
style: @field.get_html(:style, view: view, element: :input)
|
8
8
|
%>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
accept: @field.accept,
|
11
11
|
data: @field.get_html(:data, view: view, element: :input),
|
12
12
|
direct_upload: @field.direct_upload,
|
13
|
-
disabled:
|
13
|
+
disabled: disabled?,
|
14
14
|
style: @field.get_html(:style, view: view, element: :input),
|
15
15
|
class: "w-full"
|
16
16
|
%>
|
@@ -7,7 +7,7 @@
|
|
7
7
|
accept: @field.accept,
|
8
8
|
data: @field.get_html(:data, view: view, element: :input),
|
9
9
|
direct_upload: @field.direct_upload,
|
10
|
-
disabled:
|
10
|
+
disabled: disabled?,
|
11
11
|
multiple: true,
|
12
12
|
style: @field.get_html(:style, view: view, element: :input),
|
13
13
|
class: "w-full"
|
@@ -5,7 +5,7 @@
|
|
5
5
|
<% else %>
|
6
6
|
<%= render Avo::PanelComponent.new(name: @field.name) do |c| %>
|
7
7
|
<% c.tools do %>
|
8
|
-
<% if !@field.is_readonly? && can_attach? %>
|
8
|
+
<% if !@field.is_readonly? && !@field.is_disabled? && can_attach? %>
|
9
9
|
<%= a_link attach_path,
|
10
10
|
icon: 'heroicons/outline/link',
|
11
11
|
color: :primary,
|
@@ -13,7 +13,7 @@
|
|
13
13
|
<%= t('avo.attach_item', item: @field.name.downcase) %>
|
14
14
|
<% end %>
|
15
15
|
<% end %>
|
16
|
-
<% if !@field.is_readonly? && can_see_the_create_button? %>
|
16
|
+
<% if !@field.is_readonly? && !@field.is_disabled? && can_see_the_create_button? %>
|
17
17
|
<%= a_link create_path,
|
18
18
|
icon: 'heroicons/outline/plus',
|
19
19
|
'data-target': 'create',
|
@@ -27,7 +27,7 @@
|
|
27
27
|
|
28
28
|
<% c.body do %>
|
29
29
|
<div class="py-8 flex justify-center items-center">
|
30
|
-
<%= empty_state
|
30
|
+
<%= empty_state by_association: params[:related_name].present? %>
|
31
31
|
</div>
|
32
32
|
<% end %>
|
33
33
|
<% end %>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<%= text_area_tag @field.id, @field.value,
|
4
4
|
class: helpers.input_classes('w-full js-has-simple-mde-editor'),
|
5
5
|
placeholder: @field.placeholder,
|
6
|
-
disabled:
|
6
|
+
disabled: disabled?,
|
7
7
|
'data-simple-mde-target': 'element',
|
8
8
|
'data-component-options': @field.options.to_json,
|
9
9
|
'data-view': :show %>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<%= @form.password_field @field.id,
|
3
3
|
class: classes("w-full"),
|
4
4
|
data: @field.get_html(:data, view: view, element: :input),
|
5
|
-
disabled:
|
5
|
+
disabled: disabled?,
|
6
6
|
placeholder: @field.placeholder,
|
7
7
|
style: @field.get_html(:style, view: view, element: :input)
|
8
8
|
%>
|
@@ -7,7 +7,7 @@
|
|
7
7
|
<%= @form.range_field @field.id,
|
8
8
|
class: "w-full #{@field.get_html(:classes, view: view, element: :input)}",
|
9
9
|
data: @field.get_html(:data, view: view, element: :input),
|
10
|
-
disabled:
|
10
|
+
disabled: disabled?,
|
11
11
|
max: @field.max,
|
12
12
|
min: 0,
|
13
13
|
placeholder: @field.placeholder,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%= field_wrapper **field_wrapper_args do %>
|
2
|
-
<%= @form.select @field.id, @field.options_for_select, {
|
2
|
+
<%= @form.select @field.id, options_for_select(@field.options_for_select, selected: @field.value), {
|
3
3
|
include_blank: @field.include_blank
|
4
4
|
},
|
5
5
|
aria: {
|
@@ -7,7 +7,7 @@
|
|
7
7
|
},
|
8
8
|
class: classes("w-full"),
|
9
9
|
data: @field.get_html(:data, view: view, element: :input),
|
10
|
-
disabled:
|
10
|
+
disabled: disabled?,
|
11
11
|
style: @field.get_html(:style, view: view, element: :input),
|
12
12
|
value: @field.model.present? ? @field.model[@field.id] : @field.value,
|
13
13
|
placeholder: @field.include_blank.present? ? nil : @field.placeholder
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<%= @form.text_field @field.id,
|
3
3
|
class: classes("w-full"),
|
4
4
|
data: @field.get_html(:data, view: view, element: :input),
|
5
|
-
disabled:
|
5
|
+
disabled: disabled?,
|
6
6
|
placeholder: @field.placeholder,
|
7
7
|
style: @field.get_html(:style, view: view, element: :input),
|
8
8
|
value: @resource.model.present? ? @resource.model[@field.id] : @field.value
|
@@ -6,7 +6,7 @@
|
|
6
6
|
data: {
|
7
7
|
'tags-field-target': 'fakeInput',
|
8
8
|
},
|
9
|
-
disabled:
|
9
|
+
disabled: disabled?,
|
10
10
|
placeholder: @field.placeholder,
|
11
11
|
style: @field.get_html(:style, view: view, element: :input),
|
12
12
|
value: ''
|
@@ -22,7 +22,7 @@
|
|
22
22
|
'delimiters': @field.delimiters,
|
23
23
|
'close-on-select': @field.close_on_select ? 1 : 0,
|
24
24
|
},
|
25
|
-
disabled:
|
25
|
+
disabled: disabled?,
|
26
26
|
placeholder: @field.placeholder,
|
27
27
|
style: @field.get_html(:style, view: view, element: :input),
|
28
28
|
value: @field.field_value.to_json
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<%= form.text_field @field.id,
|
3
3
|
class: classes("w-full"),
|
4
4
|
data: @field.get_html(:data, view: view, element: :input),
|
5
|
-
disabled:
|
5
|
+
disabled: disabled?,
|
6
6
|
placeholder: @field.placeholder,
|
7
7
|
style: @field.get_html(:style, view: view, element: :input),
|
8
8
|
# value: @field.value,
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<%= @form.text_area @field.id,
|
3
3
|
class: classes("w-full"),
|
4
4
|
data: @field.get_html(:data, view: view, element: :input),
|
5
|
-
disabled:
|
5
|
+
disabled: disabled?,
|
6
6
|
placeholder: @field.placeholder,
|
7
7
|
rows: @field.rows,
|
8
8
|
style: @field.get_html(:style, view: view, element: :input)
|
@@ -20,7 +20,7 @@
|
|
20
20
|
placeholder: @field.placeholder,
|
21
21
|
**@field.get_html(:data, view: view, element: :input)
|
22
22
|
},
|
23
|
-
disabled:
|
23
|
+
disabled: disabled?,
|
24
24
|
placeholder: @field.placeholder,
|
25
25
|
style: @field.get_html(:style, view: view, element: :input)
|
26
26
|
%>
|
@@ -32,7 +32,7 @@
|
|
32
32
|
placeholder: @field.placeholder,
|
33
33
|
**@field.get_html(:data, view: view, element: :input)
|
34
34
|
},
|
35
|
-
disabled:
|
35
|
+
disabled: disabled?,
|
36
36
|
placeholder: @field.placeholder,
|
37
37
|
style: @field.get_html(:style, view: view, element: :input)
|
38
38
|
%>
|
@@ -1,5 +1,6 @@
|
|
1
1
|
<%= field_wrapper **field_wrapper_args, full_width: true do %>
|
2
|
-
<%= content_tag :div,
|
2
|
+
<%= content_tag :div,
|
3
|
+
class: "relative block overflow-x-auto max-w-full",
|
3
4
|
data: {
|
4
5
|
controller: "trix-field",
|
5
6
|
trix_field_target: "controller",
|
@@ -24,7 +25,7 @@
|
|
24
25
|
<%= @form.text_area @field.id,
|
25
26
|
class: classes("w-full hidden"),
|
26
27
|
data: @field.get_html(:data, view: view, element: :input),
|
27
|
-
disabled:
|
28
|
+
disabled: disabled?,
|
28
29
|
id: trix_id,
|
29
30
|
placeholder: @field.placeholder,
|
30
31
|
style: @field.get_html(:style, view: view, element: :input)
|
@@ -20,6 +20,10 @@ class Avo::Fields::TrixField::EditComponent < Avo::Fields::EditComponent
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def trix_id
|
23
|
-
|
23
|
+
if resource_name.present?
|
24
|
+
"trix_#{resource_name}_#{@field.id}"
|
25
|
+
elsif form.present?
|
26
|
+
"trix_#{form.index}_#{@field.id}"
|
27
|
+
end
|
24
28
|
end
|
25
29
|
end
|
@@ -9,6 +9,6 @@
|
|
9
9
|
</div>
|
10
10
|
<% else %>
|
11
11
|
<div class="bg-white rounded shadow-panel">
|
12
|
-
<%= helpers.empty_state
|
12
|
+
<%= helpers.empty_state by_association: params[:related_name].present?, view_type: :grid %>
|
13
13
|
</div>
|
14
14
|
<% end %>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
class Avo::Index::ResourceTableComponent < ViewComponent::Base
|
4
4
|
include Avo::ApplicationHelper
|
5
|
-
attr_reader :pagy
|
5
|
+
attr_reader :pagy, :query
|
6
6
|
|
7
7
|
def initialize(resources: nil, resource: nil, reflection: nil, parent_model: nil, parent_resource: nil, pagy: nil, query: nil)
|
8
8
|
@resources = resources
|
@@ -15,10 +15,10 @@ class Avo::Index::ResourceTableComponent < ViewComponent::Base
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def encrypted_query
|
18
|
-
return if
|
18
|
+
return :select_all_disabled if query.nil? || !query.respond_to?(:all) || !query.all.respond_to?(:to_sql)
|
19
19
|
|
20
20
|
Avo::Services::EncryptionService.encrypt(
|
21
|
-
message:
|
21
|
+
message: query.all.to_sql,
|
22
22
|
purpose: :select_all
|
23
23
|
)
|
24
24
|
end
|
@@ -25,11 +25,7 @@
|
|
25
25
|
%> <%= t('avo.per_page').downcase %>
|
26
26
|
</div>
|
27
27
|
<% per_page_options.each do |option| %>
|
28
|
-
|
29
|
-
<%= link_to "Change to #{option} items per page", helpers.related_resources_path(parent_model, parent_model, per_page: option, keep_query_params: true, page: 1), class: 'hidden', 'data-per-page-option': option, 'data-turbo-frame': turbo_frame %>
|
30
|
-
<% else %>
|
31
|
-
<%= link_to "Change to #{option} items per page", helpers.resources_path(resource: resource, per_page: option, keep_query_params: true, page: 1), class: 'hidden', 'data-per-page-option': option, 'data-turbo-frame': turbo_frame %>
|
32
|
-
<% end %>
|
28
|
+
<%= link_to "Change to #{option} items per page", change_items_per_page_url(option), class: 'hidden', 'data-per-page-option': option, 'data-turbo-frame': turbo_frame %>
|
33
29
|
<% end %>
|
34
30
|
</div>
|
35
31
|
</div>
|
@@ -16,4 +16,12 @@ class Avo::PaginatorComponent < ViewComponent::Base
|
|
16
16
|
@parent_model = parent_model
|
17
17
|
@discreet_pagination = discreet_pagination
|
18
18
|
end
|
19
|
+
|
20
|
+
def change_items_per_page_url(option)
|
21
|
+
if parent_model.present?
|
22
|
+
helpers.related_resources_path(parent_model, parent_model, per_page: option, keep_query_params: true, page: 1)
|
23
|
+
else
|
24
|
+
helpers.resources_path(resource: resource, per_page: option, keep_query_params: true, page: 1)
|
25
|
+
end
|
26
|
+
end
|
19
27
|
end
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<div class="overflow-hidden flex flex-col">
|
5
5
|
<% if display_breadcrumbs? %>
|
6
6
|
<div class="breadcrumbs truncate mb-2">
|
7
|
-
<%= helpers.
|
7
|
+
<%= helpers.render_avo_breadcrumbs(separator: helpers.svg('chevron-right', class: 'inline-block h-3 stroke-current relative top-[-1px] ml-1' )) if Avo.configuration.display_breadcrumbs %>
|
8
8
|
</div>
|
9
9
|
<% end %>
|
10
10
|
<div class="text-2xl tracking-normal font-semibold text-gray-800 truncate items-center flex flex-1" data-target="title">
|