avo 1.21.0 → 1.21.1.pre.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of avo might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -1
- data/app/assets/builds/avo.css +8606 -0
- data/app/assets/builds/avo.js +87838 -0
- data/app/assets/builds/avo.js.map +7 -0
- data/app/components/avo/fields/belongs_to_field/edit_component.html.erb +42 -36
- data/lib/avo/version.rb +1 -1
- metadata +7 -4
@@ -7,54 +7,54 @@
|
|
7
7
|
[type.to_s, resource.model_key]
|
8
8
|
end.to_h
|
9
9
|
%>
|
10
|
-
|
10
|
+
<div data-controller="belongs-to-field"
|
11
11
|
data-searchable="<%= @field.searchable %>"
|
12
12
|
data-association="<%= @field.id %>"
|
13
13
|
data-association-class="<%= @field&.target_resource&.model_class || nil %>"
|
14
14
|
>
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
15
|
+
<%= edit_field_wrapper field: @field, index: @index, form: @form, resource: @resource, displayed_in_modal: @displayed_in_modal do %>
|
16
|
+
<%= @form.select "#{@field.foreign_key}_type", @field.types.map { |type| [type.to_s.underscore.humanize, type.to_s] },
|
17
|
+
{
|
18
|
+
value: @field.value,
|
19
|
+
include_blank: @field.placeholder,
|
20
|
+
},
|
21
|
+
{
|
22
|
+
class: helpers.input_classes('w-full', has_error: @field.model_errors.include?(@field.id)),
|
23
|
+
disabled: disabled,
|
24
|
+
'data-belongs-to-field-target': "select",
|
25
|
+
'data-action': 'change->belongs-to-field#changeType'
|
26
|
+
}
|
27
|
+
%>
|
28
|
+
<%
|
29
29
|
# If the select field is disabled, no value will be sent. It's how HTML works.
|
30
30
|
# Thus the extra hidden field to actually send the related id to the server.
|
31
31
|
if disabled %>
|
32
|
-
|
33
|
-
<% end %>
|
32
|
+
<%= @form.hidden_field "#{@field.foreign_key}_type" %>
|
34
33
|
<% end %>
|
35
|
-
|
36
|
-
|
34
|
+
<% end %>
|
35
|
+
<% @field.types.each do |type| %>
|
36
|
+
<div class="hidden"
|
37
37
|
data-belongs-to-field-target="type"
|
38
38
|
data-type="<%= type %>"
|
39
39
|
>
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
<% end %>
|
40
|
+
<%= edit_field_wrapper field: @field, index: @index, form: @form, resource: @resource, displayed_in_modal: @displayed_in_modal, label: type.to_s.underscore.humanize do %>
|
41
|
+
<% if @field.searchable %>
|
42
|
+
<%= render Avo::Fields::BelongsToField::AutocompleteComponent.new form: @form, field: @field, type: type, model_key: model_keys[type.to_s], foreign_key: "#{@field.foreign_key}_id" %>
|
43
|
+
<% else %>
|
44
|
+
<%= @form.select "#{@field.foreign_key}_id", options_for_select(@field.values_for_type(type), @field.value&.class == type ? @field.field_value : nil),
|
45
|
+
{
|
46
|
+
include_blank: @field.placeholder,
|
47
|
+
},
|
48
|
+
{
|
49
|
+
class: helpers.input_classes('w-full', has_error: @field.model_errors.include?(@field.id)),
|
50
|
+
disabled: disabled
|
51
|
+
}
|
52
|
+
%>
|
54
53
|
<% end %>
|
55
|
-
|
56
|
-
|
57
|
-
|
54
|
+
<% end %>
|
55
|
+
</div>
|
56
|
+
<% end %>
|
57
|
+
</div>
|
58
58
|
<% else %>
|
59
59
|
<%= edit_field_wrapper field: @field, index: @index, form: @form, resource: @resource, displayed_in_modal: @displayed_in_modal do %>
|
60
60
|
<% if @field.searchable %>
|
@@ -69,6 +69,12 @@
|
|
69
69
|
disabled: disabled
|
70
70
|
}
|
71
71
|
%>
|
72
|
+
<%
|
73
|
+
# If the select field is disabled, no value will be sent. It's how HTML works.
|
74
|
+
# Thus the extra hidden field to actually send the related id to the server.
|
75
|
+
if disabled %>
|
76
|
+
<%= @form.hidden_field @field.foreign_key %>
|
77
|
+
<% end %>
|
72
78
|
<% end %>
|
73
79
|
<% end %>
|
74
80
|
<% end %>
|
data/lib/avo/version.rb
CHANGED
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: 1.21.
|
4
|
+
version: 1.21.1.pre.1
|
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: 2022-02-
|
12
|
+
date: 2022-02-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -206,6 +206,9 @@ files:
|
|
206
206
|
- Gemfile.lock
|
207
207
|
- README.md
|
208
208
|
- Rakefile
|
209
|
+
- app/assets/builds/avo.css
|
210
|
+
- app/assets/builds/avo.js
|
211
|
+
- app/assets/builds/avo.js.map
|
209
212
|
- app/assets/config/avo_manifest.js
|
210
213
|
- app/assets/images/avo/logo.png
|
211
214
|
- app/assets/stylesheets/avo.css
|
@@ -710,9 +713,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
710
713
|
version: '0'
|
711
714
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
712
715
|
requirements:
|
713
|
-
- - "
|
716
|
+
- - ">"
|
714
717
|
- !ruby/object:Gem::Version
|
715
|
-
version:
|
718
|
+
version: 1.3.1
|
716
719
|
requirements: []
|
717
720
|
rubygems_version: 3.3.3
|
718
721
|
signing_key:
|