Skip to content

Add post sort control to template editor#1325

Open
davidmerfield wants to merge 5 commits into
masterfrom
codex/inject-post-sorting-control-descriptor
Open

Add post sort control to template editor#1325
davidmerfield wants to merge 5 commits into
masterfrom
codex/inject-post-sorting-control-descriptor

Conversation

@davidmerfield

Copy link
Copy Markdown
Owner

Motivation

  • Ensure an index-page post-sorting control is shown even when a template's locals.sort_by/locals.sort_order are missing by providing sensible defaults.
  • Provide a single, canonical set of select options and labels for index sorting so the loader and saver share the same mapping.
  • Persist both sort_by and sort_order when the select is submitted so templates receive complete sorting metadata.

Description

  • Add app/dashboard/site/template/sort-options.js with the four required options and their exact labels and mapping values.
  • Update app/dashboard/site/template/load/index-inputs.js to always append a select-style control (matching existing select rendering) named sort_by, using defaults sort_by: "date" and sort_order: "desc" when locals are absent.
  • Implement selection resolution so the loader picks the correct option value from the shared options list and marks it selected.
  • Update app/dashboard/site/template/save/layout-inputs.js to map the submitted select value back into both req.locals.sort_by and req.locals.sort_order, falling back to the same defaults when the submitted value is missing or invalid.

Testing

  • No automated tests were run.

Codex Task

@davidmerfield davidmerfield changed the title Add index page post-sorting select control and save mapping Add post sort control to template editor Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant