Class: SnFilterable::CategoryComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/sn_filterable/category_component.rb

Overview

Renders a category to be displayed in the filtering sidebar/popup. Simple view component, logic to display filters should render a [:filter] (see [Filterable::FilterCategoryComponent])

Instance Method Summary collapse

Constructor Details

#initialize(title: nil, open: false) ⇒ CategoryComponent

Returns a new instance of CategoryComponent.

Parameters:

  • title (String) (defaults to: nil)

    Optional, the title of the category, will default to the filter’s title (if specified)

  • open (Boolean) (defaults to: false)

    Optional, determines if the category should be opened by default



13
14
15
16
# File 'app/components/sn_filterable/category_component.rb', line 13

def initialize(title: nil, open: false)
  @title = title
  @open = open
end