diff --git a/Gemfile.lock b/Gemfile.lock index b337bf3f07..e166bf0e34 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -107,7 +107,7 @@ GIT PATH remote: . specs: - avo (3.13.7) + avo (3.14.3) actionview (>= 6.1) active_link_to activerecord (>= 6.1) diff --git a/README.md b/README.md index 44eb7fa35d..b74ea91125 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ Please read the [RELEASE.MD](./RELEASE.MD) -[Become a sponsor ](https://github.com/sponsors/adrianthedev) +[Become a sponsor](mailto:hi@avohq.io) ![Alt](https://repobeats.axiom.co/api/embed/1481a6a259064f02a7936470d12a50802a9c98a4.svg "Repobeats analytics image") @@ -120,3 +120,10 @@ Please read the [RELEASE.MD](./RELEASE.MD) [Get a box of waffles and some of the best app monitoring from Appsignal](https://appsignal.com/r/93dbe69bfb) 🧇 [Get $100 in credits from Digital Ocean](https://www.digitalocean.com/?refcode=efc1fe881d74&utm_campaign=Referral_Invite&utm_medium=Referral_Program&utm_source=badge) 💸 + +## Other Open Source Work + + - [`active_storage-blurhash`](https://github.com/avo-hq/active_storage-blurhash) - A plug-n-play [blurhash](https://blurha.sh/) integration for images stored in ActiveStorage + - [`class_variants`](https://github.com/avo-hq/class_variants) - Easily configure styles and apply them as classes. Very useful when you're implementing Tailwind CSS components and call them with different states. + - [`prop_initializer`](https://github.com/avo-hq/prop_initializer) - A flexible tool for defining properties on Ruby classes. + - [`stimulus-confetti`](https://github.com/avo-hq/stimulus-confetti) - The easiest way to add confetti to your StimulusJS app diff --git a/app/assets/stylesheets/css/fields/trix.css b/app/assets/stylesheets/css/fields/trix.css index 7e7929820b..7d4113b82c 100644 --- a/app/assets/stylesheets/css/fields/trix.css +++ b/app/assets/stylesheets/css/fields/trix.css @@ -1,5 +1,14 @@ @import './../../../../../node_modules/trix/dist/trix.css'; +.trix-content.hidden { + display: block !important; + clip-path: inset(0 0 calc(100% - 50px) 0); + -webkit-mask-image: linear-gradient(to bottom, black 30px, transparent 50px); + mask-image: linear-gradient(to bottom, black 30px, transparent 50px); + max-height: 50px; + min-height: 0px; +} + .trix-content h1 { @apply text-xl font-bold mb-2; } diff --git a/app/components/avo/actions_component.rb b/app/components/avo/actions_component.rb index 59754068e3..2e809a809c 100644 --- a/app/components/avo/actions_component.rb +++ b/app/components/avo/actions_component.rb @@ -68,7 +68,7 @@ def icon(icon) def render_item(action) case action when Avo::Divider - render_divider(action) + render Avo::DividerComponent.new(action.label) when Avo::BaseAction render_action_link(action) when defined?(Avo::Advanced::Resources::Controls::Action) && Avo::Advanced::Resources::Controls::Action @@ -84,11 +84,6 @@ def render_item(action) private - def render_divider(action) - label = action.label.is_a?(Hash) ? action.label[:label] : nil - render Avo::DividerComponent.new(label) - end - def render_action_link(action, icon: nil) link_to action.link_arguments(resource: @resource, arguments: action.arguments).first, data: action_data_attributes(action), diff --git a/app/components/avo/button_component.rb b/app/components/avo/button_component.rb index 09926c4da8..dad7004729 100644 --- a/app/components/avo/button_component.rb +++ b/app/components/avo/button_component.rb @@ -57,11 +57,9 @@ def is_not_icon? def full_content result = "" - icon_classes = @icon_class # space out the icon from the text if text is present - icon_classes += " mr-1" if content.present? && is_not_icon? # add the icon height - icon_classes += icon_size_classes + icon_classes = class_names(@icon_class, "pointer-events-none", icon_size_classes, "mr-1": content.present? && is_not_icon?) # Add the icon result += helpers.svg(@icon, class: icon_classes) if @icon.present? diff --git a/app/components/avo/fields/belongs_to_field/edit_component.html.erb b/app/components/avo/fields/belongs_to_field/edit_component.html.erb index e2fd48bd1c..b38be635bd 100644 --- a/app/components/avo/fields/belongs_to_field/edit_component.html.erb +++ b/app/components/avo/fields/belongs_to_field/edit_component.html.erb @@ -49,10 +49,9 @@ <% else %> <%= @form.select @field.id_input_foreign_key, options_for_select( - # Options @field.values_for_type(type), - # Selected - @field.value.is_a?(type) ? @field.value.to_param : nil + selected: @field.value.is_a?(type) ? @field.value.to_param : nil, + disabled: t("avo.more_records_available") ), { include_blank: @field.placeholder, @@ -103,7 +102,7 @@ %> <% else %> <%= @form.select @field.id_input_foreign_key, - options_for_select(@field.options, @field.value.to_param), + options_for_select(@field.options, selected: @field.value.to_param, disabled: t("avo.more_records_available")), { include_blank: @field.placeholder, }, diff --git a/app/components/avo/fields/common/key_value_component.html.erb b/app/components/avo/fields/common/key_value_component.html.erb index 1ba7262502..3e32e12935 100644 --- a/app/components/avo/fields/common/key_value_component.html.erb +++ b/app/components/avo/fields/common/key_value_component.html.erb @@ -15,7 +15,7 @@ <%= @field.value_label %> <% if @view.form? %> -
+
<% if can_upload_file? %> - <%= @form.file_field @field.id, - accept: @field.accept, - data: @field.get_html(:data, view: view, element: :input), - direct_upload: @field.direct_upload, - disabled: disabled?, - style: @field.get_html(:style, view: view, element: :input), - autofocus: @autofocus, - class: "w-full" - %> +
+
+ <%= @form.file_field @field.id, + accept: @field.accept, + data: @field.get_html(:data, view: view, element: :input) + .merge( + action: "change->clear-input#showClearButton", + clear_input_target: "input" + ), + direct_upload: @field.direct_upload, + disabled: disabled?, + style: @field.get_html(:style, view: view, element: :input), + autofocus: @autofocus, + class: "w-full" + %> +
+ <%= content_tag :button, + class: "self-center hidden font-semibold text-xs text-red-600 p-1", + id: :reset, + type: :button, + data: { + clear_input_target: "clearButton", + action: "click->clear-input#clearInput", + tippy: :tooltip + } do %> + <% t("avo.clear_value") %> + <% end %> +
<% else %> — <% end %> diff --git a/app/components/avo/fields/files_field/edit_component.html.erb b/app/components/avo/fields/files_field/edit_component.html.erb index eebbac70ae..78416306f3 100644 --- a/app/components/avo/fields/files_field/edit_component.html.erb +++ b/app/components/avo/fields/files_field/edit_component.html.erb @@ -2,17 +2,33 @@ <%= render Avo::Fields::Common::Files::ListViewerComponent.new(field: @field, resource: @resource) if @field.value.present? %> <% if can_upload_file? %> -
- <%= @form.file_field @field.id, - accept: @field.accept, - data: @field.get_html(:data, view: view, element: :input), - direct_upload: @field.direct_upload, - disabled: disabled?, - multiple: true, - style: @field.get_html(:style, view: view, element: :input), - class: "w-full", - autofocus: @autofocus - %> +
+
+ <%= @form.file_field @field.id, + accept: @field.accept, + data: @field.get_html(:data, view: view, element: :input) + .merge( + action: "change->clear-input#showClearButton", + clear_input_target: "input" + ), + direct_upload: @field.direct_upload, + disabled: disabled?, + multiple: true, + style: @field.get_html(:style, view: view, element: :input), + autofocus: @autofocus + %> +
+ <%= content_tag :button, + class: "self-center hidden font-semibold text-xs text-red-600 p-1", + id: :reset, + type: :button, + data: { + clear_input_target: "clearButton", + action: "click->clear-input#clearInput", + tippy: :tooltip + } do %> + <% t("avo.clear_value") %> + <% end %>
<% else %> — diff --git a/app/components/avo/fields/radio_field/edit_component.html.erb b/app/components/avo/fields/radio_field/edit_component.html.erb new file mode 100644 index 0000000000..8e304a1dcf --- /dev/null +++ b/app/components/avo/fields/radio_field/edit_component.html.erb @@ -0,0 +1,10 @@ +<%= field_wrapper **field_wrapper_args do %> +
+ <% @field.options.each do |key, value| %> +
+ <%= form.radio_button @field.id, key %> + <%= form.label @field.id, value: value %> +
+ <% end %> +
+<% end %> diff --git a/app/components/avo/fields/radio_field/edit_component.rb b/app/components/avo/fields/radio_field/edit_component.rb new file mode 100644 index 0000000000..114a70156e --- /dev/null +++ b/app/components/avo/fields/radio_field/edit_component.rb @@ -0,0 +1,4 @@ +# frozen_string_literal: true + +class Avo::Fields::RadioField::EditComponent < Avo::Fields::EditComponent +end diff --git a/app/components/avo/fields/radio_field/index_component.html.erb b/app/components/avo/fields/radio_field/index_component.html.erb new file mode 100644 index 0000000000..8d4e9d5fda --- /dev/null +++ b/app/components/avo/fields/radio_field/index_component.html.erb @@ -0,0 +1,3 @@ +<%= index_field_wrapper **field_wrapper_args do %> + <%== @field.value %> +<% end %> diff --git a/app/components/avo/fields/radio_field/index_component.rb b/app/components/avo/fields/radio_field/index_component.rb new file mode 100644 index 0000000000..6e2b2b46c2 --- /dev/null +++ b/app/components/avo/fields/radio_field/index_component.rb @@ -0,0 +1,4 @@ +# frozen_string_literal: true + +class Avo::Fields::RadioField::IndexComponent < Avo::Fields::IndexComponent +end diff --git a/app/components/avo/fields/radio_field/show_component.html.erb b/app/components/avo/fields/radio_field/show_component.html.erb new file mode 100644 index 0000000000..de7fe73231 --- /dev/null +++ b/app/components/avo/fields/radio_field/show_component.html.erb @@ -0,0 +1,3 @@ +<%= field_wrapper **field_wrapper_args do %> + <%== @field.value %> +<% end %> diff --git a/app/components/avo/fields/radio_field/show_component.rb b/app/components/avo/fields/radio_field/show_component.rb new file mode 100644 index 0000000000..65cac0d7a1 --- /dev/null +++ b/app/components/avo/fields/radio_field/show_component.rb @@ -0,0 +1,4 @@ +# frozen_string_literal: true + +class Avo::Fields::RadioField::ShowComponent < Avo::Fields::ShowComponent +end diff --git a/app/components/avo/fields/trix_field/show_component.html.erb b/app/components/avo/fields/trix_field/show_component.html.erb index 7b7d310efe..f4e245781f 100644 --- a/app/components/avo/fields/trix_field/show_component.html.erb +++ b/app/components/avo/fields/trix_field/show_component.html.erb @@ -2,13 +2,19 @@ <% content_classes = 'trix-content py-2 max-w-4xl' content_classes << ' hidden' unless @field.always_show + button_classes = 'font-bold inline-block pt-3' %> -
- <% unless @field.always_show %> - <%= link_to t('avo.show_content'), 'javascript:void(0);', class: 'font-bold inline-block', data: { action: 'click->hidden-input#showContent' } %> - <% end %> -
+
+
<%= sanitize @field.value.to_s %>
+ <% unless @field.always_show %> + + + <% end %>
<% end %> diff --git a/app/components/avo/index/table_row_component.html.erb b/app/components/avo/index/table_row_component.html.erb index 0dff9248bf..1f682ab548 100644 --- a/app/components/avo/index/table_row_component.html.erb +++ b/app/components/avo/index/table_row_component.html.erb @@ -1,6 +1,7 @@ <%# hover:z-[21] removed from tr class to solve flickering actions component on row controls and z-20 changed to z-21%> <%= content_tag :tr, + id: "#{self.class.to_s.underscore}_#{@resource.record.to_param}", class: class_names("bg-white hover:bg-gray-50 hover:shadow-row z-21 border-b", {"cursor-pointer": click_row_to_view_record}), data: { component_name: self.class.to_s.underscore, diff --git a/app/components/avo/modal_component.html.erb b/app/components/avo/modal_component.html.erb index 883937dedb..a074beb9c5 100644 --- a/app/components/avo/modal_component.html.erb +++ b/app/components/avo/modal_component.html.erb @@ -1,8 +1,9 @@
- <%= render Avo::PanelComponent.new(title: "Report") do |c| %> - <% c.with_body do %> -
- - Loading... - -
- <% end %> - <% end %>
<% end %> <% end %> diff --git a/app/views/avo/partials/_navbar.html.erb b/app/views/avo/partials/_navbar.html.erb index e8b18f4100..e94860d54b 100644 --- a/app/views/avo/partials/_navbar.html.erb +++ b/app/views/avo/partials/_navbar.html.erb @@ -7,7 +7,7 @@ <%= render partial: "avo/partials/logo" %>
- <%= render Avo::Pro::GlobalSearchComponent.new rescue nil %> + <%= render Avo::Pro::GlobalSearchComponent.new(resource:) if defined?(Avo::Pro::GlobalSearchComponent) %>
<%= render partial: "avo/partials/header" %>
diff --git a/app/views/avo/partials/_panel_breadcrumbs.html.erb b/app/views/avo/partials/_panel_breadcrumbs.html.erb new file mode 100644 index 0000000000..f41fc0bda7 --- /dev/null +++ b/app/views/avo/partials/_panel_breadcrumbs.html.erb @@ -0,0 +1,3 @@ + diff --git a/app/views/layouts/avo/application.html.erb b/app/views/layouts/avo/application.html.erb index eeac92cebc..0319de8cdc 100644 --- a/app/views/layouts/avo/application.html.erb +++ b/app/views/layouts/avo/application.html.erb @@ -29,7 +29,7 @@
- <%= render partial: "avo/partials/navbar" %> + <%= render partial: "avo/partials/navbar", locals: { resource: @resource } %>
">