Class: Workarea::Admin::HelpSearchViewModel

Inherits:
SearchViewModel
  • Object
show all
Defined in:
app/view_models/workarea/admin/help_search_view_model.rb

Instance Method Summary collapse

Methods inherited from SearchViewModel

#applied_filters?, #facet_selections, #facets, #filters, #results, #sort, #sorts, #toggle_facets?, #total

Instance Method Details

#top_articles_by_categoryObject



8
9
10
11
12
13
14
# File 'app/view_models/workarea/admin/help_search_view_model.rb', line 8

def top_articles_by_category
  @top_articles_by_category ||= top_categories.reduce({}) do |memo, category|
    articles = Help::Article.in_category(category).recent.top.to_a
    memo[category] = articles if articles.present?
    memo
  end
end

#top_categoriesObject



4
5
6
# File 'app/view_models/workarea/admin/help_search_view_model.rb', line 4

def top_categories
  @top_categories ||= Help::Article.top_categories
end