Class: Workarea::TaxonomySitemap
- Inherits:
-
Object
- Object
- Workarea::TaxonomySitemap
show all
- Includes:
- Search::Pagination
- Defined in:
- app/queries/workarea/taxonomy_sitemap.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
#each_by, #from, #page, #per_page, #size
Constructor Details
Returns a new instance of TaxonomySitemap.
9
10
11
|
# File 'app/queries/workarea/taxonomy_sitemap.rb', line 9
def initialize(params = {})
@params = params
end
|
Instance Attribute Details
#params ⇒ Object
Returns the value of attribute params.
5
6
7
|
# File 'app/queries/workarea/taxonomy_sitemap.rb', line 5
def params
@params
end
|
Instance Method Details
#cache_key ⇒ Object
30
31
32
|
# File 'app/queries/workarea/taxonomy_sitemap.rb', line 30
def cache_key
['taxonomy_sitemap', I18n.locale, page, per_page].join('/')
end
|
#results ⇒ Object
26
27
28
|
# File 'app/queries/workarea/taxonomy_sitemap.rb', line 26
def results
@results ||= taxons.select(&:active?)
end
|
#second_page? ⇒ Boolean
13
14
15
|
# File 'app/queries/workarea/taxonomy_sitemap.rb', line 13
def second_page?
page == 2
end
|
#taxons ⇒ Object
17
18
19
20
21
22
23
24
|
# File 'app/queries/workarea/taxonomy_sitemap.rb', line 17
def taxons
@taxons ||=
Navigation::Taxon
.page(page)
.per(per_page)
.any_of({ :url.ne => nil }, { :navigable_id.ne => nil })
.reorder(:parent_ids.asc)
end
|