Class: AhoyCaptain::StickyNavComponent

Inherits:
ViewComponent::Base
  • Object
show all
Includes:
CompareMode, RangeOptions, Rangeable
Defined in:
app/components/ahoy_captain/sticky_nav_component.rb

Instance Method Summary collapse

Methods included from Rangeable

#period

Methods included from CompareMode

#compare_mode?, #comparison_mode, included

Instance Method Details

#custom_range_labelObject



13
14
15
16
17
18
19
# File 'app/components/ahoy_captain/sticky_nav_component.rb', line 13

def custom_range_label
  if range.custom?
    [range.starts_at, range.ends_at].map { |date| date.strftime('%b %d, %Y') }.join("-")
  else
    "Custom Range"
  end
end

#filtersObject



9
10
11
# File 'app/components/ahoy_captain/sticky_nav_component.rb', line 9

def filters
  @filters ||= ::AhoyCaptain::FilterParser.parse(request)
end

#tag_list_hidden?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'app/components/ahoy_captain/sticky_nav_component.rb', line 21

def tag_list_hidden?
  filters.values.map(&:values).flatten.size < ::AhoyCaptain::FilterParser::FILTER_MENU_MAX_SIZE
end