Class: Workarea::Admin::CategoryViewModel
Instance Method Summary
collapse
#featured_products
#content
#comment_count, #comments, #has_comments?, #new_comments_for?, #subscribed_users
Instance Method Details
#breadcrumb_string ⇒ Object
16
17
18
|
# File 'app/view_models/workarea/admin/category_view_model.rb', line 16
def breadcrumb_string
options.fetch(:source, {})[:breadcrumbs] || breadcrumbs.join(' > ')
end
|
#breadcrumbs ⇒ Object
12
13
14
|
# File 'app/view_models/workarea/admin/category_view_model.rb', line 12
def breadcrumbs
@breadcrumbs ||= Navigation::Breadcrumbs.new(model)
end
|
#insights ⇒ Object
20
21
22
|
# File 'app/view_models/workarea/admin/category_view_model.rb', line 20
def insights
@insights ||= Insights::CategoryViewModel.wrap(model, options)
end
|
#price_facet ⇒ Object
46
47
48
|
# File 'app/view_models/workarea/admin/category_view_model.rb', line 46
def price_facet
@price_facet ||= range_facets['price'] || []
end
|
#products ⇒ Object
42
43
44
|
# File 'app/view_models/workarea/admin/category_view_model.rb', line 42
def products
@products ||= Storefront::CategoryViewModel.new(model).products
end
|
#products_count ⇒ Object
50
51
52
|
# File 'app/view_models/workarea/admin/category_view_model.rb', line 50
def products_count
@products_count ||= model.products.count
end
|
#rule_fields ⇒ Array
Returns an array of arrays that each contain a human readable value and and a value that is used in a category’s rule :field field.
36
37
38
39
40
|
# File 'app/view_models/workarea/admin/category_view_model.rb', line 36
def rule_fields
Search::Storefront::Product.current_product_rule_fields.to_a.map do |field|
[field.first.to_s.titleize, field.last]
end
end
|
#sort_options ⇒ Object
24
25
26
27
28
29
|
# File 'app/view_models/workarea/admin/category_view_model.rb', line 24
def sort_options
Search::CategoryBrowse
.available_sorts
.map { |s| [s.name, s.slug] }
.reject { |s| s.last == :relevance }
end
|
#timeline ⇒ Object
8
9
10
|
# File 'app/view_models/workarea/admin/category_view_model.rb', line 8
def timeline
@timeline ||= TimelineViewModel.new(model)
end
|