avo 2.13.1 → 2.13.2.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/stylesheets/avo.css +1 -1
- data/app/assets/stylesheets/css/fields/progress.css +3 -3
- data/app/assets/stylesheets/css/pagination.css +0 -4
- data/app/assets/stylesheets/css/search.css +1 -1
- data/app/assets/stylesheets/css/sidebar.css +1 -1
- data/app/assets/stylesheets/css/tags.css +7 -0
- data/app/assets/svgs/failed_to_load.svg +4 -5
- data/app/assets/svgs/grid-empty-state.svg +10 -11
- data/app/assets/svgs/table-empty-state.svg +11 -12
- data/app/components/avo/actions_component.html.erb +2 -2
- data/app/components/avo/actions_component.rb +1 -1
- data/app/components/avo/button_component.rb +3 -3
- data/app/components/avo/fields/boolean_field/edit_component.html.erb +1 -1
- data/app/components/avo/fields/progress_bar_field/index_component.html.erb +1 -1
- data/app/components/avo/fields/progress_bar_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/tags_field/edit_component.html.erb +1 -1
- data/app/components/avo/fields/tags_field/show_component.rb +2 -0
- data/app/components/avo/profile_item_component.html.erb +1 -1
- data/app/components/avo/tab_group_component.html.erb +1 -1
- data/app/components/avo/tab_switcher_component.rb +2 -2
- data/app/components/avo/views/resource_edit_component.rb +1 -1
- data/app/components/avo/views/resource_index_component.html.erb +2 -2
- data/app/components/avo/views/resource_index_component.rb +0 -17
- data/app/components/avo/views/resource_show_component.html.erb +1 -2
- data/app/controllers/avo/base_controller.rb +33 -87
- data/app/controllers/avo/search_controller.rb +20 -57
- data/app/helpers/avo/resources_helper.rb +2 -2
- data/app/javascript/avo.js +0 -1
- data/app/javascript/js/controllers/fields/trix_field_controller.js +4 -3
- data/app/javascript/js/controllers/item_selector_controller.js +1 -1
- data/app/javascript/js/controllers/menu_controller.js +2 -2
- data/app/javascript/js/controllers/search_controller.js +15 -42
- data/app/views/avo/associations/new.html.erb +2 -3
- data/app/views/avo/base/_multiple_select_filter.html.erb +1 -1
- data/app/views/avo/base/_text_filter.html.erb +1 -1
- data/app/views/avo/partials/_branding.html.erb +5 -0
- data/app/views/avo/partials/_header.html.erb +1 -1
- data/app/views/avo/partials/_logo.html.erb +2 -2
- data/app/views/avo/partials/_resource_search.html.erb +0 -6
- data/app/views/avo/private/_links_and_buttons.html.erb +1 -1
- data/app/views/avo/private/design.html.erb +3 -3
- data/app/views/layouts/avo/application.html.erb +1 -0
- data/lib/avo/concerns/has_editable_controls.rb +1 -1
- data/lib/avo/configuration/branding.rb +57 -0
- data/lib/avo/configuration.rb +5 -0
- data/lib/avo/fields/base_field.rb +1 -1
- data/lib/avo/fields/has_base_field.rb +0 -2
- data/lib/avo/licensing/pro_license.rb +1 -0
- data/lib/avo/version.rb +1 -1
- data/lib/generators/avo/templates/initializer/avo.tt +13 -0
- data/lib/generators/avo/templates/resource/resource.tt +1 -1
- data/public/avo-assets/avo.css +286 -248
- data/public/avo-assets/avo.js +47 -47
- data/public/avo-assets/avo.js.map +2 -2
- metadata +6 -13
- data/app/components/avo/button_component.html.erb +0 -1
- data/app/helpers/avo/actions_helper.rb +0 -4
- data/app/helpers/avo/attachments_helper.rb +0 -4
- data/app/views/kaminari/_first_page.html.erb +0 -3
- data/app/views/kaminari/_last_page.html.erb +0 -3
- data/app/views/kaminari/_next_page.html.erb +0 -9
- data/app/views/kaminari/_page.html.erb +0 -12
- data/app/views/kaminari/_prev_page.html.erb +0 -9
- data/lib/avo/hosts/search_scope_host.rb +0 -7
@@ -44,13 +44,10 @@ module Avo
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def search_resource(resource)
|
47
|
-
query =
|
48
|
-
block: resource.search_query,
|
49
|
-
params: params,
|
50
|
-
scope: resource.class.scope.limit(8)
|
51
|
-
).handle
|
47
|
+
query = resource.search_query.call(params: params).limit(8)
|
52
48
|
|
53
|
-
|
49
|
+
# Figure out if this is a belongs_to search
|
50
|
+
query = apply_attach_scope query
|
54
51
|
|
55
52
|
results = apply_search_metadata(query, resource)
|
56
53
|
|
@@ -70,19 +67,22 @@ module Avo
|
|
70
67
|
[resource.name.pluralize.downcase, result_object]
|
71
68
|
end
|
72
69
|
|
73
|
-
#
|
74
|
-
#
|
75
|
-
def
|
76
|
-
if
|
77
|
-
|
78
|
-
|
79
|
-
|
70
|
+
# Figure out if it's a belongs to search and if it has the attach_scope block present.
|
71
|
+
# If so, set the parent for those edit view and the parent with the grandparent for the new view.
|
72
|
+
def apply_attach_scope(query)
|
73
|
+
return query if params[:via_reflection_class].blank?
|
74
|
+
|
75
|
+
# Fetch the field
|
76
|
+
field = belongs_to_field
|
77
|
+
|
78
|
+
# No need to modify the query if there's no attach_scope present.
|
79
|
+
return query if field.attach_scope.blank?
|
80
|
+
|
81
|
+
# Try to fetch the parent.
|
82
|
+
if params[:via_reflection_id].present?
|
83
|
+
parent = params[:via_reflection_class].safe_constantize.find params[:via_reflection_id]
|
80
84
|
end
|
81
|
-
end
|
82
85
|
|
83
|
-
# Parent passed as argument to be used as a variable instead of the method "def parent"
|
84
|
-
# Otherwise parent = params...safe_constantize... will try to call method "def parent="
|
85
|
-
def apply_attach_scope(query, parent)
|
86
86
|
# If the parent is nil it probably means that someone's creating the record so it's not attached yet.
|
87
87
|
# In these scenarios, try to find the grandparent for the new views where the parent is nil
|
88
88
|
# and initialize the parent record with the grandparent attached so the user has the required information
|
@@ -94,13 +94,8 @@ module Avo
|
|
94
94
|
)
|
95
95
|
end
|
96
96
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
def apply_has_many_scope
|
101
|
-
scope = parent.send(params[:via_association_id])
|
102
|
-
|
103
|
-
Avo::Hosts::SearchScopeHost.new(block: @resource.search_query, params: params, scope: scope).handle
|
97
|
+
# Add to the query
|
98
|
+
Avo::Hosts::AssociationScopeHost.new(block: belongs_to_field.attach_scope, query: query, parent: parent).handle
|
104
99
|
end
|
105
100
|
|
106
101
|
def apply_search_metadata(models, avo_resource)
|
@@ -123,41 +118,9 @@ module Avo
|
|
123
118
|
end
|
124
119
|
end
|
125
120
|
|
126
|
-
|
127
|
-
|
128
|
-
def should_apply_has_many_scope?
|
129
|
-
params[:via_association] == "has_many" && @resource.search_query.present?
|
130
|
-
end
|
131
|
-
|
132
|
-
def should_apply_attach_scope?
|
133
|
-
params[:via_association] == "belongs_to" && attach_scope.present?
|
134
|
-
end
|
135
|
-
|
136
|
-
def should_apply_any_scope?
|
137
|
-
should_apply_has_many_scope? || should_apply_attach_scope?
|
138
|
-
end
|
139
|
-
|
140
|
-
def attach_scope
|
141
|
-
@attach_scope ||= field&.attach_scope
|
142
|
-
end
|
143
|
-
|
144
|
-
def field
|
145
|
-
@field ||= fetch_field
|
146
|
-
end
|
147
|
-
|
148
|
-
def parent
|
149
|
-
@parent ||= fetch_parent
|
150
|
-
end
|
151
|
-
|
152
|
-
def fetch_field
|
121
|
+
def belongs_to_field
|
153
122
|
fields = ::Avo::App.get_resource_by_model_name(params[:via_reflection_class]).get_field_definitions
|
154
123
|
fields.find { |f| f.id.to_s == params[:via_association_id] }
|
155
124
|
end
|
156
|
-
|
157
|
-
def fetch_parent
|
158
|
-
return unless params[:via_reflection_id].present?
|
159
|
-
|
160
|
-
params[:via_reflection_class].safe_constantize.find params[:via_reflection_id]
|
161
|
-
end
|
162
125
|
end
|
163
126
|
end
|
@@ -47,7 +47,7 @@ module Avo
|
|
47
47
|
|
48
48
|
def item_selector_input(floating: false, size: :md)
|
49
49
|
"<input type='checkbox'
|
50
|
-
class='mx-3 rounded #{"absolute inset-auto left-0 mt-2 z-10 hidden group-hover:block checked:block" if floating} #{size.to_sym == :lg ? "w-5 h-5" : "w-4 h-4"}'
|
50
|
+
class='mx-3 rounded checked:bg-primary-400 focus:checked:!bg-primary-400 #{"absolute inset-auto left-0 mt-2 z-10 hidden group-hover:block checked:block" if floating} #{size.to_sym == :lg ? "w-5 h-5" : "w-4 h-4"}'
|
51
51
|
data-action='input->item-selector#toggle input->item-select-all#update'
|
52
52
|
data-item-select-all-target='itemCheckbox'
|
53
53
|
name='#{t "avo.select_item"}'
|
@@ -58,7 +58,7 @@ module Avo
|
|
58
58
|
|
59
59
|
def item_select_all_input
|
60
60
|
"<input type='checkbox'
|
61
|
-
class='mx-3 rounded w-4 h-4'
|
61
|
+
class='mx-3 rounded w-4 h-4 checked:bg-primary-400 focus:checked:!bg-primary-400'
|
62
62
|
data-action='input->item-select-all#toggle'
|
63
63
|
data-item-select-all-target='checkbox'
|
64
64
|
name='#{t "avo.select_all"}'
|
data/app/javascript/avo.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
/* eslint-disable no-alert */
|
1
2
|
import 'trix'
|
2
3
|
import { Controller } from '@hotwired/stimulus'
|
3
4
|
import { castBoolean } from '../../helpers/cast_boolean'
|
@@ -48,7 +49,7 @@ export default class extends Controller {
|
|
48
49
|
// Prevent file uploads for fields that have attachments disabled.
|
49
50
|
if (this.attachmentsDisabled) {
|
50
51
|
event.preventDefault()
|
51
|
-
|
52
|
+
alert('This field has attachments disabled.')
|
52
53
|
|
53
54
|
return
|
54
55
|
}
|
@@ -56,7 +57,7 @@ export default class extends Controller {
|
|
56
57
|
// Prevent file uploads for resources that haven't been saved yet.
|
57
58
|
if (this.resourceId === '') {
|
58
59
|
event.preventDefault()
|
59
|
-
|
60
|
+
alert("You can't upload files into the Trix editor until you save the resource.")
|
60
61
|
|
61
62
|
return
|
62
63
|
}
|
@@ -64,7 +65,7 @@ export default class extends Controller {
|
|
64
65
|
// Prevent file uploads for fields without an attachment key.
|
65
66
|
if (this.attachmentKey === '') {
|
66
67
|
event.preventDefault()
|
67
|
-
|
68
|
+
alert("You haven't set an `attachment_key` to this Trix field.")
|
68
69
|
}
|
69
70
|
}
|
70
71
|
})
|
@@ -22,8 +22,8 @@ export default class extends Controller {
|
|
22
22
|
}
|
23
23
|
|
24
24
|
get initiallyCollapsed() {
|
25
|
-
if (
|
26
|
-
return this.
|
25
|
+
if (this.defaultState === 'collapsed') {
|
26
|
+
return this.userState === 'collapsed'
|
27
27
|
}
|
28
28
|
|
29
29
|
return this.userState === 'collapsed'
|
@@ -48,10 +48,6 @@ export default class extends Controller {
|
|
48
48
|
return this.dataset.viaAssociation === 'belongs_to'
|
49
49
|
}
|
50
50
|
|
51
|
-
get isHasManySearch() {
|
52
|
-
return this.dataset.viaAssociation === 'has_many'
|
53
|
-
}
|
54
|
-
|
55
51
|
get isGlobalSearch() {
|
56
52
|
return this.dataset.searchResource === 'global'
|
57
53
|
}
|
@@ -87,50 +83,27 @@ export default class extends Controller {
|
|
87
83
|
params.global = true
|
88
84
|
}
|
89
85
|
|
90
|
-
if (this.isBelongsToSearch
|
91
|
-
params =
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
86
|
+
if (this.isBelongsToSearch) {
|
87
|
+
params = {
|
88
|
+
...params,
|
89
|
+
// eslint-disable-next-line camelcase
|
90
|
+
via_association_id: this.dataset.viaAssociationId,
|
91
|
+
// eslint-disable-next-line camelcase
|
92
|
+
via_reflection_class: this.dataset.viaReflectionClass,
|
93
|
+
// eslint-disable-next-line camelcase
|
94
|
+
via_reflection_id: this.dataset.viaReflectionId,
|
95
|
+
// eslint-disable-next-line camelcase
|
96
|
+
via_parent_resource_id: this.dataset.viaParentResourceId,
|
97
|
+
// eslint-disable-next-line camelcase
|
98
|
+
via_parent_resource_class: this.dataset.viaParentResourceClass,
|
99
|
+
// eslint-disable-next-line camelcase
|
100
|
+
via_relation: this.dataset.viaRelation,
|
104
101
|
}
|
105
102
|
}
|
106
103
|
|
107
104
|
return params
|
108
105
|
}
|
109
106
|
|
110
|
-
addAssociationParams(params) {
|
111
|
-
params = {
|
112
|
-
...params,
|
113
|
-
// eslint-disable-next-line camelcase
|
114
|
-
via_association: this.dataset.viaAssociation,
|
115
|
-
// eslint-disable-next-line camelcase
|
116
|
-
via_association_id: this.dataset.viaAssociationId,
|
117
|
-
}
|
118
|
-
|
119
|
-
return params
|
120
|
-
}
|
121
|
-
|
122
|
-
addReflectionParams(params) {
|
123
|
-
params = {
|
124
|
-
...params,
|
125
|
-
// eslint-disable-next-line camelcase
|
126
|
-
via_reflection_class: this.dataset.viaReflectionClass,
|
127
|
-
// eslint-disable-next-line camelcase
|
128
|
-
via_reflection_id: this.dataset.viaReflectionId,
|
129
|
-
}
|
130
|
-
|
131
|
-
return params
|
132
|
-
}
|
133
|
-
|
134
107
|
handleOnSelect({ item }) {
|
135
108
|
if (this.isBelongsToSearch) {
|
136
109
|
this.updateFieldAttribute(this.hiddenIdTarget, 'value', item._id)
|
@@ -13,7 +13,6 @@
|
|
13
13
|
<div class="flex-1 flex items-center justify-center px-0 lg:px-8 text-lg mt-8 mb-12">
|
14
14
|
<% if @field.searchable %>
|
15
15
|
<%= render Avo::Fields::BelongsToField::AutocompleteComponent.new form: form,
|
16
|
-
classes: input_classes("w-full"),
|
17
16
|
field: @field,
|
18
17
|
model_key: @field.target_resource&.model_key,
|
19
18
|
foreign_key: 'related_id',
|
@@ -35,10 +34,10 @@
|
|
35
34
|
</div>
|
36
35
|
|
37
36
|
<% c.controls do %>
|
38
|
-
<%= a_button 'data-action': 'click->modal#close', size: :sm do %>
|
37
|
+
<%= a_button 'data-action': 'click->modal#close', size: :sm, style: :outline, color: :primary do %>
|
39
38
|
<%= t('avo.cancel') %>
|
40
39
|
<% end %>
|
41
|
-
<%= a_button type: :submit, color: :
|
40
|
+
<%= a_button type: :submit, style: :primary, color: :primary, size: :sm do %>
|
42
41
|
<%= t('avo.attach') %>
|
43
42
|
<% end %>
|
44
43
|
<% end %>
|
@@ -12,7 +12,7 @@
|
|
12
12
|
'data-multiple-select-filter-target': 'selector'
|
13
13
|
%>
|
14
14
|
<div class="flex justify-end">
|
15
|
-
<%= a_button class: 'mt-4', color: :
|
15
|
+
<%= a_button class: 'mt-4', color: :primary, size: :xs, data: { action: "multiple-select-filter#changeFilter" } do %>
|
16
16
|
Filter by <%=filter.name %>
|
17
17
|
<% end %>
|
18
18
|
</div>
|
@@ -13,7 +13,7 @@
|
|
13
13
|
'data-action': 'keypress->text-filter#tryToSubmit'
|
14
14
|
%>
|
15
15
|
<div class="flex justify-end">
|
16
|
-
<%= a_button class: 'mt-4', color: :
|
16
|
+
<%= a_button class: 'mt-4', color: :primary, data: { action: "text-filter#changeFilter" }, size: :xs do %>
|
17
17
|
<%= filter.button_label || "Filter by #{filter.name}" %>
|
18
18
|
<% end %>
|
19
19
|
</div>
|
@@ -1 +1 @@
|
|
1
|
-
<%= link_to Avo.configuration.app_name, '/', class: 'text-
|
1
|
+
<%= link_to Avo.configuration.app_name, '/', class: 'text-primary-500 font-semibold', target: :_blank %>
|
@@ -1,4 +1,4 @@
|
|
1
1
|
<%= link_to root_path, class: 'logo-placeholder h-full w-full flex justify-start' do %>
|
2
|
-
<%= image_tag
|
3
|
-
<%= image_tag
|
2
|
+
<%= image_tag Avo.configuration.branding.logo, class: 'hidden sm:block object-contain', title: 'Avo' %>
|
3
|
+
<%= image_tag Avo.configuration.branding.logomark, class: 'sm:hidden object-contain', title: 'Avo' %>
|
4
4
|
<% end %>
|
@@ -3,12 +3,6 @@
|
|
3
3
|
data-search-target="autocomplete"
|
4
4
|
data-search-resource="<%= resource %>"
|
5
5
|
data-translation-keys='{"no_item_found": "<%= I18n.translate 'avo.no_item_found' %>"}'
|
6
|
-
<% if via_reflection.present? %>
|
7
|
-
data-via-association="<%= via_reflection[:association] %>"
|
8
|
-
data-via-association-id="<%= via_reflection[:association_id] %>"
|
9
|
-
data-via-reflection-class="<%= via_reflection[:class] %>"
|
10
|
-
data-via-reflection-id="<%= via_reflection[:id] %>"
|
11
|
-
<% end %>
|
12
6
|
>
|
13
7
|
</div>
|
14
8
|
<div class="hidden relative inline-flex text-gray-400 text-sm border border-gray-300 rounded cursor-pointer" data-search-target="button"></div>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
entities = [:button, :link]
|
3
3
|
sizes = [:xl, :lg, :md, :sm, :xs].reverse
|
4
4
|
styles = [:primary, :outline, :text]
|
5
|
-
colors = [:primary, :gray, :red, :orange, :green]
|
5
|
+
colors = [:primary, :blue, :gray, :red, :orange, :green]
|
6
6
|
states = [:regular, :hover, :disabled, :active]
|
7
7
|
%>
|
8
8
|
<div class="px-6 space-y-4">
|
@@ -6,15 +6,15 @@
|
|
6
6
|
<% end %>
|
7
7
|
|
8
8
|
<%= a_link('/admin', icon: 'arrow-left', style: :outline, is_link: true) do %>
|
9
|
-
|
9
|
+
Outline
|
10
10
|
<% end %>
|
11
11
|
|
12
12
|
<%= a_link('/admin', icon: 'arrow-left', style: :outline, color: :red, is_link: true) do %>
|
13
13
|
Red
|
14
14
|
<% end %>
|
15
15
|
|
16
|
-
<%= a_link('/admin', icon: 'arrow-left', style: :
|
17
|
-
|
16
|
+
<%= a_link('/admin', icon: 'arrow-left', style: :text, color: :orange, is_link: true) do %>
|
17
|
+
Text
|
18
18
|
<% end %>
|
19
19
|
<% end %>
|
20
20
|
|
@@ -7,6 +7,7 @@
|
|
7
7
|
<%= csp_meta_tag %>
|
8
8
|
<%= render partial: 'avo/partials/javascript' %>
|
9
9
|
<%= render partial: 'avo/partials/head' %>
|
10
|
+
<%= render partial: 'avo/partials/branding' %>
|
10
11
|
<% if Avo::PACKED %>
|
11
12
|
<%= javascript_include_tag "/avo-assets/avo", "data-turbo-track": "reload", defer: true %>
|
12
13
|
<%= stylesheet_link_tag "/avo-assets/avo", "data-turbo-track": "reload", defer: true %>
|
@@ -0,0 +1,57 @@
|
|
1
|
+
class Avo::Configuration::Branding
|
2
|
+
def initialize(colors: nil, logo: nil, logomark: nil)
|
3
|
+
@colors = colors
|
4
|
+
@logo = logo
|
5
|
+
@logomark = logomark
|
6
|
+
|
7
|
+
@default_colors = {
|
8
|
+
100 => "206 231 248",
|
9
|
+
400 => "57 158 229",
|
10
|
+
500 => "8 134 222",
|
11
|
+
600 => "6 107 178"
|
12
|
+
}
|
13
|
+
@default_logo = "/avo-assets/logo.png"
|
14
|
+
@default_logomark = "/avo-assets/logomark.png"
|
15
|
+
end
|
16
|
+
|
17
|
+
def css_colors
|
18
|
+
rgb_colors.map do |color, value|
|
19
|
+
"--color-primary-#{color}: #{value};"
|
20
|
+
end.join("\n")
|
21
|
+
end
|
22
|
+
|
23
|
+
def logo
|
24
|
+
return @default_logo if Avo::App.license.lacks_with_trial(:branding)
|
25
|
+
|
26
|
+
@logo || @default_logo
|
27
|
+
end
|
28
|
+
|
29
|
+
def logomark
|
30
|
+
return @default_logomark if Avo::App.license.lacks_with_trial(:branding)
|
31
|
+
|
32
|
+
@logomark || @default_logomark
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def colors
|
38
|
+
return @default_colors if Avo::App.license.lacks_with_trial(:branding)
|
39
|
+
|
40
|
+
@colors || @default_colors
|
41
|
+
end
|
42
|
+
|
43
|
+
def rgb_colors
|
44
|
+
colors.map do |key, value|
|
45
|
+
rgb_value = is_hex?(value) ? hex_to_rgb(value) : value
|
46
|
+
[key, rgb_value]
|
47
|
+
end.to_h
|
48
|
+
end
|
49
|
+
|
50
|
+
def is_hex?(value)
|
51
|
+
value.include? "#"
|
52
|
+
end
|
53
|
+
|
54
|
+
def hex_to_rgb(value)
|
55
|
+
value.to_s.match(/^#(..)(..)(..)$/).captures.map(&:hex).join(" ")
|
56
|
+
end
|
57
|
+
end
|
data/lib/avo/configuration.rb
CHANGED
@@ -34,6 +34,7 @@ module Avo
|
|
34
34
|
attr_accessor :buttons_on_form_footers
|
35
35
|
attr_accessor :main_menu
|
36
36
|
attr_accessor :profile_menu
|
37
|
+
attr_writer :branding
|
37
38
|
|
38
39
|
def initialize
|
39
40
|
@root_path = "/avo"
|
@@ -121,6 +122,10 @@ module Avo
|
|
121
122
|
def feature_enabled?(feature)
|
122
123
|
!@disabled_features.map(&:to_sym).include?(feature.to_sym)
|
123
124
|
end
|
125
|
+
|
126
|
+
def branding
|
127
|
+
Avo::Configuration::Branding.new(**@branding || {})
|
128
|
+
end
|
124
129
|
end
|
125
130
|
|
126
131
|
def self.configuration
|
@@ -160,7 +160,7 @@ module Avo
|
|
160
160
|
final_value = @model.send(property) if (model_or_class(@model) == "model") && @model.respond_to?(property)
|
161
161
|
|
162
162
|
# On new views and actions modals we need to prefill the fields
|
163
|
-
if @view
|
163
|
+
if (@view === :new) || @action.present?
|
164
164
|
if default.present?
|
165
165
|
final_value = if default.respond_to?(:call)
|
166
166
|
default.call
|
@@ -6,7 +6,6 @@ module Avo
|
|
6
6
|
attr_accessor :attach_scope
|
7
7
|
attr_accessor :description
|
8
8
|
attr_accessor :discreet_pagination
|
9
|
-
attr_accessor :hide_search_input
|
10
9
|
|
11
10
|
def initialize(id, **args, &block)
|
12
11
|
super(id, **args, &block)
|
@@ -15,7 +14,6 @@ module Avo
|
|
15
14
|
@attach_scope = args[:attach_scope].present? ? args[:attach_scope] : nil
|
16
15
|
@display = args[:display].present? ? args[:display] : :show
|
17
16
|
@searchable = args[:searchable] == true
|
18
|
-
@hide_search_input = args[:hide_search_input] || false
|
19
17
|
@description = args[:description]
|
20
18
|
@use_resource = args[:use_resource] || nil
|
21
19
|
@discreet_pagination = args[:discreet_pagination] || false
|
data/lib/avo/version.rb
CHANGED
@@ -52,6 +52,19 @@ Avo.configure do |config|
|
|
52
52
|
# config.display_license_request_timeout_error = true
|
53
53
|
# config.disabled_features = []
|
54
54
|
# config.resource_controls = :right
|
55
|
+
# config.buttons_on_form_footers = true
|
56
|
+
|
57
|
+
## == Branding ==
|
58
|
+
# config.branding = {
|
59
|
+
# colors: {
|
60
|
+
# 100 => "#CEE7F8",
|
61
|
+
# 400 => "#399EE5",
|
62
|
+
# 500 => "#0886DE",
|
63
|
+
# 600 => "#066BB2",
|
64
|
+
# },
|
65
|
+
# logo: "/avo-assets/logo.png"
|
66
|
+
# logomark: "/avo-assets/logomark.png",
|
67
|
+
# }
|
55
68
|
|
56
69
|
|
57
70
|
## == Breadcrumbs ==
|