avo 1.20.2.pre.1 → 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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e78eb8560841b7427b02bd8ec702762d50211df5f1dc12e73ea2f002ffa26006
|
4
|
+
data.tar.gz: '08f1502ed0e5d5be5d93ab466317a789a978ce6a9c6220536e14776833984723'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09e9d276e94cce4ce299cafe4d99767a27481b3fd375bef413b4a20c1701db4fa21bb483c4015ac1f18392620439aeb9d4369ca1706b880634b760b91ddbcc1c'
|
7
|
+
data.tar.gz: b935e3dfa5adc7e243989b95e0e8ada16ea7f22b643ee3892b3e9a8dcb9ea8e1ea4535af8871370a80e5df5d33571a24fb4ea01450e4821626a532410b28838e
|
data/Gemfile.lock
CHANGED
@@ -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 %>
|
@@ -7,7 +7,6 @@ module Avo
|
|
7
7
|
before_action :hydrate_resource
|
8
8
|
before_action :set_model, only: [:show, :edit, :destroy, :update]
|
9
9
|
before_action :set_model_to_fill
|
10
|
-
before_action :fill_model, only: [:create, :update]
|
11
10
|
before_action :authorize_action
|
12
11
|
before_action :reset_pagination_if_filters_changed, only: :index
|
13
12
|
before_action :cache_applied_filters, only: :index
|
@@ -113,6 +112,7 @@ module Avo
|
|
113
112
|
|
114
113
|
def create
|
115
114
|
# model gets instantiated and filled in the fill_model method
|
115
|
+
fill_model
|
116
116
|
saved = @model.save
|
117
117
|
@resource.hydrate(model: @model, view: :new, user: _current_user)
|
118
118
|
|
@@ -166,6 +166,7 @@ module Avo
|
|
166
166
|
|
167
167
|
def update
|
168
168
|
# model gets instantiated and filled in the fill_model method
|
169
|
+
fill_model
|
169
170
|
saved = @model.save
|
170
171
|
@resource = @resource.hydrate(model: @model, view: :edit, user: _current_user)
|
171
172
|
|
@@ -44,10 +44,10 @@ module Avo
|
|
44
44
|
|
45
45
|
def options
|
46
46
|
{
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
47
|
+
key_label: @key_label,
|
48
|
+
value_label: @value_label,
|
49
|
+
action_text: @action_text,
|
50
|
+
delete_text: @delete_text,
|
51
51
|
disable_editing_keys: @disable_editing_keys,
|
52
52
|
disable_adding_rows: @disable_adding_rows,
|
53
53
|
disable_deleting_rows: @disable_deleting_rows
|
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.
|
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
|