ScalesCms.Cms.CmsListing
(scales_cms v0.2.0)
Copy Markdown
Combined CMS listing for directory index screens.
This context paginates directories and pages as a single list while keeping the UX rule that directories always appear before pages.
Summary
Functions
Counts the total number of items in the combined listing.
Fetches a combined paginated list of directories and pages.
Types
@type scope() :: :root | {:directory, term()}
Functions
Counts the total number of items in the combined listing.
Fetches a combined paginated list of directories and pages.
Directories are always returned first, followed by pages.
Examples
iex> fetch_items(:root, "", "", page: 1, per_page: 20)
[%{type: :directory, data: %CmsDirectory{}}, %{type: :page, data: %CmsPage{}}]
iex> fetch_items({:directory, 123}, "blog", "published", page: 2, per_page: 10)
[%{type: :page, data: %CmsPage{}}]