avo 3.4.2 → 3.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/app/assets/builds/avo.base.css +0 -4
- data/app/components/avo/actions_component.html.erb +3 -3
- data/app/components/avo/actions_component.rb +32 -0
- data/app/components/avo/fields/belongs_to_field/edit_component.html.erb +12 -3
- data/app/components/avo/sidebar_component.html.erb +1 -1
- data/app/controllers/avo/base_controller.rb +7 -1
- data/app/helpers/avo/turbo_stream_actions_helper.rb +1 -1
- data/app/views/avo/actions/show.html.erb +0 -1
- data/app/views/avo/partials/_header.html.erb +1 -11
- data/app/views/layouts/avo/application.html.erb +1 -1
- data/lib/avo/configuration.rb +1 -1
- data/lib/avo/version.rb +1 -1
- data/lib/avo.rb +1 -1
- data/lib/generators/avo/templates/initializer/avo.tt +1 -1
- data/lib/generators/avo/templates/resource/controller.tt +1 -1
- data/public/avo-assets/avo.base.css +0 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b5aec5e488a238db9609baec7aa5f7b069b9eae298c2fded106bb949eb37591
|
4
|
+
data.tar.gz: 7be1a8be6b426ca7fe3a5c388fe962b2e23c11b1a2217700d31999e0dc8adbd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 355ca408da59a84b86d8db8f1e1324a9e6d77743d7dc5cea1e65b5c96b1eace78fd30e1f43136530c4fc8e9aac674cf55c7c41ea9cd2ada112b89f986a4b068c
|
7
|
+
data.tar.gz: 6f51493ca463f171655ba3ff1b75e77ff141f37b717ab810d646363fe3a966ea4d62b4d71a9ae67ede9f43bd71f4e58808784fb065f0741a4b11947eeab3cca0
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
avo (3.4.
|
4
|
+
avo (3.4.4)
|
5
5
|
actionview (>= 6.1)
|
6
6
|
active_link_to
|
7
7
|
activerecord (>= 6.1)
|
@@ -534,7 +534,7 @@ GEM
|
|
534
534
|
websocket-extensions (0.1.5)
|
535
535
|
xpath (3.2.0)
|
536
536
|
nokogiri (~> 1.8)
|
537
|
-
yard (0.9.
|
537
|
+
yard (0.9.35)
|
538
538
|
zeitwerk (2.6.13)
|
539
539
|
|
540
540
|
PLATFORMS
|
@@ -32,16 +32,16 @@
|
|
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
|
-
|
36
|
-
<%= link_to link,
|
35
|
+
<%= link_to action_path(action),
|
37
36
|
data: {
|
38
37
|
action_name: action.action_name,
|
38
|
+
'turbo-frame': Avo::ACTIONS_TURBO_FRAME_ID,
|
39
39
|
'action': 'click->actions-picker#visitAction',
|
40
40
|
'actions-picker-target': action.standalone ? 'standaloneAction' : 'resourceAction',
|
41
41
|
'disabled': is_disabled?(action),
|
42
42
|
# for some reason InstantClick fetches the URL even if it's prefetched.
|
43
43
|
turbo_prefetch: false,
|
44
|
-
}
|
44
|
+
},
|
45
45
|
title: action.action_name,
|
46
46
|
class: "flex items-center px-4 py-3 w-full font-semibold text-sm hover:bg-primary-100 #{is_disabled?(action) ? 'text-gray-500' : 'text-black'}" do %>
|
47
47
|
<%= svg 'play', class: 'h-5 mr-1 inline pointer-events-none' %> <%= action.action_name %>
|
@@ -31,6 +31,19 @@ class Avo::ActionsComponent < ViewComponent::Base
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
# When running an action for one record we should do it on a special path.
|
35
|
+
# We do that so we get the `record` param inside the action so we can prefill fields.
|
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?
|
39
|
+
|
40
|
+
if on_record_page?
|
41
|
+
single_record_path action
|
42
|
+
else
|
43
|
+
many_records_path action
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
34
47
|
# How should the action be displayed by default
|
35
48
|
def is_disabled?(action)
|
36
49
|
return false if action.standalone || as_row_control
|
@@ -47,4 +60,23 @@ class Avo::ActionsComponent < ViewComponent::Base
|
|
47
60
|
def on_index_page?
|
48
61
|
!on_record_page?
|
49
62
|
end
|
63
|
+
|
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)
|
70
|
+
end
|
71
|
+
|
72
|
+
def action_url(action, path)
|
73
|
+
Avo::Services::URIService.parse(path)
|
74
|
+
.append_paths("actions")
|
75
|
+
.append_query(
|
76
|
+
{
|
77
|
+
action_id: action.to_param,
|
78
|
+
arguments: Avo::BaseAction.encode_arguments(action.arguments)
|
79
|
+
}.compact
|
80
|
+
).to_s
|
81
|
+
end
|
50
82
|
end
|
@@ -71,8 +71,11 @@
|
|
71
71
|
<% create_href = create_path(Avo.resource_manager.get_resource_by_model_class(type.to_s)) %>
|
72
72
|
<% if !disabled && create_href.present? %>
|
73
73
|
<%= link_to t("avo.create_new_item", item: type.to_s.downcase),
|
74
|
-
|
75
|
-
|
74
|
+
create_href,
|
75
|
+
class: "text-sm",
|
76
|
+
data: {
|
77
|
+
turbo_prefetch: false
|
78
|
+
}
|
76
79
|
%>
|
77
80
|
<% end %>
|
78
81
|
<% end %>
|
@@ -115,7 +118,13 @@
|
|
115
118
|
<% end %>
|
116
119
|
<% if field.can_create? %>
|
117
120
|
<% if !disabled && create_path.present? %>
|
118
|
-
<%= link_to t("avo.create_new_item", item: @field.name.downcase),
|
121
|
+
<%= link_to t("avo.create_new_item", item: @field.name.downcase),
|
122
|
+
create_path,
|
123
|
+
class: "text-sm",
|
124
|
+
data: {
|
125
|
+
turbo_prefetch: false
|
126
|
+
}
|
127
|
+
%>
|
119
128
|
<% end %>
|
120
129
|
<% end %>
|
121
130
|
<% end %>
|
@@ -25,7 +25,7 @@
|
|
25
25
|
|
26
26
|
<div class="w-full space-y-1">
|
27
27
|
<% dashboards.sort_by { |r| r.navigation_label }.each do |dashboard| %>
|
28
|
-
<%= render Avo::Sidebar::LinkComponent.new label: dashboard.navigation_label, path:
|
28
|
+
<%= render Avo::Sidebar::LinkComponent.new label: dashboard.navigation_label, path: Avo::Dashboards::Engine.routes.url_helpers.dashboard_path(dashboard) %>
|
29
29
|
<% end %>
|
30
30
|
</div>
|
31
31
|
</div>
|
@@ -63,10 +63,16 @@ module Avo
|
|
63
63
|
|
64
64
|
# Create resources for each record
|
65
65
|
# Duplicate the @resource before hydration to avoid @resource keeping last record.
|
66
|
+
@resource.hydrate(params: params)
|
66
67
|
@resources = @records.map do |record|
|
67
|
-
@resource.dup.hydrate(record: record
|
68
|
+
@resource.dup.hydrate(record: record)
|
68
69
|
end
|
69
70
|
|
71
|
+
# Temporary fix for visible blocks when geting fields for header
|
72
|
+
# Hydrating with last record so resource.record != nil
|
73
|
+
# This is keeping same behavior from <= 3.4.1
|
74
|
+
@resource.hydrate(record: @records.last)
|
75
|
+
|
70
76
|
set_component_for __method__
|
71
77
|
end
|
72
78
|
|
@@ -13,7 +13,7 @@ module Avo
|
|
13
13
|
def close_action_modal
|
14
14
|
turbo_stream_action_tag :replace,
|
15
15
|
target: Avo::ACTIONS_TURBO_FRAME_ID,
|
16
|
-
|
16
|
+
template: @view_context.turbo_frame_tag(Avo::ACTIONS_TURBO_FRAME_ID, data: {turbo_temporary: 1})
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -1,11 +1 @@
|
|
1
|
-
|
2
|
-
<%= link_to Avo.configuration.app_name, '/', class: 'text-primary-500 font-semibold', target: :_blank %>
|
3
|
-
|
4
|
-
<% if false %>
|
5
|
-
<div class="ml-12">
|
6
|
-
<% current_user.accounts.each do |account| %>
|
7
|
-
<%= link_to account.name, switch_account_path(account.id), class: class_names({"underline": session[:tenant_id].to_s == account.id.to_s}), data: {turbo_method: :put} %>
|
8
|
-
<% end %>
|
9
|
-
</div>
|
10
|
-
<% end %>
|
11
|
-
</div>
|
1
|
+
<%= link_to Avo.configuration.app_name, '/', class: 'text-primary-500 font-semibold', target: :_blank %>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<html>
|
4
4
|
<head>
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
6
|
-
<% if !Avo.configuration.turbo[:
|
6
|
+
<% if !Avo.configuration.turbo[:instant_click] %>
|
7
7
|
<meta name="turbo-prefetch" content="false">
|
8
8
|
<% end %>
|
9
9
|
<%= display_meta_tags site: Avo.configuration.app_name, reverse: true, separator: "—" %>
|
data/lib/avo/configuration.rb
CHANGED
data/lib/avo/version.rb
CHANGED
data/lib/avo.rb
CHANGED
@@ -40,7 +40,7 @@ module Avo
|
|
40
40
|
private
|
41
41
|
|
42
42
|
def missing_resource_message(resource_name)
|
43
|
-
name = resource_name.to_s.
|
43
|
+
name = resource_name.to_s.underscore
|
44
44
|
|
45
45
|
"Failed to find a resource while rendering the :#{name} field.\n" \
|
46
46
|
"You may generate a resource for it by running 'rails generate avo:resource #{name.singularize}'.\n" \
|
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.4.
|
4
|
+
version: 3.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Marin
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-
|
13
|
+
date: 2024-03-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|