Sha256: 229a05595aecc3377d14072244d68618d105bdeac90048ca6a533d2463216f68

Contents?: true

Size: 860 Bytes

Versions: 5

Compression:

Stored size: 860 Bytes

Contents

# frozen_string_literal: true

class Avo::Index::ResourceTableComponent < ViewComponent::Base
  include Avo::ApplicationHelper
  attr_reader :pagy, :query

  def initialize(resources: nil, resource: nil, reflection: nil, parent_record: nil, parent_resource: nil, pagy: nil, query: nil, actions: nil)
    @resources = resources
    @resource = resource
    @reflection = reflection
    @parent_record = parent_record
    @parent_resource = parent_resource
    @pagy = pagy
    @query = query
    @actions = actions
  end

  def encrypted_query
    # TODO: move this to the resource where we can apply the adapter pattern
    if Module.const_defined?("Ransack::Search") && query.instance_of?(Ransack::Search)
      @query = @query.result
    end

    Avo::Services::EncryptionService.encrypt(message: @query, purpose: :select_all, serializer: Marshal)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
avo-3.0.1.beta23 app/components/avo/index/resource_table_component.rb
avo-3.0.1.beta20 app/components/avo/index/resource_table_component.rb
avo-3.0.1.beta21 app/components/avo/index/resource_table_component.rb
avo-3.0.1.beta22 app/components/avo/index/resource_table_component.rb
avo-3.0.1.beta24 app/components/avo/index/resource_table_component.rb