Skip to content

Commit

Permalink
revert show policy check
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul-Bob committed Feb 14, 2025
1 parent 6e775af commit f09323c
Showing 1 changed file with 8 additions and 21 deletions.
29 changes: 8 additions & 21 deletions app/components/avo/fields/preview_field/index_component.rb
Original file line number Diff line number Diff line change
@@ -1,29 +1,16 @@
# frozen_string_literal: true

class Avo::Fields::PreviewField::IndexComponent < Avo::Fields::IndexComponent
include Avo::Concerns::ChecksShowAuthorization

# Used by Avo::Concerns::ChecksShowAuthorization
attr_reader :resource

def render_preview
# Do not render the link if the user is not authorized to view the resource,
# as the link exposes the result of `record.to_param`.
return preview_icon if !can_view?

link_to resource_view_path, title: t("avo.view_item", item: @resource.name).humanize do
preview_icon
helpers.svg(
"heroicons/outline/magnifying-glass-circle",
class: "block h-6 text-gray-600",
data: {
controller: "preview",
preview_url_value: helpers.preview_resource_path(resource: @resource, turbo_frame: :preview_modal),
}
)
end
end

def preview_icon
helpers.svg(
"heroicons/outline/magnifying-glass-circle",
class: "block h-6 text-gray-600",
data: {
controller: "preview",
preview_url_value: helpers.preview_resource_path(resource: @resource, turbo_frame: :preview_modal),
}
)
end
end

0 comments on commit f09323c

Please sign in to comment.