Sha256: 39faa96532cbcfee47c730f38313e3a71a23b4634fb902bb631e5b4c8622d66e
Contents?: true
Size: 1.13 KB
Versions: 1
Compression:
Stored size: 1.13 KB
Contents
# frozen_string_literal: true module PagesCore module Pages module RssController extend ActiveSupport::Concern private def all_feed_items feeds = Page.enabled_feeds(locale, include_hidden: true) Page.where(parent_page_id: feeds) .order("published_at DESC") .published .localized(locale) end def per_page_rss_param(default = 20, max = 1000) return default unless params[:per_page].is_a?(String) params[:per_page].to_i.clamp(1, max) end def render_page_rss(page, pagination_page = 1) if page.feed_enabled? render_rss(page.pages.paginate(per_page: per_page_rss_param, page: pagination_page) .includes(:image, :author), title: page.name) else render_error 404 end end def render_rss(items, title: nil) @title = PagesCore.config.site_name @title += ": #{title}" if title @items = items render template: "feeds/pages", layout: false end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pages_core-3.15.5 | app/controllers/concerns/pages_core/pages/rss_controller.rb |