Sha256: ba3050bbe86be273fcba9b8d6d33fa2ca94c6433ee27ba4aecaf27dc94a5651d

Contents?: true

Size: 833 Bytes

Versions: 8

Compression:

Stored size: 833 Bytes

Contents

# frozen_string_literal: true

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

      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

8 entries across 8 versions & 1 rubygems

Version Path
katalyst-tables-2.6.0 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-2.6.0.beta app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-2.5.0 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-2.4.0 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-2.3.1 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-2.3.0 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-2.2.12 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-2.2.11 app/components/katalyst/tables/empty_caption_component.rb