ScalesCmsWeb.Helpers.CmsBlockTemplates (scales_cms v0.2.0)

Copy Markdown

Helper functions for building CMS template blocks paths and URLs.

Summary

Functions

Builds a filter path for the CMS block_templates listing with optional query parameters.

Functions

build_filter_path(query, template_mode, sort_by, sort_order, page \\ nil, per_page \\ nil)

Builds a filter path for the CMS block_templates listing with optional query parameters.

Parameters

  • current_block_templates - The current block_templates struct or nil for root
  • query - Search query string
  • sort_by - Column to sort by ("created", "updated", or "")
  • sort_order - Sort direction ("asc" or "desc")
  • page - Current page number (optional)
  • per_page - Items per page (optional)

Examples

iex> build_filter_path(nil, "", "", "", "asc")
"/cms/block_templates"

iex> build_filter_path(nil, "search", "created", "desc")
"/cms/block_templates?query=search&sort_by=created&sort_order=desc"

iex> build_filter_path(nil, "", "", "", "asc", 2, 20)
"/cms/block_templates?page=2&per_page=20"