Sha256: 16354af8544de0134dbb01c9ca04b0d7d91a8b35b235ee9dd1abcc8942526cfe

Contents?: true

Size: 847 Bytes

Versions: 26

Compression:

Stored size: 847 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 || "record"
        human.pluralize.downcase
      end

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

      private

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

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
katalyst-tables-3.8.0 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-3.7.0 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-3.6.2 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-3.6.1 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-3.6.0 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-3.5.5 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-3.5.4 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-3.5.3 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-3.5.2 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-3.5.1 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-3.5.0 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-3.4.6 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-3.4.5 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-3.4.4 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-3.4.3 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-3.4.2 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-3.4.1 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-3.4.0 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-3.3.4 app/components/katalyst/tables/empty_caption_component.rb
katalyst-tables-3.3.3 app/components/katalyst/tables/empty_caption_component.rb