Class: Public::CategoriesController
- Inherits:
-
Postnhost::PublicController
- Object
- Postnhost::PublicController
- Public::CategoriesController
- Includes:
- Postnhost::CanonicalFirstPageRedirect, Postnhost::LanguageSwitcher, Postnhost::PublicFooterData, Postnhost::PublicHttpCaching, Postnhost::PublicPageSize, Postnhost::PublicTemplateResolvable
- Defined in:
- app/controllers/postnhost/public/categories_controller.rb
Constant Summary
Constants included from Postnhost::PublicPageSize
Postnhost::PublicPageSize::PAGINATION_SLOTS
Instance Method Summary collapse
Methods included from Postnhost::PublicTemplateResolvable
Instance Method Details
#index ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/postnhost/public/categories_controller.rb', line 14 def index resolution = public_route_resolution(kind: :category, slug: params[:category_slug]) apply_public_http_cache(resolution.record_id, params[:page].to_i, template: resolve_public_template("categories/index")) return if performed? @category = resolution.record ActiveRecord::Associations::Preloader.new(records: [@category], associations: :category_variants).call unless @current_language.default? set_category_language_data @pagy, snapshots = pagy(:offset, category_articles, limit: public_page_size, slots: pagination_slots) if localized_request? @article_variant_snapshots = snapshots else @article_snapshots = snapshots end render_public_template("categories/index") end |