avo 2.7.0 → 2.9.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 +2 -0
- data/Gemfile.lock +6 -4
- data/README.md +11 -0
- data/app/assets/stylesheets/avo.css +4 -4
- data/app/assets/stylesheets/css/{components → fields}/code.css +0 -0
- data/app/assets/stylesheets/css/{components → fields}/progress.css +0 -0
- data/app/assets/stylesheets/css/{components → fields}/status.css +0 -0
- data/app/assets/stylesheets/css/fields/trix.css +17 -0
- data/app/assets/svgs/download-solid-reversed.svg +2 -2
- data/app/components/avo/actions_component.html.erb +5 -13
- data/app/components/avo/actions_component.rb +39 -1
- data/app/components/avo/alert_component.rb +6 -0
- data/app/components/avo/card_component.html.erb +2 -2
- data/app/components/avo/common_field_wrapper_component.html.erb +11 -4
- data/app/components/avo/common_field_wrapper_component.rb +27 -1
- data/app/components/avo/edit/field_wrapper_component.html.erb +1 -1
- data/app/components/avo/fields/badge_field/index_component.html.erb +1 -1
- data/app/components/avo/fields/badge_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb +21 -10
- data/app/components/avo/fields/belongs_to_field/autocomplete_component.rb +7 -1
- data/app/components/avo/fields/belongs_to_field/edit_component.html.erb +27 -15
- data/app/components/avo/fields/belongs_to_field/edit_component.rb +4 -0
- data/app/components/avo/fields/belongs_to_field/index_component.html.erb +1 -1
- data/app/components/avo/fields/belongs_to_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/boolean_field/edit_component.html.erb +4 -2
- data/app/components/avo/fields/boolean_field/index_component.html.erb +1 -1
- data/app/components/avo/fields/boolean_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/boolean_group_field/edit_component.html.erb +7 -1
- data/app/components/avo/fields/boolean_group_field/index_component.html.erb +1 -1
- data/app/components/avo/fields/boolean_group_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/code_field/edit_component.html.erb +7 -5
- data/app/components/avo/fields/code_field/show_component.html.erb +2 -2
- data/app/components/avo/fields/common/key_value_component.html.erb +10 -4
- data/app/components/avo/fields/common/key_value_component.rb +2 -0
- data/app/components/avo/fields/country_field/edit_component.html.erb +4 -2
- data/app/components/avo/fields/country_field/index_component.html.erb +1 -1
- data/app/components/avo/fields/country_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/date_field/edit_component.html.erb +6 -4
- data/app/components/avo/fields/date_field/index_component.html.erb +1 -1
- data/app/components/avo/fields/date_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/date_time_field/edit_component.html.erb +6 -4
- data/app/components/avo/fields/date_time_field/index_component.html.erb +1 -1
- data/app/components/avo/fields/date_time_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/edit_component.rb +7 -0
- data/app/components/avo/fields/external_image_field/edit_component.html.erb +5 -2
- data/app/components/avo/fields/external_image_field/index_component.html.erb +6 -4
- data/app/components/avo/fields/external_image_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/file_field/edit_component.html.erb +6 -1
- data/app/components/avo/fields/file_field/index_component.html.erb +1 -1
- data/app/components/avo/fields/file_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/files_field/edit_component.html.erb +7 -1
- data/app/components/avo/fields/files_field/index_component.html.erb +1 -1
- data/app/components/avo/fields/files_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/gravatar_field/index_component.html.erb +1 -1
- data/app/components/avo/fields/gravatar_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/has_one_field/index_component.html.erb +1 -1
- data/app/components/avo/fields/hidden_field/edit_component.html.erb +5 -1
- data/app/components/avo/fields/id_field/edit_component.html.erb +1 -1
- data/app/components/avo/fields/id_field/index_component.html.erb +1 -1
- data/app/components/avo/fields/id_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/index_component.rb +3 -0
- data/app/components/avo/fields/key_value_field/edit_component.html.erb +1 -1
- data/app/components/avo/fields/key_value_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/markdown_field/edit_component.html.erb +8 -5
- data/app/components/avo/fields/markdown_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/number_field/edit_component.html.erb +7 -4
- data/app/components/avo/fields/number_field/index_component.html.erb +1 -1
- data/app/components/avo/fields/number_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/password_field/edit_component.html.erb +4 -2
- data/app/components/avo/fields/progress_bar_field/edit_component.html.erb +7 -4
- 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/select_field/edit_component.html.erb +9 -3
- data/app/components/avo/fields/select_field/index_component.html.erb +1 -1
- data/app/components/avo/fields/select_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/show_component.rb +3 -0
- data/app/components/avo/fields/status_field/edit_component.html.erb +6 -3
- data/app/components/avo/fields/status_field/index_component.html.erb +1 -1
- data/app/components/avo/fields/status_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/tags_field/edit_component.html.erb +19 -11
- data/app/components/avo/fields/tags_field/index_component.html.erb +1 -1
- data/app/components/avo/fields/tags_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/text_field/edit_component.html.erb +5 -2
- data/app/components/avo/fields/text_field/index_component.html.erb +1 -1
- data/app/components/avo/fields/text_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/textarea_field/edit_component.html.erb +6 -3
- data/app/components/avo/fields/textarea_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/trix_field/edit_component.html.erb +14 -4
- data/app/components/avo/fields/trix_field/edit_component.rb +3 -0
- data/app/components/avo/fields/trix_field/show_component.html.erb +2 -2
- data/app/components/avo/index/field_wrapper_component.html.erb +12 -5
- data/app/components/avo/index/field_wrapper_component.rb +27 -3
- data/app/components/avo/panel_component.rb +4 -3
- data/app/components/avo/resource_component.rb +1 -0
- data/app/components/avo/show/field_wrapper_component.html.erb +1 -1
- data/app/components/avo/show/field_wrapper_component.rb +2 -1
- data/app/components/avo/sidebar/item_switcher_component.html.erb +2 -2
- data/app/components/avo/views/resource_edit_component.html.erb +13 -8
- data/app/components/avo/views/resource_edit_component.rb +32 -3
- data/app/components/avo/views/resource_index_component.html.erb +7 -4
- data/app/components/avo/views/resource_index_component.rb +7 -1
- data/app/components/avo/views/resource_show_component.html.erb +11 -9
- data/app/components/avo/views/resource_show_component.rb +1 -0
- data/app/controllers/avo/actions_controller.rb +4 -1
- data/app/controllers/avo/base_controller.rb +24 -13
- data/app/controllers/avo/cards_controller.rb +25 -0
- data/app/controllers/avo/dashboards_controller.rb +2 -8
- data/app/controllers/avo/home_controller.rb +8 -1
- data/app/controllers/avo/search_controller.rb +7 -1
- data/app/helpers/avo/url_helpers.rb +8 -9
- data/app/javascript/js/controllers/fields/code_field_controller.js +7 -1
- data/app/javascript/js/controllers/fields/key_value_controller.js +1 -0
- data/app/javascript/js/controllers/fields/tags_field_controller.js +0 -1
- data/app/javascript/js/controllers/menu_controller.js +4 -3
- data/app/javascript/js/controllers/resource_edit_controller.js +72 -0
- data/app/javascript/js/controllers/resource_index_controller.js +4 -0
- data/app/javascript/js/controllers/resource_show_controller.js +4 -0
- data/app/javascript/js/controllers/search_controller.js +28 -5
- data/app/javascript/js/controllers.js +8 -0
- data/app/views/avo/associations/new.html.erb +2 -1
- data/app/views/avo/base/_select_filter.html.erb +1 -1
- data/app/views/avo/base/_text_filter.html.erb +1 -0
- data/app/views/avo/base/edit.html.erb +2 -1
- data/app/views/avo/base/new.html.erb +1 -1
- data/app/views/avo/{dashboards → cards}/_chartkick_card.html.erb +0 -0
- data/app/views/avo/{dashboards → cards}/_metric_card.html.erb +0 -0
- data/app/views/avo/{dashboards/card.html.erb → cards/show.html.erb} +0 -0
- data/app/views/avo/partials/_custom_tools_alert.html.erb +21 -7
- data/app/views/avo/partials/_logo.html.erb +3 -2
- data/app/views/avo/partials/_navbar.html.erb +1 -1
- data/app/views/avo/partials/_table_header.html.erb +9 -1
- data/bin/test +1 -0
- data/config/routes.rb +7 -4
- data/db/factories.rb +1 -0
- data/lib/avo/app.rb +18 -1
- data/lib/avo/base_action.rb +16 -4
- data/lib/avo/base_card.rb +0 -23
- data/lib/avo/base_resource.rb +23 -16
- data/lib/avo/concerns/fetches_things.rb +19 -12
- data/lib/avo/concerns/has_fields.rb +93 -0
- data/lib/avo/concerns/has_html_attributes.rb +110 -0
- data/lib/avo/concerns/has_model.rb +11 -0
- data/lib/avo/concerns/has_stimulus_controllers.rb +42 -0
- data/lib/avo/dynamic_router.rb +1 -1
- data/lib/avo/engine.rb +1 -3
- data/lib/avo/fields/base_field.rb +24 -13
- data/lib/avo/fields/concerns/is_required.rb +17 -0
- data/lib/avo/fields/select_field.rb +1 -1
- data/lib/avo/grid_collector.rb +4 -4
- data/lib/avo/hosts/view_record_host.rb +7 -0
- data/lib/avo/html/builder.rb +117 -0
- data/lib/avo/licensing/pro_license.rb +1 -0
- data/lib/avo/menu/base_item.rb +4 -0
- data/lib/avo/menu/dashboard.rb +5 -0
- data/lib/avo/menu/resource.rb +5 -0
- data/lib/avo/version.rb +1 -1
- data/lib/avo.rb +5 -0
- data/lib/generators/avo/install_generator.rb +1 -4
- data/lib/generators/avo/templates/cards/chartkick_card_sample.tt +11 -1
- data/lib/generators/avo/templates/cards/metric_card_sample.tt +11 -1
- data/lib/generators/avo/templates/field/components/edit_component.html.erb.tt +1 -1
- data/lib/generators/avo/templates/field/components/index_component.html.erb.tt +1 -1
- data/lib/generators/avo/templates/field/components/show_component.html.erb.tt +1 -1
- data/lib/generators/avo/templates/initializer/avo.tt +1 -1
- data/lib/generators/avo/templates/locales/avo.en.yml +3 -3
- data/public/avo-assets/avo.css +473 -1055
- data/public/avo-assets/avo.js +147 -147
- data/public/avo-assets/avo.js.map +3 -3
- data/public/avo-assets/logomark.png +0 -0
- metadata +21 -11
- data/app/components/avo/views/resource_new_component.html.erb +0 -55
- data/app/components/avo/views/resource_new_component.rb +0 -38
- data/lib/avo/fields_collector.rb +0 -70
@@ -38,16 +38,22 @@
|
|
38
38
|
value: @field.parsed_value,
|
39
39
|
class: 'hidden',
|
40
40
|
placeholder: @field.placeholder,
|
41
|
-
|
42
|
-
|
41
|
+
data: {
|
42
|
+
"key-value-target": 'input',
|
43
|
+
view: @view,
|
44
|
+
**@field.get_html(:data, view: view, element: :input)
|
45
|
+
}
|
43
46
|
%>
|
44
47
|
<% else %>
|
45
48
|
<%= text_area_tag @field.id,
|
46
49
|
@field.parsed_value,
|
47
50
|
class: 'hidden',
|
48
51
|
placeholder: @field.placeholder,
|
49
|
-
|
50
|
-
|
52
|
+
data: {
|
53
|
+
"key-value-target": 'input',
|
54
|
+
view: @view,
|
55
|
+
**@field.get_html(:data, view: view, element: :input)
|
56
|
+
}
|
51
57
|
%>
|
52
58
|
<% end %>
|
53
59
|
</div>
|
@@ -1,7 +1,9 @@
|
|
1
1
|
<%= edit_field_wrapper field: @field, index: @index, form: @form, resource: @resource, displayed_in_modal: @displayed_in_modal do %>
|
2
2
|
<%= @form.select @field.id, @field.select_options, { selected: @field.value, prompt: @field.placeholder },
|
3
|
-
class:
|
3
|
+
class: classes("w-full"),
|
4
|
+
data: @field.get_html(:data, view: view, element: :input),
|
5
|
+
disabled: @field.readonly,
|
4
6
|
placeholder: @field.placeholder,
|
5
|
-
|
7
|
+
style: @field.get_html(:style, view: view, element: :input)
|
6
8
|
%>
|
7
9
|
<% end %>
|
@@ -1,9 +1,7 @@
|
|
1
1
|
<%= edit_field_wrapper field: @field, index: @index, form: @form, resource: @resource, displayed_in_modal: @displayed_in_modal do %>
|
2
2
|
<div data-controller="date-field">
|
3
3
|
<%= @form.date_field @field.id,
|
4
|
-
class:
|
5
|
-
placeholder: @field.placeholder,
|
6
|
-
disabled: @field.readonly,
|
4
|
+
class: classes("w-full"),
|
7
5
|
data: {
|
8
6
|
'date-field-target': 'input',
|
9
7
|
'first-day-of-week': @field.first_day_of_week,
|
@@ -12,7 +10,11 @@
|
|
12
10
|
format: @field.format,
|
13
11
|
placeholder: @field.placeholder,
|
14
12
|
relative: @field.relative,
|
15
|
-
|
13
|
+
**@field.get_html(:data, view: view, element: :input)
|
14
|
+
},
|
15
|
+
disabled: @field.readonly,
|
16
|
+
placeholder: @field.placeholder,
|
17
|
+
style: @field.get_html(:style, view: view, element: :input)
|
16
18
|
%>
|
17
19
|
</div>
|
18
20
|
<% end %>
|
@@ -1,9 +1,7 @@
|
|
1
1
|
<%= edit_field_wrapper field: @field, index: @index, form: @form, resource: @resource, displayed_in_modal: @displayed_in_modal do %>
|
2
2
|
<div data-controller="date-field">
|
3
3
|
<%= @form.datetime_field @field.id,
|
4
|
-
class:
|
5
|
-
placeholder: @field.placeholder,
|
6
|
-
disabled: @field.readonly,
|
4
|
+
class: classes("w-full"),
|
7
5
|
data: {
|
8
6
|
'date-field-target': 'input',
|
9
7
|
'first-day-of-week': @field.first_day_of_week,
|
@@ -14,7 +12,11 @@
|
|
14
12
|
format: @field.format,
|
15
13
|
placeholder: @field.placeholder,
|
16
14
|
relative: @field.relative,
|
17
|
-
|
15
|
+
**@field.get_html(:data, view: view, element: :input)
|
16
|
+
},
|
17
|
+
disabled: @field.readonly,
|
18
|
+
placeholder: @field.placeholder,
|
19
|
+
style: @field.get_html(:style, view: view, element: :input)
|
18
20
|
%>
|
19
21
|
</div>
|
20
22
|
<% end %>
|
@@ -3,11 +3,18 @@
|
|
3
3
|
class Avo::Fields::EditComponent < ViewComponent::Base
|
4
4
|
include Avo::ResourcesHelper
|
5
5
|
|
6
|
+
attr_reader :view
|
7
|
+
|
6
8
|
def initialize(field: nil, resource: nil, index: 0, form: nil, displayed_in_modal: false)
|
7
9
|
@field = field
|
8
10
|
@resource = resource
|
9
11
|
@index = index
|
10
12
|
@form = form
|
11
13
|
@displayed_in_modal = displayed_in_modal
|
14
|
+
@view = :edit
|
15
|
+
end
|
16
|
+
|
17
|
+
def classes(extra_classes = "")
|
18
|
+
helpers.input_classes("#{@field.get_html(:classes, view: view, element: :input)} #{extra_classes}", has_error: @field.model_errors.include?(@field.id))
|
12
19
|
end
|
13
20
|
end
|
@@ -1,6 +1,9 @@
|
|
1
1
|
<%= edit_field_wrapper field: @field, index: @index, form: @form, resource: @resource, displayed_in_modal: @displayed_in_modal do %>
|
2
2
|
<%= @form.text_field @field.id,
|
3
|
-
class:
|
3
|
+
class: classes("w-full"),
|
4
|
+
data: @field.get_html(:data, view: view, element: :input),
|
5
|
+
disabled: @field.readonly,
|
4
6
|
placeholder: @field.placeholder,
|
5
|
-
|
7
|
+
style: @field.get_html(:style, view: view, element: :input)
|
8
|
+
%>
|
6
9
|
<% end %>
|
@@ -1,8 +1,10 @@
|
|
1
|
-
<%= index_field_wrapper field: @field, flush: true do %>
|
1
|
+
<%= index_field_wrapper field: @field, resource: @resource, flush: true do %>
|
2
2
|
<% if @field.value.present? %>
|
3
|
-
<%=
|
4
|
-
|
5
|
-
|
3
|
+
<%= link_to_if @field.link_to_resource.present?,
|
4
|
+
image_tag(@field.value,
|
5
|
+
height: @field.height,
|
6
|
+
style: "border-radius: #{@field.radius}px; max-height: #{@field.height}#{@field.height.to_s&.ends_with?('px') ? '' : 'px'};"),
|
7
|
+
resource_path
|
6
8
|
%>
|
7
9
|
<% end %>
|
8
10
|
<% end %>
|
@@ -6,6 +6,11 @@
|
|
6
6
|
<% end %>
|
7
7
|
|
8
8
|
<% if @resource.authorization.authorize_action(:upload_attachments?, raise_exception: false) %>
|
9
|
-
<%= @form.file_field @field.id,
|
9
|
+
<%= @form.file_field @field.id,
|
10
|
+
data: @field.get_html(:data, view: view, element: :input),
|
11
|
+
direct_upload: @field.direct_upload,
|
12
|
+
disabled: @field.readonly,
|
13
|
+
style: @field.get_html(:style, view: view, element: :input)
|
14
|
+
%>
|
10
15
|
<% end %>
|
11
16
|
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= index_field_wrapper field: @field, flush: flush? do %>
|
1
|
+
<%= index_field_wrapper field: @field, resource: @resource, flush: flush? do %>
|
2
2
|
<% if @field.value.present? %>
|
3
3
|
<% if @field.value.attached? && @field.value.representable? && @field.is_image %>
|
4
4
|
<%= link_to_if @field.link_to_resource, image_tag(helpers.main_app.url_for(@field.value), class: 'h-10'), resource_path, class: 'block' %>
|
@@ -3,7 +3,13 @@
|
|
3
3
|
|
4
4
|
<% if @resource.authorization.authorize_action(:upload_attachments?, raise_exception: false) %>
|
5
5
|
<div class="mt-2">
|
6
|
-
<%= @form.file_field @field.id,
|
6
|
+
<%= @form.file_field @field.id,
|
7
|
+
data: @field.get_html(:data, view: view, element: :input),
|
8
|
+
direct_upload: @field.direct_upload,
|
9
|
+
disabled: @field.readonly,
|
10
|
+
multiple: true,
|
11
|
+
style: @field.get_html(:style, view: view, element: :input)
|
12
|
+
%>
|
7
13
|
</div>
|
8
14
|
<% end %>
|
9
15
|
<% end %>
|
@@ -1,3 +1,3 @@
|
|
1
|
-
<%= show_field_wrapper field: @field, full_width: true do %>
|
1
|
+
<%= show_field_wrapper field: @field, resource: @resource, full_width: true do %>
|
2
2
|
<%= render Avo::Fields::Common::FilesListViewerComponent.new(field: @field, resource: @resource) if @field.value.present? %>
|
3
3
|
<% end %>
|
@@ -1,3 +1,3 @@
|
|
1
|
-
<%= index_field_wrapper field: @field, class: 'whitespace-no-wrap w-[1%]' do %>
|
1
|
+
<%= index_field_wrapper field: @field, resource: @resource, class: 'whitespace-no-wrap w-[1%]' do %>
|
2
2
|
<% link_to_if (@field.link_to_resource or Avo.configuration.id_links_to_resource), @field.value, resource_path, title: t('avo.view_item', item: @resource.name).humanize %>
|
3
3
|
<% end %>
|
@@ -3,11 +3,14 @@
|
|
3
3
|
class Avo::Fields::IndexComponent < ViewComponent::Base
|
4
4
|
include Avo::ResourcesHelper
|
5
5
|
|
6
|
+
attr_reader :view
|
7
|
+
|
6
8
|
def initialize(field: nil, resource: nil, index: 0, parent_model: nil)
|
7
9
|
@field = field
|
8
10
|
@resource = resource
|
9
11
|
@index = index
|
10
12
|
@parent_model = parent_model
|
13
|
+
@view = :index
|
11
14
|
end
|
12
15
|
|
13
16
|
def resource_path
|
@@ -1,3 +1,3 @@
|
|
1
1
|
<%= edit_field_wrapper field: @field, index: @index, form: @form, resource: @resource, displayed_in_modal: @displayed_in_modal, full_width: true do %>
|
2
|
-
<%= render Avo::Fields::Common::KeyValueComponent.new field: @field, form: @form, view:
|
2
|
+
<%= render Avo::Fields::Common::KeyValueComponent.new field: @field, form: @form, view: @resource.view %>
|
3
3
|
<% end %>
|
@@ -1,12 +1,15 @@
|
|
1
1
|
<%= edit_field_wrapper field: @field, index: @index, form: @form, resource: @resource, displayed_in_modal: @displayed_in_modal, full_width: true do %>
|
2
2
|
<div data-controller="simple-mde">
|
3
3
|
<%= @form.text_area @field.id,
|
4
|
-
class:
|
5
|
-
|
4
|
+
class: classes("w-full js-has-simple-mde-editor"),
|
5
|
+
data: {
|
6
|
+
view: @resource.view,
|
7
|
+
'simple-mde-target': 'element',
|
8
|
+
'component-options': @field.options.to_json,
|
9
|
+
},
|
6
10
|
disabled: @field.readonly,
|
7
|
-
|
8
|
-
|
9
|
-
'data-view': :edit
|
11
|
+
placeholder: @field.placeholder,
|
12
|
+
style: @field.get_html(:style, view: view, element: :input)
|
10
13
|
%>
|
11
14
|
</div>
|
12
15
|
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= show_field_wrapper field: @field, index: @index, full_width: true do %>
|
1
|
+
<%= show_field_wrapper field: @field, resource: @resource, index: @index, full_width: true do %>
|
2
2
|
<div data-controller="simple-mde">
|
3
3
|
<%= text_area_tag @field.id, @field.value,
|
4
4
|
class: helpers.input_classes('w-full js-has-simple-mde-editor'),
|
@@ -1,9 +1,12 @@
|
|
1
1
|
<%= edit_field_wrapper field: @field, index: @index, form: @form, resource: @resource, displayed_in_modal: @displayed_in_modal do %>
|
2
2
|
<%= @form.number_field @field.id,
|
3
|
-
class:
|
4
|
-
|
3
|
+
class: classes("w-full"),
|
4
|
+
data: @field.get_html(:data, view: view, element: :input),
|
5
5
|
disabled: @field.readonly,
|
6
|
-
min: @field.min,
|
7
6
|
max: @field.max,
|
8
|
-
|
7
|
+
min: @field.min,
|
8
|
+
placeholder: @field.placeholder,
|
9
|
+
step: @field.step,
|
10
|
+
style: @field.get_html(:style, view: view, element: :input)
|
11
|
+
%>
|
9
12
|
<% end %>
|
@@ -1,7 +1,9 @@
|
|
1
1
|
<%= edit_field_wrapper field: @field, index: @index, form: @form, resource: @resource, displayed_in_modal: @displayed_in_modal do %>
|
2
2
|
<%= @form.password_field @field.id,
|
3
|
-
class:
|
3
|
+
class: classes("w-full"),
|
4
|
+
data: @field.get_html(:data, view: view, element: :input),
|
5
|
+
disabled: @field.readonly,
|
4
6
|
placeholder: @field.placeholder,
|
5
|
-
|
7
|
+
style: @field.get_html(:style, view: view, element: :input)
|
6
8
|
%>
|
7
9
|
<% end %>
|
@@ -5,12 +5,15 @@
|
|
5
5
|
</div>
|
6
6
|
<% end %>
|
7
7
|
<%= @form.range_field @field.id,
|
8
|
-
|
8
|
+
class: "w-full #{@field.get_html(:classes, view: view, element: :input)}",
|
9
|
+
data: @field.get_html(:data, view: view, element: :input),
|
10
|
+
disabled: @field.readonly,
|
9
11
|
max: @field.max,
|
10
|
-
|
11
|
-
class: 'w-full',
|
12
|
+
min: 0,
|
12
13
|
placeholder: @field.placeholder,
|
13
|
-
|
14
|
+
step: @field.step,
|
15
|
+
style: @field.get_html(:style, view: view, element: :input)
|
16
|
+
%>
|
14
17
|
<% end %>
|
15
18
|
|
16
19
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= index_field_wrapper field: @field, flush: true do %>
|
1
|
+
<%= index_field_wrapper field: @field, resource: @resource, flush: true do %>
|
2
2
|
<% if @field.display_value %>
|
3
3
|
<div class="text-center text-sm font-semibold w-full leading-none mb-1">
|
4
4
|
<%= @field.value %><%= @field.value_suffix if @field.value_suffix.present? %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= show_field_wrapper field: @field, index: @index do %>
|
1
|
+
<%= show_field_wrapper field: @field, resource: @resource, index: @index do %>
|
2
2
|
<% if @field.display_value %>
|
3
3
|
<div class="text-center text-sm font-semibold w-full leading-none mb-1">
|
4
4
|
<%= @field.value %><%= @field.value_suffix if @field.value_suffix.present? %>
|
@@ -1,6 +1,12 @@
|
|
1
1
|
<%= edit_field_wrapper field: @field, index: @index, form: @form, resource: @resource, displayed_in_modal: @displayed_in_modal do %>
|
2
2
|
<%= @form.select @field.id, @field.options_for_select, { selected: @field.value, prompt: @field.placeholder }, {
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
aria: {
|
4
|
+
placeholder: @field.placeholder
|
5
|
+
},
|
6
|
+
class: classes("w-full"),
|
7
|
+
data: @field.get_html(:data, view: view, element: :input),
|
8
|
+
disabled: @field.readonly,
|
9
|
+
style: @field.get_html(:style, view: view, element: :input),
|
10
|
+
value: @field.model.present? ? @field.model[@field.id] : @field.value
|
11
|
+
} %>
|
6
12
|
<% end %>
|
@@ -1,7 +1,10 @@
|
|
1
1
|
<%= edit_field_wrapper field: @field, index: @index, form: @form, resource: @resource, displayed_in_modal: @displayed_in_modal do %>
|
2
2
|
<%= @form.text_field @field.id,
|
3
|
-
class:
|
4
|
-
|
3
|
+
class: classes("w-full"),
|
4
|
+
data: @field.get_html(:data, view: view, element: :input),
|
5
5
|
disabled: @field.readonly,
|
6
|
-
|
6
|
+
placeholder: @field.placeholder,
|
7
|
+
style: @field.get_html(:style, view: view, element: :input),
|
8
|
+
value: @resource.model.present? ? @resource.model[@field.id] : @field.value
|
9
|
+
%>
|
7
10
|
<% end %>
|
@@ -1,20 +1,23 @@
|
|
1
|
-
<%= edit_field_wrapper field: @field,
|
1
|
+
<%= edit_field_wrapper field: @field,
|
2
|
+
index: @index,
|
3
|
+
form: @form,
|
4
|
+
resource: @resource,
|
5
|
+
displayed_in_modal: @displayed_in_modal do %>
|
2
6
|
<div data-controller="tags-field">
|
3
7
|
<%# dummy field %>
|
4
8
|
<%= text_field_tag "#{@field.id}-dummy", '',
|
5
|
-
class:
|
6
|
-
placeholder: @field.placeholder,
|
7
|
-
disabled: @field.readonly,
|
8
|
-
value: '',
|
9
|
+
class: classes("w-full"),
|
9
10
|
data: {
|
10
11
|
'tags-field-target': 'fakeInput',
|
11
|
-
}
|
12
|
+
},
|
13
|
+
disabled: @field.readonly,
|
14
|
+
placeholder: @field.placeholder,
|
15
|
+
style: @field.get_html(:style, view: view, element: :input),
|
16
|
+
value: ''
|
17
|
+
%>
|
12
18
|
<%# real field %>
|
13
19
|
<%= @form.text_field @field.id,
|
14
|
-
class:
|
15
|
-
placeholder: @field.placeholder,
|
16
|
-
disabled: @field.readonly,
|
17
|
-
value: @field.field_value.to_json,
|
20
|
+
class: classes("hidden w-full"),
|
18
21
|
data: {
|
19
22
|
'tags-field-target': 'input',
|
20
23
|
'whitelist-items': @field.suggestions.to_json,
|
@@ -22,6 +25,11 @@
|
|
22
25
|
'enforce-suggestions': @field.enforce_suggestions ? 1 : 0,
|
23
26
|
'delimiters': @field.delimiters,
|
24
27
|
'close-on-select': @field.close_on_select ? 1 : 0,
|
25
|
-
}
|
28
|
+
},
|
29
|
+
disabled: @field.readonly,
|
30
|
+
placeholder: @field.placeholder,
|
31
|
+
style: @field.get_html(:style, view: view, element: :input),
|
32
|
+
value: @field.field_value.to_json
|
33
|
+
%>
|
26
34
|
</div>
|
27
35
|
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= index_field_wrapper field: @field, flush: true do %>
|
1
|
+
<%= index_field_wrapper field: @field, resource: @resource, flush: true do %>
|
2
2
|
<div class="flex gap-1 items-center flex-nowrap">
|
3
3
|
<% value.take(3).each do |item| %>
|
4
4
|
<%= render Avo::Fields::TagsField::TagComponent.new(label: label_from_item(item)) %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= show_field_wrapper field: @field, index: @index do %>
|
1
|
+
<%= show_field_wrapper field: @field, resource: @resource, index: @index do %>
|
2
2
|
<div class="flex gap-1 items-center flex-wrap">
|
3
3
|
<% @field.field_value.each do |item| %>
|
4
4
|
<%= render Avo::Fields::TagsField::TagComponent.new(label: label_from_item(item)) %>
|
@@ -1,6 +1,9 @@
|
|
1
1
|
<%= edit_field_wrapper field: @field, index: @index, form: @form, resource: @resource, displayed_in_modal: @displayed_in_modal do %>
|
2
2
|
<%= @form.text_field @field.id,
|
3
|
-
class:
|
3
|
+
class: classes("w-full"),
|
4
|
+
data: @field.get_html(:data, view: view, element: :input),
|
5
|
+
disabled: @field.readonly,
|
4
6
|
placeholder: @field.placeholder,
|
5
|
-
|
7
|
+
style: @field.get_html(:style, view: view, element: :input)
|
8
|
+
%>
|
6
9
|
<% end %>
|
@@ -1,7 +1,10 @@
|
|
1
1
|
<%= edit_field_wrapper field: @field, index: @index, form: @form, resource: @resource, displayed_in_modal: @displayed_in_modal do %>
|
2
2
|
<%= @form.text_area @field.id,
|
3
|
-
class:
|
4
|
-
|
3
|
+
class: classes("w-full"),
|
4
|
+
data: @field.get_html(:data, view: view, element: :input),
|
5
5
|
disabled: @field.readonly,
|
6
|
-
|
6
|
+
placeholder: @field.placeholder,
|
7
|
+
rows: @field.rows,
|
8
|
+
style: @field.get_html(:style, view: view, element: :input)
|
9
|
+
%>
|
7
10
|
<% end %>
|