Sha256: 775e3ef0c9546655a6fdf6b750db9dab1af672972b6e35d739b5760c533590d4
Contents?: true
Size: 879 Bytes
Versions: 36
Compression:
Stored size: 879 Bytes
Contents
# frozen_string_literal: true module Katalyst module Tables class PagyNavComponent < ViewComponent::Base # :nodoc: # Pagy is not a required gem unless you're using pagination # Expect to see NoMethodError failures if pagy is not available "Pagy::Frontend".safe_constantize&.tap { |pagy| include(pagy) } attr_reader :pagy_options def initialize(collection: nil, pagy: nil, **pagy_options) super() pagy ||= collection&.pagination if collection.respond_to?(:pagination) raise ArgumentError, "pagy is required" if pagy.blank? @pagy = pagy @pagy_options = pagy_options end def call pagy_nav(@pagy, **pagy_options).html_safe # rubocop:disable Rails/OutputSafety end def inspect "#<#{self.class.name} pagy: #{@pagy.inspect}>" end end end end
Version data entries
36 entries across 36 versions & 1 rubygems