Sha256: 7fa63e55b495008f347d706fd8b582e9de7549b7c6d40544a5a53fe1e10abed5

Contents?: true

Size: 826 Bytes

Versions: 11

Compression:

Stored size: 826 Bytes

Contents

# frozen_string_literal: true

module Katalyst
  module Tables
    class EmptyCaptionComponent < ViewComponent::Base # :nodoc:
      include HasHtmlAttributes

      def initialize(table, **html_attributes)
        super(**html_attributes)

        @table = table
      end

      def render?
        @table.collection.empty?
      end

      def filtered?
        @table.collection.respond_to?(:filtered?) && @table.collection.filtered?
      end

      def clear_filters_path
        url_for
      end

      def plural_human_model_name
        human = @table.model_name&.human || @table.object_name.to_s.humanize
        human.pluralize.downcase
      end

      def inspect
        "#<#{self.class.name}>"
      end

      private

      def default_html_attributes
        { align: "bottom" }
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
katalyst-tables-2.2.10 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-2.2.9 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-2.2.8 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-2.2.7 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-2.2.6 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-2.2.5 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-2.2.4 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-2.2.3 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-2.2.2 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-2.2.1 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-2.2.0 app/components/katalyst/tables/empty_caption_component.rb